diff --git a/striker-ui/components/ManageManifest/ManageManifestPanel.tsx b/striker-ui/components/ManageManifest/ManageManifestPanel.tsx new file mode 100644 index 00000000..f5256dfe --- /dev/null +++ b/striker-ui/components/ManageManifest/ManageManifestPanel.tsx @@ -0,0 +1,60 @@ +import { PlayCircle } from '@mui/icons-material'; +import { FC, useMemo, useState } from 'react'; +import API_BASE_URL from '../../lib/consts/API_BASE_URL'; +import periodicFetch from '../../lib/fetchers/periodicFetch'; +import FlexBox from '../FlexBox'; +import IconButton from '../IconButton'; +import List from '../List'; +import { Panel, PanelHeader } from '../Panels'; +import Spinner from '../Spinner'; +import { BodyText, HeaderText } from '../Text'; + +const ManageManifestPanel: FC = () => { + const [isEditManifests, setIsEditManifests] = useState(false); + + const { data: manifestOverviews, isLoading: isLoadingManifestOverviews } = + periodicFetch(`${API_BASE_URL}/manifest`, { + refreshInterval: 60000, + }); + + const listElement = useMemo( + () => ( + { + setIsEditManifests((previous) => !previous); + }} + renderListItem={(manifestUUID, { manifestName }) => ( + + + + + {manifestName} + + )} + /> + ), + [isEditManifests, manifestOverviews], + ); + + const panelContent = useMemo( + () => (isLoadingManifestOverviews ? : listElement), + [isLoadingManifestOverviews, listElement], + ); + + return ( + + + Manage manifests + + {panelContent} + + ); +}; + +export default ManageManifestPanel; diff --git a/striker-ui/components/ManageManifest/index.tsx b/striker-ui/components/ManageManifest/index.tsx new file mode 100644 index 00000000..815cbed8 --- /dev/null +++ b/striker-ui/components/ManageManifest/index.tsx @@ -0,0 +1,3 @@ +import ManageManifestPanel from './ManageManifestPanel'; + +export default ManageManifestPanel; diff --git a/striker-ui/types/APIManifest.d.ts b/striker-ui/types/APIManifest.d.ts new file mode 100644 index 00000000..85a07e86 --- /dev/null +++ b/striker-ui/types/APIManifest.d.ts @@ -0,0 +1,8 @@ +type APIManifestOverview = { + manifestName: string; + manifestUUID: string; +}; + +type APIManifestOverviewList = { + [manifestUUID: string]: APIManifestOverview; +};