Start moving to @mdi/js for Icons

This commit is contained in:
Prayag Prajapati committed 2023-02-10 16:15:36 +05:30
1 parent e84444bf0e
commit 022b247d59
12 files changed
+131 -29

No files matched your search

+13 -2
View File
@@ -1,11 +1,11 @@
{ {
"name": "jellyplayer-react", "name": "jellyplayer",
"version": "0.0.0", "version": "0.0.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "jellyplayer-react", "name": "jellyplayer",
"version": "0.0.0", "version": "0.0.0",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"dependencies": { "dependencies": {
@@ -13,6 +13,7 @@
"@emotion/styled": "^11.10.5", "@emotion/styled": "^11.10.5",
"@fontsource/open-sans": "^4.5.13", "@fontsource/open-sans": "^4.5.13",
"@jellyfin/sdk": "^0.7.0", "@jellyfin/sdk": "^0.7.0",
"@mdi/js": "^7.1.96",
"@mui/lab": "^5.0.0-alpha.110", "@mui/lab": "^5.0.0-alpha.110",
"@mui/material": "^5.10.15", "@mui/material": "^5.10.15",
"events": "^3.3.0", "events": "^3.3.0",
@@ -673,6 +674,11 @@
"@jridgewell/sourcemap-codec": "1.4.14" "@jridgewell/sourcemap-codec": "1.4.14"
} }
}, },
"node_modules/@mdi/js": {
"version": "7.1.96",
"resolved": "https://registry.npmjs.org/@mdi/js/-/js-7.1.96.tgz",
"integrity": "sha512-wlrJs6Ryhaa5CqhK3FjTfMRnb/s7HeLkKMFqwQySkK86cdN1TGdzpSM3O4tsmzCA1dYBeTbXvOwSE/Y42cUrvA=="
},
"node_modules/@motionone/animation": { "node_modules/@motionone/animation": {
"version": "10.15.1", "version": "10.15.1",
"resolved": "https://registry.npmjs.org/@motionone/animation/-/animation-10.15.1.tgz", "resolved": "https://registry.npmjs.org/@motionone/animation/-/animation-10.15.1.tgz",
@@ -3673,6 +3679,11 @@
"@jridgewell/sourcemap-codec": "1.4.14" "@jridgewell/sourcemap-codec": "1.4.14"
} }
}, },
"@mdi/js": {
"version": "7.1.96",
"resolved": "https://registry.npmjs.org/@mdi/js/-/js-7.1.96.tgz",
"integrity": "sha512-wlrJs6Ryhaa5CqhK3FjTfMRnb/s7HeLkKMFqwQySkK86cdN1TGdzpSM3O4tsmzCA1dYBeTbXvOwSE/Y42cUrvA=="
},
"@motionone/animation": { "@motionone/animation": {
"version": "10.15.1", "version": "10.15.1",
"resolved": "https://registry.npmjs.org/@motionone/animation/-/animation-10.15.1.tgz", "resolved": "https://registry.npmjs.org/@motionone/animation/-/animation-10.15.1.tgz",
+1
View File
@@ -14,6 +14,7 @@
"@emotion/styled": "^11.10.5", "@emotion/styled": "^11.10.5",
"@fontsource/open-sans": "^4.5.13", "@fontsource/open-sans": "^4.5.13",
"@jellyfin/sdk": "^0.7.0", "@jellyfin/sdk": "^0.7.0",
"@mdi/js": "^7.1.96",
"@mui/lab": "^5.0.0-alpha.110", "@mui/lab": "^5.0.0-alpha.110",
"@mui/material": "^5.10.15", "@mui/material": "^5.10.15",
"events": "^3.3.0", "events": "^3.3.0",
+2 -2
View File
@@ -3,7 +3,7 @@
import AppBar from "@mui/material/AppBar"; import AppBar from "@mui/material/AppBar";
import Toolbar from "@mui/material/Toolbar"; import Toolbar from "@mui/material/Toolbar";
import IconButton from "@mui/material/IconButton"; import IconButton from "@mui/material/IconButton";
import ArrowLeft from "mdi-material-ui/ArrowLeft"; import { MdiArrowLeft } from "../icons/mdiArrowLeft";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
export const AppBarBackOnly = () => { export const AppBarBackOnly = () => {
@@ -24,7 +24,7 @@ export const AppBarBackOnly = () => {
onClick={handleBack} onClick={handleBack}
sx={{ mr: 2 }} sx={{ mr: 2 }}
> >
<ArrowLeft /> <MdiArrowLeft />
</IconButton> </IconButton>
</Toolbar> </Toolbar>
</AppBar> </AppBar>
+1
View File
@@ -22,6 +22,7 @@ export const AvatarCard = ({ userName, userId, userImageAvailable }) => {
"/Users/" + "/Users/" +
userId + userId +
"/Images/Primary')", "/Images/Primary')",
// http://localhost/Users/{userId}/Images/{imageType}
}} }}
></div> ></div>
) : ( ) : (
+13 -1
View File
@@ -13,6 +13,8 @@
gap: 0.5em; gap: 0.5em;
margin-bottom: 0.5em; margin-bottom: 0.5em;
.card-image { .card-image {
position: absolute;
inset: 0;
&-container { &-container {
font-size: 5em; font-size: 5em;
} }
@@ -36,12 +38,22 @@
} }
.avatar-image { .avatar-image {
aspect-ratio: 1;
height: 100%;
position: absolute;
inset: 0;
background-size: cover;
background-position: center;
&-container { &-container {
width: fit-content; width: fit-content;
aspect-ratio: 1; aspect-ratio: 1;
position: relative;
border-radius: 100vh;
overflow: hidden;
} }
&-icon { &-icon {
border-radius: 100%; height: 100%;
padding: 0.2em; padding: 0.2em;
background: $clr-accent-dark; background: $clr-accent-dark;
color: $clr-accent-default; color: $clr-accent-default;
+13
View File
@@ -0,0 +1,13 @@
/** @format */
import SvgIcon from "@mui/material/SvgIcon";
import { mdiArrowLeft } from "@mdi/js";
export const MdiArrowLeft = () => {
return (
<SvgIcon>
<path d={mdiArrowLeft}></path>
</SvgIcon>
);
};
+13
View File
@@ -0,0 +1,13 @@
/** @format */
import SvgIcon from "@mui/material/SvgIcon";
import { mdiChevronRight } from "@mdi/js";
export const MdiChevronRight = () => {
return (
<SvgIcon>
<path d={mdiChevronRight}></path>
</SvgIcon>
);
};
+13
View File
@@ -0,0 +1,13 @@
/** @format */
import SvgIcon from "@mui/material/SvgIcon";
import { mdiEyeOffOutline } from "@mdi/js";
export const MdiEyeOffOutline = () => {
return (
<SvgIcon>
<path d={mdiEyeOffOutline}></path>
</SvgIcon>
);
};
+13
View File
@@ -0,0 +1,13 @@
/** @format */
import SvgIcon from "@mui/material/SvgIcon";
import { mdiEyeOutline } from "@mdi/js";
export const MdiEyeOutline = () => {
return (
<SvgIcon>
<path d={mdiEyeOutline}></path>
</SvgIcon>
);
};
+5
View File
@@ -0,0 +1,5 @@
/** @format */
export const SplashScreen = () => {
return <h1>I am loading...</h1>;
};
+20 -15
View File
@@ -7,9 +7,9 @@ import { EventEmitter as event } from "../../eventEmitter.js";
import { motion } from "framer-motion"; import { motion } from "framer-motion";
// import Icon from "mdi-material-ui"; // import Icon from "mdi-material-ui";
import EyeOffOutline from "mdi-material-ui/EyeOffOutline"; import { MdiEyeOffOutline } from "../../components/icons/mdiEyeOffOutline";
import EyeOutline from "mdi-material-ui/EyeOutline"; import { MdiEyeOutline } from "../../components/icons/mdiEyeOutline";
import ChevronRight from "mdi-material-ui/ChevronRight"; import { MdiChevronRight } from "../../components/icons/mdiChevronRight";
import Container from "@mui/material/Container"; import Container from "@mui/material/Container";
import Grid from "@mui/material/Grid"; import Grid from "@mui/material/Grid";
@@ -19,7 +19,6 @@ import FormControl from "@mui/material/FormControl";
import InputAdornment from "@mui/material/InputAdornment"; import InputAdornment from "@mui/material/InputAdornment";
import InputLabel from "@mui/material/InputLabel"; import InputLabel from "@mui/material/InputLabel";
import IconButton from "@mui/material/IconButton"; import IconButton from "@mui/material/IconButton";
import Avatar from "@mui/material/Avatar";
import LoadingButton from "@mui/lab/LoadingButton"; import LoadingButton from "@mui/lab/LoadingButton";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
import { useSnackbar } from "notistack"; import { useSnackbar } from "notistack";
@@ -101,7 +100,12 @@ export const LoginWithImage = () => {
<br /> <br />
</Typography> </Typography>
</Grid> </Grid>
<Grid item> <Grid
container
direction="column"
justifyContent="center"
alignItems="center"
>
<AvatarImage userId={userId} /> <AvatarImage userId={userId} />
<Typography <Typography
color="textPrimary" color="textPrimary"
@@ -136,9 +140,9 @@ export const LoginWithImage = () => {
aria-label="toggle password visibility" aria-label="toggle password visibility"
> >
{password.showpass ? ( {password.showpass ? (
<EyeOffOutline /> <MdiEyeOffOutline />
) : ( ) : (
<EyeOutline /> <MdiEyeOutline />
)} )}
</IconButton> </IconButton>
</InputAdornment> </InputAdornment>
@@ -149,7 +153,7 @@ export const LoginWithImage = () => {
<Grid item minWidth="100%"> <Grid item minWidth="100%">
<LoadingButton <LoadingButton
variant="contained" variant="contained"
endIcon={<ChevronRight />} endIcon={<MdiChevronRight />}
onClick={handleLogin} onClick={handleLogin}
loading={loading} loading={loading}
loadingPosition="end" loadingPosition="end"
@@ -188,8 +192,9 @@ export const UserLogin = () => {
useEffect(() => { useEffect(() => {
getUsers().then((users) => { getUsers().then((users) => {
setUsers(users.data); setUsers(users.data);
console.log(userList);
}); });
}); }, []);
return ( return (
<> <>
@@ -206,16 +211,16 @@ export const UserLogin = () => {
className="userCard" className="userCard"
index={index} index={index}
> >
{item.ImageTags == undefined ? ( {item.PrimaryImageTag ? (
<AvatarCard <AvatarCard
userName={item.Name} userName={item.Name}
userId={item.Id} userId={item.Id}
userImageAvailable={false} userImageAvailable={true}
></AvatarCard> ></AvatarCard>
) : ( ) : (
<AvatarCard <AvatarCard
userName={item.Name} userName={item.Name}
userImageAvailable={true} userImageAvailable={false}
></AvatarCard> ></AvatarCard>
)} )}
</Link> </Link>
@@ -360,9 +365,9 @@ export const UserLoginManual = () => {
aria-label="toggle password visibility" aria-label="toggle password visibility"
> >
{password.showpass ? ( {password.showpass ? (
<EyeOffOutline /> <MdiEyeOffOutline />
) : ( ) : (
<EyeOutline /> <MdiEyeOutline />
)} )}
</IconButton> </IconButton>
</InputAdornment> </InputAdornment>
@@ -373,7 +378,7 @@ export const UserLoginManual = () => {
<Grid item xl={5} md={6} sx={{ width: "100%" }}> <Grid item xl={5} md={6} sx={{ width: "100%" }}>
<LoadingButton <LoadingButton
variant="contained" variant="contained"
endIcon={<ChevronRight />} endIcon={<MdiChevronRight />}
onClick={handleLogin} onClick={handleLogin}
loading={loading} loading={loading}
loadingPosition="end" loadingPosition="end"
+24 -9
View File
@@ -12,11 +12,14 @@ import { getSystemApi } from "@jellyfin/sdk/lib/utils/api/system-api";
import TextField from "@mui/material/TextField"; import TextField from "@mui/material/TextField";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import Grid from "@mui/material/Grid"; import Grid from "@mui/material/Grid";
import ListItem from "@mui/material/ListItem"; import LoadingButton from "@mui/lab/LoadingButton";
import ListItemText from "@mui/material/ListItemText"; import SvgIcon from "@mui/material/SvgIcon";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
import LinearProgress from "@mui/material/LinearProgress"; import LinearProgress from "@mui/material/LinearProgress";
import Container from "@mui/material/Container"; import Container from "@mui/material/Container";
import { mdiChevronRight } from "@mdi/js";
import { useSnackbar } from "notistack"; import { useSnackbar } from "notistack";
// Svgs // Svgs
@@ -130,6 +133,8 @@ export const ServerSetup = (props) => {
const [currentServer, setCurrentServer] = useCookies(["currentServer"]); const [currentServer, setCurrentServer] = useCookies(["currentServer"]);
const cookies = new Cookies(); const cookies = new Cookies();
const [loading, setLoading] = useState(false);
const addServer = async () => { const addServer = async () => {
event.emit("create-jellyfin-api", serverIp); event.emit("create-jellyfin-api", serverIp);
let sysInfo = await getSystemApi(window.api).getPublicSystemInfo(); let sysInfo = await getSystemApi(window.api).getPublicSystemInfo();
@@ -156,8 +161,9 @@ export const ServerSetup = (props) => {
}; };
const handleAddServer = () => { const handleAddServer = () => {
setLoading(true);
let data; let data;
setServerCheckState(true); // setServerCheckState(true);
fetch(`${serverIp}/System/Ping`, { fetch(`${serverIp}/System/Ping`, {
body: JSON.stringify(data), body: JSON.stringify(data),
}) })
@@ -165,20 +171,23 @@ export const ServerSetup = (props) => {
.then((data) => { .then((data) => {
if (data == "Jellyfin Server") { if (data == "Jellyfin Server") {
console.log(true); console.log(true);
setServerCheckState(false); // setServerCheckState(false);
addServer(); addServer();
setLoading(false);
return true; return true;
} else { } else {
setServerCheckState(false); // setServerCheckState(false);
enqueueSnackbar( enqueueSnackbar(
"The server address does not seem be a jellyfin server", "The server address does not seem be a jellyfin server",
{ variant: "error" }, { variant: "error" },
); );
setLoading(false);
return false; return false;
} }
}) })
.catch((error) => { .catch((error) => {
setServerCheckState(false); // setServerCheckState(false);
setLoading(false);
enqueueSnackbar( enqueueSnackbar(
"Unable to verify whether the give address is a valid Jellyfin server", "Unable to verify whether the give address is a valid Jellyfin server",
{ variant: "error" }, { variant: "error" },
@@ -189,7 +198,6 @@ export const ServerSetup = (props) => {
return ( return (
<> <>
{checkingServer && <LinearProgress />}
{isJfServer && <Navigate to="/login" />} {isJfServer && <Navigate to="/login" />}
<Container <Container
maxWidth="md" maxWidth="md"
@@ -222,14 +230,21 @@ export const ServerSetup = (props) => {
></TextField> ></TextField>
</Grid> </Grid>
<Grid item xl={5} md={6} sx={{ width: "100%" }}> <Grid item xl={5} md={6} sx={{ width: "100%" }}>
<Button <LoadingButton
variant="contained" variant="contained"
sx={{ width: "100%" }} sx={{ width: "100%" }}
size="large" size="large"
loading={loading}
endIcon={
<SvgIcon>
<path d={mdiChevronRight}></path>
</SvgIcon>
}
loadingPosition="end"
onClick={handleAddServer} onClick={handleAddServer}
> >
Add Server Add Server
</Button> </LoadingButton>
</Grid> </Grid>
</Grid> </Grid>
</Container> </Container>