Skip to content

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

chore(frontend:users): adapt links for Electron and update localization

johavend193230e632c
diff --git a/frontend/src/app/app.constants.ts b/frontend/src/app/app.constants.ts
index 992a16b3..e0f444cc 100644
--- a/frontend/src/app/app.constants.ts
+++ b/frontend/src/app/app.constants.ts
@@ -22,3 +22,8 @@ export const APP_MENU: AppMenu = {
level: 0,
submenus: []
} as const
+
+export const APP_URL = {
+ WEBSITE: 'https://sync-in.com',
+ RELEASES: 'https://github.com/Sync-in/server/releases'
+} as const
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 3aebf94d..525f00c0 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
@@ -5,7 +5,7 @@
-->
<!-- The user image in the menu -->
-<div class="d-flex flex-column" style="height: 92vh">
+<div class="d-flex flex-column 100vh">
<div class="sidebar-component-title">
<div class="d-flex flex-fill justify-content-between">
@if (!user?.isLink) {
@@ -51,20 +51,20 @@
</select>
</div>
</div>
- <div class="d-flex flex-column mt-auto fs-xs">
+ <div class="d-none d-md-block hide-on-small-height position-absolute w-100 fs-xs" style="bottom: 46px">
<hr />
- <div class="d-flex flex-column mx-3 mt-auto">
+ <div class="d-flex flex-column mx-3">
<div class="mb-1">
<img alt="" height="26" [src]="this.layout.switchTheme.getValue() === themeLight ? logoUrl: logoDarkUrl">
</div>
<div>
- <a href="https://sync-in.com" target="_blank">Website</a>
+ <a class="link-primary cursor-pointer" (click)="openLink('website')" l10nTranslate>Website</a>
<span>&nbsp;|&nbsp;</span>
- <a href="https://sync-in.com/docs" target="_blank">Documentation</a>
+ <a class="link-primary cursor-pointer" (click)="openLink('docs')" l10nTranslate>Documentation</a>
<span>&nbsp;|&nbsp;</span>
- <a href="https://github.com/Sync-in/server/releases" target="_blank">Versions</a>
+ <a class="link-primary cursor-pointer" (click)="openLink('versions')" l10nTranslate>Versions</a>
<span>&nbsp;|&nbsp;</span>
- <a href="https://sync-in.com/support" target="_blank"> 💛</a>
+ <a class="link-primary cursor-pointer" (click)="openLink('support')"> 💛</a>
</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 f0b0d4b4..ac1bc002 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
@@ -12,6 +12,7 @@ import { faCircleHalfStroke, faCog, faPowerOff, faUserAlt, faUserSecret } from '
import { USER_ONLINE_STATUS_LIST } from '@sync-in-server/backend/src/applications/users/constants/user'
import { L10nTranslateDirective } from 'angular-l10n'
import { Subscription } from 'rxjs'
+import { APP_URL } from '../../../../app.constants'
import { AuthService } from '../../../../auth/auth.service'
import { CapitalizePipe } from '../../../../common/pipes/capitalize.pipe'
import { themeLight } from '../../../../layout/layout.interfaces'
@@ -25,6 +26,13 @@ import { UserService } from '../../user.service'
@Component({
selector: 'app-user-profile',
templateUrl: 'user-profile.component.html',
+ styles: `
+ @media (max-height: 300px) {
+ .hide-on-small-height {
+ display: none !important;
+ }
+ }
+ `,
imports: [FormsModule, RouterLink, CapitalizePipe, FaIconComponent, L10nTranslateDirective]
})
export class UserProfileComponent implements OnDestroy {
@@ -33,6 +41,7 @@ export class UserProfileComponent implements OnDestroy {
protected readonly store = inject(StoreService)
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 user: UserType
protected userAvatar: string = null
@@ -45,6 +54,7 @@ export class UserProfileComponent implements OnDestroy {
constructor() {
this.subscriptions.push(this.store.user.subscribe((user: UserType) => (this.user = user)))
this.subscriptions.push(this.store.userAvatarUrl.subscribe((avatarUrl: string) => (this.userAvatar = avatarUrl)))
+ this.appBaseUrl = this.layout.getCurrentLanguage() === 'fr' ? `${APP_URL.WEBSITE}/fr/` : `${APP_URL.WEBSITE}/`
}
ngOnDestroy() {
@@ -67,4 +77,17 @@ export class UserProfileComponent implements OnDestroy {
this.authService.logout()
this.layout.toggleRSideBar(false)
}
+
+ openLink(urlType: 'website' | 'news' | 'docs' | 'versions' | 'support') {
+ switch (urlType) {
+ case 'website':
+ this.layout.openUrl(this.appBaseUrl)
+ break
+ case 'versions':
+ this.layout.openUrl(APP_URL.RELEASES)
+ break
+ default:
+ this.layout.openUrl(`${this.appBaseUrl}${urlType}`)
+ }
+ }
}
diff --git a/frontend/src/app/electron/constants/events.ts b/frontend/src/app/electron/constants/events.ts
index 58f088e3..5afe9710 100644
--- a/frontend/src/app/electron/constants/events.ts
+++ b/frontend/src/app/electron/constants/events.ts
@@ -30,6 +30,7 @@ export const EVENT = {
},
MISC: {
DIALOG_OPEN: 'dialog-open',
+ URL_OPEN: 'url-open',
FILE_OPEN: 'file-open',
SWITCH_THEME: 'switch-theme',
NETWORK_IS_ONLINE: 'network-is-online'
diff --git a/frontend/src/app/electron/electron.service.ts b/frontend/src/app/electron/electron.service.ts
index ce6819f9..8aea3bcc 100644
--- a/frontend/src/app/electron/electron.service.ts
+++ b/frontend/src/app/electron/electron.service.ts
@@ -77,6 +77,10 @@ export class Electron {
this.send(EVENT.MISC.FILE_OPEN, path)
}
+ openUrl(url: string) {
+ this.send(EVENT.MISC.URL_OPEN, url)
+ }
+
private setSync(sync: SyncStatus) {
if (sync.reportOnly) {
this.store.clientSyncIsReporting.next(sync.state)
diff --git a/frontend/src/app/layout/layout.service.ts b/frontend/src/app/layout/layout.service.ts
index 5c85d959..d456893b 100644
--- a/frontend/src/app/layout/layout.service.ts
+++ b/frontend/src/app/layout/layout.service.ts
@@ -253,6 +253,14 @@ export class LayoutService {
this.breadcrumbNav.next(url)
}
+ openUrl(url: string) {
+ if (this.electron.enabled) {
+ this.electron.openUrl(url)
+ } else {
+ window.open(url, '_blank')
+ }
+ }
+
translateString(text: string, args?: any): string {
return text ? this.translation.translate(text, args) : text
}
diff --git a/frontend/src/i18n/fr.json b/frontend/src/i18n/fr.json
index 2e34b859..8c876dd4 100644
--- a/frontend/src/i18n/fr.json
+++ b/frontend/src/i18n/fr.json
@@ -675,6 +675,9 @@
"System requirements": "Configuration requise",
"Feature not enabled": "Fonctionnalité non activée",
"Check the settings": "Vérifiez les paramètres",
+ "Website": "Site Web",
+ "Documentation": "Documentation",
+ "Versions": "Versions",
"Security": "Sécurité",
"Recovery code": "Code de récupération",
"Use a recovery code": "Utiliser un code de récupération",