/** * Copyright 2021 Design Barn Inc. */ import { Appearance, Size, TextColor } from '@lottiefiles/react-ui-kit'; import React from 'react'; import { Button, Card } from '../../../../../_components'; import { LottiePlayer } from '../../../../../components/LottiePlayer'; import { useWorkspace } from '../../../../../context/workspace-provider'; import { toHumanDate } from '../../../../../utils/helpers'; import './file-card.css'; interface FileCardProps { animationUrl: string; id: string; meta: { modifiedAt: Date; modifiedBy: string; }; name: string; status: string; } const statusColors: { [key: string]: string } = { Approved: 'bg-green-500', InProgress: 'bg-purple-500', NeedsReview: 'bg-orange-500', NoStatus: 'bg-gray-400', }; const statusToText: { [key: string]: string } = { Approved: 'Approved', InProgress: 'In Progress', NeedsReview: 'Needs Review', NoStatus: 'No Status', }; export const FileCard: React.FC = ({ animationUrl, id, meta, name, status }: FileCardProps) => { const { setFile } = useWorkspace(); const goToFile = (): void => { // goTo({ id, node: 'File' }); // Fetch file and setfile setFile(id); }; const actualStatus = status || 'NoStatus'; if (!animationUrl || animationUrl === '') { return <>; } return (
null} className="list-item lf-cursor-pointer lf-list-none lf-show lf-relative lf-group" >
{name}
Modified by {meta.modifiedBy} {toHumanDate(new Date(meta.modifiedAt)) as string}
{statusToText[actualStatus]}
); };