diff --git a/Website/src/components/AntiFeatureListItem.tsx b/Website/src/components/AntiFeatureListItem.tsx index b48885a3..b6f7da8e 100644 --- a/Website/src/components/AntiFeatureListItem.tsx +++ b/Website/src/components/AntiFeatureListItem.tsx @@ -1,26 +1,21 @@ import { useStrings } from "@Hooks/useStrings"; -import Avatar from "@mui/material/Avatar"; -import Card from "@mui/material/Card"; -import CardContent from "@mui/material/CardContent"; import ListItem from "@mui/material/ListItem"; -import ListItemAvatar from "@mui/material/ListItemAvatar"; -import ListItemText from "@mui/material/ListItemText"; -import Stack from "@mui/material/Stack"; -import Typography from "@mui/material/Typography"; -import ImageIcon from "@mui/icons-material/Image"; +import { en_antifeatures } from "./../locales/antifeatures/en"; import React from "react"; +import { ListItemText } from "@mui/material"; interface AntiFeatureListItemProps { type: string; } const AntiFeatureListItem = (props: AntiFeatureListItemProps) => { - const { strings } = useStrings(); + const find = React.useMemo(() => en_antifeatures.find((anti) => anti.id === props.type), []); + + if (!find) return null; return ( - {/* @ts-ignore */} - + ); }; diff --git a/Website/src/components/AntifeaturesButton.tsx b/Website/src/components/AntifeaturesButton.tsx new file mode 100644 index 00000000..66f4c5a6 --- /dev/null +++ b/Website/src/components/AntifeaturesButton.tsx @@ -0,0 +1,48 @@ +import { Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, List, SxProps } from "@mui/material"; +import Button from "@mui/material/Button"; +import WarningAmberIcon from "@mui/icons-material/WarningAmber"; +import React from "react"; +import { useStrings } from "@Hooks/useStrings"; +import AntiFeatureListItem from "./AntiFeatureListItem"; + +type Props = { + sx?: SxProps; + antifeatures?: Track["antifeatures"]; +}; + +export const AntifeatureButton = (props: Props) => { + const [open, setOpen] = React.useState(false); + + const { strings } = useStrings(); + + const handleClickOpen = () => { + setOpen(true); + }; + + const handleClose = () => { + setOpen(false); + }; + + return ( + <> + + + {strings("antifeatures")} + + + {typeof props.antifeatures === "string" ? ( + + ) : ( + Array.isArray(props.antifeatures) && props.antifeatures.map((anti) => ) + )} + + + + + + + + ); +}; diff --git a/Website/src/components/module/DeviceModule.tsx b/Website/src/components/module/DeviceModule.tsx index 7d086ec3..78d88ee2 100644 --- a/Website/src/components/module/DeviceModule.tsx +++ b/Website/src/components/module/DeviceModule.tsx @@ -23,6 +23,8 @@ import { SuFile } from "@Native/SuFile"; import { useConfirm } from "material-ui-confirm"; import Switch from "@mui/material/Switch"; import { Image } from "@Components/dapi/Image"; +import { blacklistedModules } from "@Util/blacklisted-modules"; +import { AntifeatureButton } from "@Components/AntifeaturesButton"; interface Props { module: Module; @@ -59,6 +61,10 @@ const DeviceModule = React.memo((props) => { const boot_complete = SuFile.exist(format("BOOTCOMP")); const module_config_file = SuFile.exist(format("CONFINDEX")); + const findHardCodedAntifeature = React.useMemo(() => { + return blacklistedModules[id]?.antifeatures || []; + }, [id]); + return ( @@ -167,6 +173,11 @@ const DeviceModule = React.memo((props) => { + {findHardCodedAntifeature && findHardCodedAntifeature.length !== 0 && ( + + + + )}