memories/src/types.ts

93 lines
2.1 KiB
TypeScript
Raw Normal View History

2022-09-13 01:33:24 +00:00
export type IFileInfo = {
fileid: number;
filename: string;
etag: string;
2022-09-13 01:48:05 +00:00
hasPreview: boolean;
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;
/** 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-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-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;
/** Top row at this */
top: number;
/** Static distance from top (for headers) */
topS: number;
/** Count row distance from top (dynamic) */
topC: number;
/** Text if any (e.g. year) */
text?: string | number;
/** Whether this tick should be shown */
s?: boolean;
}