From 8b63792a7bc42103d02bbe6327bd74bec361b56f Mon Sep 17 00:00:00 2001 From: safiyamak Date: Mon, 27 May 2024 09:14:11 -0400 Subject: [PATCH 1/2] Making downloaded datasets marked accordingly on datastore --- src/renderer/components/Data/DataStore.tsx | 7 ++-- src/renderer/components/Data/DatasetCard.tsx | 32 ++++++++++++++----- .../components/Data/LocalDatasets.tsx | 3 +- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/src/renderer/components/Data/DataStore.tsx b/src/renderer/components/Data/DataStore.tsx index 598a51a..c12326a 100644 --- a/src/renderer/components/Data/DataStore.tsx +++ b/src/renderer/components/Data/DataStore.tsx @@ -70,15 +70,16 @@ export default function DataStore() { > {data && - filterByFilters(data, searchText).map((row) => ( + data.data && + filterByFilters(data.data, searchText).map((row) => ( diff --git a/src/renderer/components/Data/DatasetCard.tsx b/src/renderer/components/Data/DatasetCard.tsx index 1f6fb2d..c067a05 100644 --- a/src/renderer/components/Data/DatasetCard.tsx +++ b/src/renderer/components/Data/DatasetCard.tsx @@ -1,5 +1,5 @@ -import * as React from 'react'; import { useState } from 'react'; +import * as React from 'react'; import { Button, @@ -11,7 +11,12 @@ import { ModalDialog, Typography, } from '@mui/joy'; -import { DownloadIcon, FileTextIcon, Trash2Icon } from 'lucide-react'; +import { + DownloadIcon, + FileTextIcon, + Trash2Icon, + CheckIcon, +} from 'lucide-react'; import { formatBytes } from 'renderer/lib/utils'; import * as chatAPI from '../../lib/transformerlab-api-sdk'; @@ -25,9 +30,10 @@ export default function DatasetCard({ size, description, repo, - download = false, + downloaded, location, parentMutate, + local, }) { const [installing, setInstalling] = useState(null); const [previewDatasetModalOpen, setPreviewDatasetModalOpen] = @@ -81,7 +87,7 @@ export default function DatasetCard({ - {!download && ( + {downloaded && local && ( <> )} diff --git a/src/renderer/components/Data/LocalDatasets.tsx b/src/renderer/components/Data/LocalDatasets.tsx index b841ab8..3b91ed8 100644 --- a/src/renderer/components/Data/LocalDatasets.tsx +++ b/src/renderer/components/Data/LocalDatasets.tsx @@ -107,7 +107,6 @@ export default function LocalDatasets() { }} > - {data && console.log(data)} {data && filterByFiltersDatasetID(data, searchText).map((row) => ( @@ -118,6 +117,8 @@ export default function LocalDatasets() { description={row?.description} repo={row.huggingfacerepo} location={row?.location} + downloaded={true} + local={true} parentMutate={mutate} /> From 095cb9d6a88e5262f8cb97c4bf51fcd48a473225 Mon Sep 17 00:00:00 2001 From: safiyamak Date: Mon, 27 May 2024 09:15:04 -0400 Subject: [PATCH 2/2] Removing extra imports from DatasetCard --- src/renderer/components/Data/DatasetCard.tsx | 6 ++---- src/renderer/components/Data/DatasetInfoModal.tsx | 1 - src/renderer/components/Data/PreviewDatasetModal.tsx | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/renderer/components/Data/DatasetCard.tsx b/src/renderer/components/Data/DatasetCard.tsx index c067a05..b9d94cb 100644 --- a/src/renderer/components/Data/DatasetCard.tsx +++ b/src/renderer/components/Data/DatasetCard.tsx @@ -1,5 +1,4 @@ import { useState } from 'react'; -import * as React from 'react'; import { Button, @@ -36,9 +35,8 @@ export default function DatasetCard({ local, }) { const [installing, setInstalling] = useState(null); - const [previewDatasetModalOpen, setPreviewDatasetModalOpen] = - React.useState(false); - const [datasetInfoModalOpen, setDatasetInfoModalOpen] = React.useState(false); + const [previewDatasetModalOpen, setPreviewDatasetModalOpen] = useState(false); + const [datasetInfoModalOpen, setDatasetInfoModalOpen] = useState(false); return ( <> diff --git a/src/renderer/components/Data/DatasetInfoModal.tsx b/src/renderer/components/Data/DatasetInfoModal.tsx index 440f3f1..946abe1 100644 --- a/src/renderer/components/Data/DatasetInfoModal.tsx +++ b/src/renderer/components/Data/DatasetInfoModal.tsx @@ -1,5 +1,4 @@ /* eslint-disable camelcase */ -import React, { useEffect, useState } from 'react'; import useSWR from 'swr'; import { diff --git a/src/renderer/components/Data/PreviewDatasetModal.tsx b/src/renderer/components/Data/PreviewDatasetModal.tsx index 0feb772..b06622c 100644 --- a/src/renderer/components/Data/PreviewDatasetModal.tsx +++ b/src/renderer/components/Data/PreviewDatasetModal.tsx @@ -1,5 +1,5 @@ /* eslint-disable camelcase */ -import React, { useEffect, useState } from 'react'; +import { useEffect, useState } from 'react'; import useSWR from 'swr'; import { Button,