feat: add project meta
This commit is contained in:
parent
380f7f2045
commit
89e7018920
40
app/components/projects/detail/project-meta.tsx
Normal file
40
app/components/projects/detail/project-meta.tsx
Normal file
@ -0,0 +1,40 @@
|
||||
import { ColorTag } from '~/components/ui/color-tag';
|
||||
import { Text } from '~/components/ui/text';
|
||||
import { AR_BUTTON_LABEL } from '~/data/ar-viewer/constants';
|
||||
import { DEFAULT_BRAND_COLOR, LOGO_BACKGROUND_PRESETS } from '~/data/projects/constants';
|
||||
import { useAdminData } from '~/hooks/admin/use-admin-data';
|
||||
import { formatDate } from '~/lib/format';
|
||||
import { cn } from '~/lib/utils';
|
||||
import { getButtonStyle } from '~/services/asset-media';
|
||||
import type { Project } from '~/types/project';
|
||||
|
||||
export function ProjectMeta({ project, assetCount }: { project: Project; assetCount: number }) {
|
||||
const { settings } = useAdminData();
|
||||
const archived = project.status === 'archived';
|
||||
const button = getButtonStyle(project, settings);
|
||||
const preset = LOGO_BACKGROUND_PRESETS[project.logo_bg];
|
||||
|
||||
return (
|
||||
<div className='flex flex-wrap items-center gap-x-3.5 gap-y-1.5'>
|
||||
<Text as='span' variant='caption' className='flex items-center gap-1.5'>
|
||||
<span className={cn('h-1.5 w-1.5 rounded-full', archived ? 'bg-text-muted' : 'bg-success')} />
|
||||
{archived ? 'Archived' : 'Active'}
|
||||
</Text>
|
||||
<Text as='span' variant='caption'>
|
||||
{assetCount} {assetCount === 1 ? 'asset' : 'assets'}
|
||||
</Text>
|
||||
<Text as='span' variant='caption'>Created {formatDate(project.created)}</Text>
|
||||
<Text as='span' variant='caption' className='flex items-center gap-1.5'>
|
||||
Logo backing
|
||||
<ColorTag color={project.logo_bg_color || preset.value} label={project.logo_bg_color || preset.label} />
|
||||
</Text>
|
||||
{settings.brand_button && (
|
||||
<Text as='span' variant='caption' className='flex items-center gap-1.5'>
|
||||
Button
|
||||
<ColorTag color={button.color ?? DEFAULT_BRAND_COLOR} label={button.color ?? 'thob default'} />
|
||||
“{button.label ?? AR_BUTTON_LABEL}”
|
||||
</Text>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user