Skip to content

Build your personal knowledge base with Trilium Notes

feat(options): add platform indicator

Elian Doranff46493775c3
diff --git a/apps/client/src/widgets/react/Icon.tsx b/apps/client/src/widgets/react/Icon.tsx
index 8d12548334..4bae69c460 100644
--- a/apps/client/src/widgets/react/Icon.tsx
+++ b/apps/client/src/widgets/react/Icon.tsx
@@ -1,7 +1,7 @@
import clsx from "clsx";
import { HTMLAttributes } from "preact";
-interface IconProps extends Pick<HTMLAttributes<HTMLSpanElement>, "className" | "onClick"> {
+interface IconProps extends Pick<HTMLAttributes<HTMLSpanElement>, "className" | "onClick" | "title"> {
icon?: string;
className?: string;
}
diff --git a/apps/client/src/widgets/type_widgets/options/appearance.tsx b/apps/client/src/widgets/type_widgets/options/appearance.tsx
index fd8412a69a..3cff63ed66 100644
--- a/apps/client/src/widgets/type_widgets/options/appearance.tsx
+++ b/apps/client/src/widgets/type_widgets/options/appearance.tsx
@@ -18,6 +18,7 @@ import FormTextBox, { FormTextBoxWithUnit } from "../../react/FormTextBox";
import { useTriliumOption, useTriliumOptionBool } from "../../react/hooks";
import Icon from "../../react/Icon";
import OptionsSection from "./components/OptionsSection";
+import PlatformIndicator from "./components/PlatformIndicator";
import RadioWithIllustration from "./components/RadioWithIllustration";
import RelatedSettings from "./components/RelatedSettings";
@@ -174,13 +175,13 @@ function LayoutIllustration({ isNewLayout }: { isNewLayout?: boolean }) {
</div>
</div>
) : (
- <div>
- <div className="title-bar">
- <Icon icon="bx bx-leaf" />
- <span className="title">Title</span>
- <Icon icon="bx bx-dock-right" />
+ <div>
+ <div className="title-bar">
+ <Icon icon="bx bx-leaf" />
+ <span className="title">Title</span>
+ <Icon icon="bx bx-dock-right" />
+ </div>
</div>
- </div>
)}
{!isNewLayout && <div className="ribbon">
@@ -192,7 +193,7 @@ function LayoutIllustration({ isNewLayout }: { isNewLayout?: boolean }) {
</div>
<div className="ribbon-body">
- <div className="ribbon-body-content"></div>
+ <div className="ribbon-body-content" />
</div>
</div>}
@@ -356,7 +357,11 @@ function ElectronIntegration() {
<FormGroup name="background-effects" description={t("electron_integration.background-effects-description")}>
<FormCheckbox
- label={t("electron_integration.background-effects")}
+ label={<>
+ {t("electron_integration.background-effects")}
+ {" "}
+ <PlatformIndicator windows="11" mac />
+ </>}
currentValue={backgroundEffects} onChange={setBackgroundEffects}
disabled={nativeTitleBarVisible}
/>
diff --git a/apps/client/src/widgets/type_widgets/options/components/PlatformIndicator.css b/apps/client/src/widgets/type_widgets/options/components/PlatformIndicator.css
new file mode 100644
index 0000000000..e91e873559
--- /dev/null
+++ b/apps/client/src/widgets/type_widgets/options/components/PlatformIndicator.css
@@ -0,0 +1,5 @@
+.platform-indicator {
+ display: inline-flex;
+ gap: 0.25em;
+ color: var(--muted-text-color);
+}
diff --git a/apps/client/src/widgets/type_widgets/options/components/PlatformIndicator.tsx b/apps/client/src/widgets/type_widgets/options/components/PlatformIndicator.tsx
new file mode 100644
index 0000000000..bb95e8d9ce
--- /dev/null
+++ b/apps/client/src/widgets/type_widgets/options/components/PlatformIndicator.tsx
@@ -0,0 +1,34 @@
+import "./PlatformIndicator.css";
+
+import { useRef } from "preact/hooks";
+
+import { t } from "../../../../services/i18n";
+import { useStaticTooltip } from "../../../react/hooks";
+import Icon from "../../../react/Icon";
+
+interface PlatformIndicatorProps {
+ windows?: boolean | "11";
+ mac: boolean;
+}
+
+export default function PlatformIndicator({ windows, mac }: PlatformIndicatorProps) {
+ const containerRef = useRef<HTMLDivElement>(null);
+ useStaticTooltip(containerRef, {
+ selector: "span",
+ animation: false,
+ title() { return this.title; },
+ });
+
+ return (
+ <div ref={containerRef} className="platform-indicator">
+ {windows && <Icon
+ icon="bx bxl-windows"
+ title={t("platform_indicator.available_on", { platform: windows === "11" ? "Windows 11" : "Windows" })}
+ />}
+ {mac && <Icon
+ icon="bx bxl-apple"
+ title={t("platform_indicator.available_on", { platform: "macOS" })}
+ />}
+ </div>
+ );
+}