@@ -7,15 +7,14 @@ import {
77} from "react-aria-components" ;
88import { useConnectedDeviceData } from "./rpc/useConnectedDeviceData" ;
99import { useSub } from "./usePubSub" ;
10- import {
11- ArrowUturnLeftIcon ,
12- ArrowUturnRightIcon ,
13- } from "@heroicons/react/24/solid" ;
1410import { useContext , useEffect , useState } from "react" ;
1511import { useModalRef } from "./misc/useModalRef" ;
1612import { LockStateContext } from "./rpc/LockStateContext" ;
1713import { LockState } from "@zmkfirmware/zmk-studio-ts-client/core" ;
1814import { ConnectionContext } from "./rpc/ConnectionContext" ;
15+ import { ChevronDown , Undo2 , Redo2 , Save , Trash2 } from "lucide-react" ;
16+ import { Tooltip } from "./misc/Tooltip" ;
17+ import { GenericModal } from "./GenericModal" ;
1918
2019export interface AppHeaderProps {
2120 connectedDeviceLabel ?: string ;
@@ -66,12 +65,12 @@ export const AppHeader = ({
6665 ) ;
6766
6867 return (
69- < header className = "top-0 left-0 right-0 grid grid-cols-[1fr_auto_1fr] items-center justify-between border-b border-text-base " >
70- < p className = "px-3" > ZMK Studio </ p >
71- < dialog
72- ref = { showSettingsRef }
73- className = "p-5 rounded-lg border-text-base border max-w-[50vw]"
74- >
68+ < header className = "top-0 left-0 right-0 grid grid-cols-[1fr_auto_1fr] items-center justify-between h-10 max-w-full " >
69+ < div className = "flex px-3 items-center gap-1" >
70+ < img src = "/zmk.svg" alt = "ZMK Logo" className = "h-8 rounded" />
71+ < p > Studio </ p >
72+ </ div >
73+ < GenericModal ref = { showSettingsRef } className = "max-w-[50vw]" >
7574 < h2 className = "my-2 text-lg" > Settings Reset</ h2 >
7675 < div >
7776 < p >
@@ -80,83 +79,88 @@ export const AppHeader = ({
8079 </ p >
8180 < p > Continue?</ p >
8281 < div className = "flex justify-end my-2 gap-3" >
83- < button onClick = { ( ) => setShowSettingsReset ( false ) } > Cancel</ button >
84- < button
85- onClick = { ( ) => {
82+ < Button
83+ className = "rounded bg-base-200 hover:bg-base-300 px-3 py-2"
84+ onPress = { ( ) => setShowSettingsReset ( false ) }
85+ >
86+ Cancel
87+ </ Button >
88+ < Button
89+ className = "rounded bg-base-200 hover:bg-base-300 px-3 py-2"
90+ onPress = { ( ) => {
8691 setShowSettingsReset ( false ) ;
8792 onResetSettings ?.( ) ;
8893 } }
8994 >
9095 Reset Settings
91- </ button >
96+ </ Button >
9297 </ div >
9398 </ div >
94- </ dialog >
99+ </ GenericModal >
95100 < MenuTrigger >
96101 < Button
97- className = "text-center enabled:after:content-['⏷'] after:relative after:left-2 pr-3 "
102+ className = "text-center rac-disabled:opacity-0 hover:bg-base-300 transition-all duration-100 p-1 pl-2 rounded-lg "
98103 isDisabled = { ! connectedDeviceLabel }
99104 >
100105 { connectedDeviceLabel }
106+ < ChevronDown className = "inline-block w-4" />
101107 </ Button >
102108 < Popover >
103- < Menu className = "border rounded bg-bg- base cursor-pointer" >
104- < MenuItem className = "p- 1 hover:text-accent " onAction = { onDisconnect } >
109+ < Menu className = "shadow-md rounded bg-base-100 text- base-content cursor-pointer overflow-hidden " >
110+ < MenuItem className = "px-2 py- 1 hover:bg-base-200 " onAction = { onDisconnect } >
105111 Disconnect
106112 </ MenuItem >
107113 < MenuItem
108- className = "p- 1 hover:text-accent "
114+ className = "px-2 py- 1 hover:bg-base-200 "
109115 onAction = { ( ) => setShowSettingsReset ( true ) }
110116 >
111117 Settings Reset
112118 </ MenuItem >
113119 </ Menu >
114120 </ Popover >
115121 </ MenuTrigger >
116- < div className = "flex justify-end" >
122+ < div className = "flex justify-end gap-1 px-2 " >
117123 { onUndo && (
118- < button
119- type = "button"
120- className = "flex justify-center items-center px-3 py-1.5 enabled:hover:text-accent disabled:text-gray-500"
121- disabled = { ! canUndo }
122- onClick = { onUndo }
123- >
124- < ArrowUturnLeftIcon
125- className = "inline-block w-4 mx-1"
126- aria-label = "Undo"
127- />
128- </ button >
124+ < Tooltip label = "Undo" >
125+ < Button
126+ className = "flex items-center justify-center p-1.5 rounded enabled:hover:bg-base-300 disabled:opacity-50"
127+ isDisabled = { ! canUndo }
128+ onPress = { onUndo }
129+ >
130+ < Undo2 className = "inline-block w-4 mx-1" aria-label = "Undo" />
131+ </ Button >
132+ </ Tooltip >
129133 ) }
130134
131135 { onRedo && (
132- < button
133- type = "button"
134- className = "flex items-center justify-center px-3 py-1.5 enabled:hover:text-accent disabled:text-gray-500"
135- disabled = { ! canRedo }
136- onClick = { onRedo }
137- >
138- < ArrowUturnRightIcon
139- className = "inline-block w-4 mx-1"
140- aria-label = "Redo"
141- />
142- </ button >
136+ < Tooltip label = "Redo" >
137+ < Button
138+ className = "flex items-center justify-center p-1.5 rounded enabled:hover:bg-base-300 disabled:opacity-50"
139+ isDisabled = { ! canRedo }
140+ onPress = { onRedo }
141+ >
142+ < Redo2 className = "inline-block w-4 mx-1" aria-label = "Redo" />
143+ </ Button >
144+ </ Tooltip >
143145 ) }
144- < button
145- type = "button"
146- className = "px-3 py-1.5 enabled:hover:text-accent disabled:text-gray-500"
147- disabled = { ! unsaved }
148- onClick = { onSave }
149- >
150- Save
151- </ button >
152- < button
153- type = "button"
154- className = "px-3 py-1.5 enabled:hover:text-accent disabled:text-gray-500"
155- onClick = { onDiscard }
156- disabled = { ! unsaved }
157- >
158- Discard
159- </ button >
146+ < Tooltip label = "Save" >
147+ < Button
148+ className = "flex items-center justify-center p-1.5 rounded enabled:hover:bg-base-300 disabled:opacity-50"
149+ isDisabled = { ! unsaved }
150+ onPress = { onSave }
151+ >
152+ < Save className = "inline-block w-4 mx-1" aria-label = "Save" />
153+ </ Button >
154+ </ Tooltip >
155+ < Tooltip label = "Discard" >
156+ < Button
157+ className = "flex items-center justify-center p-1.5 rounded enabled:hover:bg-base-300 disabled:opacity-50"
158+ onPress = { onDiscard }
159+ isDisabled = { ! unsaved }
160+ >
161+ < Trash2 className = "inline-block w-4 mx-1" aria-label = "Discard" />
162+ </ Button >
163+ </ Tooltip >
160164 </ div >
161165 </ header >
162166 ) ;
0 commit comments