Organize code some more
This commit is contained in:
@@ -9,7 +9,7 @@ import {InputText} from 'primeng/inputtext';
|
||||
import {OAuthService} from 'angular-oauth2-oidc';
|
||||
import {Observable, Subject} from 'rxjs';
|
||||
import {filter, take} from 'rxjs/operators';
|
||||
import {getOidcErrorCount, isOidcBypassed, resetOidcBypass} from '../../../core/auth-initializer';
|
||||
import {getOidcErrorCount, isOidcBypassed, resetOidcBypass} from '../../../core/security/auth-initializer';
|
||||
import {AppSettingsService, PublicAppSettings} from '../../service/app-settings.service';
|
||||
|
||||
@Component({
|
||||
|
||||
@@ -9,7 +9,7 @@ import {Ripple} from 'primeng/ripple';
|
||||
import {Button} from 'primeng/button';
|
||||
import {Menu} from 'primeng/menu';
|
||||
import {UserService} from '../../../../features/settings/user-management/user.service';
|
||||
import {DialogLauncherService} from '../../../../core/service/dialog-launcher.service';
|
||||
import {DialogLauncherService} from '../../../services/dialog-launcher.service';
|
||||
|
||||
@Component({
|
||||
selector: '[app-menuitem]',
|
||||
|
||||
@@ -21,7 +21,7 @@ import {takeUntil} from 'rxjs/operators';
|
||||
import {Subject} from 'rxjs';
|
||||
import {MetadataBatchProgressNotification} from '../../../model/metadata-batch-progress.model';
|
||||
import {BookdropFileService} from '../../../../features/bookdrop/service/bookdrop-file.service';
|
||||
import {DialogLauncherService} from '../../../../core/service/dialog-launcher.service';
|
||||
import {DialogLauncherService} from '../../../services/dialog-launcher.service';
|
||||
import {DuplicateFileService} from '../../../websocket/duplicate-file.service';
|
||||
import {UnifiedNotificationBoxComponent} from '../../../components/unified-notification-popover/unified-notification-popover-component';
|
||||
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
import {inject, Injectable} from '@angular/core';
|
||||
import {DialogService, DynamicDialogRef} from 'primeng/dynamicdialog';
|
||||
import {GithubSupportDialog} from '../components/github-support-dialog/github-support-dialog';
|
||||
import {LibraryCreatorComponent} from '../../features/library-creator/library-creator.component';
|
||||
import {BookUploaderComponent} from '../components/book-uploader/book-uploader.component';
|
||||
import {UserProfileDialogComponent} from '../../features/settings/user-profile-dialog/user-profile-dialog.component';
|
||||
import {MagicShelfComponent} from '../../features/magic-shelf/component/magic-shelf-component';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class DialogLauncherService {
|
||||
|
||||
dialogService = inject(DialogService);
|
||||
|
||||
open(options: { component: any; header: string; top?: string; width?: string }): DynamicDialogRef {
|
||||
const isMobile = window.innerWidth <= 768;
|
||||
const {component, header, top, width} = options;
|
||||
return this.dialogService.open(component, {
|
||||
header,
|
||||
modal: true,
|
||||
closable: true,
|
||||
contentStyle: {
|
||||
overflowY: 'hidden',
|
||||
},
|
||||
style: {
|
||||
position: 'absolute',
|
||||
...(top ? {top} : {}),
|
||||
...(isMobile
|
||||
? {
|
||||
width: '90vw',
|
||||
maxWidth: '90vw',
|
||||
minWidth: '90vw',
|
||||
}
|
||||
: width
|
||||
? {width}
|
||||
: {}),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
openGithubSupportDialog(): void {
|
||||
this.open({
|
||||
component: GithubSupportDialog,
|
||||
header: 'Support Booklore',
|
||||
top: '15%'
|
||||
});
|
||||
}
|
||||
|
||||
openLibraryCreatorDialog(): void {
|
||||
this.open({
|
||||
component: LibraryCreatorComponent,
|
||||
header: 'Create New Library',
|
||||
top: '15%'
|
||||
});
|
||||
}
|
||||
|
||||
openFileUploadDialog(): void {
|
||||
this.open({
|
||||
component: BookUploaderComponent,
|
||||
header: 'Book Uploader',
|
||||
top: '10%'
|
||||
});
|
||||
}
|
||||
|
||||
openUserProfileDialog(): void {
|
||||
this.open({
|
||||
component: UserProfileDialogComponent,
|
||||
header: 'User Profile Information',
|
||||
top: '10%'
|
||||
});
|
||||
}
|
||||
|
||||
openMagicShelfDialog(): void {
|
||||
this.open({
|
||||
component: MagicShelfComponent,
|
||||
header: 'Magic Shelf Creator'
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user