@@ -5,20 +5,18 @@ import clsx from "clsx";
55
66import CommonIcon from "@/components/Common/Icons/CommonIcon" ;
77import Copyright from "@/components/Common/Copyright" ;
8- import PinOffIcon from "@/icons/PinOff" ;
9- import PinIcon from "@/icons/Pin" ;
108import logoImg from "@/assets/icon.svg" ;
119import { useAppStore } from "@/stores/appStore" ;
1210import { useSearchStore } from "@/stores/searchStore" ;
1311import { useUpdateStore } from "@/stores/updateStore" ;
14- import VisibleKey from "../VisibleKey" ;
1512import { useShortcutsStore } from "@/stores/shortcutsStore" ;
1613import { formatKey } from "@/utils/keyboardUtils" ;
1714import source_default_img from "@/assets/images/source_default.png" ;
1815import source_default_dark_img from "@/assets/images/source_default_dark.png" ;
1916import { useThemeStore } from "@/stores/themeStore" ;
2017import platformAdapter from "@/utils/platformAdapter" ;
2118import FontIcon from "../Icons/FontIcon" ;
19+ import TogglePin from "../TogglePin" ;
2220
2321interface FooterProps {
2422 setIsPinnedWeb ?: ( value : boolean ) => void ;
@@ -37,28 +35,11 @@ export default function Footer({ setIsPinnedWeb }: FooterProps) {
3735
3836 const isDark = useThemeStore ( ( state ) => state . isDark ) ;
3937
40- const { isTauri, isPinned , setIsPinned } = useAppStore ( ) ;
38+ const { isTauri } = useAppStore ( ) ;
4139
4240 const { setVisible, updateInfo, skipVersions } = useUpdateStore ( ) ;
4341
44- const { fixedWindow, modifierKey } = useShortcutsStore ( ) ;
45-
46- const togglePin = async ( ) => {
47- try {
48- const { isTauri, isPinned } = useAppStore . getState ( ) ;
49-
50- const nextPinned = ! isPinned ;
51-
52- if ( ! isTauri ) {
53- setIsPinnedWeb ?.( nextPinned ) ;
54- }
55-
56- setIsPinned ( nextPinned ) ;
57- } catch ( err ) {
58- console . error ( "Failed to toggle window pin state:" , err ) ;
59- setIsPinned ( isPinned ) ;
60- }
61- } ;
42+ const { modifierKey } = useShortcutsStore ( ) ;
6243
6344 const openSetting = useCallback ( ( ) => {
6445 return platformAdapter . emitEvent ( "open_settings" , "" ) ;
@@ -88,7 +69,10 @@ export default function Footer({ setIsPinnedWeb }: FooterProps) {
8869 if ( visibleExtensionDetail && selectedExtension ) {
8970 return (
9071 < div className = "flex items-center gap-2" >
91- < img src = { selectedExtension . icon } className = "size-5 dark:drop-shadow-[0_0_6px_rgb(255,255,255)]" />
72+ < img
73+ src = { selectedExtension . icon }
74+ className = "size-5 dark:drop-shadow-[0_0_6px_rgb(255,255,255)]"
75+ />
9276 < span className = "text-sm" > { selectedExtension . name } </ span >
9377 </ div >
9478 ) ;
@@ -139,17 +123,12 @@ export default function Footer({ setIsPinnedWeb }: FooterProps) {
139123 < div className = "flex items-center space-x-2" >
140124 { renderLeft ( ) }
141125
142- < button
143- onClick = { togglePin }
126+ < TogglePin
144127 className = { clsx ( {
145- "text-blue-500" : isPinned ,
146128 "pl-2" : hasUpdate ,
147129 } ) }
148- >
149- < VisibleKey shortcut = { fixedWindow } onKeyPress = { togglePin } >
150- { isPinned ? < PinIcon /> : < PinOffIcon /> }
151- </ VisibleKey >
152- </ button >
130+ setIsPinnedWeb = { setIsPinnedWeb }
131+ />
153132 </ div >
154133 </ div >
155134 ) : (
0 commit comments