Refactor SystemVersionComponent to remove unused imports and update styling
parent
97b22c7047
commit
5f234938b8
|
@ -1,5 +1,4 @@
|
||||||
import React, { useMemo, useEffect, useState } from "react";
|
import React, { useMemo } from "react";
|
||||||
import PropTypes from "prop-types";
|
|
||||||
import { List, ListItem, ListItemText, ListItemAvatar, Theme } from "@mui/material";
|
import { List, ListItem, ListItemText, ListItemAvatar, Theme } from "@mui/material";
|
||||||
import Avatar from "@mui/material/Avatar";
|
import Avatar from "@mui/material/Avatar";
|
||||||
import WebAssetIcon from "@mui/icons-material/WebAsset";
|
import WebAssetIcon from "@mui/icons-material/WebAsset";
|
||||||
|
@ -37,25 +36,6 @@ const SystemVersionComponent: React.FC<Props> = ({ data }) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const styles = useMemo(() => getStyles(theme), [theme]);
|
const styles = useMemo(() => getStyles(theme), [theme]);
|
||||||
const [listClass, setListClass] = useState(styles.horizontally);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const mediaQuery = window.matchMedia("(max-width: 800px)");
|
|
||||||
|
|
||||||
const handleMatches = (event: MediaQueryListEvent) => {
|
|
||||||
const cssClass: any = event.matches ? styles.vertical : styles.horizontally;
|
|
||||||
setListClass(cssClass);
|
|
||||||
};
|
|
||||||
|
|
||||||
mediaQuery.addEventListener("change", handleMatches);
|
|
||||||
|
|
||||||
// Initial check
|
|
||||||
handleMatches(mediaQuery as unknown as MediaQueryListEvent);
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
mediaQuery.removeEventListener("change", handleMatches);
|
|
||||||
};
|
|
||||||
}, [styles.horizontally, styles.vertical]);
|
|
||||||
|
|
||||||
const lastReleaseDate = useMemo(() => {
|
const lastReleaseDate = useMemo(() => {
|
||||||
const format = "DD-MM-YYYY HH:mm:ss";
|
const format = "DD-MM-YYYY HH:mm:ss";
|
||||||
|
@ -85,7 +65,14 @@ const SystemVersionComponent: React.FC<Props> = ({ data }) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Paper variant="outlined">
|
<Paper variant="outlined">
|
||||||
<List sx={listClass}>
|
<List
|
||||||
|
sx={{
|
||||||
|
display: { xs: "block", md: "flex" },
|
||||||
|
flexDirection: { md: "row" },
|
||||||
|
padding: 0,
|
||||||
|
width: "100%"
|
||||||
|
}}
|
||||||
|
>
|
||||||
<ListItem>
|
<ListItem>
|
||||||
<ListItemAvatar>
|
<ListItemAvatar>
|
||||||
<Avatar sx={styles.versionAvatar}>
|
<Avatar sx={styles.versionAvatar}>
|
||||||
|
|
Loading…
Reference in New Issue