diff --git a/api/src/main/kotlin/com/andr3h3nriqu3s/applications/ApplicationsController.kt b/api/src/main/kotlin/com/andr3h3nriqu3s/applications/ApplicationsController.kt index a2b64e1..eec119f 100644 --- a/api/src/main/kotlin/com/andr3h3nriqu3s/applications/ApplicationsController.kt +++ b/api/src/main/kotlin/com/andr3h3nriqu3s/applications/ApplicationsController.kt @@ -33,6 +33,7 @@ data class Application( var recruiter: String, var message: String, var linked_application: String, + var status_history: String, var flairs: List, var views: List, ) { @@ -52,6 +53,7 @@ data class Application( rs.getString("recruiter"), rs.getString("message"), rs.getString("linked_application"), + rs.getString("status_history"), emptyList(), emptyList(), ) @@ -182,6 +184,7 @@ class ApplicationsController( "", "", "", + "", emptyList(), emptyList(), ) @@ -259,6 +262,13 @@ class ApplicationsController( } application.status = info.status + val status_string = "${info.status}"; + var status_history = application.status_history.split(",").filter { it.length >= 1 } + if (status_history.indexOf(status_string) == -1) { + status_history = status_history.plus("${info.status}"); + } + + application.status_history = status_history.joinToString(",") { it } applicationService.update(application) @@ -466,7 +476,7 @@ class ApplicationService( } db.update( - "insert into applications (id, url, original_url, unique_url, title, user_id, extra_data, payrange, status, company, recruiter, message, linked_application) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", + "insert into applications (id, url, original_url, unique_url, title, user_id, extra_data, payrange, status, company, recruiter, message, linked_application, status_history) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", application.id, application.url, application.original_url, @@ -480,6 +490,7 @@ class ApplicationService( application.recruiter, application.message, application.linked_application, + application.status_history, ) return true @@ -516,7 +527,7 @@ class ApplicationService( public fun update(application: Application): Application { db.update( - "update applications set url=?, original_url=?, unique_url=?, title=?, user_id=?, extra_data=?, payrange=?, status=?, company=?, recruiter=?, message=?, linked_application=? where id=?", + "update applications set url=?, original_url=?, unique_url=?, title=?, user_id=?, extra_data=?, payrange=?, status=?, company=?, recruiter=?, message=?, linked_application=?, status_history=? where id=?", application.url, application.original_url, application.unique_url, @@ -529,6 +540,7 @@ class ApplicationService( application.recruiter, application.message, application.linked_application, + application.status_history, application.id, ) return application diff --git a/api/src/main/resources/schema.sql b/api/src/main/resources/schema.sql index d670a74..704d8a3 100644 --- a/api/src/main/resources/schema.sql +++ b/api/src/main/resources/schema.sql @@ -20,6 +20,7 @@ create table if not exists applications ( recruiter text, title text, mesasge text default '', + status_history text default '', user_id text, extra_data text, status integer, diff --git a/extensions/background-script.js b/extensions/background-script.js index 42b5700..2e9a6d6 100644 --- a/extensions/background-script.js +++ b/extensions/background-script.js @@ -80,6 +80,7 @@ async function startup() { }); browser.menus.onClicked.addListener(async function (e, tab) { + console.log("here") if (e.menuItemId === "mark-page") { console.log("set mark-page", tab.id) await browser.storage.local.set({ @@ -90,4 +91,4 @@ async function startup() { } browser.runtime.onInstalled.addListener(startup); -browser.runtime.onStartup.addListener(startup); +browser.runtime.onConnect.addListener(startup); diff --git a/site/src/lib/ApplicationsStore.svelte.ts b/site/src/lib/ApplicationsStore.svelte.ts index dad855e..4d12780 100644 --- a/site/src/lib/ApplicationsStore.svelte.ts +++ b/site/src/lib/ApplicationsStore.svelte.ts @@ -9,7 +9,8 @@ export const ApplicationStatus = Object.freeze({ Ignore: 2, ApplyedButSaidNo: 3, Applyed: 4, - Expired: 5 + Expired: 5, + TasksToDo: 6, }); export const ApplicationStatusMaping: Record< @@ -21,7 +22,8 @@ export const ApplicationStatusMaping: Record< 2: 'Ignore', 3: 'Applyed But Said No', 4: 'Applyed', - 5: 'Expired' + 5: 'Expired', + 6: 'Tasks To Do', }); export type View = { @@ -51,9 +53,12 @@ export type Application = { function createApplicationStore() { let applications: Application[] = $state([]); let applyed: Application[] = $state([]); + let tasksToDo: Application[] = $state([]); let dragApplication: Application | undefined = $state(undefined); + let loadItem: Application | undefined = $state(undefined); + return { /** * @throws {Error} @@ -69,12 +74,22 @@ function createApplicationStore() { * @throws {Error} */ async loadAplyed(force = false) { - if (!force && applications.length > 1) { + if (!force && applyed.length > 1) { return; } applyed = await post('application/list', { status: ApplicationStatus.Applyed }); }, + /** + * @throws {Error} + */ + async loadTasksToDo(force = false) { + if (!force && tasksToDo.length > 1) { + return; + } + tasksToDo = await post('application/list', { status: ApplicationStatus.TasksToDo }); + }, + clear() { applications = []; }, @@ -97,7 +112,19 @@ function createApplicationStore() { get applyed() { return applyed; - } + }, + + get tasksToDo() { + return tasksToDo; + }, + + get loadItem() { + return loadItem; + }, + + set loadItem(item: Application | undefined) { + loadItem = item; + }, }; } diff --git a/site/src/routes/+page.svelte b/site/src/routes/+page.svelte index b551b75..07e897c 100644 --- a/site/src/routes/+page.svelte +++ b/site/src/routes/+page.svelte @@ -4,6 +4,7 @@ import ApplicationsList from './ApplicationsList.svelte'; import WorkArea from './work-area/WorkArea.svelte'; import AppliyedList from './AppliyedList.svelte'; + import TasksToDoList from './TasksToDoList.svelte'; @@ -14,6 +15,7 @@ + diff --git a/site/src/routes/AppliyedList.svelte b/site/src/routes/AppliyedList.svelte index 8f234fe..67b5d1c 100644 --- a/site/src/routes/AppliyedList.svelte +++ b/site/src/routes/AppliyedList.svelte @@ -11,18 +11,17 @@

Applied

{#each applicationStore.applyed as item} -
applicationStore.dragStart(item)} - ondragend={() => { - window.requestAnimationFrame(() => { - applicationStore.dragEnd(); + {/each}
diff --git a/site/src/routes/TasksToDoList.svelte b/site/src/routes/TasksToDoList.svelte new file mode 100644 index 0000000..6f1d702 --- /dev/null +++ b/site/src/routes/TasksToDoList.svelte @@ -0,0 +1,45 @@ + + +{#if applicationStore.tasksToDo.length > 0} +
+

Tasks To Do

+
+ {#each applicationStore.tasksToDo as item} + + {/each} +
+
+{/if} diff --git a/site/src/routes/graphs/+page.svelte b/site/src/routes/graphs/+page.svelte index 2c42f46..1468ccf 100644 --- a/site/src/routes/graphs/+page.svelte +++ b/site/src/routes/graphs/+page.svelte @@ -31,6 +31,7 @@ [ApplicationStatus.ApplyedButSaidNo]: 0, [ApplicationStatus.Expired]: 0, [ApplicationStatus.Applyed]: 0, + [ApplicationStatus.TasksToDo]: 0, Linkedin: 0, Glassdoor: 0, 'Unknown Source': 0, @@ -51,6 +52,11 @@ source: ApplicationStatus.Applyed, target: ApplicationStatus.ApplyedButSaidNo, value: 1 + }, + { + source: ApplicationStatus.Applyed, + target: ApplicationStatus.TasksToDo, + value: 1 } ]; @@ -63,7 +69,7 @@ nodeTypes['Unknown Source'] += 1; } nodeTypes[a.status] += 1; - if (a.status === ApplicationStatus.ApplyedButSaidNo) { + if ([ApplicationStatus.ApplyedButSaidNo, ApplicationStatus.TasksToDo].includes(a.status) ) { nodeTypes[ApplicationStatus.Applyed] += 1; } }); diff --git a/site/src/routes/work-area/WorkArea.svelte b/site/src/routes/work-area/WorkArea.svelte index 6ab5a63..144c8f2 100644 --- a/site/src/routes/work-area/WorkArea.svelte +++ b/site/src/routes/work-area/WorkArea.svelte @@ -14,6 +14,7 @@ import DropZone from './DropZone.svelte'; import { userStore } from '$lib/UserStore.svelte'; import LinkApplication from './LinkApplication.svelte'; + import ApplicationsList from '../ApplicationsList.svelte'; let activeItem: Application | undefined = $state(); @@ -148,6 +149,14 @@ loadActive(); }); + $effect(() => { + if (!applicationStore.loadItem) { + return; + } + activeItem = applicationStore.loadItem; + applicationStore.loadItem = undefined; + }); + async function moveStatus(status: number) { if (!activeItem) return; // Deactivate active item @@ -372,7 +381,13 @@ {#if activeItem.original_url != null} {/if} - + {#if applicationStore.dragging} @@ -384,48 +399,69 @@ icon="box-arrow-down" ondrop={() => { moveStatus(ApplicationStatus.ToApply); + applicationStore.loadAplyed(true); + applicationStore.loadTasksToDo(true); }} > To apply - - { - moveStatus(ApplicationStatus.Ignore); - }} - > - Ignore it - + {#if activeItem.status === ApplicationStatus.WorkingOnIt} + + { + moveStatus(ApplicationStatus.Ignore); + }} + > + Ignore it + - - { - if (activeItem && activeItem.status === ApplicationStatus.Expired) { - moveStatus(ApplicationStatus.ToApply); - } else { - moveStatus(ApplicationStatus.Expired); - } - }} - > - Mark as expired - + + { + if (activeItem && activeItem.status === ApplicationStatus.Expired) { + moveStatus(ApplicationStatus.ToApply); + } else { + moveStatus(ApplicationStatus.Expired); + } + }} + > + Mark as expired + - - remove()}>Delete it + + remove()} + >Delete it - - { - await moveStatus(ApplicationStatus.Applyed); - applicationStore.loadAplyed(true); - }} - > - Apply - + + { + await moveStatus(ApplicationStatus.Applyed); + applicationStore.loadAplyed(true); + applicationStore.loadTasksToDo(true); + }} + > + Apply + + {/if} + + {#if activeItem.status === ApplicationStatus.Applyed} + + { + await moveStatus(ApplicationStatus.TasksToDo); + applicationStore.loadTasksToDo(true); + applicationStore.loadAplyed(true); + }} + > + Tasks To Do + + {/if}