diff --git a/ui/public/locales/en.json b/ui/public/locales/en.json deleted file mode 100644 index 9e26dfee..00000000 --- a/ui/public/locales/en.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/ui/public/locales/zh.json b/ui/public/locales/zh.json deleted file mode 100644 index 9e26dfee..00000000 --- a/ui/public/locales/zh.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/ui/src/components/ActionBar.tsx b/ui/src/components/ActionBar.tsx index 23ad49b4..1f232f52 100644 --- a/ui/src/components/ActionBar.tsx +++ b/ui/src/components/ActionBar.tsx @@ -18,7 +18,7 @@ import { cx } from "@/cva.config"; import PasteModal from "@/components/popovers/PasteModal"; import WakeOnLanModal from "@/components/popovers/WakeOnLan/Index"; import MountPopopover from "@/components/popovers/MountPopover"; -import {ExtensionPopover} from "@/components/popovers/ExtensionPopover"; +import { ExtensionPopover } from "@/components/popovers/ExtensionPopover"; import { useDeviceUiNavigation } from "@/hooks/useAppNavigation"; export default function Actionbar({ diff --git a/ui/src/components/ConfirmDialog.tsx b/ui/src/components/ConfirmDialog.tsx index ee05ba48..6ab43883 100644 --- a/ui/src/components/ConfirmDialog.tsx +++ b/ui/src/components/ConfirmDialog.tsx @@ -1,5 +1,4 @@ import { useTranslation } from "react-i18next"; - import { CheckCircleIcon, ExclamationTriangleIcon, @@ -58,15 +57,15 @@ const variantConfig = { buttonTheme: "danger" | "primary" | "blank" | "light" | "lightDanger"; } >; -// @ts-ignore + export function ConfirmDialog({ open, onClose, title, description, variant = "info", - confirmText = useTranslation('Confirm').toString(), - cancelText = useTranslation('Cancel').toString(), + confirmText = 'Confirm', + cancelText = 'Cancel', onConfirm, isConfirming = false, }: ConfirmDialogProps) { diff --git a/ui/src/components/Header.tsx b/ui/src/components/Header.tsx index aabf56e1..f66788e2 100644 --- a/ui/src/components/Header.tsx +++ b/ui/src/components/Header.tsx @@ -27,7 +27,7 @@ interface NavbarProps { kvmName?: string; } -export default function DashboardNavbar({ +export default function DashboardNavbar({ primaryLinks = [], isLoggedIn, showConnectionStatus, diff --git a/ui/src/components/InfoBar.tsx b/ui/src/components/InfoBar.tsx index a6c86f62..ecac9164 100644 --- a/ui/src/components/InfoBar.tsx +++ b/ui/src/components/InfoBar.tsx @@ -96,19 +96,19 @@ export default function InfoBar() { {debugMode && (
{t('USB_State')}: - {t(usbState.replace(' ','_').toString())} + {t(usbState)}
)} {debugMode && (
{t('HDMI_State')}: - {t(hdmiState.toString())} + {t(hdmiState)}
)} {debugMode && (
{t('HidRPC_State')}: - {t(rpcHidStatus.toString().replace(' ','_'))} + {t(rpcHidStatus)}
)} {isPasteInProgress && ( diff --git a/ui/src/components/PeerConnectionStatusCard.tsx b/ui/src/components/PeerConnectionStatusCard.tsx index 83c184ef..d5a7d372 100644 --- a/ui/src/components/PeerConnectionStatusCard.tsx +++ b/ui/src/components/PeerConnectionStatusCard.tsx @@ -1,13 +1,15 @@ -import StatusCard from "@components/StatusCards"; import {useTranslation} from "react-i18next"; +import StatusCard from "@components/StatusCards"; + + const PeerConnectionStatusMap = { connected: "Connected", connecting: "Connecting", disconnected: "Disconnected", - error: "Connection error", + error: "Connection_error", closing: "Closing", - failed: "Connection failed", + failed: "Connection_failed", closed: "Closed", new: "Connecting", } as Record; @@ -28,7 +30,8 @@ export default function PeerConnectionStatusCard({ state?: RTCPeerConnectionState | null; title?: string; }) { - if (!state) return <>; + if (!state) return; + // eslint-disable-next-line react-hooks/rules-of-hooks const { t } = useTranslation(); const StatusCardProps: StatusProps = { connected: { @@ -57,7 +60,7 @@ export default function PeerConnectionStatusCard({ }, }; const props = StatusCardProps[state]; - if (!props) return (
); + if (!props) return; return ( ( ), @@ -61,7 +61,7 @@ export default function USBStateStatus({ configured: t('Connected'), attached: t('Connecting'), addressed: t('Connecting'), - "not attached": t('Disconnected'), + "not_attached": t('Disconnected'), suspended: t('Low_power_mode'), }; const props = StatusCardProps[state]; @@ -76,7 +76,7 @@ export default function USBStateStatus({ icon: Icon, iconClassName, statusIndicatorClassName, - } = StatusCardProps["not attached"]; + } = StatusCardProps["not_attached"]; return ( {usbConfigProduct === "custom" && ( diff --git a/ui/src/hooks/stores.ts b/ui/src/hooks/stores.ts index bfbbb26e..94d05e35 100644 --- a/ui/src/hooks/stores.ts +++ b/ui/src/hooks/stores.ts @@ -468,7 +468,7 @@ export interface KeysDownState { export type USBStates = | "configured" | "attached" - | "not attached" + | "not_attached" | "suspended" | "addressed"; @@ -503,7 +503,7 @@ export const useHidStore = create(set => ({ setPasteModeEnabled: (enabled: boolean): void => set({ isPasteInProgress: enabled }), // Add these new properties for USB state - usbState: "not attached", + usbState: "not_attached", setUsbState: (state: USBStates) => set({ usbState: state }), })); diff --git a/ui/src/routes/devices.$id.settings.general.reboot.tsx b/ui/src/routes/devices.$id.settings.general.reboot.tsx index d59c2ab0..05a92602 100644 --- a/ui/src/routes/devices.$id.settings.general.reboot.tsx +++ b/ui/src/routes/devices.$id.settings.general.reboot.tsx @@ -52,7 +52,7 @@ function ConfirmationBox({

- {t('重启JetKVM')} + {t('Reboot_JetKVM')}

{t('Do_you_want_to_proceed_with_rebooting_the_system')} diff --git a/ui/src/routes/devices.$id.settings.video.tsx b/ui/src/routes/devices.$id.settings.video.tsx index 8a6644e0..cd01a3ae 100644 --- a/ui/src/routes/devices.$id.settings.video.tsx +++ b/ui/src/routes/devices.$id.settings.video.tsx @@ -12,41 +12,6 @@ import notifications from "@/notifications"; import { SettingsItem } from "./devices.$id.settings"; -const defaultEdid = - "00ffffffffffff0052620188008888881c150103800000780a0dc9a05747982712484c00000001010101010101010101010101010101023a801871382d40582c4500c48e2100001e011d007251d01e206e285500c48e2100001e000000fc00543734392d6648443732300a20000000fd00147801ff1d000a202020202020017b"; -const edids = [ - { - value: defaultEdid, - label: "JetKVM Default", - }, - { - value: - "00FFFFFFFFFFFF00047265058A3F6101101E0104A53420783FC125A8554EA0260D5054BFEF80714F8140818081C081008B009500B300283C80A070B023403020360006442100001A000000FD00304C575716010A202020202020000000FC0042323436574C0A202020202020000000FF0054384E4545303033383532320A01F802031CF14F90020304050607011112131415161F2309070783010000011D8018711C1620582C250006442100009E011D007251D01E206E28550006442100001E8C0AD08A20E02D10103E9600064421000018C344806E70B028401720A80406442100001E00000000000000000000000000000000000000000000000000000096", - label: "Acer B246WL, 1920x1200", - }, - { - value: - "00FFFFFFFFFFFF0006B3872401010101021F010380342078EA6DB5A7564EA0250D5054BF6F00714F8180814081C0A9409500B300D1C0283C80A070B023403020360006442100001A000000FD00314B1E5F19000A202020202020000000FC00504132343851560A2020202020000000FF004D314C4D51533035323135370A014D02032AF14B900504030201111213141F230907078301000065030C001000681A00000101314BE6E2006A023A801871382D40582C450006442100001ECD5F80B072B0374088D0360006442100001C011D007251D01E206E28550006442100001E8C0AD08A20E02D10103E960006442100001800000000000000000000000000DC", - label: "ASUS PA248QV, 1920x1200", - }, - { - value: - "00FFFFFFFFFFFF0010AC132045393639201E0103803C22782ACD25A3574B9F270D5054A54B00714F8180A9C0D1C00101010101010101023A801871382D40582C450056502100001E000000FF00335335475132330A2020202020000000FC0044454C4C204432373231480A20000000FD00384C1E5311000A202020202020018102031AB14F90050403020716010611121513141F65030C001000023A801871382D40582C450056502100001E011D8018711C1620582C250056502100009E011D007251D01E206E28550056502100001E8C0AD08A20E02D10103E960056502100001800000000000000000000000000000000000000000000000000000000004F", - label: "DELL D2721H, 1920x1080", - }, - { - value: - "00ffffffffffff0010ac0100020000000111010380221bff0a00000000000000000000adce0781800101010101010101010101010101000000ff0030303030303030303030303030000000ff0030303030303030303030303030000000fd00384c1f530b000a000000000000000000fc0044454c4c2049445241430a2020000a", - label: "DELL IDRAC EDID, 1280x1024", - }, -]; - -const streamQualityOptions = [ - { value: "1", label: "High" }, - { value: "0.5", label: "Medium" }, - { value: "0.1", label: "Low" }, -]; - export default function SettingsVideoRoute() { const { send } = useJsonRpc(); const { t } = useTranslation(); @@ -55,6 +20,40 @@ export default function SettingsVideoRoute() { const [edid, setEdid] = useState(null); const [edidLoading, setEdidLoading] = useState(false); + const defaultEdid = + "00ffffffffffff0052620188008888881c150103800000780a0dc9a05747982712484c00000001010101010101010101010101010101023a801871382d40582c4500c48e2100001e011d007251d01e206e285500c48e2100001e000000fc00543734392d6648443732300a20000000fd00147801ff1d000a202020202020017b"; + const edids = [ + { + value: defaultEdid, + label: t('JetKVM_Default'), + }, + { + value: + "00FFFFFFFFFFFF00047265058A3F6101101E0104A53420783FC125A8554EA0260D5054BFEF80714F8140818081C081008B009500B300283C80A070B023403020360006442100001A000000FD00304C575716010A202020202020000000FC0042323436574C0A202020202020000000FF0054384E4545303033383532320A01F802031CF14F90020304050607011112131415161F2309070783010000011D8018711C1620582C250006442100009E011D007251D01E206E28550006442100001E8C0AD08A20E02D10103E9600064421000018C344806E70B028401720A80406442100001E00000000000000000000000000000000000000000000000000000096", + label: "Acer B246WL, 1920x1200", + }, + { + value: + "00FFFFFFFFFFFF0006B3872401010101021F010380342078EA6DB5A7564EA0250D5054BF6F00714F8180814081C0A9409500B300D1C0283C80A070B023403020360006442100001A000000FD00314B1E5F19000A202020202020000000FC00504132343851560A2020202020000000FF004D314C4D51533035323135370A014D02032AF14B900504030201111213141F230907078301000065030C001000681A00000101314BE6E2006A023A801871382D40582C450006442100001ECD5F80B072B0374088D0360006442100001C011D007251D01E206E28550006442100001E8C0AD08A20E02D10103E960006442100001800000000000000000000000000DC", + label: "ASUS PA248QV, 1920x1200", + }, + { + value: + "00FFFFFFFFFFFF0010AC132045393639201E0103803C22782ACD25A3574B9F270D5054A54B00714F8180A9C0D1C00101010101010101023A801871382D40582C450056502100001E000000FF00335335475132330A2020202020000000FC0044454C4C204432373231480A20000000FD00384C1E5311000A202020202020018102031AB14F90050403020716010611121513141F65030C001000023A801871382D40582C450056502100001E011D8018711C1620582C250056502100009E011D007251D01E206E28550056502100001E8C0AD08A20E02D10103E960056502100001800000000000000000000000000000000000000000000000000000000004F", + label: "DELL D2721H, 1920x1080", + }, + { + value: + "00ffffffffffff0010ac0100020000000111010380221bff0a00000000000000000000adce0781800101010101010101010101010101000000ff0030303030303030303030303030000000ff0030303030303030303030303030000000fd00384c1f530b000a000000000000000000fc0044454c4c2049445241430a2020000a", + label: "DELL IDRAC EDID, 1280x1024", + }, + ]; + + const streamQualityOptions = [ + { value: "1", label: t("High") }, + { value: "0.5", label: t('Medium') }, + { value: "0.1", label: t('Low') }, + ]; // Video enhancement settings from store const { videoSaturation, diff --git a/ui/src/routes/devices.$id.tsx b/ui/src/routes/devices.$id.tsx index ddf59292..73a914bb 100644 --- a/ui/src/routes/devices.$id.tsx +++ b/ui/src/routes/devices.$id.tsx @@ -366,11 +366,7 @@ export default function KvmIdRoute() { const sessionUrl = `${CLOUD_API}/webrtc/session`; console.log("Trying to get remote session description"); - setLoadingMessage( - t('Getting_remote_session_description',{ - attempt:signalingAttempts.current > 0 ? t('attempt_num',{num:signalingAttempts.current + 1}) : '' - }) - );//Getting remote session description... ${signalingAttempts.current > 0 ? `(attempt ${signalingAttempts.current + 1})` : ""}`, + setLoadingMessage(t('Getting_remote_session_description',{ attempt: signalingAttempts.current > 0 ? t('attempt_num', { num:signalingAttempts.current + 1 }) : '' })); const res = await api.POST(sessionUrl, { sd, // When on device, we don't need to specify the device id, as it's already known