Skip to content

Commit

Permalink
before moving dialogues to base config
Browse files Browse the repository at this point in the history
  • Loading branch information
edsilv committed Nov 16, 2023
1 parent 051b865 commit bf0f2a3
Show file tree
Hide file tree
Showing 39 changed files with 559 additions and 160 deletions.
99 changes: 97 additions & 2 deletions src/content-handlers/iiif/BaseConfig.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { StorageType } from "@edsilv/utils";

export { StorageType } from "@edsilv/utils";

export type MetricType = string | "sm" | "md" | "lg" | "xl";
Expand Down Expand Up @@ -105,11 +104,104 @@ type Locale = {
label: string;
};

export type ModuleOptions = {};

export type ModuleContent = {};

export type ModuleConfig = {
options: ModuleOptions;
content: ModuleContent;
};

export type Localisation = {
label: string;
locales: Locale[];
};

export type HeaderPanelOptions = {
/** Determines if center options are enabled */
centerOptionsEnabled: boolean;
/** Determines if locale toggle is enabled */
localeToggleEnabled: boolean;
/** Determines if settings button is enabled */
settingsButtonEnabled: boolean;
};

export type HeaderPanelContent = {
close: string;
settings: string;
};

type HeaderPanel = ModuleConfig & {
options: HeaderPanelOptions;
content: HeaderPanelContent;
};

export type LeftPanelOptions = {
/** Determines if expand full is enabled */
expandFullEnabled: boolean;
/** Determines the duration of the panel expand/collapse animation */
panelAnimationDuration: number;
/** Width of the collapsed panel */
panelCollapsedWidth: number;
/** Width of the expanded panel */
panelExpandedWidth: number;
/** Determines if the panel is open */
panelOpen: boolean;
};

export type LeftPanelContent = {
collapse: string;
collapseFull: string;
expand: string;
expandFull: string;
};

type LeftPanel = ModuleConfig & {
options: LeftPanelOptions;
content: LeftPanelContent;
};

export type FooterPanelOptions = {
/** Determines if bookmarking is enabled */
bookmarkEnabled: boolean;
/** Determines if downloading is enabled */
downloadEnabled: boolean;
/** Determines if embedding is enabled */
embedEnabled: boolean;
/** Determines if feedback is enabled */
feedbackEnabled: boolean;
/** Determines if fullscreen mode is enabled */
fullscreenEnabled: boolean;
/** Determines if buttons are minimised */
minimiseButtons: boolean;
/** Determines if more information is enabled */
moreInfoEnabled: boolean;
/** Determines if opening is enabled */
openEnabled: boolean;
/** Determines if printing is enabled */
printEnabled: boolean;
/** Determines if sharing is enabled */
shareEnabled: boolean;
};

export type FooterPanelContent = {
bookmark: string;
download: string;
embed: string;
exitFullScreen: string;
feedback: string;
fullScreen: string;
moreInfo: string;
open: string;
share: string;
};

type FooterPanel = ModuleConfig & {
options: FooterPanelOptions;
content: FooterPanelContent;
};

type DialogueOptions = {
topCloseButtonEnabled: boolean;
};
Expand All @@ -118,7 +210,7 @@ type DialogueContent = {
close: string;
};

