feat(admin-pwa): modernize dashboard KPI section with unified glass strip
This commit is contained in:
@@ -203,7 +203,8 @@
|
|||||||
"processing": "Verarbeite …",
|
"processing": "Verarbeite …",
|
||||||
"select": "Auswählen",
|
"select": "Auswählen",
|
||||||
"close": "Schließen",
|
"close": "Schließen",
|
||||||
"reset": "Zurücksetzen"
|
"reset": "Zurücksetzen",
|
||||||
|
"actionNeeded": "Prüfen"
|
||||||
},
|
},
|
||||||
"photos": {
|
"photos": {
|
||||||
"moderation": {
|
"moderation": {
|
||||||
|
|||||||
@@ -199,7 +199,8 @@
|
|||||||
"processing": "Processing…",
|
"processing": "Processing…",
|
||||||
"select": "Select",
|
"select": "Select",
|
||||||
"close": "Close",
|
"close": "Close",
|
||||||
"reset": "Reset"
|
"reset": "Reset",
|
||||||
|
"actionNeeded": "Review"
|
||||||
},
|
},
|
||||||
"photos": {
|
"photos": {
|
||||||
"moderation": {
|
"moderation": {
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import { buildLimitWarnings } from '../lib/limitWarnings';
|
|||||||
import { withAlpha } from './components/colors';
|
import { withAlpha } from './components/colors';
|
||||||
import { useEventReadiness } from './hooks/useEventReadiness';
|
import { useEventReadiness } from './hooks/useEventReadiness';
|
||||||
import { SetupChecklist } from './components/SetupChecklist';
|
import { SetupChecklist } from './components/SetupChecklist';
|
||||||
|
import { KpiStrip } from './components/Primitives';
|
||||||
|
|
||||||
// --- HELPERS ---
|
// --- HELPERS ---
|
||||||
|
|
||||||
@@ -386,27 +387,29 @@ function PulseStrip({ event, stats }: any) {
|
|||||||
const pendingCount = stats?.pending_photos ?? event?.pending_photo_count ?? 0;
|
const pendingCount = stats?.pending_photos ?? event?.pending_photo_count ?? 0;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<XStack space="$3" paddingVertical="$1">
|
<YStack paddingVertical="$1">
|
||||||
<PulseItem icon={ImageIcon} value={uploadCount} label={t('management:events.list.stats.photos', 'Fotos')} />
|
<KpiStrip items={[
|
||||||
<YStack width={1} backgroundColor={theme.border} marginVertical={4} />
|
{
|
||||||
<PulseItem icon={Users} value={guestCount} label={t('management:events.list.stats.guests', 'Gäste')} />
|
icon: ImageIcon,
|
||||||
<YStack width={1} backgroundColor={theme.border} marginVertical={4} />
|
value: uploadCount,
|
||||||
<PulseItem icon={Bell} value={pendingCount} label={t('management:photos.filters.pending', 'Pending')} tone={pendingCount > 0 ? 'warning' : 'neutral'} />
|
label: t('management:events.list.stats.photos', 'Photos'),
|
||||||
</XStack>
|
color: theme.primary
|
||||||
);
|
},
|
||||||
}
|
{
|
||||||
|
icon: Users,
|
||||||
function PulseItem({ icon: Icon, value, label, tone = 'neutral' }: any) {
|
value: guestCount,
|
||||||
const theme = useAdminTheme();
|
label: t('management:events.list.stats.guests', 'Guests'),
|
||||||
const color = tone === 'warning' ? theme.warningText : theme.textStrong;
|
color: theme.textStrong
|
||||||
return (
|
},
|
||||||
<XStack alignItems="center" space="$2" flex={1} justifyContent="center">
|
{
|
||||||
<Icon size={16} color={theme.muted} />
|
icon: ShieldCheck,
|
||||||
<YStack>
|
value: pendingCount,
|
||||||
<Text fontSize="$md" fontWeight="800" color={color} lineHeight="$xs">{value}</Text>
|
label: t('management:photos.filters.pending', 'Pending'),
|
||||||
<Text fontSize={10} color={theme.muted} textTransform="uppercase" fontWeight="600">{label}</Text>
|
note: pendingCount > 0 ? t('management:common.actionNeeded', 'Review') : undefined,
|
||||||
</YStack>
|
color: pendingCount > 0 ? '#8B5CF6' : theme.textMuted
|
||||||
</XStack>
|
}
|
||||||
|
]} />
|
||||||
|
</YStack>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -153,35 +153,42 @@ export function KpiTile({
|
|||||||
label,
|
label,
|
||||||
value,
|
value,
|
||||||
note,
|
note,
|
||||||
|
color,
|
||||||
}: {
|
}: {
|
||||||
icon: React.ComponentType<{ size?: number; color?: string }>;
|
icon: React.ComponentType<{ size?: number; color?: string }>;
|
||||||
label: string;
|
label: string;
|
||||||
value: string | number;
|
value: string | number;
|
||||||
note?: string;
|
note?: string;
|
||||||
|
color?: string;
|
||||||
}) {
|
}) {
|
||||||
const { accentSoft, primary, text } = useAdminTheme();
|
const { surfaceMuted, textStrong, textMuted, primary, accentSoft } = useAdminTheme();
|
||||||
|
const iconBg = color ? withAlpha(color, 0.12) : accentSoft;
|
||||||
|
const iconColor = color || primary;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MobileCard borderRadius={14} padding="$3" width="32%" minWidth={110} alignItems="flex-start">
|
<MobileCard borderRadius={14} padding="$2.5" width="31%" minWidth={100} space="$1.5">
|
||||||
<XStack alignItems="center" space="$2">
|
<XStack
|
||||||
<XStack
|
width={28}
|
||||||
width={32}
|
height={28}
|
||||||
height={32}
|
borderRadius={8}
|
||||||
borderRadius={12}
|
backgroundColor={iconBg}
|
||||||
backgroundColor={accentSoft}
|
alignItems="center"
|
||||||
alignItems="center"
|
justifyContent="center"
|
||||||
justifyContent="center"
|
>
|
||||||
>
|
<IconCmp size={14} color={iconColor} />
|
||||||
<IconCmp size={16} color={primary} />
|
</XStack>
|
||||||
</XStack>
|
|
||||||
<Text fontSize="$xs" color={text}>
|
<YStack space="$0">
|
||||||
|
<Text fontSize="$xl" fontWeight="900" color={textStrong} letterSpacing={-0.5} lineHeight="$xl">
|
||||||
|
{value}
|
||||||
|
</Text>
|
||||||
|
<Text fontSize={9} fontWeight="700" color={textMuted} textTransform="uppercase" letterSpacing={0.4}>
|
||||||
{label}
|
{label}
|
||||||
</Text>
|
</Text>
|
||||||
</XStack>
|
</YStack>
|
||||||
<Text fontSize="$xl" fontWeight="800" color={text}>
|
|
||||||
{value}
|
|
||||||
</Text>
|
|
||||||
{note ? (
|
{note ? (
|
||||||
<Text fontSize="$xs" color={text} opacity={0.7}>
|
<Text fontSize={9} fontWeight="800" color={iconColor} opacity={0.9} textTransform="uppercase">
|
||||||
{note}
|
{note}
|
||||||
</Text>
|
</Text>
|
||||||
) : null}
|
) : null}
|
||||||
@@ -189,6 +196,76 @@ export function KpiTile({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function KpiStrip({
|
||||||
|
items
|
||||||
|
}: {
|
||||||
|
items: Array<{
|
||||||
|
icon: React.ComponentType<{ size?: number; color?: string }>;
|
||||||
|
label: string;
|
||||||
|
value: string | number;
|
||||||
|
color?: string;
|
||||||
|
note?: string;
|
||||||
|
}>
|
||||||
|
}) {
|
||||||
|
const { glassSurface, border, textStrong, textMuted, primary, accentSoft } = useAdminTheme();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<YStack
|
||||||
|
backgroundColor={glassSurface}
|
||||||
|
borderRadius={16}
|
||||||
|
borderWidth={1}
|
||||||
|
borderColor={border}
|
||||||
|
paddingVertical="$3"
|
||||||
|
paddingHorizontal="$1"
|
||||||
|
>
|
||||||
|
<XStack alignItems="flex-start">
|
||||||
|
{items.map((item, index) => {
|
||||||
|
const isLast = index === items.length - 1;
|
||||||
|
const iconColor = item.color || primary;
|
||||||
|
const iconBg = withAlpha(iconColor, 0.12);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<React.Fragment key={index}>
|
||||||
|
<YStack flex={1} alignItems="center" space="$1.5">
|
||||||
|
<XStack
|
||||||
|
width={32}
|
||||||
|
height={32}
|
||||||
|
borderRadius={10}
|
||||||
|
backgroundColor={iconBg}
|
||||||
|
alignItems="center"
|
||||||
|
justifyContent="center"
|
||||||
|
marginBottom="$0.5"
|
||||||
|
>
|
||||||
|
<item.icon size={16} color={iconColor} />
|
||||||
|
</XStack>
|
||||||
|
|
||||||
|
<YStack alignItems="center" space="$0">
|
||||||
|
<Text fontSize="$2xl" fontWeight="900" color={textStrong} letterSpacing={-0.5} lineHeight="$2xl">
|
||||||
|
{item.value}
|
||||||
|
</Text>
|
||||||
|
<Text fontSize={9} fontWeight="700" color={textMuted} textTransform="uppercase" letterSpacing={0.5} textAlign="center">
|
||||||
|
{item.label}
|
||||||
|
</Text>
|
||||||
|
</YStack>
|
||||||
|
|
||||||
|
{item.note && (
|
||||||
|
<Text fontSize={9} fontWeight="800" color={iconColor} opacity={0.9} textTransform="uppercase" marginTop="$0.5">
|
||||||
|
{item.note}
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
</YStack>
|
||||||
|
|
||||||
|
{!isLast && (
|
||||||
|
<YStack width={1} height={40} backgroundColor={border} alignSelf="center" opacity={0.6} />
|
||||||
|
)}
|
||||||
|
</React.Fragment>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</XStack>
|
||||||
|
</YStack>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export function SkeletonCard({ height = 80 }: { height?: number }) {
|
export function SkeletonCard({ height = 80 }: { height?: number }) {
|
||||||
return (
|
return (
|
||||||
<MobileCard className="mobile-skeleton" height={height} />
|
<MobileCard className="mobile-skeleton" height={height} />
|
||||||
|
|||||||
Reference in New Issue
Block a user