From cea8d1668d06a3e55cbec334fd83f78a4460ea03 Mon Sep 17 00:00:00 2001 From: Der_Googler <54764558+DerGoogler@users.noreply.github.com> Date: Sun, 29 Oct 2023 00:12:11 +0200 Subject: [PATCH] Hover more low quality modules --- Website/src/activitys/ModuleViewActivity.tsx | 12 +++++++++++- Website/src/components/DeviceModule.tsx | 18 ++++++++++++++++-- Website/src/components/ExploreModule.tsx | 12 ++++++------ Website/src/locales/de.ts | 6 +++++- Website/src/locales/en.ts | 6 +++++- 5 files changed, 43 insertions(+), 11 deletions(-) diff --git a/Website/src/activitys/ModuleViewActivity.tsx b/Website/src/activitys/ModuleViewActivity.tsx index d5aa43bb..f8257865 100644 --- a/Website/src/activitys/ModuleViewActivity.tsx +++ b/Website/src/activitys/ModuleViewActivity.tsx @@ -49,6 +49,7 @@ import PicturePreviewActivity from "./PicturePreviewActivity"; import GitHubIcon from "@mui/icons-material/GitHub"; import TerminalIcon from "@mui/icons-material/Terminal"; import { isLiteralObject } from "@Util/util"; +import { useLowQualityModule } from "@Hooks/useLowQualityModule"; function a11yProps(index: number) { return { @@ -93,6 +94,8 @@ const ModuleViewActivity = () => { const search = React.useMemo(() => new URLSearchParams(window.location.search), [window.location.search]); + const isLowQuality = useLowQualityModule(extra, !settings._low_quality_module); + React.useEffect(() => { search.set("module", id); const newRelativePathQuery = window.location.pathname + "?" + search.toString(); @@ -347,6 +350,13 @@ const ModuleViewActivity = () => { )} + {isLowQuality && ( + + {strings("low_quality_module")} + {strings("low_quality_module_warn")} + + )} + {mmrl.screenshots && ( @@ -436,7 +446,7 @@ const ModuleViewActivity = () => { - {isLiteralObject(description) ? String((description as ModuleDescription)[currentLanguage]) : String(description)} + {isLiteralObject(description) ? String((description as ModuleDescription)[currentLanguage]) : String(description)} {strings("updated_on")} diff --git a/Website/src/components/DeviceModule.tsx b/Website/src/components/DeviceModule.tsx index b01ef6c5..e146846e 100644 --- a/Website/src/components/DeviceModule.tsx +++ b/Website/src/components/DeviceModule.tsx @@ -3,7 +3,7 @@ import { DeleteRounded, RefreshRounded } from "@mui/icons-material"; import React from "react"; import { useStrings } from "@Hooks/useStrings"; import { Android12Switch } from "./Android12Switch"; -import { Box, Button, Card, Divider, Stack, SxProps, Theme, Typography } from "@mui/material"; +import { Alert, AlertTitle, Box, Button, Card, Divider, Stack, SxProps, Theme, Typography } from "@mui/material"; import SettingsIcon from "@mui/icons-material/Settings"; import { useActivity } from "@Hooks/useActivity"; import { ConfigureActivity } from "@Activitys/ConfigureActivity"; @@ -15,6 +15,7 @@ import { useTheme } from "@Hooks/useTheme"; import TerminalActivity from "@Activitys/TerminalActivity"; import { useRepos } from "@Hooks/useRepos"; import { ModConf, useModConf } from "@Hooks/useModConf"; +import { useLowQualityModule } from "@Hooks/useLowQualityModule"; export const badgeStyle: (color: (typeof colors)["blue" | "teal" | "red" | "orange"]) => SxProps = (color) => { return { @@ -66,6 +67,10 @@ const DeviceModule = React.memo((props) => { const findOnlineModule = React.useMemo(() => modules.find((module) => module.id === id), [modules]) as Module; + const hasUpdate = React.useMemo(() => findOnlineModule && versionCode < findOnlineModule.versionCode, [findOnlineModule]); + + const isLowQuality = useLowQualityModule(props.module, !settings._low_quality_module); + return ( <> ((props) => { )} - {findOnlineModule && versionCode < findOnlineModule.versionCode && ( + {isLowQuality && ( + + {strings("low_quality_module")} + {strings("low_quality_module_warn")} + + )} + {hasUpdate && (