diff --git a/frontend/src/Layout.tsx b/frontend/src/Layout.tsx index 55b1ffe..bc23444 100644 --- a/frontend/src/Layout.tsx +++ b/frontend/src/Layout.tsx @@ -1,14 +1,11 @@ import { ThemeProvider } from '@emotion/react' - import ChevronLeft from '@mui/icons-material/ChevronLeft' import Dashboard from '@mui/icons-material/Dashboard' import Menu from '@mui/icons-material/Menu' import SettingsIcon from '@mui/icons-material/Settings' import SettingsEthernet from '@mui/icons-material/SettingsEthernet' import Storage from '@mui/icons-material/Storage' - import { Box, createTheme } from '@mui/material' - import DownloadIcon from '@mui/icons-material/Download' import CssBaseline from '@mui/material/CssBaseline' import Divider from '@mui/material/Divider' @@ -19,20 +16,16 @@ import ListItemIcon from '@mui/material/ListItemIcon' import ListItemText from '@mui/material/ListItemText' import Toolbar from '@mui/material/Toolbar' import Typography from '@mui/material/Typography' - import { grey } from '@mui/material/colors' - import { useMemo, useState } from 'react' import { useSelector } from 'react-redux' - import { Link, Outlet } from 'react-router-dom' import { RootState } from './stores/store' - import AppBar from './components/AppBar' import Drawer from './components/Drawer' - import Logout from './components/Logout' import ThemeToggler from './components/ThemeToggler' +import Toaster from './providers/ToasterProvider' import I18nProvider from './providers/i18nProvider' import RPCClientProvider from './providers/rpcClientProvider' import { formatGiB } from './utils' @@ -184,6 +177,7 @@ export default function Layout() { + diff --git a/frontend/src/components/DownloadsCardView.tsx b/frontend/src/components/DownloadsCardView.tsx index 7ac9eca..741a09d 100644 --- a/frontend/src/components/DownloadsCardView.tsx +++ b/frontend/src/components/DownloadsCardView.tsx @@ -1,8 +1,9 @@ -import { Grid, Snackbar } from "@mui/material" -import { Fragment, useContext, useEffect, useState } from "react" +import { Grid } from "@mui/material" +import { Fragment, useContext } from "react" +import { useToast } from "../hooks/toast" +import { I18nContext } from "../providers/i18nProvider" import type { RPCResult } from "../types" import { StackableResult } from "./StackableResult" -import { I18nContext } from "../providers/i18nProvider" type Props = { downloads: RPCResult[] @@ -10,9 +11,8 @@ type Props = { } export function DownloadsCardView({ downloads, onStop }: Props) { - const [openSB, setOpenSB] = useState(false) - const { i18n } = useContext(I18nContext) + const { pushMessage } = useToast() return ( @@ -26,7 +26,7 @@ export function DownloadsCardView({ downloads, onStop }: Props) { thumbnail={download.info.thumbnail} percentage={download.progress.percentage} onStop={() => onStop(download.id)} - onCopy={() => setOpenSB(true)} + onCopy={() => pushMessage(i18n.t('clipboardAction'))} resolution={download.info.resolution ?? ''} speed={download.progress.speed} size={download.info.filesize_approx ?? 0} @@ -36,12 +36,6 @@ export function DownloadsCardView({ downloads, onStop }: Props) { )) } - setOpenSB(false)} - message={i18n.t('clipboardAction')} - /> ) } \ No newline at end of file diff --git a/frontend/src/components/DownloadsListView.tsx b/frontend/src/components/DownloadsListView.tsx index 3f4a26d..9994992 100644 --- a/frontend/src/components/DownloadsListView.tsx +++ b/frontend/src/components/DownloadsListView.tsx @@ -19,13 +19,13 @@ type Props = { onStop: (id: string) => void } -export function DownloadsListView({ downloads, onStop }: Props) { +export const DownloadsListView: React.FC = ({ downloads, onStop }) => { return ( - + - +