Remove few bugs
This commit is contained in:
10 files changed
+117
-171
No files matched your search
+1
-2
@@ -22,7 +22,7 @@ import { relaunch } from "@tauri-apps/api/process";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
||||
// import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
||||
|
||||
// Theming
|
||||
import CssBaseline from "@mui/material/CssBaseline";
|
||||
@@ -398,7 +398,6 @@ function App() {
|
||||
</Routes>
|
||||
</div>
|
||||
</AnimatePresence>
|
||||
<ReactQueryDevtools />
|
||||
</ThemeProvider>
|
||||
</SnackbarProvider>
|
||||
);
|
||||
|
||||
@@ -17,7 +17,6 @@ import { theme } from "../../theme";
|
||||
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { useLocation, useNavigate } from "react-router-dom";
|
||||
import { hideBackButton } from "../../utils/slice/appBar";
|
||||
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { useQueryClient, useQuery } from "@tanstack/react-query";
|
||||
@@ -34,10 +33,7 @@ export const AppBar = () => {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const [display, setDisplay] = useState(false);
|
||||
const backButtonVisible = useSelector(
|
||||
(state) => state.appBar.backButtonVisible,
|
||||
);
|
||||
const backdropVisible = useSelector((state) => state.appBar.backdrop);
|
||||
const [backButtonVisible, setBackButtonVisible] = useState(true);
|
||||
|
||||
const location = useLocation();
|
||||
|
||||
@@ -78,7 +74,9 @@ export const AppBar = () => {
|
||||
|
||||
useEffect(() => {
|
||||
if (location.pathname == "/home") {
|
||||
dispatch(hideBackButton());
|
||||
setBackButtonVisible(false);
|
||||
} else {
|
||||
setBackButtonVisible(true);
|
||||
}
|
||||
}, [location]);
|
||||
|
||||
@@ -94,7 +92,7 @@ export const AppBar = () => {
|
||||
backgroundColor: "transparent",
|
||||
}}
|
||||
className={trigger ? "appBar backdropVisible" : "appBar"}
|
||||
elevation={backdropVisible ? 6 : 0}
|
||||
elevation={0}
|
||||
>
|
||||
<Toolbar sx={{ justifyContent: "space-between" }}>
|
||||
<Box
|
||||
|
||||
@@ -70,7 +70,7 @@ export const SideMenu = ({}) => {
|
||||
let usr = await getUserApi(window.api).getCurrentUser();
|
||||
return usr.data;
|
||||
},
|
||||
enabled: false,
|
||||
enabled: !!window.api,
|
||||
networkMode: "always",
|
||||
});
|
||||
let libraries = useQuery({
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useState } from "react";
|
||||
|
||||
import { Blurhash } from "react-blurhash";
|
||||
|
||||
import { useQueryClient, useQuery } from "@tanstack/react-query";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { EventEmitter as event } from "../../eventEmitter";
|
||||
import { getServer } from "../../utils/storage/servers";
|
||||
@@ -37,18 +37,14 @@ import { MdiStarHalfFull } from "../../components/icons/mdiStarHalfFull";
|
||||
import { MdiPlayOutline } from "../../components/icons/mdiPlayOutline";
|
||||
import { MdiChevronRight } from "../../components/icons/mdiChevronRight";
|
||||
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { showAppBar } from "../../utils/slice/appBar";
|
||||
|
||||
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getTvShowsApi } from "@jellyfin/sdk/lib/utils/api/tv-shows-api";
|
||||
|
||||
import { useNavigate, useLocation } from "react-router-dom";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
|
||||
import { formateDate } from "../../utils/date/formateDate";
|
||||
import { getRuntime } from "../../utils/date/time";
|
||||
|
||||
const Home = () => {
|
||||
@@ -156,10 +152,7 @@ const Home = () => {
|
||||
|
||||
const [latestMediaLibs, setLatestMediaLibs] = useState([]);
|
||||
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
|
||||
const excludeTypes = ["boxsets", "playlists", "livetv", "channels"];
|
||||
|
||||
@@ -191,12 +184,6 @@ const Home = () => {
|
||||
});
|
||||
}
|
||||
|
||||
const appBarVisiblity = useSelector((state) => state.appBar.visible);
|
||||
|
||||
if (!appBarVisiblity) {
|
||||
dispatch(showAppBar());
|
||||
}
|
||||
|
||||
if (user.isPaused) {
|
||||
user.refetch();
|
||||
console.log(user.isError);
|
||||
|
||||
@@ -28,7 +28,6 @@ import { green, pink } from "@mui/material/colors";
|
||||
import { AvatarImage } from "../../components/avatar/avatar";
|
||||
|
||||
import { Blurhash } from "react-blurhash";
|
||||
import { showAppBar, showBackButton } from "../../utils/slice/appBar";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { useParams, useNavigate } from "react-router-dom";
|
||||
|
||||
@@ -97,17 +96,9 @@ const ItemDetail = () => {
|
||||
const { id } = useParams();
|
||||
const dispatch = useDispatch();
|
||||
const navigate = useNavigate();
|
||||
const appBarVisiblity = useSelector((state) => state.appBar.visible);
|
||||
const [primageImageLoaded, setPrimaryImageLoaded] = useState(false);
|
||||
const [backdropImageLoaded, setBackdropImageLoaded] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (!appBarVisiblity) {
|
||||
dispatch(showAppBar());
|
||||
}
|
||||
dispatch(showBackButton());
|
||||
}, []);
|
||||
|
||||
const user = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
@@ -509,7 +500,7 @@ const ItemDetail = () => {
|
||||
>
|
||||
<Box
|
||||
className="item-detail-header"
|
||||
mb={0}
|
||||
mb={2}
|
||||
paddingTop={
|
||||
item.data.Type == BaseItemKind.MusicAlbum
|
||||
? 10
|
||||
@@ -698,8 +689,8 @@ const ItemDetail = () => {
|
||||
)}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
color="gray"
|
||||
variant="h6"
|
||||
sx={{ opacity: 0.7 }}
|
||||
>
|
||||
{item.data.OriginalTitle}
|
||||
</Typography>
|
||||
@@ -865,6 +856,7 @@ const ItemDetail = () => {
|
||||
</IconButton>
|
||||
</Stack>
|
||||
</Box>
|
||||
|
||||
<Box
|
||||
className="item-detail-tagline"
|
||||
sx={{ width: "100%" }}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
}
|
||||
&-header {
|
||||
display: flex;
|
||||
gap: 2em;
|
||||
gap: 1em;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-end;
|
||||
position: relative;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/** @format */
|
||||
import { useState, useEffect } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { showAppBar, showBackButton } from "../../utils/slice/appBar";
|
||||
import { useParams, useNavigate, Link } from "react-router-dom";
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
@@ -56,7 +55,6 @@ import { clrBackgroundDarkOpacity0_8 } from "../../palette.module.scss";
|
||||
import { ErrorNotice } from "../../components/notices/errorNotice/errorNotice";
|
||||
import {
|
||||
BaseItemKind,
|
||||
CollectionTypeOptions,
|
||||
ItemFields,
|
||||
SortOrder,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
@@ -69,15 +67,10 @@ import { MdiHeartOutline } from "../../components/icons/mdiHeartOutline";
|
||||
|
||||
const LibraryView = () => {
|
||||
const navigate = useNavigate();
|
||||
const dispatch = useDispatch();
|
||||
const appBarVisiblity = useSelector((state) => state.appBar.visible);
|
||||
|
||||
const [page, setPage] = useState(1);
|
||||
const maxDisplayItems = 50;
|
||||
|
||||
if (!appBarVisiblity) {
|
||||
dispatch(showAppBar());
|
||||
}
|
||||
const { id } = useParams();
|
||||
|
||||
const user = useQuery({
|
||||
@@ -116,10 +109,6 @@ const LibraryView = () => {
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
if (currentLib.isSuccess) {
|
||||
dispatch(showBackButton());
|
||||
}
|
||||
|
||||
const [isPlayed, setIsPlayed] = useState(false);
|
||||
const [isUnPlayed, setIsUnPlayed] = useState(false);
|
||||
const [isResumable, setIsResumable] = useState(false);
|
||||
@@ -405,7 +394,10 @@ const LibraryView = () => {
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (viewType.length != 0) setCurrentViewType(viewType[0].value);
|
||||
if (viewType.length != 0) {
|
||||
setCurrentViewType(viewType[0].value);
|
||||
console.log(viewType);
|
||||
}
|
||||
}, [viewType]);
|
||||
|
||||
const disabledSortViews = [
|
||||
@@ -809,84 +801,94 @@ const LibraryView = () => {
|
||||
currentViewType,
|
||||
) && (
|
||||
<>
|
||||
{sortByData != undefined && (
|
||||
<>
|
||||
<Checkbox
|
||||
icon={
|
||||
<MdiSortDescending />
|
||||
}
|
||||
checkedIcon={
|
||||
<MdiSortAscending />
|
||||
}
|
||||
sx={{
|
||||
color: "white !important",
|
||||
}}
|
||||
color="white"
|
||||
onChange={
|
||||
handleSortChange
|
||||
}
|
||||
checked={
|
||||
sortAscending
|
||||
}
|
||||
/>
|
||||
<TextField
|
||||
select
|
||||
hiddenLabel
|
||||
value={
|
||||
sortByData[0]
|
||||
.value
|
||||
}
|
||||
size="small"
|
||||
variant="filled"
|
||||
onChange={
|
||||
handleSortBy
|
||||
}
|
||||
>
|
||||
{sortByData.map(
|
||||
(
|
||||
item,
|
||||
index,
|
||||
) => {
|
||||
return (
|
||||
<MenuItem
|
||||
key={
|
||||
index
|
||||
}
|
||||
value={
|
||||
item.value
|
||||
}
|
||||
>
|
||||
{`By ${item.title}`}
|
||||
</MenuItem>
|
||||
);
|
||||
},
|
||||
)}
|
||||
</TextField>
|
||||
</>
|
||||
)}
|
||||
{sortByData != undefined &&
|
||||
sortBy != undefined && (
|
||||
<>
|
||||
<Checkbox
|
||||
icon={
|
||||
<MdiSortDescending />
|
||||
}
|
||||
checkedIcon={
|
||||
<MdiSortAscending />
|
||||
}
|
||||
sx={{
|
||||
color: "white !important",
|
||||
}}
|
||||
color="white"
|
||||
onChange={
|
||||
handleSortChange
|
||||
}
|
||||
checked={
|
||||
sortAscending
|
||||
}
|
||||
/>
|
||||
<TextField
|
||||
select
|
||||
hiddenLabel
|
||||
value={sortBy}
|
||||
size="small"
|
||||
variant="filled"
|
||||
onChange={
|
||||
handleSortBy
|
||||
}
|
||||
>
|
||||
{sortByData.map(
|
||||
(
|
||||
item,
|
||||
index,
|
||||
) => {
|
||||
return (
|
||||
<MenuItem
|
||||
key={
|
||||
index
|
||||
}
|
||||
value={
|
||||
item.value
|
||||
}
|
||||
>
|
||||
{`By ${item.title}`}
|
||||
</MenuItem>
|
||||
);
|
||||
},
|
||||
)}
|
||||
</TextField>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{viewType.length != 0 && (
|
||||
<TextField
|
||||
select
|
||||
hiddenLabel
|
||||
value={viewType[0].value}
|
||||
size="small"
|
||||
variant="filled"
|
||||
onChange={handleCurrentViewType}
|
||||
>
|
||||
{viewType.map((item, index) => {
|
||||
return (
|
||||
<MenuItem
|
||||
key={item.value}
|
||||
value={item.value}
|
||||
>
|
||||
{item.title}
|
||||
</MenuItem>
|
||||
);
|
||||
})}
|
||||
</TextField>
|
||||
)}
|
||||
{viewType.length != 0 &&
|
||||
currentViewType != undefined && (
|
||||
<TextField
|
||||
select
|
||||
hiddenLabel
|
||||
// value={viewType[0].value}
|
||||
value={currentViewType}
|
||||
size="small"
|
||||
variant="filled"
|
||||
onChange={
|
||||
handleCurrentViewType
|
||||
}
|
||||
>
|
||||
{viewType.map(
|
||||
(item, index) => {
|
||||
return (
|
||||
<MenuItem
|
||||
key={
|
||||
item.value
|
||||
}
|
||||
value={
|
||||
item.value
|
||||
}
|
||||
>
|
||||
{
|
||||
item.title
|
||||
}
|
||||
</MenuItem>
|
||||
);
|
||||
},
|
||||
)}
|
||||
</TextField>
|
||||
)}
|
||||
</Stack>
|
||||
</Toolbar>
|
||||
</AppBar>
|
||||
|
||||
@@ -2,10 +2,8 @@
|
||||
|
||||
import { configureStore } from "@reduxjs/toolkit";
|
||||
import sideBarReducer from "./utils/slice/sidemenu";
|
||||
import appBarReducer from "./utils/slice/appBar";
|
||||
export default configureStore({
|
||||
reducer: {
|
||||
sidebar: sideBarReducer,
|
||||
appBar: appBarReducer,
|
||||
},
|
||||
});
|
||||
@@ -1,28 +0,0 @@
|
||||
/** @format */
|
||||
|
||||
import { createSlice } from "@reduxjs/toolkit";
|
||||
export const appBarSlice = createSlice({
|
||||
name: "appBar",
|
||||
initialState: {
|
||||
visible: false,
|
||||
backButtonVisible: false,
|
||||
},
|
||||
reducers: {
|
||||
showAppBar: (state) => {
|
||||
state.visible = true;
|
||||
},
|
||||
hideAppBar: (state) => {
|
||||
state.visible = false;
|
||||
},
|
||||
showBackButton: (state, action) => {
|
||||
state.backButtonVisible = true;
|
||||
},
|
||||
hideBackButton: (state) => {
|
||||
state.backButtonVisible = false;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const { showAppBar, hideAppBar, showBackButton, hideBackButton } =
|
||||
appBarSlice.actions;
|
||||
export default appBarSlice.reducer;
|
||||
Reference in new issue
Block a user