diff options
Diffstat (limited to 'viewer/src')
44 files changed, 676 insertions, 337 deletions
diff --git a/viewer/src/@types/ItemType.ts b/viewer/src/@types/ItemType.ts index 31a395b..9974d4e 100644 --- a/viewer/src/@types/ItemType.ts +++ b/viewer/src/@types/ItemType.ts | |||
@@ -1,4 +1,21 @@ | |||
1 | // TODO: Convert all ambiant types related to LdGallery to modules | 1 | /* ldgallery - A static generator which turns a collection of tagged |
2 | -- pictures into a searchable web gallery. | ||
3 | -- | ||
4 | -- Copyright (C) 2019-2021 Guillaume FOUET | ||
5 | -- | ||
6 | -- This program is free software: you can redistribute it and/or modify | ||
7 | -- it under the terms of the GNU Affero General Public License as | ||
8 | -- published by the Free Software Foundation, either version 3 of the | ||
9 | -- License, or (at your option) any later version. | ||
10 | -- | ||
11 | -- This program is distributed in the hope that it will be useful, | ||
12 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | -- GNU Affero General Public License for more details. | ||
15 | -- | ||
16 | -- You should have received a copy of the GNU Affero General Public License | ||
17 | -- along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
18 | */ | ||
2 | 19 | ||
3 | export enum ItemType { | 20 | export enum ItemType { |
4 | OTHER = "other", | 21 | OTHER = "other", |
diff --git a/viewer/src/@types/gallery.d.ts b/viewer/src/@types/gallery.d.ts index e9b80e6..9011f19 100644 --- a/viewer/src/@types/gallery.d.ts +++ b/viewer/src/@types/gallery.d.ts | |||
@@ -17,98 +17,101 @@ | |||
17 | -- along with this program. If not, see <https://www.gnu.org/licenses/>. | 17 | -- along with this program. If not, see <https://www.gnu.org/licenses/>. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | declare namespace Gallery { | 20 | import { ItemType } from "./ItemType"; |
21 | type ItemSortStr = "title_asc" | "date_asc" | "date_desc"; | 21 | import { SplashScreenConfig } from "./splashscreen"; |
22 | 22 | ||
23 | interface Config { | 23 | export type ItemSortStr = "title_asc" | "date_asc" | "date_desc"; |
24 | galleryRoot: string; | ||
25 | galleryIndex?: string; | ||
26 | initialItemSort?: ItemSortStr; | ||
27 | initialTagDisplayLimit?: number; | ||
28 | } | ||
29 | 24 | ||
30 | interface GalleryProperties { | 25 | export interface Config { |
31 | galleryTitle: string; | 26 | galleryRoot: string; |
32 | tagCategories: RawTag[]; | 27 | galleryIndex?: string; |
33 | } | 28 | initialItemSort?: ItemSortStr; |
34 | interface Index { | 29 | initialTagDisplayLimit?: number; |
35 | properties: GalleryProperties; | 30 | splashScreen?: SplashScreenConfig; |
36 | tree: Directory; | 31 | } |
37 | } | 32 | |
33 | export interface Properties { | ||
34 | galleryTitle: string; | ||
35 | tagCategories: RawTag[]; | ||
36 | } | ||
37 | export interface Index { | ||
38 | properties: Properties; | ||
39 | tree: DirectoryItem; | ||
40 | } | ||
41 | |||
42 | export interface OtherItem extends Item { | ||
43 | properties: OtherProperties; | ||
44 | } | ||
45 | export interface PictureItem extends Item { | ||
46 | properties: PictureProperties; | ||
47 | } | ||
48 | export interface PlainTextItem extends Item { | ||
49 | properties: PlainTextProperties; | ||
50 | } | ||
51 | export interface PDFItem extends Item { | ||
52 | properties: PDFProperties; | ||
53 | } | ||
54 | export interface VideoItem extends Item { | ||
55 | properties: VideoProperties; | ||
56 | } | ||
57 | export interface AudioItem extends Item { | ||
58 | properties: AudioProperties; | ||
59 | } | ||
60 | export interface DirectoryItem extends Item { | ||
61 | properties: DirectoryProperties; | ||
62 | } | ||
63 | export interface Item { | ||
64 | title: string; | ||
65 | datetime: string; | ||
66 | description: string; | ||
67 | tags: RawTag[]; | ||
68 | path: string; | ||
69 | thumbnail?: Thumbnail; | ||
70 | properties: | ||
71 | | OtherProperties | ||
72 | | PictureProperties | ||
73 | | PlainTextProperties | ||
74 | | PDFProperties | ||
75 | | VideoProperties | ||
76 | | AudioProperties | ||
77 | | DirectoryProperties; | ||
78 | } | ||
79 | export interface Resolution { | ||
80 | width: number; | ||
81 | height: number; | ||
82 | } | ||
83 | export interface OtherProperties { | ||
84 | type: ItemType.OTHER; | ||
85 | resource: string; | ||
86 | } | ||
87 | export interface PictureProperties { | ||
88 | type: ItemType.PICTURE; | ||
89 | resource: string; | ||
90 | resolution: Resolution; | ||
91 | } | ||
92 | export interface PlainTextProperties { | ||
93 | type: ItemType.PLAINTEXT; | ||
94 | resource: string; | ||
95 | } | ||
96 | export interface PDFProperties { | ||
97 | type: ItemType.PDF; | ||
98 | resource: string; | ||
99 | } | ||
100 | export interface VideoProperties { | ||
101 | type: ItemType.VIDEO; | ||
102 | resource: string; | ||
103 | } | ||
104 | export interface AudioProperties { | ||
105 | type: ItemType.AUDIO; | ||
106 | resource: string; | ||
107 | } | ||
108 | export interface DirectoryProperties { | ||
109 | type: ItemType.DIRECTORY; | ||
110 | items: Item[]; | ||
111 | } | ||
38 | 112 | ||
39 | interface Other extends Item { | 113 | export interface Thumbnail { |
40 | properties: OtherProperties; | 114 | resource: string; |
41 | } | 115 | resolution: Resolution; |
42 | interface Picture extends Item { | ||
43 | properties: PictureProperties; | ||
44 | } | ||
45 | interface PlainText extends Item { | ||
46 | properties: PlainTextProperties; | ||
47 | } | ||
48 | interface PDF extends Item { | ||
49 | properties: PDFProperties; | ||
50 | }< |