@@ -71,7 +71,7 @@ export const CustomizeNavigationDialog: FC<TCustomizeNavigationDialogProps> = ob
7171 const filteredPersonalItems = PERSONAL_ITEMS ;
7272
7373 // Filter workspace items by permissions and feature flags, then get pinned/unpinned items
74- const { pinnedItems , unpinnedItems } = useMemo ( ( ) => {
74+ const workspaceItems = useMemo ( ( ) => {
7575 const items = WORKSPACE_SIDEBAR_DYNAMIC_NAVIGATION_ITEMS_LINKS . filter ( ( item ) => {
7676 // Permission check
7777 const hasPermission = allowPermissions (
@@ -94,11 +94,7 @@ export const CustomizeNavigationDialog: FC<TCustomizeNavigationDialogProps> = ob
9494 } ;
9595 } ) ;
9696
97- // Sort pinned items by sort_order
98- const pinned = items . filter ( ( item ) => item . isPinned ) . sort ( ( a , b ) => a . sortOrder - b . sortOrder ) ;
99- const unpinned = items . filter ( ( item ) => ! item . isPinned ) ;
100-
101- return { pinnedItems : pinned , unpinnedItems : unpinned } ;
97+ return items . sort ( ( a , b ) => a . sortOrder - b . sortOrder ) ;
10298 } , [ workspaceSlug , allowPermissions , workspacePreferences ] ) ;
10399
104100 // Handle checkbox toggle
@@ -134,7 +130,7 @@ export const CustomizeNavigationDialog: FC<TCustomizeNavigationDialogProps> = ob
134130 ) ;
135131
136132 // Separate personal items into enabled/disabled
137- const { enabledPersonalItems , disabledPersonalItems } = useMemo ( ( ) => {
133+ const personalItems = useMemo ( ( ) => {
138134 const items = filteredPersonalItems . map ( ( item ) => {
139135 const itemState = personalPreferences . items [ item . key ] ;
140136 const isEnabled = typeof itemState === "boolean" ? itemState : ( itemState ?. enabled ?? true ) ;
@@ -147,10 +143,7 @@ export const CustomizeNavigationDialog: FC<TCustomizeNavigationDialogProps> = ob
147143 } ;
148144 } ) ;
149145
150- const enabled = items . filter ( ( item ) => item . isEnabled ) . sort ( ( a , b ) => a . sortOrder - b . sortOrder ) ;
151- const disabled = items . filter ( ( item ) => ! item . isEnabled ) ;
152-
153- return { enabledPersonalItems : enabled , disabledPersonalItems : disabled } ;
146+ return items . sort ( ( a , b ) => a . sortOrder - b . sortOrder ) ;
154147 } , [ personalPreferences , filteredPersonalItems ] ) ;
155148
156149 // Prevent typing invalid characters in number input
@@ -203,18 +196,19 @@ export const CustomizeNavigationDialog: FC<TCustomizeNavigationDialogProps> = ob
203196 { /* Personal Section */ }
204197 < div className = "flex flex-col gap-2" >
205198 < h3 className = "text-sm font-semibold text-custom-text-400" > { t ( "personal" ) } </ h3 >
206-
207- { /* Enabled Items - Sortable */ }
208199 < div className = "border border-custom-border-200 rounded-md py-2 bg-custom-background-90" >
209200 < Sortable
210- data = { enabledPersonalItems }
201+ data = { personalItems }
211202 onChange = { handlePersonalReorder }
212203 keyExtractor = { ( item ) => item . key }
213204 id = "personal-enabled-items"
214205 render = { ( item ) => (
215206 < div className = "flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-custom-background-90 transition-all duration-200" >
216207 < GripVertical className = "size-4 text-custom-text-400 cursor-grab active:cursor-grabbing transition-colors" />
217- < Checkbox checked onChange = { ( e ) => togglePersonalItem ( item . key , e . target . checked ) } />
208+ < Checkbox
209+ checked = { ! ! personalPreferences . items [ item . key ] ?. enabled }
210+ onChange = { ( e ) => togglePersonalItem ( item . key , e . target . checked ) }
211+ />
218212 < div className = "flex items-center gap-2 flex-1" >
219213 { getSidebarNavigationItemIcon ( item . key ) }
220214 < label className = "text-sm text-custom-text-200 flex-1 cursor-pointer" >
@@ -224,27 +218,6 @@ export const CustomizeNavigationDialog: FC<TCustomizeNavigationDialogProps> = ob
224218 </ div >
225219 ) }
226220 />
227-
228- { /* Disabled Items */ }
229- { disabledPersonalItems . length > 0 && (
230- < div className = { cn ( "space-y-1" , enabledPersonalItems . length > 0 && "mt-1" ) } >
231- { disabledPersonalItems . map ( ( item ) => (
232- < div
233- key = { item . key }
234- className = "flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-custom-background-90 transition-all duration-200"
235- >
236- < GripVertical className = "size-4 text-custom-text-400 opacity-40" />
237- < Checkbox checked = { false } onChange = { ( e ) => togglePersonalItem ( item . key , e . target . checked ) } />
238- < div className = "flex items-center gap-2 flex-1" >
239- { getSidebarNavigationItemIcon ( item . key ) }
240- < label className = "text-sm text-custom-text-200 flex-1 cursor-pointer" >
241- { t ( item . labelTranslationKey ) }
242- </ label >
243- </ div >
244- </ div >
245- ) ) }
246- </ div >
247- ) }
248221 </ div >
249222 </ div >
250223
@@ -254,7 +227,7 @@ export const CustomizeNavigationDialog: FC<TCustomizeNavigationDialogProps> = ob
254227 < div className = "border border-custom-border-200 rounded-md py-2 bg-custom-background-90" >
255228 { /* Pinned Items - Draggable */ }
256229 < Sortable
257- data = { pinnedItems }
230+ data = { workspaceItems }
258231 onChange = { handleReorder }
259232 keyExtractor = { ( item ) => item . key }
260233 id = "workspace-pinned-items"
@@ -263,7 +236,10 @@ export const CustomizeNavigationDialog: FC<TCustomizeNavigationDialogProps> = ob
263236 return (
264237 < div className = "flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-custom-background-90 group transition-all duration-200" >
265238 < GripVertical className = "size-4 text-custom-text-400 cursor-grab active:cursor-grabbing transition-colors" />
266- < Checkbox checked onChange = { ( e ) => handleWorkspaceItemToggle ( item . key , e . target . checked ) } />
239+ < Checkbox
240+ checked = { ! ! workspacePreferences . items [ item . key ] ?. is_pinned }
241+ onChange = { ( e ) => handleWorkspaceItemToggle ( item . key , e . target . checked ) }
242+ />
267243 < div className = "flex items-center gap-2 flex-1" >
268244 { icon }
269245 < span className = "text-sm text-custom-text-200" > { t ( item . labelTranslationKey ) } </ span >
@@ -272,31 +248,6 @@ export const CustomizeNavigationDialog: FC<TCustomizeNavigationDialogProps> = ob
272248 ) ;
273249 } }
274250 />
275-
276- { /* Unpinned Items */ }
277- { unpinnedItems . length > 0 && (
278- < div className = "space-y-1 mt-1" >
279- { unpinnedItems . map ( ( item ) => {
280- const icon = getSidebarNavigationItemIcon ( item . key ) ;
281- return (
282- < div
283- key = { item . key }
284- className = "flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-custom-background-90 transition-all duration-200"
285- >
286- < GripVertical className = "size-4 text-custom-text-400 opacity-40" />
287- < Checkbox
288- checked = { false }
289- onChange = { ( e ) => handleWorkspaceItemToggle ( item . key , e . target . checked ) }
290- />
291- < div className = "flex items-center gap-2 flex-1" >
292- { icon }
293- < span className = "text-sm text-custom-text-200" > { t ( item . labelTranslationKey ) } </ span >
294- </ div >
295- </ div >
296- ) ;
297- } ) }
298- </ div >
299- ) }
300251 </ div >
301252 </ div >
302253
0 commit comments