refactor: sidebar

This commit is contained in:
codytseng
2025-10-17 23:34:56 +08:00
parent 21663711f8
commit 057de9595b
13 changed files with 110 additions and 44 deletions

View File

@@ -48,6 +48,7 @@ class LocalStorageService {
private notificationListStyle: TNotificationStyle = NOTIFICATION_LIST_STYLE.DETAILED
private mediaAutoLoadPolicy: TMediaAutoLoadPolicy = MEDIA_AUTO_LOAD_POLICY.ALWAYS
private shownCreateWalletGuideToastPubkeys: Set<string> = new Set()
private sidebarCollapse: boolean = false
constructor() {
if (!LocalStorageService.instance) {
@@ -193,6 +194,8 @@ class LocalStorageService {
? new Set(JSON.parse(shownCreateWalletGuideToastPubkeysStr))
: new Set()
this.sidebarCollapse = window.localStorage.getItem(StorageKey.SIDEBAR_COLLAPSE) === 'true'
// Clean up deprecated data
window.localStorage.removeItem(StorageKey.ACCOUNT_PROFILE_EVENT_MAP)
window.localStorage.removeItem(StorageKey.ACCOUNT_FOLLOW_LIST_EVENT_MAP)
@@ -476,6 +479,15 @@ class LocalStorageService {
JSON.stringify(Array.from(this.shownCreateWalletGuideToastPubkeys))
)
}
getSidebarCollapse() {
return this.sidebarCollapse
}
setSidebarCollapse(collapse: boolean) {
this.sidebarCollapse = collapse
window.localStorage.setItem(StorageKey.SIDEBAR_COLLAPSE, collapse.toString())
}
}
const instance = new LocalStorageService()