From d00c07e8eceda1bfb2de0d094ad3044acf1c129e Mon Sep 17 00:00:00 2001 From: ayangweb <75017711+ayangweb@users.noreply.github.com> Date: Wed, 31 Dec 2025 14:13:22 +0800 Subject: [PATCH] refactor: remove the pin button in the standalone window (#1041) * refactor: remove the pin button in the standalone window * refactor: update --- src/components/Common/TogglePin.tsx | 39 +++++++++++++++++++---------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/src/components/Common/TogglePin.tsx b/src/components/Common/TogglePin.tsx index 36d9ff19..56c0eb09 100644 --- a/src/components/Common/TogglePin.tsx +++ b/src/components/Common/TogglePin.tsx @@ -1,10 +1,14 @@ -import { useAppStore } from "@/stores/appStore"; -import { useShortcutsStore } from "@/stores/shortcutsStore"; +import { FC, HTMLAttributes, useState } from "react"; +import { useMount } from "ahooks"; import clsx from "clsx"; + import VisibleKey from "./VisibleKey"; -import { FC, HTMLAttributes } from "react"; import PinOffIcon from "@/icons/PinOff"; import PinIcon from "@/icons/Pin"; +import platformAdapter from "@/utils/platformAdapter"; +import { MAIN_WINDOW_LABEL } from "@/constants"; +import { useAppStore } from "@/stores/appStore"; +import { useShortcutsStore } from "@/stores/shortcutsStore"; interface TogglePinProps extends HTMLAttributes { setIsPinnedWeb?: (value: boolean) => void; @@ -14,6 +18,13 @@ const TogglePin: FC = (props) => { const { className, setIsPinnedWeb } = props; const { isPinned, setIsPinned } = useAppStore(); const { fixedWindow } = useShortcutsStore(); + const [windowLabel, setWindowLabel] = useState(); + + useMount(async () => { + const label = await platformAdapter.getCurrentWindowLabel(); + + setWindowLabel(label); + }); const togglePin = async () => { const { isTauri, isPinned } = useAppStore.getState(); @@ -34,16 +45,18 @@ const TogglePin: FC = (props) => { }; return ( - + windowLabel === MAIN_WINDOW_LABEL && ( + + ) ); };