Display Grayed-Out Mode for Unsupported Platforms (#7244)
Some checks are pending
autofix.ci / autofix (push) Waiting to run
CI / lint (push) Waiting to run
CI / filename-matching (push) Waiting to run
CI / mypy (push) Waiting to run
CI / individual-coverage (push) Waiting to run
CI / test (macos-latest, 3.13-dev) (push) Waiting to run
CI / test (ubuntu-latest, 3.10) (push) Waiting to run
CI / test (ubuntu-latest, 3.11) (push) Waiting to run
CI / test (ubuntu-latest, 3.12) (push) Waiting to run
CI / test (ubuntu-latest, 3.13-dev) (push) Waiting to run
CI / test (windows-latest, 3.13-dev) (push) Waiting to run
CI / test-old-dependencies (push) Waiting to run
CI / build (macos-12, macos-x86_64) (push) Waiting to run
CI / build (macos-14, macos-arm64) (push) Waiting to run
CI / build (ubuntu-20.04, linux) (push) Waiting to run
CI / build (windows-2019, windows) (push) Waiting to run
CI / build-wheel (push) Waiting to run
CI / build-windows-installer (push) Waiting to run
CI / test-web-ui (push) Waiting to run
CI / test-docker (push) Blocked by required conditions
CI / docs (push) Waiting to run
CI / check (push) Blocked by required conditions
CI / deploy-docker (push) Blocked by required conditions
CI / deploy (push) Blocked by required conditions

add missing mode component
This commit is contained in:
Matteo Luppi 2024-10-14 23:11:33 +02:00 committed by GitHub
parent 93649e8baf
commit 96a1b934be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 51 additions and 2 deletions

View File

@ -312,4 +312,19 @@
}
}
}
.missing-mode-container {
color: #b2b2b2;
.title-icon-container {
display: flex;
flex-direction: row;
align-items: center;
gap: 5px;
i {
font-size: 1.8rem;
}
}
}
}

View File

@ -8,6 +8,7 @@ import Transparent from "./Modes/Transparent";
import Socks from "./Modes/Socks";
import Upstream from "./Modes/Upstream";
import Dns from "./Modes/Dns";
import MissingMode from "./Modes/MissingMode";
export default function Modes() {
const platform = useAppSelector((state) => state.backendState.platform);
@ -20,7 +21,14 @@ export default function Modes() {
<h3>Recommended</h3>
<div className="modes-container">
<Regular />
{!platform.startsWith("linux") ? <Local /> : undefined}
{!platform.startsWith("linux") ? (
<Local />
) : (
<MissingMode
title="Local Redirect Mode"
description="This mode is only supported on Windows and MacOS."
/>
)}
<Wireguard />
<Reverse />
</div>
@ -33,7 +41,12 @@ export default function Modes() {
<Dns />
{!platform.startsWith("win32") ? (
<Transparent />
) : undefined}
) : (
<MissingMode
title="Transparent Proxy"
description="This mode is only supported on Linux and MacOS."
/>
)}
</div>
</div>
</div>

View File

@ -0,0 +1,21 @@
import * as React from "react";
interface MissingModeProps {
title: string;
description: string;
}
export default function MissingMode({ title, description }: MissingModeProps) {
return (
<div className="missing-mode-container">
<div className="title-icon-container">
<h4 className="mode-title">{title}</h4>
<i
className="fa fa-exclamation-triangle"
aria-hidden="true"
></i>
</div>
<p className="mode-description">{description}</p>
</div>
);
}