diff --git a/site/src/lib/ApplicationsStore.svelte.ts b/site/src/lib/ApplicationsStore.svelte.ts index 4fcf292..81c51f0 100644 --- a/site/src/lib/ApplicationsStore.svelte.ts +++ b/site/src/lib/ApplicationsStore.svelte.ts @@ -4,138 +4,135 @@ import { post } from './utils'; export type AsEnum = T[keyof T]; export const ApplicationStatus = Object.freeze({ - ToApply: 0, - WorkingOnIt: 1, - Ignore: 2, - ApplyedButSaidNo: 3, - Applyed: 4, - Expired: 5, - TasksToDo: 6, - LinkedApplication: 7, - InterviewStep1: 8 + ToApply: 0, + WorkingOnIt: 1, + Ignore: 2, + ApplyedButSaidNo: 3, + Applyed: 4, + Expired: 5, + TasksToDo: 6, + LinkedApplication: 7, + InterviewStep1: 8 }); -export const ApplicationStatusMaping: Record< - (typeof ApplicationStatus)[keyof typeof ApplicationStatus], - string -> = Object.freeze({ - 0: 'To Apply', - 1: 'Working On It', - 2: 'Ignore', - 3: 'Applyed But Said No', - 4: 'Applyed', - 5: 'Expired', - 6: 'Tasks To Do', - 7: 'Linked Application', - 8: 'Interview 1' +export const ApplicationStatusMaping: Record, string> = Object.freeze({ + 0: 'To Apply', + 1: 'Working On It', + 2: 'Ignore', + 3: 'Applyed But Said No', + 4: 'Applyed', + 5: 'Expired', + 6: 'Tasks To Do', + 7: 'Linked Application', + 8: 'Interview 1' }); export type View = { - id: string; - application_id: string; - time: string; + id: string; + application_id: string; + time: string; }; export type Application = { - id: string; - url: string; - original_url: string | null; - unique_url: string | null; - title: string; - user_id: string; - extra_data: string; - payrange: string; - status: AsEnum; - recruiter: string; - company: string; - message: string; - linked_application: string; - application_time: string; - create_time: string; - status_history: string; - flairs: Flair[]; - views: View[]; + id: string; + url: string; + original_url: string | null; + unique_url: string | null; + title: string; + user_id: string; + extra_data: string; + payrange: string; + status: AsEnum; + recruiter: string; + company: string; + message: string; + linked_application: string; + application_time: string; + create_time: string; + status_history: string; + flairs: Flair[]; + views: View[]; }; function createApplicationStore() { - let applications: Application[] = $state([]); - let applyed: Application[] = $state([]); - let all: Application[] = $state([]); + let applications: Application[] = $state([]); + let applyed: Application[] = $state([]); + let all: Application[] = $state([]); - let dragApplication: Application | undefined = $state(undefined); + let dragApplication: Application | undefined = $state(undefined); - let loadItem: Application | undefined = $state(undefined); + let loadItem: Application | undefined = $state(undefined); - return { - /** - * @throws {Error} - */ - async loadApplications(force = false) { - if (!force && applications.length > 1) { - return; - } - applications = await post('application/list', { status: 0 }); - }, + return { + /** + * @throws {Error} + */ + async loadApplications(force = false) { + if (!force && applications.length > 1) { + return; + } + applications = await post('application/list', { status: 0 }); + }, - /** - * @throws {Error} - */ - async loadAplyed(force = false) { - if (!force && applyed.length > 1) { - return; - } - applyed = await post('application/list', { status: ApplicationStatus.Applyed, views: true }); - }, + /** + * @throws {Error} + */ + async loadAplyed(force = false) { + if (!force && applyed.length > 1) { + return; + } + applyed = await post('application/list', { status: ApplicationStatus.Applyed, views: true }); + }, - /** - * @throws {Error} - */ - async loadAll(force = false) { - if (!force && all.length > 1) { - return; - } - all = await post('application/list', {}); - }, + /** + * @throws {Error} + */ + async loadAll(force = false) { + if (!force && all.length > 1) { + return; + } + all = await post('application/list', {}); + }, - clear() { - applications = []; - }, + clear() { + applications = []; + }, - dragStart(application: Application | undefined) { + dragStart(application: Application | undefined) { if (!application) { return; } - dragApplication = application; - }, + dragApplication = application; + }, - dragEnd() { - dragApplication = undefined; - }, + dragEnd() { + dragApplication = undefined; + }, - get dragging() { - return dragApplication; - }, + get dragging() { + return dragApplication; + }, - get applications() { - return applications; - }, + get applications() { + return applications; + }, - get applyed() { - return applyed; - }, + get applyed() { + return applyed; + }, - get all() { - return all; - }, + get all() { + return all; + }, - get loadItem() { - return loadItem; - }, + get loadItem() { + return loadItem; + }, - set loadItem(item: Application | undefined) { - loadItem = item; - } - }; + set loadItem(item: Application | undefined) { + loadItem = item; + } + }; } export const applicationStore = createApplicationStore(); diff --git a/site/src/routes/work-area/WorkArea.svelte b/site/src/routes/work-area/WorkArea.svelte index 76a4a6e..01b4fda 100644 --- a/site/src/routes/work-area/WorkArea.svelte +++ b/site/src/routes/work-area/WorkArea.svelte @@ -487,6 +487,9 @@ > Tasks To Do + {/if} + + {#if [ApplicationStatus.TasksToDo, ApplicationStatus.Applyed].includes(activeItem.status)}