import type React from 'react'; import { AnimatePresence, m } from 'framer-motion'; import { FiFilePlus } from 'react-icons/fi'; import useSWR from 'swr'; import { Button } from '@components/generic/button/Button'; import { Card } from '@components/generic/Card'; import { fetcher } from '@core/utils/fetcher'; import { useAppSelector } from '@hooks/useAppSelector'; export interface File { nameModified: string; name: string; size: number; } export interface Files { data: { files: File[]; fileSystem: { total: number; used: number; free: number; }; }; status: string; } export const FileBrowser = (): JSX.Element => { const connectionParams = useAppSelector( (state) => state.app.connectionParams, ); const appState = useAppSelector((state) => state.app); const meshtasticState = useAppSelector((state) => state.meshtastic); const { data } = useSWR( `${connectionParams.HTTP.tls ? 'https' : 'http'}://${ connectionParams.HTTP.address }${ meshtasticState.radio.hardware.firmwareVersion.includes('1.2') ? '/json/spiffs/browse/static' : '/json/fs/browse/static' }`, fetcher, ); return (
}>Upload File} className="flex-grow flex-col" >
{(!data || data?.data.files.length === 0) && (
)}
{data?.data.files.map((file) => (
))}
); };