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

+20 -15
View File
@@ -7,9 +7,9 @@ import { EventEmitter as event } from "../../eventEmitter.js";
import { motion } from "framer-motion";
// import Icon from "mdi-material-ui";
import EyeOffOutline from "mdi-material-ui/EyeOffOutline";
import EyeOutline from "mdi-material-ui/EyeOutline";
import ChevronRight from "mdi-material-ui/ChevronRight";
import { MdiEyeOffOutline } from "../../components/icons/mdiEyeOffOutline";
import { MdiEyeOutline } from "../../components/icons/mdiEyeOutline";
import { MdiChevronRight } from "../../components/icons/mdiChevronRight";
import Container from "@mui/material/Container";
import Grid from "@mui/material/Grid";
@@ -19,7 +19,6 @@ import FormControl from "@mui/material/FormControl";
import InputAdornment from "@mui/material/InputAdornment";
import InputLabel from "@mui/material/InputLabel";
import IconButton from "@mui/material/IconButton";
import Avatar from "@mui/material/Avatar";
import LoadingButton from "@mui/lab/LoadingButton";
import Button from "@mui/material/Button";
import { useSnackbar } from "notistack";
@@ -101,7 +100,12 @@ export const LoginWithImage = () => {
<br />
</Typography>
</Grid>
<Grid item>
<Grid
container
direction="column"
justifyContent="center"
alignItems="center"
>
<AvatarImage userId={userId} />
<Typography
color="textPrimary"
@@ -136,9 +140,9 @@ export const LoginWithImage = () => {
aria-label="toggle password visibility"
>
{password.showpass ? (
<EyeOffOutline />
<MdiEyeOffOutline />
) : (
<EyeOutline />
<MdiEyeOutline />
)}
</IconButton>
</InputAdornment>
@@ -149,7 +153,7 @@ export const LoginWithImage = () => {
<Grid item minWidth="100%">
<LoadingButton
variant="contained"
endIcon={<ChevronRight />}
endIcon={<MdiChevronRight />}
onClick={handleLogin}
loading={loading}
loadingPosition="end"
@@ -188,8 +192,9 @@ export const UserLogin = () => {
useEffect(() => {
getUsers().then((users) => {
setUsers(users.data);
console.log(userList);
});
});
}, []);
return (
<>
@@ -206,16 +211,16 @@ export const UserLogin = () => {
className="userCard"
index={index}
>
{item.ImageTags == undefined ? (
{item.PrimaryImageTag ? (
<AvatarCard
userName={item.Name}
userId={item.Id}
userImageAvailable={false}
userImageAvailable={true}
></AvatarCard>
) : (
<AvatarCard
userName={item.Name}
userImageAvailable={true}
userImageAvailable={false}
></AvatarCard>
)}
</Link>
@@ -360,9 +365,9 @@ export const UserLoginManual = () => {
aria-label="toggle password visibility"
>
{password.showpass ? (
<EyeOffOutline />
<MdiEyeOffOutline />
) : (
<EyeOutline />
<MdiEyeOutline />
)}
</IconButton>
</InputAdornment>
@@ -373,7 +378,7 @@ export const UserLoginManual = () => {
<Grid item xl={5} md={6} sx={{ width: "100%" }}>
<LoadingButton
variant="contained"
endIcon={<ChevronRight />}
endIcon={<MdiChevronRight />}
onClick={handleLogin}
loading={loading}
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 Typography from "@mui/material/Typography";
import Grid from "@mui/material/Grid";
import ListItem from "@mui/material/ListItem";
import ListItemText from "@mui/material/ListItemText";
import LoadingButton from "@mui/lab/LoadingButton";
import SvgIcon from "@mui/material/SvgIcon";
import Button from "@mui/material/Button";
import LinearProgress from "@mui/material/LinearProgress";
import Container from "@mui/material/Container";
import { mdiChevronRight } from "@mdi/js";
import { useSnackbar } from "notistack";
// Svgs
@@ -130,6 +133,8 @@ export const ServerSetup = (props) => {
const [currentServer, setCurrentServer] = useCookies(["currentServer"]);
const cookies = new Cookies();
const [loading, setLoading] = useState(false);
const addServer = async () => {
event.emit("create-jellyfin-api", serverIp);
let sysInfo = await getSystemApi(window.api).getPublicSystemInfo();
@@ -156,8 +161,9 @@ export const ServerSetup = (props) => {
};
const handleAddServer = () => {
setLoading(true);
let data;
setServerCheckState(true);
// setServerCheckState(true);
fetch(`${serverIp}/System/Ping`, {
body: JSON.stringify(data),
})
@@ -165,20 +171,23 @@ export const ServerSetup = (props) => {
.then((data) => {
if (data == "Jellyfin Server") {
console.log(true);
setServerCheckState(false);
// setServerCheckState(false);
addServer();
setLoading(false);
return true;
} else {
setServerCheckState(false);
// setServerCheckState(false);
enqueueSnackbar(
"The server address does not seem be a jellyfin server",
{ variant: "error" },
);
setLoading(false);
return false;
}
})
.catch((error) => {
setServerCheckState(false);
// setServerCheckState(false);
setLoading(false);
enqueueSnackbar(
"Unable to verify whether the give address is a valid Jellyfin server",
{ variant: "error" },
@@ -189,7 +198,6 @@ export const ServerSetup = (props) => {
return (
<>
{checkingServer && <LinearProgress />}
{isJfServer && <Navigate to="/login" />}
<Container
maxWidth="md"
@@ -222,14 +230,21 @@ export const ServerSetup = (props) => {
></TextField>
</Grid>
<Grid item xl={5} md={6} sx={{ width: "100%" }}>
<Button
<LoadingButton
variant="contained"
sx={{ width: "100%" }}
size="large"
loading={loading}
endIcon={
<SvgIcon>
<path d={mdiChevronRight}></path>
</SvgIcon>
}
loadingPosition="end"
onClick={handleAddServer}
>
Add Server
</Button>
</LoadingButton>
</Grid>
</Grid>
</Container>