memories/src/types.ts

136 lines
3.1 KiB
TypeScript
Raw Normal View History

2022-09-13 01:33:24 +00:00
export type IFileInfo = {
2022-10-06 18:15:41 +00:00
/** Database file ID */
2022-09-13 01:33:24 +00:00
fileid: number;
2022-10-06 18:15:41 +00:00
/** Full file name, e.g. /pi/test/Qx0dq7dvEXA.jpg */
2022-09-13 01:33:24 +00:00
filename: string;
2022-10-06 18:15:41 +00:00
/** Base name of file e.g. Qx0dq7dvEXA.jpg */
basename: string;
/** Etag identifier */
2022-09-13 01:33:24 +00:00
etag: string;
2022-10-06 18:15:41 +00:00
/** File has preview available */
2022-09-13 01:48:05 +00:00
hasPreview: boolean;
2022-10-06 18:15:41 +00:00
/** File is marked favorite */
favorite: boolean;
/** Vue flags */
2022-09-13 01:48:05 +00:00
flag?: number;
2022-09-13 01:33:24 +00:00
}
export type IDay = {
/** Day ID */
dayid: number;
/** Number of photos in this day */
count: number;
/** Set of rows in the day */
rows?: Set<IRow>;
/** List of photos for this day */
detail?: IPhoto[];
/** WebDAV fileInfos, fetched before viewer open */
fileInfos?: IFileInfo[];
/** Original fileIds from fileInfos */
origFileIds?: Set<number>;
}
export type IPhoto = {
/** Nextcloud ID of file */
fileid: number;
/** Etag from server */
etag?: string;
/** Bit flags */
flag: number;
2022-10-06 19:24:45 +00:00
/** DayID from server */
dayid?: number;
2022-09-13 01:33:24 +00:00
/** Reference to day object */
d?: IDay;
/** Video flag from server */
isvideo?: boolean;
/** Favorite flag from server */
isfavorite?: boolean;
2022-09-13 04:59:35 +00:00
/** Is this a folder */
isfolder?: boolean;
2022-10-06 23:28:35 +00:00
/** Is this a tag */
istag?: boolean;
/** Is this a face */
isface?: boolean;
2022-09-25 14:37:03 +00:00
/** Optional datetaken epoch */
datetaken?: number;
2022-09-13 01:33:24 +00:00
}
2022-09-13 01:48:05 +00:00
export interface IFolder extends IPhoto {
/** Path to folder */
path: string;
/** FileInfos for preview images */
previewFileInfos?: IFileInfo[];
2022-09-13 02:06:35 +00:00
/** Name of folder */
name: string;
2022-09-13 01:48:05 +00:00
}
2022-10-06 23:28:35 +00:00
export interface ITag extends IPhoto {
/** Name of tag */
name: string;
/** Number of images in this tag */
count: number;
/** ID of face if this is a face */
faceid?: number;
2022-10-06 23:28:35 +00:00
}
2022-09-13 01:33:24 +00:00
export type IRow = {
/** Vue Recycler identifier */
id?: number;
/** Day ID */
dayId: number;
/** Refrence to day object */
day: IDay;
/** Whether this is a head row */
2022-09-15 03:52:58 +00:00
type: IRowType;
2022-09-13 01:33:24 +00:00
/** [Head only] Title of the header */
name?: string;
2022-09-15 17:49:51 +00:00
/** [Head only] Boolean if the entire day is selected */
selected?: boolean;
2022-09-13 01:33:24 +00:00
/** Main list of photo items */
photos?: IPhoto[];
/** Height in px of the row */
size?: number;
/** Count of placeholders to create */
pct?: number;
}
2022-09-15 17:49:51 +00:00
export type IHeadRow = IRow & {
type: IRowType.HEAD;
selected: boolean;
}
2022-09-15 03:52:58 +00:00
export enum IRowType {
HEAD = 0,
PHOTOS = 1,
2022-09-16 21:37:52 +00:00
FOLDERS = 2,
2022-09-15 03:52:58 +00:00
}
2022-09-13 01:33:24 +00:00
export type ITick = {
/** Day ID */
dayId: number;
2022-09-16 22:55:57 +00:00
/** Number of ROWS above this (dynamic) */
2022-09-13 01:33:24 +00:00
top: number;
2022-09-16 22:55:57 +00:00
/** Extra static distance from top (for headers) */
2022-09-13 01:33:24 +00:00
topS: number;
2022-09-16 22:55:57 +00:00
/** Actual Y position calculated (C) */
2022-09-13 01:33:24 +00:00
topC: number;
/** Text if any (e.g. year) */
text?: string | number;
/** Whether this tick should be shown */
s?: boolean;
}
export type TopMatter = {
type: TopMatterType;
}
export enum TopMatterType {
NONE = 0,
FOLDER = 1,
2022-10-07 22:56:43 +00:00
TAG = 2,
}
export type TopMatterFolder = TopMatter & {
type: TopMatterType.FOLDER;
list: {
text: string;
path: string;
}[];
}