feat(lint): use biome instead
This commit is contained in:
1 parent
dca2a31639
commit
8d68eb546d
129 files changed
+2352
-4366
No files matched your search
+86
-177
@@ -5,105 +5,103 @@ import React, { useState, useEffect } from "react";
|
||||
import useKonami from "react-use-konami";
|
||||
|
||||
import { ThemeProvider } from "@mui/material/styles";
|
||||
import { AnimatePresence, motion } from "framer-motion";
|
||||
import { SnackbarProvider } from "notistack";
|
||||
import {
|
||||
Routes,
|
||||
Route,
|
||||
useNavigate,
|
||||
useLocation,
|
||||
Navigate,
|
||||
Route,
|
||||
Routes,
|
||||
useLocation,
|
||||
useNavigate,
|
||||
} from "react-router-dom";
|
||||
import { AnimatePresence, motion } from "framer-motion";
|
||||
|
||||
import { relaunch } from "@tauri-apps/api/process";
|
||||
import {
|
||||
UpdateManifest,
|
||||
checkUpdate,
|
||||
installUpdate,
|
||||
} from "@tauri-apps/api/updater";
|
||||
import { relaunch } from "@tauri-apps/api/process";
|
||||
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
|
||||
// Theming
|
||||
import CssBaseline from "@mui/material/CssBaseline";
|
||||
import { theme } from "./theme";
|
||||
import "./styles/global.scss";
|
||||
import { theme } from "./theme";
|
||||
|
||||
import LoadingButton from "@mui/lab/LoadingButton";
|
||||
import Button from "@mui/material/Button";
|
||||
// MUI
|
||||
import Dialog from "@mui/material/Dialog";
|
||||
import DialogActions from "@mui/material/DialogActions";
|
||||
import DialogContent from "@mui/material/DialogContent";
|
||||
import DialogContentText from "@mui/material/DialogContentText";
|
||||
import DialogTitle from "@mui/material/DialogTitle";
|
||||
import Button from "@mui/material/Button";
|
||||
import Slide from "@mui/material/Slide";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import LinearProgress from "@mui/material/LinearProgress";
|
||||
import Slide from "@mui/material/Slide";
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import LoadingButton from "@mui/lab/LoadingButton";
|
||||
|
||||
import About from "./routes/about";
|
||||
import FavoritePage from "./routes/favorite/index.jsx";
|
||||
import Home from "./routes/home";
|
||||
import ItemDetail from "./routes/item";
|
||||
import LibraryView from "./routes/library";
|
||||
import { LoginWithImage, UserLogin, UserLoginManual } from "./routes/login";
|
||||
import SearchPage from "./routes/search";
|
||||
import SeriesTitlePage from "./routes/series/index.jsx";
|
||||
import Settings from "./routes/settings";
|
||||
// Routes
|
||||
import { ServerSetup } from "./routes/setup/server";
|
||||
import ServerList from "./routes/setup/serverList/index.jsx";
|
||||
import Home from "./routes/home";
|
||||
import { UserLogin, LoginWithImage, UserLoginManual } from "./routes/login";
|
||||
import LibraryView from "./routes/library";
|
||||
import ItemDetail from "./routes/item";
|
||||
import SeriesTitlePage from "./routes/series/index.jsx";
|
||||
import FavoritePage from "./routes/favorite/index.jsx";
|
||||
import Settings from "./routes/settings";
|
||||
import About from "./routes/about";
|
||||
import SearchPage from "./routes/search";
|
||||
|
||||
import { VideoPlayer } from "./routes/player/videoPlayer.jsx";
|
||||
import Markdown from "react-markdown";
|
||||
import { VideoPlayer } from "./routes/player/videoPlayer.jsx";
|
||||
|
||||
import { AppBar } from "./components/appBar/appBar.jsx";
|
||||
|
||||
import "@fontsource-variable/jetbrains-mono";
|
||||
import "@fontsource/noto-sans/100-italic.css";
|
||||
// Fonts
|
||||
import "@fontsource/noto-sans/100.css";
|
||||
import "@fontsource/noto-sans/100-italic.css";
|
||||
import "@fontsource/noto-sans/200.css";
|
||||
import "@fontsource/noto-sans/200-italic.css";
|
||||
import "@fontsource/noto-sans/300.css";
|
||||
import "@fontsource/noto-sans/200.css";
|
||||
import "@fontsource/noto-sans/300-italic.css";
|
||||
import "@fontsource/noto-sans/400.css";
|
||||
import "@fontsource/noto-sans/300.css";
|
||||
import "@fontsource/noto-sans/400-italic.css";
|
||||
import "@fontsource/noto-sans/500.css";
|
||||
import "@fontsource/noto-sans/400.css";
|
||||
import "@fontsource/noto-sans/500-italic.css";
|
||||
import "@fontsource/noto-sans/600.css";
|
||||
import "@fontsource/noto-sans/500.css";
|
||||
import "@fontsource/noto-sans/600-italic.css";
|
||||
import "@fontsource/noto-sans/700.css";
|
||||
import "@fontsource/noto-sans/600.css";
|
||||
import "@fontsource/noto-sans/700-italic.css";
|
||||
import "@fontsource/noto-sans/800.css";
|
||||
import "@fontsource/noto-sans/700.css";
|
||||
import "@fontsource/noto-sans/800-italic.css";
|
||||
import "@fontsource/noto-sans/900.css";
|
||||
import "@fontsource/noto-sans/800.css";
|
||||
import "@fontsource/noto-sans/900-italic.css";
|
||||
import "@fontsource/noto-sans/900.css";
|
||||
import "material-symbols";
|
||||
import "@fontsource-variable/jetbrains-mono";
|
||||
|
||||
import AudioPlayer from "./components/playback/audioPlayer/index.jsx";
|
||||
import MusicAlbumTitlePage from "./routes/album/index.jsx";
|
||||
import ArtistTitlePage from "./routes/artist/index.jsx";
|
||||
import BoxSetTitlePage from "./routes/boxset/index.jsx";
|
||||
import EpisodeTitlePage from "./routes/episode/index.jsx";
|
||||
import PersonTitlePage from "./routes/person/index.jsx";
|
||||
import PlaylistTitlePage from "./routes/playlist/index.jsx";
|
||||
import { useAudioPlayback } from "./utils/store/audioPlayback.js";
|
||||
import { useBackdropStore } from "./utils/store/backdrop.js";
|
||||
import { usePlaybackDataLoadStore } from "./utils/store/playback.js";
|
||||
import BoxSetTitlePage from "./routes/boxset/index.jsx";
|
||||
import PersonTitlePage from "./routes/person/index.jsx";
|
||||
import MusicAlbumTitlePage from "./routes/album/index.jsx";
|
||||
import AudioPlayer from "./components/playback/audioPlayer/index.jsx";
|
||||
import { useAudioPlayback } from "./utils/store/audioPlayback.js";
|
||||
import ArtistTitlePage from "./routes/artist/index.jsx";
|
||||
import EpisodeTitlePage from "./routes/episode/index.jsx";
|
||||
import PlaylistTitlePage from "./routes/playlist/index.jsx";
|
||||
|
||||
import { useApi } from "./utils/store/api";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { CircularProgress } from "@mui/material";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
||||
import { useCentralStore } from "./utils/store/central.js";
|
||||
import { useSnackbar } from "notistack";
|
||||
import { ErrorBoundary } from "react-error-boundary";
|
||||
import { ErrorNotice } from "./components/notices/errorNotice/errorNotice.jsx";
|
||||
|
||||
|
||||
import { useApi } from "./utils/store/api";
|
||||
import { useCentralStore } from "./utils/store/central.js";
|
||||
|
||||
const LoginRoute = () => {
|
||||
const navigate = useNavigate();
|
||||
@@ -183,8 +181,8 @@ function App() {
|
||||
state.isPending,
|
||||
]);
|
||||
|
||||
const handleRelaunch = async (_event: any, reason?: string) => {
|
||||
if (reason && reason == "backdropClick") {
|
||||
const handleRelaunch = async (_event: unknown, reason?: string) => {
|
||||
if (reason && reason === "backdropClick") {
|
||||
return;
|
||||
}
|
||||
await relaunch();
|
||||
@@ -192,6 +190,7 @@ function App() {
|
||||
|
||||
const location = useLocation();
|
||||
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: this dependency is required
|
||||
useEffect(() => {
|
||||
window.scrollTo(0, 0);
|
||||
}, [location.key]);
|
||||
@@ -228,7 +227,9 @@ function App() {
|
||||
|
||||
const [updateDialog, setUpdateDialog] = useState(false);
|
||||
|
||||
const [updateInfo, setUpdateInfo] = useState<UpdateManifest | undefined>(undefined);
|
||||
const [updateInfo, setUpdateInfo] = useState<UpdateManifest | undefined>(
|
||||
undefined,
|
||||
);
|
||||
|
||||
const [updateDialogButton, setUpdateDialogButton] = useState(false);
|
||||
|
||||
@@ -241,9 +242,7 @@ function App() {
|
||||
setUpdateInfo(manifest);
|
||||
setUpdateDialog(true);
|
||||
// You could show a dialog asking the user if they want to install the update here.
|
||||
console.log(
|
||||
`Update found : ${manifest?.version}, ${manifest?.date}`,
|
||||
);
|
||||
console.log(`Update found : ${manifest?.version}, ${manifest?.date}`);
|
||||
|
||||
// Install the update. This will also restart the app on Windows!
|
||||
// await installUpdate();
|
||||
@@ -275,7 +274,8 @@ function App() {
|
||||
<CircularProgress size={72} thickness={1.4} />
|
||||
</div>
|
||||
);
|
||||
} else if (initialRoute) {
|
||||
}
|
||||
if (initialRoute) {
|
||||
return (
|
||||
<SnackbarProvider maxSnack={5}>
|
||||
<ThemeProvider theme={theme}>
|
||||
@@ -298,7 +298,7 @@ function App() {
|
||||
// maxWidth="md"
|
||||
fullWidth
|
||||
>
|
||||
{updateInfo != undefined && (
|
||||
{updateInfo !== undefined && (
|
||||
<>
|
||||
<DialogTitle>
|
||||
Update Available!
|
||||
@@ -312,9 +312,7 @@ function App() {
|
||||
</DialogTitle>
|
||||
<DialogContent dividers>
|
||||
<DialogContentText>
|
||||
<Markdown>
|
||||
{updateInfo.body}
|
||||
</Markdown>
|
||||
<Markdown>{updateInfo.body}</Markdown>
|
||||
</DialogContentText>
|
||||
</DialogContent>
|
||||
<DialogActions
|
||||
@@ -322,9 +320,7 @@ function App() {
|
||||
padding: "1em",
|
||||
}}
|
||||
>
|
||||
<IconButton
|
||||
disabled={updateDialogButton}
|
||||
>
|
||||
<IconButton disabled={updateDialogButton}>
|
||||
<SvgIcon>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
@@ -333,6 +329,7 @@ function App() {
|
||||
fill="currentColor"
|
||||
viewBox="0 0 16 16"
|
||||
>
|
||||
<title>Update</title>
|
||||
<path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.012 8.012 0 0 0 16 8c0-4.42-3.58-8-8-8" />
|
||||
</svg>
|
||||
</SvgIcon>
|
||||
@@ -342,9 +339,7 @@ function App() {
|
||||
color="error"
|
||||
variant="outlined"
|
||||
disabled={updateDialogButton}
|
||||
onClick={() =>
|
||||
setUpdateDialog(false)
|
||||
}
|
||||
onClick={() => setUpdateDialog(false)}
|
||||
>
|
||||
close
|
||||
</Button>
|
||||
@@ -355,9 +350,7 @@ function App() {
|
||||
loading={updateDialogButton}
|
||||
loadingIndicator="Updating..."
|
||||
onClick={async () => {
|
||||
setUpdateDialogButton(
|
||||
true,
|
||||
);
|
||||
setUpdateDialogButton(true);
|
||||
await installUpdate();
|
||||
enqueueSnackbar(
|
||||
"Update has been installed! You need to relaunch JellyPlayer.",
|
||||
@@ -387,18 +380,14 @@ function App() {
|
||||
src="https://www.youtube.com/embed/dQw4w9WgXcQ?autoplay=1&disablekb=1"
|
||||
title="EasterEgg"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||
></iframe>
|
||||
/>
|
||||
</Dialog>
|
||||
<Slide
|
||||
direction="up"
|
||||
in={easterEgg}
|
||||
mountOnEnter
|
||||
unmountOnExit
|
||||
>
|
||||
<Slide direction="up" in={easterEgg} mountOnEnter unmountOnExit>
|
||||
<img
|
||||
src="https://i.gifer.com/PYh.gif"
|
||||
width={320}
|
||||
height={320}
|
||||
alt="nyan cat gif"
|
||||
style={{
|
||||
zIndex: "99999999",
|
||||
position: "fixed",
|
||||
@@ -445,9 +434,7 @@ function App() {
|
||||
</AnimatePresence>
|
||||
</div>
|
||||
<div
|
||||
className={
|
||||
audioPlayerVisible ? "audio-playing" : ""
|
||||
}
|
||||
className={audioPlayerVisible ? "audio-playing" : ""}
|
||||
style={{
|
||||
display: "flex",
|
||||
width: "100vw",
|
||||
@@ -464,12 +451,7 @@ function App() {
|
||||
// key={location.key}
|
||||
element={<AnimationWrapper />}
|
||||
> */}
|
||||
<Route
|
||||
path="/"
|
||||
element={
|
||||
<Navigate to={initialRoute} />
|
||||
}
|
||||
></Route>
|
||||
<Route path="/" element={<Navigate to={initialRoute} />} />
|
||||
<Route
|
||||
path="/error"
|
||||
element={
|
||||
@@ -481,126 +463,53 @@ function App() {
|
||||
maxWidth="md"
|
||||
>
|
||||
<DialogTitle id="alert-dialog-text">
|
||||
Unable to reach
|
||||
server
|
||||
Unable to reach server
|
||||
</DialogTitle>
|
||||
<DialogContent>
|
||||
<DialogContentText id="alert-dialog-desc">
|
||||
Unable to
|
||||
connect to the
|
||||
jellyfin
|
||||
server.
|
||||
Unable to connect to the jellyfin server.
|
||||
</DialogContentText>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button
|
||||
onClick={() =>
|
||||
navigate(
|
||||
"/servers/list",
|
||||
)
|
||||
}
|
||||
>
|
||||
<Button onClick={() => navigate("/servers/list")}>
|
||||
Change Server
|
||||
</Button>
|
||||
<Button
|
||||
variant="outlined"
|
||||
onClick={
|
||||
handleRelaunch
|
||||
}
|
||||
>
|
||||
Restart
|
||||
JellyPlayer
|
||||
<Button variant="outlined" onClick={handleRelaunch}>
|
||||
Restart JellyPlayer
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="/login/index"
|
||||
element={<LoginRoute />}
|
||||
/>
|
||||
<Route path="/login/index" element={<LoginRoute />} />
|
||||
|
||||
<Route
|
||||
path="/home"
|
||||
element={<Home />}
|
||||
/>
|
||||
<Route
|
||||
path="/setup/server"
|
||||
element={<ServerSetup />}
|
||||
/>
|
||||
<Route
|
||||
path="/servers/list"
|
||||
element={<ServerList />}
|
||||
/>
|
||||
<Route path="/home" element={<Home />} />
|
||||
<Route path="/setup/server" element={<ServerSetup />} />
|
||||
<Route path="/servers/list" element={<ServerList />} />
|
||||
<Route
|
||||
path="/login/withImg/:userName/:userId/"
|
||||
element={<LoginWithImage />}
|
||||
/>
|
||||
<Route
|
||||
path="/login/users"
|
||||
element={<UserLogin />}
|
||||
/>
|
||||
<Route
|
||||
path="/login/manual"
|
||||
element={<UserLoginManual />}
|
||||
/>
|
||||
<Route
|
||||
path="/library/:id"
|
||||
element={<LibraryView />}
|
||||
/>
|
||||
<Route
|
||||
path="/item/:id"
|
||||
element={<ItemDetail />}
|
||||
/>
|
||||
<Route path="/login/users" element={<UserLogin />} />
|
||||
<Route path="/login/manual" element={<UserLoginManual />} />
|
||||
<Route path="/library/:id" element={<LibraryView />} />
|
||||
<Route path="/item/:id" element={<ItemDetail />} />
|
||||
<Route
|
||||
path="/musicalbum/:id"
|
||||
element={<MusicAlbumTitlePage />}
|
||||
errorElement={<div>Error</div>}
|
||||
/>
|
||||
<Route
|
||||
path="/artist/:id"
|
||||
element={<ArtistTitlePage />}
|
||||
/>
|
||||
<Route
|
||||
path="/boxset/:id"
|
||||
element={<BoxSetTitlePage />}
|
||||
/>
|
||||
<Route
|
||||
path="/episode/:id"
|
||||
element={<EpisodeTitlePage />}
|
||||
/>
|
||||
<Route
|
||||
path="/person/:id"
|
||||
element={<PersonTitlePage />}
|
||||
/>
|
||||
<Route
|
||||
path="/playlist/:id"
|
||||
element={<PlaylistTitlePage />}
|
||||
/>
|
||||
<Route
|
||||
path="/series/:id"
|
||||
element={<SeriesTitlePage />}
|
||||
/>
|
||||
<Route
|
||||
path="/search"
|
||||
element={<SearchPage />}
|
||||
/>
|
||||
<Route
|
||||
path="/favorite"
|
||||
element={<FavoritePage />}
|
||||
/>
|
||||
<Route
|
||||
path="/settings"
|
||||
element={<Settings />}
|
||||
/>
|
||||
<Route
|
||||
path="/about"
|
||||
element={<About />}
|
||||
/>
|
||||
<Route
|
||||
path="/player"
|
||||
element={<VideoPlayer />}
|
||||
/>
|
||||
<Route path="/artist/:id" element={<ArtistTitlePage />} />
|
||||
<Route path="/boxset/:id" element={<BoxSetTitlePage />} />
|
||||
<Route path="/episode/:id" element={<EpisodeTitlePage />} />
|
||||
<Route path="/person/:id" element={<PersonTitlePage />} />
|
||||
<Route path="/playlist/:id" element={<PlaylistTitlePage />} />
|
||||
<Route path="/series/:id" element={<SeriesTitlePage />} />
|
||||
<Route path="/search" element={<SearchPage />} />
|
||||
<Route path="/favorite" element={<FavoritePage />} />
|
||||
<Route path="/settings" element={<Settings />} />
|
||||
<Route path="/about" element={<About />} />
|
||||
<Route path="/player" element={<VideoPlayer />} />
|
||||
{/* </Route> */}
|
||||
</Routes>
|
||||
</ErrorBoundary>
|
||||
|
||||
Reference in new issue
Block a user