feat: add information and update chunk loading

This commit is contained in:
PandaDEV 2024-12-16 23:38:35 +10:00
parent c48a0d8239
commit 149e72802c
No known key found for this signature in database
GPG key ID: 13EFF9BAF70EE75C
7 changed files with 435 additions and 151 deletions

View file

@ -1,4 +1,4 @@
import { v4 as uuidv4 } from 'uuid';
import { v4 as uuidv4 } from "uuid";
export enum ContentType {
Text = "text",
@ -11,21 +11,52 @@ export enum ContentType {
export class HistoryItem {
id: string;
source: string;
source_icon?: string;
content_type: ContentType;
content: string;
favicon?: string;
timestamp: Date;
language?: string;
constructor(content_type: ContentType, content: string, favicon?: string) {
constructor(
source: string,
content_type: ContentType,
content: string,
favicon?: string,
source_icon?: string,
language?: string
) {
this.id = uuidv4();
this.source = source;
this.source_icon = source_icon;
this.content_type = content_type;
this.content = content;
this.favicon = favicon;
this.timestamp = new Date();
this.language = language;
}
toRow(): [string, string, string, string | undefined, Date] {
return [this.id, this.content_type, this.content, this.favicon, this.timestamp];
toRow(): [
string,
string,
string | undefined,
string,
string,
string | undefined,
Date,
string | undefined
] {
return [
this.id,
this.source,
this.source_icon,
this.content_type,
this.content,
this.favicon,
this.timestamp,
this.language,
];
}
}
@ -33,3 +64,52 @@ export interface Settings {
key: string;
value: string;
}
export interface Text {
source: string;
content_type: ContentType.Text;
characters: number;
words: number;
copied: Date;
}
export interface Image {
source: string;
content_type: ContentType.Image;
dimensions: string;
size: number;
copied: Date;
}
export interface File {
source: string;
content_type: ContentType.File;
path: string;
filesize: number;
copied: Date;
}
export interface Link {
source: string;
content_type: ContentType.Link;
title: string;
link: string;
characters: number;
copied: Date;
}
export interface Color {
source: string;
content_type: ContentType.Color;
hexcode: string;
rgba: string;
copied: Date;
}
export interface Code {
source: string;
content_type: ContentType.Code;
language: string;
lines: number;
copied: Date;
}