Add app backdrop
This commit is contained in:
5 files changed
+66
-5
No files matched your search
+28
-4
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
|
|
||||||
import { appWindow } from "@tauri-apps/api/window";
|
|
||||||
|
|
||||||
import useKonami from "react-use-konami";
|
import useKonami from "react-use-konami";
|
||||||
|
|
||||||
import { ThemeProvider } from "@mui/material/styles";
|
import { ThemeProvider } from "@mui/material/styles";
|
||||||
@@ -38,8 +36,7 @@ import DialogContentText from "@mui/material/DialogContentText";
|
|||||||
import DialogTitle from "@mui/material/DialogTitle";
|
import DialogTitle from "@mui/material/DialogTitle";
|
||||||
import Button from "@mui/material/Button";
|
import Button from "@mui/material/Button";
|
||||||
import Slide from "@mui/material/Slide";
|
import Slide from "@mui/material/Slide";
|
||||||
// import Slide from "@mui/material/Slide";
|
import Box from "@mui/material/Box";
|
||||||
import CircularProgress from "@mui/material/CircularProgress";
|
|
||||||
|
|
||||||
// Routes
|
// Routes
|
||||||
import { ServerSetup, ServerList } from "./routes/setup/server";
|
import { ServerSetup, ServerList } from "./routes/setup/server";
|
||||||
@@ -71,6 +68,7 @@ import { delServer, getServer } from "./utils/storage/servers.js";
|
|||||||
import { delUser, getUser } from "./utils/storage/user.js";
|
import { delUser, getUser } from "./utils/storage/user.js";
|
||||||
|
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
import { useBackdropStore } from "./utils/store/backdrop.js";
|
||||||
|
|
||||||
const jellyfin = new Jellyfin({
|
const jellyfin = new Jellyfin({
|
||||||
clientInfo: {
|
clientInfo: {
|
||||||
@@ -268,6 +266,12 @@ function App() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const [backdropUrl, backdropId] = useBackdropStore((state) => [
|
||||||
|
state.backdropUrl,
|
||||||
|
state.backdropId,
|
||||||
|
]);
|
||||||
|
|
||||||
const [easterEgg, setEasterEgg] = useState(false);
|
const [easterEgg, setEasterEgg] = useState(false);
|
||||||
const sixtyNine = () => {
|
const sixtyNine = () => {
|
||||||
setEasterEgg(true);
|
setEasterEgg(true);
|
||||||
@@ -362,6 +366,26 @@ function App() {
|
|||||||
width: "calc(100vw - 14px)",
|
width: "calc(100vw - 14px)",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
<Box className="app-backdrop-container">
|
||||||
|
<motion.img
|
||||||
|
key={backdropId}
|
||||||
|
src={backdropUrl}
|
||||||
|
alt=""
|
||||||
|
className="app-backdrop"
|
||||||
|
initial={{
|
||||||
|
opacity: 0,
|
||||||
|
}}
|
||||||
|
animate={{
|
||||||
|
opacity: 0.5,
|
||||||
|
}}
|
||||||
|
exit={{
|
||||||
|
opacity: 0,
|
||||||
|
}}
|
||||||
|
transition={{
|
||||||
|
duration: 1,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
<CssBaseline />
|
<CssBaseline />
|
||||||
<SideMenu />
|
<SideMenu />
|
||||||
<AppBar />
|
<AppBar />
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
/** @format */
|
|
||||||
@@ -53,6 +53,7 @@ import { ErrorBoundary } from "react-error-boundary";
|
|||||||
import CarouselSlideError from "../../components/errors/carousel";
|
import CarouselSlideError from "../../components/errors/carousel";
|
||||||
|
|
||||||
import { motion } from "framer-motion";
|
import { motion } from "framer-motion";
|
||||||
|
import { useBackdropStore } from "../../utils/store/backdrop";
|
||||||
const Home = () => {
|
const Home = () => {
|
||||||
const authUser = useQuery({
|
const authUser = useQuery({
|
||||||
queryKey: ["home", "authenticateUser"],
|
queryKey: ["home", "authenticateUser"],
|
||||||
@@ -196,6 +197,8 @@ const Home = () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const [setAppBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
|
||||||
|
|
||||||
if (user.isPaused) {
|
if (user.isPaused) {
|
||||||
user.refetch();
|
user.refetch();
|
||||||
console.log(user.isError);
|
console.log(user.isError);
|
||||||
@@ -245,6 +248,13 @@ const Home = () => {
|
|||||||
sx={{
|
sx={{
|
||||||
marginBottom: "1.5em",
|
marginBottom: "1.5em",
|
||||||
}}
|
}}
|
||||||
|
onChange={(now) => {
|
||||||
|
console.log(latestMedia.data[now]);
|
||||||
|
setAppBackdrop(
|
||||||
|
`${window.api.basePath}/Items/${latestMedia.data[now].Id}/Images/Backdrop`,
|
||||||
|
latestMedia.data[now].Id,
|
||||||
|
);
|
||||||
|
}}
|
||||||
duration={400}
|
duration={400}
|
||||||
interval={10000}
|
interval={10000}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -41,6 +41,24 @@ body {
|
|||||||
overflow-y: overlay;
|
overflow-y: overlay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.app-backdrop {
|
||||||
|
object-fit: cover;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
filter: blur(50px);
|
||||||
|
|
||||||
|
&-container {
|
||||||
|
position: fixed;
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#root,
|
#root,
|
||||||
.root-page {
|
.root-page {
|
||||||
height: fit-content;
|
height: fit-content;
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
/** @format */
|
||||||
|
|
||||||
|
import { create } from "zustand";
|
||||||
|
|
||||||
|
export const useBackdropStore = create((set) => ({
|
||||||
|
backdropUrl: "",
|
||||||
|
backdropId: "",
|
||||||
|
setBackdrop: (url, id) =>
|
||||||
|
set((state) => ({ backdropUrl: url, backdropId: id })),
|
||||||
|
}));
|
||||||
Reference in new issue
Block a user