From 62cc9b1752be8ca0a0ad4bdce0e97ac8069b92f8 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 4 Mar 2024 09:34:25 +0100 Subject: [PATCH] Use standalone components for menu --- .../my-account-notifications.component.ts | 2 +- .../src/app/+my-account/my-account.module.ts | 4 ++- client/src/app/app.component.html | 4 +-- client/src/app/app.module.ts | 22 +++++++--------- client/src/app/menu/index.ts | 1 - .../app/menu/language-chooser.component.ts | 6 ++++- client/src/app/menu/menu.component.html | 4 ++- client/src/app/menu/menu.component.ts | 26 ++++++++++++++++--- client/src/app/menu/notification.component.ts | 8 ++++-- .../quick-settings-modal.component.html | 0 .../quick-settings-modal.component.ts | 7 ++++- .../account-setup-warning-modal.component.ts | 7 ++++- .../modal/admin-welcome-modal.component.html | 17 ++++++------ .../modal/admin-welcome-modal.component.ts | 5 +++- ...instance-config-warning-modal.component.ts | 8 ++++-- .../shared/shared-main/shared-main.module.ts | 4 +-- .../src/app/shared/shared-main/users/index.ts | 1 - .../user-notifications.component.html | 0 .../user-notifications.component.scss | 0 .../user-notifications.component.ts | 9 ++++--- 20 files changed, 89 insertions(+), 46 deletions(-) rename client/src/app/{modal => menu}/quick-settings-modal.component.html (100%) rename client/src/app/{modal => menu}/quick-settings-modal.component.ts (87%) rename client/src/app/shared/{shared-main/users => standalone-notifications}/user-notifications.component.html (100%) rename client/src/app/shared/{shared-main/users => standalone-notifications}/user-notifications.component.scss (100%) rename client/src/app/shared/{shared-main/users => standalone-notifications}/user-notifications.component.ts (90%) diff --git a/client/src/app/+my-account/my-account-notifications/my-account-notifications.component.ts b/client/src/app/+my-account/my-account-notifications/my-account-notifications.component.ts index 0ec67d401..7c7a9352b 100644 --- a/client/src/app/+my-account/my-account-notifications/my-account-notifications.component.ts +++ b/client/src/app/+my-account/my-account-notifications/my-account-notifications.component.ts @@ -1,5 +1,5 @@ import { Component, ViewChild } from '@angular/core' -import { UserNotificationsComponent } from '@app/shared/shared-main' +import { UserNotificationsComponent } from '@app/shared/standalone-notifications/user-notifications.component' type NotificationSortType = 'createdAt' | 'read' diff --git a/client/src/app/+my-account/my-account.module.ts b/client/src/app/+my-account/my-account.module.ts index 266478aaf..aca09c9a1 100644 --- a/client/src/app/+my-account/my-account.module.ts +++ b/client/src/app/+my-account/my-account.module.ts @@ -35,6 +35,7 @@ import { UserImportExportService } from './my-account-import-export' import { UploadProgressComponent } from '@app/shared/standalone-upload' +import { UserNotificationsComponent } from '@app/shared/standalone-notifications/user-notifications.component' @NgModule({ imports: [ @@ -56,7 +57,8 @@ import { UploadProgressComponent } from '@app/shared/standalone-upload' SharedActorImageModule, SharedActorImageEditModule, - UploadProgressComponent + UploadProgressComponent, + UserNotificationsComponent ], declarations: [ diff --git a/client/src/app/app.component.html b/client/src/app/app.component.html index 6068df927..49aea4daf 100644 --- a/client/src/app/app.component.html +++ b/client/src/app/app.component.html @@ -72,10 +72,10 @@ - +@defer (when isUserLoggedIn()) { - +} diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts index 6485c98c9..d235a58ac 100644 --- a/client/src/app/app.module.ts +++ b/client/src/app/app.module.ts @@ -13,13 +13,9 @@ import { EmptyComponent } from './empty.component' import { HeaderComponent, SearchTypeaheadComponent, SuggestionComponent } from './header' import { HighlightPipe } from './header/highlight.pipe' import { polyfillICU } from './helpers' -import { LanguageChooserComponent, MenuComponent, NotificationComponent } from './menu' -import { AccountSetupWarningModalComponent } from './modal/account-setup-warning-modal.component' -import { AdminWelcomeModalComponent } from './modal/admin-welcome-modal.component' +import { MenuComponent } from './menu' import { ConfirmComponent } from './modal/confirm.component' import { CustomModalComponent } from './modal/custom-modal.component' -import { InstanceConfigWarningModalComponent } from './modal/instance-config-warning-modal.component' -import { QuickSettingsModalComponent } from './modal/quick-settings-modal.component' import { SharedActorImageModule } from './shared/shared-actor-image/shared-actor-image.module' import { SharedFormModule } from './shared/shared-forms' import { SharedGlobalIconModule } from './shared/shared-icons' @@ -27,6 +23,9 @@ import { SharedInstanceModule } from './shared/shared-instance' import { SharedMainModule } from './shared/shared-main' import { SharedUserInterfaceSettingsModule } from './shared/shared-user-settings' import { HotkeysCheatSheetComponent } from './hotkeys' +import { InstanceConfigWarningModalComponent } from './modal/instance-config-warning-modal.component' +import { AdminWelcomeModalComponent } from './modal/admin-welcome-modal.component' +import { AccountSetupWarningModalComponent } from './modal/account-setup-warning-modal.component' registerLocaleData(localeOc, 'oc') @@ -51,19 +50,12 @@ export function loadConfigFactory (server: ServerService, pluginService: PluginS AppComponent, EmptyComponent, - MenuComponent, - LanguageChooserComponent, - QuickSettingsModalComponent, - NotificationComponent, HeaderComponent, SearchTypeaheadComponent, SuggestionComponent, HighlightPipe, - AccountSetupWarningModalComponent, CustomModalComponent, - AdminWelcomeModalComponent, - InstanceConfigWarningModalComponent, ConfirmComponent, HotkeysCheatSheetComponent @@ -81,6 +73,12 @@ export function loadConfigFactory (server: ServerService, pluginService: PluginS SharedInstanceModule, SharedActorImageModule, + MenuComponent, + + InstanceConfigWarningModalComponent, + AdminWelcomeModalComponent, + AccountSetupWarningModalComponent, + AppRoutingModule // Put it after all the module because it has the 404 route ], diff --git a/client/src/app/menu/index.ts b/client/src/app/menu/index.ts index 7f62c1100..a78928aac 100644 --- a/client/src/app/menu/index.ts +++ b/client/src/app/menu/index.ts @@ -1,3 +1,2 @@ export * from './language-chooser.component' -export * from './notification.component' export * from './menu.component' diff --git a/client/src/app/menu/language-chooser.component.ts b/client/src/app/menu/language-chooser.component.ts index 978a4af39..b636ba76e 100644 --- a/client/src/app/menu/language-chooser.component.ts +++ b/client/src/app/menu/language-chooser.component.ts @@ -1,12 +1,16 @@ +import { CommonModule } from '@angular/common' import { Component, ElementRef, Inject, LOCALE_ID, ViewChild } from '@angular/core' import { getDevLocale, isOnDevLocale } from '@app/helpers' +import { SharedGlobalIconModule } from '@app/shared/shared-icons' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { getCompleteLocale, getShortLocale, I18N_LOCALES, objectKeysTyped, sortBy } from '@peertube/peertube-core-utils' @Component({ selector: 'my-language-chooser', templateUrl: './language-chooser.component.html', - styleUrls: [ './language-chooser.component.scss' ] + styleUrls: [ './language-chooser.component.scss' ], + standalone: true, + imports: [ CommonModule, SharedGlobalIconModule ] }) export class LanguageChooserComponent { @ViewChild('modal', { static: true }) modal: ElementRef diff --git a/client/src/app/menu/menu.component.html b/client/src/app/menu/menu.component.html index 261b4f780..2479f4b7f 100644 --- a/client/src/app/menu/menu.component.html +++ b/client/src/app/menu/menu.component.html @@ -78,7 +78,9 @@ - + @defer (when isLoggedIn) { + + }