SkateSpots/src/components/AdminReviewCard.tsx
SkateSpots 0b796440f1 feat(i18n): Spanish batch 2 — nav/chrome, events/shops/tours, crews/DMs, settings/auth, wallet/stash/newsletter/stats
~3,470 new keys (5,770 total, EN=ES), ~115 more files wired.
- nav + chromeUi: header, More menu, burger menu, footer, map toolbar widgets
  (sort/trust/weather), spot-type label helper.
- placesUi: events, shops, tours, food. socialUi: crews, DMs, notifications,
  collectives, crew chat/coordinator. settingsUi: settings, auth/signup,
  onboarding, profile edit, legal. walletUi: wallet/Cashu, stash, mints,
  app shop, newsletter, community stats, leaderboards, profile.
- Fixed 738 usages where an agent dropped the socialUi. prefix (caught by check:i18n).
2026-10-02 10:11:06 +07:00

45 lines
1.8 KiB
TypeScript

import { Link } from 'react-router-dom';
import { useMemo } from 'react';
import { ShieldAlert, ArrowRight } from 'lucide-react';
import { useCurrentUser } from '@/hooks/useCurrentUser';
import { useSkateSpots } from '@/hooks/useSkateSpots';
import { isAdminPubkey } from '@/lib/admins';
import { isFlagged } from '@/lib/spotQuality';
import { useTranslation } from '@/contexts/language';
/**
* Admin-only entry point for the review queue. Renders nothing for everyone
* else, so it can sit in Settings → Advanced beside the other owner cards.
*/
export function AdminReviewCard() {
const { user } = useCurrentUser();
const isAdmin = isAdminPubkey(user?.pubkey);
const { data: spots } = useSkateSpots(300);
const { t } = useTranslation();
// Cheap signals only here (no per-spot trust/status queries just to draw a
// badge) — the review page does the deeper pass.
const flaggedCount = useMemo(() => (spots ?? []).filter(isFlagged).length, [spots]);
if (!isAdmin) return null;
return (
<Link
to="/review"
className="block rounded-2xl border border-amber-500/20 bg-white/[0.02] transition-colors hover:border-amber-500/40"
>
<div className="flex items-center gap-3 px-4 py-3.5">
<ShieldAlert className="h-5 w-5 shrink-0 text-amber-400" />
<div className="min-w-0 flex-1">
<p className="text-sm font-bold text-amber-400">{t('settingsUi.adminReview.title')}</p>
<p className="mt-0.5 text-xs text-muted-foreground">
{flaggedCount > 0
? t('settingsUi.adminReview.flagged', { count: flaggedCount, s: flaggedCount === 1 ? '' : 's' })
: t('settingsUi.adminReview.clean')}
</p>
</div>
<ArrowRight className="h-4 w-4 shrink-0 text-gray-500" />
</div>
</Link>
);
}