Skip to content

Commit

Permalink
fix styling issues
Browse files Browse the repository at this point in the history
  • Loading branch information
luis-411 committed Nov 13, 2024
1 parent 03c3d6c commit 98d5415
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/services/src/Domain/Preferences/LocalPrefKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const LocalPrefDefaults = {
[LocalPrefKey.EditorMonospaceEnabled]: false,
[LocalPrefKey.EditorLineHeight]: EditorLineHeight.Normal,
[LocalPrefKey.EditorLineWidth]: EditorLineWidth.FullWidth,
[LocalPrefKey.EditorFontSize]: EditorFontSize.Normal
[LocalPrefKey.EditorFontSize]: EditorFontSize.Normal,
} satisfies {
[key in LocalPrefKey]: LocalPrefValue[key]
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,14 @@ export class PaneController extends AbstractViewController implements InternalEv
currentItemsPanelWidth = 0
focusModeEnabled = false

listPaneExplicitelyCollapsed = this.preferences.getLocalValue(LocalPrefKey.ListPaneCollapsed, LocalPrefDefaults[LocalPrefKey.ListPaneCollapsed])
navigationPaneExplicitelyCollapsed = this.preferences.getLocalValue(LocalPrefKey.NavigationPaneCollapsed, LocalPrefDefaults[LocalPrefKey.NavigationPaneCollapsed])
listPaneExplicitelyCollapsed = this.preferences.getLocalValue(
LocalPrefKey.ListPaneCollapsed,
LocalPrefDefaults[LocalPrefKey.ListPaneCollapsed],
)
navigationPaneExplicitelyCollapsed = this.preferences.getLocalValue(
LocalPrefKey.NavigationPaneCollapsed,
LocalPrefDefaults[LocalPrefKey.NavigationPaneCollapsed],
)

constructor(
private preferences: PreferenceServiceInterface,
Expand Down Expand Up @@ -147,9 +153,15 @@ export class PaneController extends AbstractViewController implements InternalEv
this.setCurrentNavPanelWidth(this.preferences.getValue(PrefKey.TagsPanelWidth, MinimumNavPanelWidth))
this.setCurrentItemsPanelWidth(this.preferences.getValue(PrefKey.NotesPanelWidth, MinimumNotesPanelWidth))
}
if(event.type === ApplicationEvent.LocalPreferencesChanged){
this.listPaneExplicitelyCollapsed = this.preferences.getLocalValue(LocalPrefKey.ListPaneCollapsed, LocalPrefDefaults[LocalPrefKey.ListPaneCollapsed])
this.navigationPaneExplicitelyCollapsed = this.preferences.getLocalValue(LocalPrefKey.NavigationPaneCollapsed, LocalPrefDefaults[LocalPrefKey.NavigationPaneCollapsed])
if (event.type === ApplicationEvent.LocalPreferencesChanged) {
this.listPaneExplicitelyCollapsed = this.preferences.getLocalValue(
LocalPrefKey.ListPaneCollapsed,
LocalPrefDefaults[LocalPrefKey.ListPaneCollapsed],
)
this.navigationPaneExplicitelyCollapsed = this.preferences.getLocalValue(
LocalPrefKey.NavigationPaneCollapsed,
LocalPrefDefaults[LocalPrefKey.NavigationPaneCollapsed],
)
}
}

Expand Down
9 changes: 8 additions & 1 deletion packages/web/src/javascripts/Hooks/usePreference.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { useApplication } from '@/Components/ApplicationProvider'
import { ApplicationEvent, PrefKey, PrefDefaults, LocalPrefKey, LocalPrefValue, LocalPrefDefaults } from '@standardnotes/snjs'
import {
ApplicationEvent,
PrefKey,
PrefDefaults,
LocalPrefKey,
LocalPrefValue,
LocalPrefDefaults,
} from '@standardnotes/snjs'
import { useCallback, useEffect, useState } from 'react'

export function useLocalPreference<Key extends LocalPrefKey>(preference: Key) {
Expand Down

0 comments on commit 98d5415

Please sign in to comment.