New UX Part 1.5 (#3105)
This commit is contained in:
parent
c188e0f23b
commit
ac21b04fa4
239 changed files with 1626 additions and 776 deletions
|
|
@ -11,6 +11,7 @@ import { AccountService } from './account.service';
|
|||
import { DeviceService } from './device.service';
|
||||
import {SideNavStream} from "../_models/sidenav/sidenav-stream";
|
||||
import {SmartFilter} from "../_models/metadata/v2/smart-filter";
|
||||
import {translate} from "@jsverse/transloco";
|
||||
|
||||
export enum Action {
|
||||
Submenu = -1,
|
||||
|
|
@ -117,6 +118,7 @@ export type ActionAllowedCallback<T> = (action: ActionItem<T>) => boolean;
|
|||
|
||||
export interface ActionItem<T> {
|
||||
title: string;
|
||||
description: string;
|
||||
action: Action;
|
||||
callback: ActionCallback<T>;
|
||||
requiresAdmin: boolean;
|
||||
|
|
@ -208,15 +210,6 @@ export class ActionFactoryService {
|
|||
return this.applyCallbackToList(this.bookmarkActions, callback);
|
||||
}
|
||||
|
||||
getMetadataFilterActions(callback: ActionCallback<any>) {
|
||||
const actions = [
|
||||
{title: 'add-rule-group-and', action: Action.AddRuleGroup, requiresAdmin: false, children: [], callback: this.dummyCallback},
|
||||
{title: 'add-rule-group-or', action: Action.AddRuleGroup, requiresAdmin: false, children: [], callback: this.dummyCallback},
|
||||
{title: 'remove-rule-group', action: Action.RemoveRuleGroup, requiresAdmin: false, children: [], callback: this.dummyCallback},
|
||||
];
|
||||
return this.applyCallbackToList(actions, callback);
|
||||
}
|
||||
|
||||
dummyCallback(action: ActionItem<any>, data: any) {}
|
||||
|
||||
filterSendToAction(actions: Array<ActionItem<Chapter>>, chapter: Chapter) {
|
||||
|
|
@ -227,11 +220,44 @@ export class ActionFactoryService {
|
|||
return actions;
|
||||
}
|
||||
|
||||
getActionablesForSettingsPage(actions: Array<ActionItem<any>>, blacklist: Array<Action> = []) {
|
||||
const tasks = [];
|
||||
|
||||
let actionItem;
|
||||
for (let parent of actions) {
|
||||
if (parent.action === Action.SendTo) continue;
|
||||
|
||||
if (parent.children.length === 0) {
|
||||
actionItem = {...parent};
|
||||
actionItem.title = translate('actionable.' + actionItem.title);
|
||||
if (actionItem.description !== '') {
|
||||
actionItem.description = translate('actionable.' + actionItem.description);
|
||||
}
|
||||
|
||||
tasks.push(actionItem);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (let child of parent.children) {
|
||||
actionItem = {...child};
|
||||
actionItem.title = translate('actionable.' + actionItem.title);
|
||||
if (actionItem.description !== '') {
|
||||
actionItem.description = translate('actionable.' + actionItem.description);
|
||||
}
|
||||
tasks.push(actionItem);
|
||||
}
|
||||
}
|
||||
|
||||
// Filter out tasks that don't make sense
|
||||
return tasks.filter(t => !blacklist.includes(t.action));
|
||||
}
|
||||
|
||||
private _resetActions() {
|
||||
this.libraryActions = [
|
||||
{
|
||||
action: Action.Scan,
|
||||
title: 'scan-library',
|
||||
description: 'scan-library-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: true,
|
||||
children: [],
|
||||
|
|
@ -239,12 +265,14 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.Submenu,
|
||||
title: 'others',
|
||||
description: '',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: true,
|
||||
children: [
|
||||
{
|
||||
action: Action.RefreshMetadata,
|
||||
title: 'refresh-covers',
|
||||
description: 'refresh-covers-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: true,
|
||||
children: [],
|
||||
|
|
@ -252,6 +280,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.GenerateColorScape,
|
||||
title: 'generate-colorscape',
|
||||
description: 'generate-colorscape-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: true,
|
||||
children: [],
|
||||
|
|
@ -259,6 +288,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.AnalyzeFiles,
|
||||
title: 'analyze-files',
|
||||
description: 'analyze-files-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: true,
|
||||
children: [],
|
||||
|
|
@ -266,6 +296,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.Delete,
|
||||
title: 'delete',
|
||||
description: 'delete-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: true,
|
||||
children: [],
|
||||
|
|
@ -275,6 +306,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.Edit,
|
||||
title: 'settings',
|
||||
description: 'settings-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: true,
|
||||
children: [],
|
||||
|
|
@ -285,6 +317,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.Edit,
|
||||
title: 'edit',
|
||||
description: 'edit-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
|
|
@ -292,6 +325,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.Delete,
|
||||
title: 'delete',
|
||||
description: 'delete-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
class: 'danger',
|
||||
|
|
@ -300,6 +334,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.Promote,
|
||||
title: 'promote',
|
||||
description: 'promote-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
|
|
@ -307,6 +342,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.UnPromote,
|
||||
title: 'unpromote',
|
||||
description: 'unpromote-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
|
|
@ -317,6 +353,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.MarkAsRead,
|
||||
title: 'mark-as-read',
|
||||
description: 'mark-as-read-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
|
|
@ -324,6 +361,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.MarkAsUnread,
|
||||
title: 'mark-as-unread',
|
||||
description: 'mark-as-unread-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
|
|
@ -331,6 +369,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.Scan,
|
||||
title: 'scan-series',
|
||||
description: 'scan-series-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: true,
|
||||
children: [],
|
||||
|
|
@ -338,12 +377,14 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.Submenu,
|
||||
title: 'add-to',
|
||||
description: '',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [
|
||||
{
|
||||
action: Action.AddToWantToReadList,
|
||||
title: 'add-to-want-to-read',
|
||||
description: 'add-to-want-to-read-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
|
|
@ -351,6 +392,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.RemoveFromWantToReadList,
|
||||
title: 'remove-from-want-to-read',
|
||||
description: 'remove-to-want-to-read-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
|
|
@ -358,6 +400,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.AddToReadingList,
|
||||
title: 'add-to-reading-list',
|
||||
description: 'add-to-reading-list-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
|
|
@ -365,6 +408,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.AddToCollection,
|
||||
title: 'add-to-collection',
|
||||
description: 'add-to-collection-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
|
|
@ -374,12 +418,14 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.Submenu,
|
||||
title: 'send-to',
|
||||
description: 'send-to-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [
|
||||
{
|
||||
action: Action.SendTo,
|
||||
title: '',
|
||||
description: '',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
dynamicList: this.deviceService.devices$.pipe(map((devices: Array<Device>) => devices.map(d => {
|
||||
|
|
@ -392,12 +438,22 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.Submenu,
|
||||
title: 'others',
|
||||
description: '',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: true,
|
||||
children: [
|
||||
{
|
||||
action: Action.RefreshMetadata,
|
||||
title: 'refresh-covers',
|
||||
description: 'refresh-covers-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: true,
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
action: Action.GenerateColorScape,
|
||||
title: 'generate-colorscape',
|
||||
description: 'generate-colorscape-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: true,
|
||||
children: [],
|
||||
|
|
@ -405,6 +461,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.AnalyzeFiles,
|
||||
title: 'analyze-files',
|
||||
description: 'analyze-files-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: true,
|
||||
children: [],
|
||||
|
|
@ -412,6 +469,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.Delete,
|
||||
title: 'delete',
|
||||
description: 'delete-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: true,
|
||||
class: 'danger',
|
||||
|
|
@ -422,6 +480,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.Download,
|
||||
title: 'download',
|
||||
description: 'download-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
|
|
@ -429,6 +488,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.Edit,
|
||||
title: 'edit',
|
||||
description: 'edit-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: true,
|
||||
children: [],
|
||||
|
|
@ -439,6 +499,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.IncognitoRead,
|
||||
title: 'read-incognito',
|
||||
description: 'read-incognito-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
|
|
@ -446,6 +507,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.MarkAsRead,
|
||||
title: 'mark-as-read',
|
||||
description: 'mark-as-read-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
|
|
@ -453,6 +515,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.MarkAsUnread,
|
||||
title: 'mark-as-unread',
|
||||
description: 'mark-as-unread-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
|
|
@ -460,12 +523,14 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.Submenu,
|
||||
title: 'add-to',
|
||||
description: '=',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [
|
||||
{
|
||||
action: Action.AddToReadingList,
|
||||
title: 'add-to-reading-list',
|
||||
description: 'add-to-reading-list-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
|
|
@ -475,12 +540,14 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.Submenu,
|
||||
title: 'send-to',
|
||||
description: 'send-to-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [
|
||||
{
|
||||
action: Action.SendTo,
|
||||
title: '',
|
||||
description: '',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
dynamicList: this.deviceService.devices$.pipe(map((devices: Array<Device>) => devices.map(d => {
|
||||
|
|
@ -493,6 +560,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.Download,
|
||||
title: 'download',
|
||||
description: 'download-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
|
|
@ -500,6 +568,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.Edit,
|
||||
title: 'details',
|
||||
description: 'edit-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
|
|
@ -510,6 +579,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.IncognitoRead,
|
||||
title: 'read-incognito',
|
||||
description: 'read-incognito-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
|
|
@ -517,6 +587,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.MarkAsRead,
|
||||
title: 'mark-as-read',
|
||||
description: 'mark-as-read-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
|
|
@ -524,6 +595,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.MarkAsUnread,
|
||||
title: 'mark-as-unread',
|
||||
description: 'mark-as-unread-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
|
|
@ -531,12 +603,14 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.Submenu,
|
||||
title: 'add-to',
|
||||
description: '',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [
|
||||
{
|
||||
action: Action.AddToReadingList,
|
||||
title: 'add-to-reading-list',
|
||||
description: 'add-to-reading-list-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
|
|
@ -546,12 +620,14 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.Submenu,
|
||||
title: 'send-to',
|
||||
description: 'send-to-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [
|
||||
{
|
||||
action: Action.SendTo,
|
||||
title: '',
|
||||
description: '',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
dynamicList: this.deviceService.devices$.pipe(map((devices: Array<Device>) => devices.map(d => {
|
||||
|
|
@ -565,6 +641,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.Download,
|
||||
title: 'download',
|
||||
description: 'download-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
|
|
@ -572,6 +649,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.Edit,
|
||||
title: 'details',
|
||||
description: 'edit-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
|
|
@ -582,6 +660,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.Edit,
|
||||
title: 'edit',
|
||||
description: 'edit-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
|
|
@ -589,6 +668,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.Delete,
|
||||
title: 'delete',
|
||||
description: 'delete-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
class: 'danger',
|
||||
|
|
@ -597,6 +677,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.Promote,
|
||||
title: 'promote',
|
||||
description: 'promote-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
|
|
@ -604,6 +685,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.UnPromote,
|
||||
title: 'unpromote',
|
||||
description: 'unpromote-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
|
|
@ -614,6 +696,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.ViewSeries,
|
||||
title: 'view-series',
|
||||
description: 'view-series-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
|
|
@ -621,6 +704,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.DownloadBookmark,
|
||||
title: 'download',
|
||||
description: 'download-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
|
|
@ -628,6 +712,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.Delete,
|
||||
title: 'clear',
|
||||
description: 'delete-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
class: 'danger',
|
||||
requiresAdmin: false,
|
||||
|
|
@ -639,6 +724,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.MarkAsVisible,
|
||||
title: 'mark-visible',
|
||||
description: 'mark-visible-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
|
|
@ -646,6 +732,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.MarkAsInvisible,
|
||||
title: 'mark-invisible',
|
||||
description: 'mark-invisible-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
|
|
@ -656,6 +743,7 @@ export class ActionFactoryService {
|
|||
{
|
||||
action: Action.Delete,
|
||||
title: 'delete',
|
||||
description: 'delete-tooltip',
|
||||
callback: this.dummyCallback,
|
||||
requiresAdmin: false,
|
||||
children: [],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue