mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-07-11 23:51:58 +00:00
fix(motd): run prettier
This commit is contained in:
@@ -1,36 +1,37 @@
|
|||||||
import {useEffect, useMemo, useState} from 'react'
|
|
||||||
import { getMotd, Motd } from '../store';
|
|
||||||
import { useSetting } from '../utils/hooks/useSetting';
|
|
||||||
import { DialogButton, Focusable, PanelSection } from '@decky/ui';
|
import { DialogButton, Focusable, PanelSection } from '@decky/ui';
|
||||||
|
import { useEffect, useMemo, useState } from 'react';
|
||||||
import { FaTimes } from 'react-icons/fa';
|
import { FaTimes } from 'react-icons/fa';
|
||||||
|
|
||||||
|
import { Motd, getMotd } from '../store';
|
||||||
|
import { useSetting } from '../utils/hooks/useSetting';
|
||||||
|
|
||||||
const SEVERITIES = {
|
const SEVERITIES = {
|
||||||
High: {
|
High: {
|
||||||
color: "#bb1414",
|
color: '#bb1414',
|
||||||
text: "#fff",
|
text: '#fff',
|
||||||
},
|
},
|
||||||
Medium: {
|
Medium: {
|
||||||
color: "#bbbb14",
|
color: '#bbbb14',
|
||||||
text: "#fff",
|
text: '#fff',
|
||||||
},
|
},
|
||||||
Low: {
|
Low: {
|
||||||
color: "#1488bb",
|
color: '#1488bb',
|
||||||
text: "#fff",
|
text: '#fff',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const welcomeMotd: Motd = {
|
const welcomeMotd: Motd = {
|
||||||
id: "welcomeMotd",
|
id: 'welcomeMotd',
|
||||||
name: "Welcome to Decky!",
|
name: 'Welcome to Decky!',
|
||||||
date: Date.now().toString(),
|
date: Date.now().toString(),
|
||||||
description: "We hope you enjoy using Decky! If you have any questions or feedback, please let us know.",
|
description: 'We hope you enjoy using Decky! If you have any questions or feedback, please let us know.',
|
||||||
severity: "Low",
|
severity: 'Low',
|
||||||
}
|
};
|
||||||
|
|
||||||
export function MotdDisplay() {
|
export function MotdDisplay() {
|
||||||
const [motd, setMotd] = useState<Motd | null>(null);
|
const [motd, setMotd] = useState<Motd | null>(null);
|
||||||
// showWelcome will display a welcome motd, the welcome motd has an id of "welcome" and once that is saved to hiddenMotdId, it will not show again
|
// showWelcome will display a welcome motd, the welcome motd has an id of "welcome" and once that is saved to hiddenMotdId, it will not show again
|
||||||
const [hiddenMotdId, setHiddenMotdId] = useSetting("hiddenMotdId", "showWelcome")
|
const [hiddenMotdId, setHiddenMotdId] = useSetting('hiddenMotdId', 'showWelcome');
|
||||||
|
|
||||||
async function fetchMotd() {
|
async function fetchMotd() {
|
||||||
const motd = await getMotd();
|
const motd = await getMotd();
|
||||||
@@ -39,13 +40,13 @@ export function MotdDisplay() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
void fetchMotd();
|
void fetchMotd();
|
||||||
}, [])
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (hiddenMotdId === 'showWelcome') {
|
if (hiddenMotdId === 'showWelcome') {
|
||||||
setMotd(welcomeMotd);
|
setMotd(welcomeMotd);
|
||||||
}
|
}
|
||||||
}, [hiddenMotdId])
|
}, [hiddenMotdId]);
|
||||||
|
|
||||||
function hideMotd() {
|
function hideMotd() {
|
||||||
if (motd) {
|
if (motd) {
|
||||||
@@ -62,7 +63,7 @@ export function MotdDisplay() {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const severity = SEVERITIES[motd?.severity || "Low"];
|
const severity = SEVERITIES[motd?.severity || 'Low'];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PanelSection>
|
<PanelSection>
|
||||||
@@ -72,41 +73,40 @@ export function MotdDisplay() {
|
|||||||
backgroundColor: `${severity.color}33`,
|
backgroundColor: `${severity.color}33`,
|
||||||
color: severity.text,
|
color: severity.text,
|
||||||
borderColor: severity.color,
|
borderColor: severity.color,
|
||||||
borderWidth: "2px",
|
borderWidth: '2px',
|
||||||
borderStyle: "solid",
|
borderStyle: 'solid',
|
||||||
padding: "0.7rem",
|
padding: '0.7rem',
|
||||||
display: "flex",
|
display: 'flex',
|
||||||
flexDirection: "column",
|
flexDirection: 'column',
|
||||||
position: "relative",
|
position: 'relative',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div style={{ display: "flex", justifyContent: "space-between" }}>
|
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||||
<span style={{ fontWeight: "bold" }}>{motd?.name}</span>
|
<span style={{ fontWeight: 'bold' }}>{motd?.name}</span>
|
||||||
<DialogButton
|
<DialogButton
|
||||||
style={{
|
style={{
|
||||||
width: "1rem",
|
width: '1rem',
|
||||||
minWidth: "1rem",
|
minWidth: '1rem',
|
||||||
height: "1rem",
|
height: '1rem',
|
||||||
padding: "0",
|
padding: '0',
|
||||||
display: "flex",
|
display: 'flex',
|
||||||
alignItems: "center",
|
alignItems: 'center',
|
||||||
justifyContent: "center",
|
justifyContent: 'center',
|
||||||
position: "absolute",
|
position: 'absolute',
|
||||||
top: ".75rem",
|
top: '.75rem',
|
||||||
right: ".75rem",
|
right: '.75rem',
|
||||||
}}
|
}}
|
||||||
onClick={hideMotd}
|
onClick={hideMotd}
|
||||||
>
|
>
|
||||||
<FaTimes
|
<FaTimes
|
||||||
style={{
|
style={{
|
||||||
height: ".75rem",
|
height: '.75rem',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</DialogButton>
|
</DialogButton>
|
||||||
</div>
|
</div>
|
||||||
<span style={{ fontSize: "0.75rem", whiteSpace: "pre-line" }}>{motd?.description}</span>
|
<span style={{ fontSize: '0.75rem', whiteSpace: 'pre-line' }}>{motd?.description}</span>
|
||||||
</Focusable>
|
</Focusable>
|
||||||
</PanelSection>
|
</PanelSection>
|
||||||
)
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -4,10 +4,10 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { FaEyeSlash } from 'react-icons/fa';
|
import { FaEyeSlash } from 'react-icons/fa';
|
||||||
|
|
||||||
import { useDeckyState } from './DeckyState';
|
import { useDeckyState } from './DeckyState';
|
||||||
|
import { MotdDisplay } from './MotdDisplay';
|
||||||
import NotificationBadge from './NotificationBadge';
|
import NotificationBadge from './NotificationBadge';
|
||||||
import { useQuickAccessVisible } from './QuickAccessVisibleState';
|
import { useQuickAccessVisible } from './QuickAccessVisibleState';
|
||||||
import TitleView from './TitleView';
|
import TitleView from './TitleView';
|
||||||
import { MotdDisplay } from './MotdDisplay';
|
|
||||||
|
|
||||||
const PluginView: FC = () => {
|
const PluginView: FC = () => {
|
||||||
const { plugins, hiddenPlugins, updates, activePlugin, pluginOrder, setActivePlugin, closeActivePlugin } =
|
const { plugins, hiddenPlugins, updates, activePlugin, pluginOrder, setActivePlugin, closeActivePlugin } =
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export interface Motd {
|
|||||||
name: string;
|
name: string;
|
||||||
description: string;
|
description: string;
|
||||||
date: string;
|
date: string;
|
||||||
severity: "High" | "Medium" | "Low";
|
severity: 'High' | 'Medium' | 'Low';
|
||||||
}
|
}
|
||||||
|
|
||||||
// name: version
|
// name: version
|
||||||
|
|||||||
Reference in New Issue
Block a user