memories/src/types.ts

152 lines
3.4 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;
2022-10-16 20:55:07 +00:00
/** Rows in the day */
rows?: IRow[];
2022-09-13 01:33:24 +00:00
/** List of photos for this day */
detail?: IPhoto[];
}
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-10-15 19:23:31 +00:00
/** Width of full image */
w?: number;
/** Height of full image */
h?: number;
2022-10-16 02:55:53 +00:00
/** Grid display width percentage */
dispWp?: number;
2022-10-16 22:47:14 +00:00
/** Grid display height (forced) */
dispH?: number;
/** Grid display X percentage */
dispXp?: number;
/** Grid display Y px */
dispY?: number;
/** Grid display row id (relative to head) */
dispRowNum?: 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;
2022-10-08 06:26:09 +00:00
/** User for face if face */
user_id?: string;
2022-10-08 00:26:10 +00:00
/** Cache of previews */
previews?: IPhoto[];
2022-10-06 23:28:35 +00:00
}
2022-09-13 01:33:24 +00:00
export type IRow = {
/** Vue Recycler identifier */
2022-10-16 20:55:07 +00:00
id?: string;
2022-10-16 22:47:14 +00:00
/** Row ID from head */
num: number;
2022-09-13 01:33:24 +00:00
/** 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-10-12 20:23:29 +00:00
super?: string;
2022-09-15 17:49:51 +00:00
}
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-10-15 17:41:49 +00:00
/** Display top position */
2022-10-16 02:55:53 +00:00
topF: number;
/** Display top position (truncated to 1 decimal pt) */
2022-09-13 01:33:24 +00:00
top: number;
2022-10-15 17:41:49 +00:00
/** Y coordinate on recycler */
y: number;
2022-09-13 01:33:24 +00:00
/** 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,
2022-10-08 06:52:41 +00:00
FACE = 3,
}
export type TopMatterFolder = TopMatter & {
type: TopMatterType.FOLDER;
list: {
text: string;
path: string;
}[];
}