type Dialogue = {
type Dialogue = ModuleConfig & {
options?: DialogueOptions;
content: DialogueContent;
};
Expand Down Expand Up @@ -268,7 +360,10 @@ export type BaseConfig = {
modules: {
dialogue: Dialogue;
downloadDialogue: DownloadDialogue;
footerPanel: FooterPanel;
genericDialogue: GenericDialogue;
headerPanel: HeaderPanel;
leftPanel: LeftPanel;
moreInfoRightPanel: MoreInfoRightPanel;
};
localisation: Localisation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export default class Extension extends BaseExtension<Config>
$shareDialogue: JQuery;
centerPanel: AlephCenterPanel;
downloadDialogue: DownloadDialogue;
footerPanel: FooterPanel;
headerPanel: HeaderPanel;
footerPanel: FooterPanel<Config["modules"]["footerPanel"]>;
headerPanel: HeaderPanel<Config["modules"]["headerPanel"]>;
leftPanel: AlephLeftPanel;
mobileFooterPanel: MobileFooterPanel;
rightPanel: MoreInfoRightPanel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
import { BaseConfig } from "@/content-handlers/iiif/BaseConfig";
import {
BaseConfig,
LeftPanelContent,
LeftPanelOptions,
} from "@/content-handlers/iiif/BaseConfig";

type Modules = {};
type AlephLeftPanelOptions = LeftPanelOptions & {
consoleTabEnabled: boolean;
graphTabEnabled: boolean;
settingsTabEnabled: boolean;
srcTabEnabled: boolean;
};

type AlephLeftPanelContent = LeftPanelContent & {
title: string;
};

type AlephLeftPanel = {
options: AlephLeftPanelOptions;
content: AlephLeftPanelContent;
};

type Modules = {
alephLeftPanel: AlephLeftPanel;
};

export type Config = BaseConfig & {
modules: Modules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,39 @@
"zoomToSearchResultEnabled": true
},
"modules": {
"alephLeftPanel": {
"leftPanel": {
"options": {
"expandFullEnabled": false,
"panelAnimationDuration": 250,
"panelCollapsedWidth": 30,
"panelExpandedWidth": 255,
"panelOpen": false,
"panelOpen": false
},
"content": {
"collapse": "$collapse",
"collapseFull": "$collapseFull",
"expand": "$expandContents",
"expandFull": "$expandGallery"
}
},
"alephLeftPanel": {
"options": {
"consoleTabEnabled": true,
"graphTabEnabled": true,
"settingsTabEnabled": true,
"srcTabEnabled": false
"srcTabEnabled": false,
"expandFullEnabled": false,
"panelAnimationDuration": 250,
"panelCollapsedWidth": 30,
"panelExpandedWidth": 255,
"panelOpen": false
},
"content": {
"collapse": "Collapse",
"collapseFull": "Collapse",
"expand": "Expand",
"expandFull": "Expand",
"title": "Tools"
"title": "Tools",
"collapse": "$collapse",
"collapseFull": "$collapseFull",
"expand": "$expandContents",
"expandFull": "$expandGallery"
}
},
"dialogue": {
Expand Down Expand Up @@ -111,11 +126,13 @@
},
"headerPanel": {
"options": {
"centerOptionsEnabled": true,
"localeToggleEnabled": false,
"settingsButtonEnabled": true
},
"content": {
"settings": "Settings"
"close": "$close",
"settings": "$settings"
}
},
"helpDialogue": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export default class Extension extends BaseExtension<Config>
$shareDialogue: JQuery;
centerPanel: AVCenterPanel;
downloadDialogue: DownloadDialogue;
footerPanel: FooterPanel;
headerPanel: HeaderPanel;
footerPanel: FooterPanel<Config["modules"]["footerPanel"]>;
headerPanel: HeaderPanel<Config["modules"]["headerPanel"]>;
leftPanel: ContentLeftPanel;
mobileFooterPanel: MobileFooterPanel;
rightPanel: MoreInfoRightPanel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,21 @@
"zoomToSearchResultEnabled": true
},
"modules": {
"leftPanel": {
"options": {
"expandFullEnabled": false,
"panelAnimationDuration": 250,
"panelCollapsedWidth": 30,
"panelExpandedWidth": 255,
"panelOpen": false
},
"content": {
"collapse": "$collapse",
"collapseFull": "$collapseFull",
"expand": "$expandContents",
"expandFull": "$expandGallery"
}
},
"contentLeftPanel": {
"options": {
"autoExpandTreeEnabled": true,
Expand Down Expand Up @@ -137,10 +152,12 @@
},
"headerPanel": {
"options": {
"centerOptionsEnabled": true,
"localeToggleEnabled": false,
"settingsButtonEnabled": true
},
"content": {
"close": "$close",
"settings": "$settings"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export default class Extension extends BaseExtension<Config>
$settingsDialogue: JQuery;
centerPanel: FileLinkCenterPanel;
shareDialogue: ShareDialogue;
footerPanel: FooterPanel;
headerPanel: HeaderPanel;
footerPanel: FooterPanel<Config["modules"]["footerPanel"]>;
headerPanel: HeaderPanel<Config["modules"]["headerPanel"]>;
helpDialogue: HelpDialogue;
leftPanel: ResourcesLeftPanel;
rightPanel: MoreInfoRightPanel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
import { BaseConfig } from "@/content-handlers/iiif/BaseConfig";
import {
BaseConfig,
LeftPanelContent,
LeftPanelOptions,
} from "@/content-handlers/iiif/BaseConfig";

type Modules = {};
type ResourcesLeftPanelOptions = LeftPanelOptions & {
expandFullEnabled: boolean;
panelAnimationDuration: number;
panelCollapsedWidth: number;
panelExpandedWidth: number;
panelOpen: boolean;
twoColThumbWidth: number;
twoColThumbHeight: number;
oneColThumbWidth: number;
oneColThumbHeight: number;
};

type ResourcesLeftPanelContent = LeftPanelContent & {
title: string;
};

type ResourcesLeftPanel = {
options: ResourcesLeftPanelOptions;
content: ResourcesLeftPanelContent;
};

type Modules = {
resourcesLeftPanel: ResourcesLeftPanel;
};

export type Config = BaseConfig & {
modules: Modules;
Expand Down
Loading

0 comments on commit bf0f2a3

Please sign in to comment.