100 lines
2.7 KiB
TypeScript
100 lines
2.7 KiB
TypeScript
import { Heading } from '@/ui/Heading';
|
|
import { Icon } from '@/ui/Icon';
|
|
import { Text } from '@/ui/Text';
|
|
import { Box } from '@/ui/Box';
|
|
import { Group } from '@/ui/Group';
|
|
import { Stack } from '@/ui/Stack';
|
|
import { Surface } from '@/ui/Surface';
|
|
import { ListItem, ListItemInfo } from '@/ui/ListItem';
|
|
import { motion } from 'framer-motion';
|
|
import { Car, Trophy, Users } from 'lucide-react';
|
|
import React from 'react';
|
|
|
|
const USER_ROLES = [
|
|
{
|
|
icon: Car,
|
|
title: 'Driver',
|
|
description: 'Race, track stats, join teams',
|
|
intent: 'primary' as const,
|
|
},
|
|
{
|
|
icon: Trophy,
|
|
title: 'League Admin',
|
|
description: 'Organize leagues and events',
|
|
intent: 'success' as const,
|
|
},
|
|
{
|
|
icon: Users,
|
|
title: 'Team Manager',
|
|
description: 'Manage team and drivers',
|
|
intent: 'telemetry' as const,
|
|
},
|
|
] as const;
|
|
|
|
interface UserRolesPreviewProps {
|
|
variant?: 'full' | 'compact';
|
|
}
|
|
|
|
export function UserRolesPreview({ variant = 'full' }: UserRolesPreviewProps) {
|
|
if (variant === 'compact') {
|
|
return (
|
|
<Box marginTop={8}>
|
|
<Text align="center" size="xs" variant="low" block marginBottom={4}>
|
|
One account for all roles
|
|
</Text>
|
|
<Group justify="center" gap={6}>
|
|
{USER_ROLES.map((role) => (
|
|
<Stack key={role.title} align="center" gap={1}>
|
|
<Surface
|
|
width="2rem"
|
|
height="2rem"
|
|
rounded="md"
|
|
variant="muted"
|
|
display="flex"
|
|
alignItems="center"
|
|
justifyContent="center"
|
|
>
|
|
<Icon icon={role.icon} size={4} intent={role.intent} />
|
|
</Surface>
|
|
<Text size="xs" variant="low">{role.title}</Text>
|
|
</Stack>
|
|
))}
|
|
</Group>
|
|
</Box>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<Stack gap={3} marginBottom={8}>
|
|
{USER_ROLES.map((role, index) => (
|
|
<motion.div
|
|
key={role.title}
|
|
initial={{ opacity: 0, x: -20 }}
|
|
animate={{ opacity: 1, x: 0 }}
|
|
transition={{ delay: index * 0.1 }}
|
|
>
|
|
<ListItem>
|
|
<Group gap={4}>
|
|
<Surface
|
|
width="2.5rem"
|
|
height="2.5rem"
|
|
rounded="md"
|
|
variant="muted"
|
|
display="flex"
|
|
alignItems="center"
|
|
justifyContent="center"
|
|
>
|
|
<Icon icon={role.icon} size={5} intent={role.intent} />
|
|
</Surface>
|
|
<ListItemInfo
|
|
title={role.title}
|
|
description={role.description}
|
|
/>
|
|
</Group>
|
|
</ListItem>
|
|
</motion.div>
|
|
))}
|
|
</Stack>
|
|
);
|
|
}
|