Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

feat(frontend): add delayed auto-collapse functionality for right sidebar

johaven315bad25980d
diff --git a/frontend/src/app/applications/files/components/sidebar/files-selection.component.ts b/frontend/src/app/applications/files/components/sidebar/files-selection.component.ts
index 4781813c..23fcc53c 100755
--- a/frontend/src/app/applications/files/components/sidebar/files-selection.component.ts
+++ b/frontend/src/app/applications/files/components/sidebar/files-selection.component.ts
@@ -24,7 +24,7 @@ import { UserAvatarComponent } from '../../../users/components/utils/user-avatar
import { USER_PATH } from '../../../users/user.constants'
import { FileModel } from '../../models/file.model'
import { FilesService } from '../../services/files.service'
-import { FileLockFormatPipe, fileLockPropsToString } from '../utils/file-lock.utils'
+import { FileLockFormatPipe } from '../utils/file-lock.utils'
import { FilePermissionsComponent } from '../utils/file-permissions.component'
import { FilesViewerMediaComponent } from '../viewers/files-viewer-media.component'
@@ -63,7 +63,6 @@ export class FilesSelectionComponent {
faArrowsAlt,
faSpinner
}
- protected readonly fileLockPropsToString = fileLockPropsToString
private readonly router = inject(Router)
private readonly layout = inject(LayoutService)
private readonly filesService = inject(FilesService)
diff --git a/frontend/src/app/applications/users/components/sidebar/user-profile.component.html b/frontend/src/app/applications/users/components/sidebar/user-profile.component.html
index b9cd6aee..74da6efc 100755
--- a/frontend/src/app/applications/users/components/sidebar/user-profile.component.html
+++ b/frontend/src/app/applications/users/components/sidebar/user-profile.component.html
@@ -29,7 +29,7 @@
</div>
</div>
<div appAutoResize [useMaxHeight]="false" class="d-flex flex-column">
- <div class="user-header py-3">
+ <div class="user-header py-3 px-3">
<div class="d-flex flex-column justify-content-center me-2">
<div class="avatar-lg">
<img class="avatar-img" [src]="userAvatar" alt="">
@@ -59,14 +59,17 @@
<div class="mb-1">
<img alt="" height="30" [src]="this.layout.switchTheme.getValue() === themeLight ? logoUrl: logoDarkUrl">
</div>
- <div>
+ <div class="d-flex">
<a class="link-primary cursor-pointer" (click)="openLink('website')" l10nTranslate>Website</a>
<span>&nbsp;|&nbsp;</span>
- <a class="link-primary cursor-pointer" (click)="openLink('docs')" l10nTranslate>Documentation</a>
- <span>&nbsp;|&nbsp;</span>
<a class="link-primary cursor-pointer" (click)="openLink('versions')" l10nTranslate>Versions</a>
<span>&nbsp;|&nbsp;</span>
<a class="link-primary cursor-pointer" (click)="openLink('support')"> 💛</a>
+ <fa-icon class="ms-auto fs-xs cursor-pointer"
+ (click)="layout.setAutoCollapseRSideBarPreference(!layout.collapseRSideBarPreference())"
+ [title]="(layout.collapseRSideBarPreference() ? 'Sidebar auto-hide enabled' : 'Sidebar pinned') | translate:locale.language"
+ [icon]="layout.collapseRSideBarPreference() ? icons.faThumbTackSlash : icons.faThumbTack">
+ </fa-icon>
</div>
</div>
</div>
diff --git a/frontend/src/app/applications/users/components/sidebar/user-profile.component.ts b/frontend/src/app/applications/users/components/sidebar/user-profile.component.ts
index 318e76d8..164c3915 100644
--- a/frontend/src/app/applications/users/components/sidebar/user-profile.component.ts
+++ b/frontend/src/app/applications/users/components/sidebar/user-profile.component.ts
@@ -8,7 +8,7 @@ import { Component, inject, OnDestroy } from '@angular/core'
import { FormsModule } from '@angular/forms'
import { RouterLink } from '@angular/router'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
-import { faCircleHalfStroke, faCog, faPowerOff, faUserAlt, faUserSecret } from '@fortawesome/free-solid-svg-icons'
+import { faCircleHalfStroke, faCog, faPowerOff, faThumbTack, faThumbTackSlash, faUserAlt, faUserSecret } from '@fortawesome/free-solid-svg-icons'
import { APP_URL } from '@sync-in-server/backend/src/common/shared'
import { L10N_LOCALE, L10nLocale, L10nTranslateDirective, L10nTranslatePipe } from 'angular-l10n'
import { Subscription } from 'rxjs'
@@ -36,11 +36,11 @@ export class UserProfileComponent implements OnDestroy {
protected readonly USER_PATH = USER_PATH
protected readonly allOnlineStatus = USER_ONLINE_STATUS_LIST
protected appBaseUrl = `${APP_URL.WEBSITE}`
- protected readonly icons = { faUserAlt, faCircleHalfStroke, faCog, faPowerOff, faUserSecret }
+ protected readonly icons = { faUserAlt, faCircleHalfStroke, faCog, faPowerOff, faUserSecret, faThumbTack, faThumbTackSlash }
protected user: UserType
protected userAvatar: string = null
- protected readonly layout = inject(LayoutService)
protected readonly themeLight = themeLight
+ protected readonly layout = inject(LayoutService)
private readonly authService = inject(AuthService)
private readonly userService = inject(UserService)
private subscriptions: Subscription[] = []
@@ -72,7 +72,7 @@ export class UserProfileComponent implements OnDestroy {
this.layout.toggleRSideBar(false)
}
- openLink(urlType: 'website' | 'news' | 'docs' | 'versions' | 'support') {
+ openLink(urlType: 'website' | 'news' | 'versions' | 'support') {
switch (urlType) {
case 'website':
this.layout.openUrl(this.appBaseUrl)
diff --git a/frontend/src/app/layout/layout.service.ts b/frontend/src/app/layout/layout.service.ts
index e3ab51e4..efb3faa0 100644
--- a/frontend/src/app/layout/layout.service.ts
+++ b/frontend/src/app/layout/layout.service.ts
@@ -5,7 +5,7 @@
*/
import { HttpErrorResponse } from '@angular/common/http'
-import { inject, Injectable, NgZone } from '@angular/core'
+import { inject, Injectable, NgZone, signal, WritableSignal } from '@angular/core'
import { Title } from '@angular/platform-browser'
import { FaConfig } from '@fortawesome/angular-fontawesome'
import { IconDefinition } from '@fortawesome/fontawesome-svg-core'
@@ -59,6 +59,7 @@ export class LayoutService {
// Modal section
public windows = new BehaviorSubject<AppWindow[]>([]) // minimized modals
public modalRefs = new Map<number | string, BsModalRef>()
+ public collapseRSideBarPreference: WritableSignal<boolean> = signal(this.getAutoCollapseRSideBarPreference())
// Services
private readonly title = inject(Title)
private readonly ngZone = inject(NgZone)
@@ -71,6 +72,7 @@ export class LayoutService {
// States
private readonly screenMediumSize = 767 // px
private readonly screenSmallSize = 576 // px
+ private collapseRSideBarTimeoutId: ReturnType<typeof setTimeout> | null = null
// Network events
private _networkIsOnline = new BehaviorSubject<boolean>(navigator.onLine)
public networkIsOnline: Observable<boolean> = this._networkIsOnline
@@ -79,6 +81,7 @@ export class LayoutService {
private preferTheme = fromEvent(window.matchMedia('(prefers-color-scheme: dark)'), 'change').pipe(
map((e: any) => (e.matches ? themeDark : themeLight))
)
+ // Modal options
private readonly modalOptions: ModalOptions = {
animated: true,
keyboard: true,
@@ -117,6 +120,20 @@ export class LayoutService {
toggleRSideBar(show: boolean) {
this.rightSideBarIsOpen.next(show)
this.toggleRightSideBar.next(show)
+
+ // Cancel the current timeout if it exists
+ if (this.collapseRSideBarTimeoutId) {
+ clearTimeout(this.collapseRSideBarTimeoutId)
+ this.collapseRSideBarTimeoutId = null
+ }
+ if (show && this.collapseRSideBarPreference()) {
+ this.collapseRSideBarTimeoutId = setTimeout(() => {
+ if (!this.collapseRSideBarPreference()) return
+ this.rightSideBarIsOpen.next(false)
+ this.toggleRightSideBar.next(false)
+ this.collapseRSideBarTimeoutId = null
+ }, 10_000)
+ }
}
setTabsRSideBar(name: TAB_GROUP, tabs?: TabMenu[]) {
@@ -291,6 +308,14 @@ export class LayoutService {
this.closeDialog(null, null, true)
}
+ setAutoCollapseRSideBarPreference(preference: boolean) {
+ localStorage.setItem('autoCollapseRSideBar', preference ? 'on' : 'off')
+ this.collapseRSideBarPreference.set(preference)
+ if (preference) {
+ this.toggleRSideBar(true)
+ }
+ }
+
private openModalWithEffect(modal: ModalComponent) {
this.bsModal['_renderer'].setAttribute(modal['instance']._element.nativeElement, 'aria-hidden', 'false')
this.bsModal['_renderer'].setStyle(modal['instance']._element.nativeElement, 'display', 'block')
@@ -346,4 +371,8 @@ export class LayoutService {
this.ngZone.run(() => this.switchTheme.next(theme))
sessionStorage.setItem('themeMode', theme)
}
+
+ private getAutoCollapseRSideBarPreference(): boolean {
+ return localStorage.getItem('autoCollapseRSideBar') === 'on'
+ }
}
diff --git a/frontend/src/i18n/de.json b/frontend/src/i18n/de.json
index 97be96b5..5afca308 100644
--- a/frontend/src/i18n/de.json
+++ b/frontend/src/i18n/de.json
@@ -565,7 +565,6 @@
"System requirements": "Systemanforderungen",
"Feature not enabled": "Funktion nicht aktiviert",
"Website": "Website",
- "Documentation": "Dokumentation",
"Versions": "Versionen",
"Security": "Sicherheit",
"Recovery code": "Wiederherstellungscode",
@@ -633,5 +632,7 @@
"Used when both editors support the file type.": "Wird verwendet, wenn beide Editoren den Dateityp unterstützen.",
"Enable content indexation for personal files.": "Inhaltsindexierung für persönliche Dateien aktivieren.",
"Preferences": "Einstellungen",
- "of": "von"
+ "of": "von",
+ "Sidebar auto-hide enabled": "Automatisches Ausblenden der Seitenleiste aktiviert",
+ "Sidebar pinned": "Seitenleiste angeheftet"
}
\ No newline at end of file
diff --git a/frontend/src/i18n/es.json b/frontend/src/i18n/es.json
index 7995cc27..b166f749 100644
--- a/frontend/src/i18n/es.json
+++ b/frontend/src/i18n/es.json
@@ -565,7 +565,6 @@
"System requirements": "Requisitos del sistema",
"Feature not enabled": "Funcionalidad no habilitada",
"Website": "Sitio web",
- "Documentation": "Documentación",
"Versions": "Versiones",
"Security": "Seguridad",
"Recovery code": "Código de recuperación",
@@ -633,5 +632,7 @@
"Used when both editors support the file type.": "Se usa cuando ambos editores admiten el tipo de archivo.",
"Enable content indexation for personal files.": "Habilitar la indexación de contenido para archivos personales.",
"Preferences": "Preferencias",
- "of": "de"
+ "of": "de",
+ "Sidebar auto-hide enabled": "Ocultación automática de la barra lateral activada",
+ "Sidebar pinned": "Barra lateral fijada"
}
\ No newline at end of file
diff --git a/frontend/src/i18n/fr.json b/frontend/src/i18n/fr.json
index 4a48d0b0..6501ecdc 100644
--- a/frontend/src/i18n/fr.json
+++ b/frontend/src/i18n/fr.json
@@ -565,7 +565,6 @@
"System requirements": "Configuration requise",
"Feature not enabled": "Fonctionnalité non activée",
"Website": "Site Web",
- "Documentation": "Documentation",
"Versions": "Versions",
"Security": "Sécurité",
"Recovery code": "Code de récupération",
@@ -633,5 +632,7 @@
"Used when both editors support the file type.": "Utilisé lorsque les deux éditeurs prennent en charge le type de fichier.",
"Enable content indexation for personal files.": "Activer l'indexation du contenu pour les fichiers personnels.",
"Preferences": "Préférences",
- "of": "de"
+ "of": "de",
+ "Sidebar auto-hide enabled": "Masquage automatique de la barre latérale activé",
+ "Sidebar pinned": "Barre latérale épinglée"
}
\ No newline at end of file
diff --git a/frontend/src/i18n/hi.json b/frontend/src/i18n/hi.json
index 76db7078..485c5fc1 100644
--- a/frontend/src/i18n/hi.json
+++ b/frontend/src/i18n/hi.json
@@ -565,7 +565,6 @@
"System requirements": "सिस्टम आवश्यकताएँ",
"Feature not enabled": "विशेषता सक्षम नहीं है",
"Website": "वेबसाइट",
- "Documentation": "दस्तावेज़ीकरण",
"Versions": "संस्करण",
"Security": "सुरक्षा",
"Recovery code": "रिकवरी कोड",
@@ -633,5 +632,7 @@
"Used when both editors support the file type.": "जब दोनों संपादक फ़ाइल प्रकार का समर्थन करते हैं तो उपयोग किया जाता है।",
"Enable content indexation for personal files.": "व्यक्तिगत फ़ाइलों के लिए सामग्री अनुक्रमण सक्षम करें।",
"Preferences": "वरीयताएँ",
- "of": "का"
+ "of": "का",
+ "Sidebar auto-hide enabled": "साइडबार स्वतः छिपाना सक्षम",
+ "Sidebar pinned": "साइडबार पिन किया गया"
}
\ No newline at end of file
diff --git a/frontend/src/i18n/it.json b/frontend/src/i18n/it.json
index b31219e7..96e6da10 100644
--- a/frontend/src/i18n/it.json
+++ b/frontend/src/i18n/it.json
@@ -565,7 +565,6 @@
"System requirements": "Requisiti di sistema",
"Feature not enabled": "Funzionalità non abilitata",
"Website": "Sito web",
- "Documentation": "Documentazione",
"Versions": "Versioni",
"Security": "Sicurezza",
"Recovery code": "Codice di recupero",
@@ -633,5 +632,7 @@
"Used when both editors support the file type.": "Usato quando entrambi gli editor supportano il tipo di file.",
"Enable content indexation for personal files.": "Abilita l'indicizzazione dei contenuti per i file personali.",
"Preferences": "Preferenze",
- "of": "di"
+ "of": "di",
+ "Sidebar auto-hide enabled": "Nascondimento automatico della barra laterale attivato",
+ "Sidebar pinned": "Barra laterale bloccata"
}
\ No newline at end of file
diff --git a/frontend/src/i18n/ja.json b/frontend/src/i18n/ja.json
index 4f8cbb98..9a2afa37 100644
--- a/frontend/src/i18n/ja.json
+++ b/frontend/src/i18n/ja.json
@@ -565,7 +565,6 @@
"System requirements": "システム要件",
"Feature not enabled": "機能が有効ではありません",
"Website": "ウェブサイト",
- "Documentation": "ドキュメント",
"Versions": "バージョン",
"Security": "セキュリティ",
"Recovery code": "復旧コード",
@@ -633,5 +632,7 @@
"Used when both editors support the file type.": "両方のエディタがファイルタイプをサポートしている場合に使用されます。",
"Enable content indexation for personal files.": "個人ファイルのコンテンツインデックス作成を有効にする。",
"Preferences": "環境設定",
- "of": "の"
+ "of": "の",
+ "Sidebar auto-hide enabled": "サイドバー自動非表示が有効",
+ "Sidebar pinned": "サイドバー固定"
}
\ No newline at end of file
diff --git a/frontend/src/i18n/ko.json b/frontend/src/i18n/ko.json
index a944fd83..a06bc0ee 100644
--- a/frontend/src/i18n/ko.json
+++ b/frontend/src/i18n/ko.json
@@ -565,7 +565,6 @@
"System requirements": "시스템 요구 사항",
"Feature not enabled": "기능이 활성화되어 있지 않습니다",
"Website": "웹사이트",
- "Documentation": "문서",
"Versions": "버전",
"Security": "보안",
"Recovery code": "복구 코드",
@@ -633,5 +632,7 @@
"Used when both editors support the file type.": "두 편집기 모두 파일 유형을 지원할 때 사용됩니다.",
"Enable content indexation for personal files.": "개인 파일에 대한 콘텐츠 인덱싱을 활성화합니다.",
"Preferences": "환경 설정",
- "of": "의"
+ "of": "의",
+ "Sidebar auto-hide enabled": "사이드바 자동 숨김 활성화",
+ "Sidebar pinned": "사이드바 고정됨"
}
\ No newline at end of file
diff --git a/frontend/src/i18n/pl.json b/frontend/src/i18n/pl.json
index eb4480b3..8e15517c 100644
--- a/frontend/src/i18n/pl.json
+++ b/frontend/src/i18n/pl.json
@@ -565,7 +565,6 @@
"System requirements": "Wymagania systemowe",
"Feature not enabled": "Funkcja nie jest włączona",
"Website": "Strona internetowa",
- "Documentation": "Dokumentacja",
"Versions": "Wersje",
"Security": "Bezpieczeństwo",
"Recovery code": "Kod odzyskiwania",
@@ -633,5 +632,7 @@
"Used when both editors support the file type.": "Używane, gdy oba edytory obsługują typ pliku.",
"Enable content indexation for personal files.": "Włącz indeksowanie treści dla plików osobistych.",
"Preferences": "Preferencje",
- "of": "z"
+ "of": "z",
+ "Sidebar auto-hide enabled": "Włączono automatyczne ukrywanie panelu bocznego",
+ "Sidebar pinned": "Panel boczny przypięty"
}
\ No newline at end of file
diff --git a/frontend/src/i18n/pt-BR.json b/frontend/src/i18n/pt-BR.json
index d662fe8e..5ee275ad 100644
--- a/frontend/src/i18n/pt-BR.json
+++ b/frontend/src/i18n/pt-BR.json
@@ -565,7 +565,6 @@
"System requirements": "Requisitos do sistema",
"Feature not enabled": "Recurso não habilitado",
"Website": "Site",
- "Documentation": "Documentação",
"Versions": "Versões",
"Security": "Segurança",
"Recovery code": "Código de recuperação",
@@ -633,5 +632,7 @@
"Used when both editors support the file type.": "Usado quando ambos os editores suportam o tipo de arquivo.",
"Enable content indexation for personal files.": "Ativar indexação de conteúdo para arquivos pessoais.",
"Preferences": "Preferências",
- "of": "de"
+ "of": "de",
+ "Sidebar auto-hide enabled": "Ocultação automática da barra lateral ativada",
+ "Sidebar pinned": "Barra lateral fixada"
}
\ No newline at end of file
diff --git a/frontend/src/i18n/pt.json b/frontend/src/i18n/pt.json
index 466f28e9..965f2caf 100644
--- a/frontend/src/i18n/pt.json
+++ b/frontend/src/i18n/pt.json
@@ -565,7 +565,6 @@
"System requirements": "Requisitos do sistema",
"Feature not enabled": "Funcionalidade não habilitada",
"Website": "Site",
- "Documentation": "Documentação",
"Versions": "Versões",
"Security": "Segurança",
"Recovery code": "Código de recuperação",
@@ -633,5 +632,7 @@
"Used when both editors support the file type.": "Usado quando ambos os editores suportam o tipo de arquivo.",
"Enable content indexation for personal files.": "Ativar indexação de conteúdo para ficheiros pessoais.",
"Preferences": "Preferências",
- "of": "de"
+ "of": "de",
+ "Sidebar auto-hide enabled": "Ocultação automática da barra lateral ativada",
+ "Sidebar pinned": "Barra lateral fixa"
}
\ No newline at end of file
diff --git a/frontend/src/i18n/ru.json b/frontend/src/i18n/ru.json
index 06d4f9c3..296f467d 100644
--- a/frontend/src/i18n/ru.json
+++ b/frontend/src/i18n/ru.json
@@ -565,7 +565,6 @@
"System requirements": "Системные требования",
"Feature not enabled": "Функция не включена",
"Website": "Сайт",
- "Documentation": "Документация",
"Versions": "Версии",
"Security": "Безопасность",
"Recovery code": "Код восстановления",
@@ -633,5 +632,7 @@
"Used when both editors support the file type.": "Используется, когда оба редактора поддерживают тип файла.",
"Enable content indexation for personal files.": "Включить индексацию содержимого для личных файлов.",
"Preferences": "Настройки",
- "of": "из"
+ "of": "из",
+ "Sidebar auto-hide enabled": "Автоскрытие боковой панели включено",
+ "Sidebar pinned": "Боковая панель закреплена"
}
\ No newline at end of file
diff --git a/frontend/src/i18n/tr.json b/frontend/src/i18n/tr.json
index c823c114..c607f2e3 100644
--- a/frontend/src/i18n/tr.json
+++ b/frontend/src/i18n/tr.json
@@ -565,7 +565,6 @@
"System requirements": "Sistem gereksinimleri",
"Feature not enabled": "Özellik etkin değil",
"Website": "Web sitesi",
- "Documentation": "Dokümantasyon",
"Versions": "Sürümler",
"Security": "Güvenlik",
"Recovery code": "Kurtarma kodu",
@@ -633,5 +632,7 @@
"Used when both editors support the file type.": "Her iki editör de dosya türünü desteklediğinde kullanılır.",
"Enable content indexation for personal files.": "Kişisel dosyalar için içerik indekslemeyi etkinleştir.",
"Preferences": "Tercihler",
- "of": "/"
+ "of": "/",
+ "Sidebar auto-hide enabled": "Kenar çubuğu otomatik gizleme etkin",
+ "Sidebar pinned": "Kenar çubuğu sabitlendi"
}
\ No newline at end of file
diff --git a/frontend/src/i18n/zh.json b/frontend/src/i18n/zh.json
index 3a583c57..250a42bb 100644
--- a/frontend/src/i18n/zh.json
+++ b/frontend/src/i18n/zh.json
@@ -565,7 +565,6 @@
"System requirements": "系统要求",
"Feature not enabled": "功能未启用",
"Website": "网站",
- "Documentation": "文档",
"Versions": "版本",
"Security": "安全",
"Recovery code": "恢复代码",
@@ -633,5 +632,7 @@
"Used when both editors support the file type.": "当两个编辑器都支持该文件类型时使用。",
"Enable content indexation for personal files.": "启用个人文件内容索引。",
"Preferences": "偏好设置",
- "of": "的"
+ "of": "的",
+ "Sidebar auto-hide enabled": "侧边栏自动隐藏已启用",
+ "Sidebar pinned": "侧边栏已固定"
}
\ No newline at end of file
diff --git a/frontend/src/styles/components/_sidebar_right.scss b/frontend/src/styles/components/_sidebar_right.scss
index fef867d8..4451b71e 100755
--- a/frontend/src/styles/components/_sidebar_right.scss
+++ b/frontend/src/styles/components/_sidebar_right.scss
@@ -32,7 +32,7 @@
justify-content: center;
height: $sidebar-apps-height;
font-size: $font-size-xs;
- padding: .3rem;
+ padding: .3rem .6rem;
}
.sidebar-component-title {