From 74c1c5e34787ac57299c8cbd874e9dcc56da406d Mon Sep 17 00:00:00 2001 From: Zero~Informatique Date: Fri, 22 May 2020 04:14:48 +0200 Subject: viewer: Enumerated item types --- viewer/src/@types/ItemType.ts | 11 +++++++++++ viewer/src/@types/gallery.d.ts | 27 +++++++++++++-------------- 2 files changed, 24 insertions(+), 14 deletions(-) create mode 100644 viewer/src/@types/ItemType.ts (limited to 'viewer/src/@types') diff --git a/viewer/src/@types/ItemType.ts b/viewer/src/@types/ItemType.ts new file mode 100644 index 0000000..31a395b --- /dev/null +++ b/viewer/src/@types/ItemType.ts @@ -0,0 +1,11 @@ +// TODO: Convert all ambiant types related to LdGallery to modules + +export enum ItemType { + OTHER = "other", + PICTURE = "picture", + PLAINTEXT = "plaintext", + PDF = "pdf", + VIDEO = "video", + AUDIO = "audio", + DIRECTORY = "directory", +} diff --git a/viewer/src/@types/gallery.d.ts b/viewer/src/@types/gallery.d.ts index 2407f98..151ae92 100644 --- a/viewer/src/@types/gallery.d.ts +++ b/viewer/src/@types/gallery.d.ts @@ -60,44 +60,44 @@ declare namespace Gallery { path: string, thumbnail?: Thumbnail properties: OtherProperties - | PictureProperties - | PlainTextProperties - | PDFProperties - | VideoProperties - | AudioProperties - | DirectoryProperties, + | PictureProperties + | PlainTextProperties + | PDFProperties + | VideoProperties + | AudioProperties + | DirectoryProperties, } interface Resolution { width: number, height: number, } interface OtherProperties { - type: "other", + type: import("./ItemType").ItemType.OTHER, resource: string } interface PictureProperties { - type: "picture", + type: import("./ItemType").ItemType.PICTURE, resource: string, resolution: Resolution } interface PlainTextProperties { - type: "plaintext", + type: import("./ItemType").ItemType.PLAINTEXT, resource: string, } interface PDFProperties { - type: "pdf", + type: import("./ItemType").ItemType.PDF, resource: string, } interface VideoProperties { - type: "video", + type: import("./ItemType").ItemType.VIDEO, resource: string, } interface AudioProperties { - type: "audio", + type: import("./ItemType").ItemType.AUDIO, resource: string, } interface DirectoryProperties { - type: "directory", + type: import("./ItemType").ItemType.DIRECTORY, items: Item[] } interface Thumbnail { @@ -105,5 +105,4 @@ declare namespace Gallery { resolution: Resolution } type RawTag = string; - type ItemType = "other" | "picture" | "plaintext" | "pdf" | "video" | "audio" | "directory"; } -- cgit v1.2.3