From 08d4d8e3d76fab6eefe8c9be50cc8d495cc17eb7 Mon Sep 17 00:00:00 2001 From: Vadzim Mahilny Date: Fri, 1 Sep 2023 17:37:16 +0100 Subject: [PATCH] New train page --- src/renderer/components/Tasks.tsx | 301 +++++++++++++++++++++--------- 1 file changed, 211 insertions(+), 90 deletions(-) diff --git a/src/renderer/components/Tasks.tsx b/src/renderer/components/Tasks.tsx index 5251323..c30e1b1 100644 --- a/src/renderer/components/Tasks.tsx +++ b/src/renderer/components/Tasks.tsx @@ -1,7 +1,16 @@ import { useAccount, useContractRead } from 'wagmi'; -import { Box, Button, DataTable, Layer, Spinner, Text } from 'grommet'; +import { Box, Button, Heading, Layer, Spinner, Text, TextInput } from 'grommet'; import { useEffect, useState } from 'react'; import { readContract } from '@wagmi/core'; +import { + Chat, + CreditCard, + Scorecard, + Image, + UserFemale, + Search, + StatusGood, +} from 'grommet-icons'; import { FLOCK_TASK_MANAGER_ABI, FLOCK_TASK_MANAGER_ADDRESS, @@ -11,11 +20,45 @@ import { TaskType } from './types'; import Task from './Task'; import { CreateTask } from './CreateTask'; +interface TaskCardProps { + cardColor: string; + // eslint-disable-next-line no-undef + cardIcon: JSX.Element; +} + +type CardColors = { + [key: string]: TaskCardProps; +}; + +const cardColors: CardColors = { + 'Large Language Model Finetuning': { + cardColor: '#A4C0FF', + cardIcon: , + }, + 'NLP': { + cardColor: '#E69FBD', + cardIcon: , + }, + 'Time series prediction': { + cardColor: '#D9D9D9', + cardIcon: , + }, + 'Classification': { + cardColor: '#BDD4DA', + cardIcon: , + }, + 'Finance': { + cardColor: '#A4C0FF', + cardIcon: , + }, +}; + function Tasks() { const { address } = useAccount(); const [tasks, setTasks] = useState([] as TaskType[]); const [showCreateTask, setShowCreateTask] = useState(false); const [isLoadingTasks, setIsLoadingTasks] = useState(false); + const [filterMode, setFilterMode] = useState<'all' | 'completed'>('all'); const [taskToShow, setTaskToShow] = useState({} as TaskType); @@ -104,98 +147,176 @@ function Tasks() { ) : ( - - -