feat: added linked application to graph
This commit is contained in:
parent
9f9b335557
commit
d8b0556a3e
@ -24,7 +24,8 @@ create table if not exists applications (
|
|||||||
user_id text,
|
user_id text,
|
||||||
extra_data text,
|
extra_data text,
|
||||||
status integer,
|
status integer,
|
||||||
linked_application text default ''
|
linked_application text default '',
|
||||||
|
application_time text default ''
|
||||||
);
|
);
|
||||||
|
|
||||||
create table if not exists views (
|
create table if not exists views (
|
||||||
|
@ -78,17 +78,17 @@ async function startup() {
|
|||||||
title: "Mark Page As the Url target",
|
title: "Mark Page As the Url target",
|
||||||
contexts: ["all"],
|
contexts: ["all"],
|
||||||
});
|
});
|
||||||
|
|
||||||
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({
|
|
||||||
windows: tab.id,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
browser.runtime.onInstalled.addListener(startup);
|
browser.runtime.onInstalled.addListener(startup);
|
||||||
|
browser.runtime.onStartup.addListener(startup);
|
||||||
browser.runtime.onConnect.addListener(startup);
|
browser.runtime.onConnect.addListener(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({
|
||||||
|
windows: tab.id,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
@ -11,6 +11,7 @@ export const ApplicationStatus = Object.freeze({
|
|||||||
Applyed: 4,
|
Applyed: 4,
|
||||||
Expired: 5,
|
Expired: 5,
|
||||||
TasksToDo: 6,
|
TasksToDo: 6,
|
||||||
|
LinkedApplication: 7
|
||||||
});
|
});
|
||||||
|
|
||||||
export const ApplicationStatusMaping: Record<
|
export const ApplicationStatusMaping: Record<
|
||||||
@ -24,6 +25,7 @@ export const ApplicationStatusMaping: Record<
|
|||||||
4: 'Applyed',
|
4: 'Applyed',
|
||||||
5: 'Expired',
|
5: 'Expired',
|
||||||
6: 'Tasks To Do',
|
6: 'Tasks To Do',
|
||||||
|
7: 'Linked Application',
|
||||||
});
|
});
|
||||||
|
|
||||||
export type View = {
|
export type View = {
|
||||||
|
@ -5,19 +5,36 @@
|
|||||||
onMount(() => {
|
onMount(() => {
|
||||||
applicationStore.loadAplyed();
|
applicationStore.loadAplyed();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let filter = $state('');
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="card p-3 rounded-lg flex flex-col">
|
<div class="card p-3 rounded-lg flex flex-col">
|
||||||
<h1>Applied</h1>
|
<h1 class="flex gap-2">
|
||||||
|
Applied <input bind:value={filter} placeholder="search" class="flex-grow text-blue-500" />
|
||||||
|
</h1>
|
||||||
<div class="overflow-auto flex-grow">
|
<div class="overflow-auto flex-grow">
|
||||||
{#each applicationStore.applyed as item}
|
{#each applicationStore.applyed.filter((i) => {
|
||||||
|
if (!filter) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
const f = new RegExp(filter, 'ig');
|
||||||
|
|
||||||
|
let x = i.title;
|
||||||
|
|
||||||
|
if (i.company) {
|
||||||
|
x = `${x} @ ${i.company}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return x.match(f);
|
||||||
|
}) as item}
|
||||||
<button
|
<button
|
||||||
class="card p-2 my-2 bg-slate-100 w-full text-left"
|
class="card p-2 my-2 bg-slate-100 w-full text-left"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
applicationStore.loadItem = item;
|
applicationStore.loadItem = item;
|
||||||
window.scrollTo({
|
window.scrollTo({
|
||||||
top: 0,
|
top: 0,
|
||||||
behavior: 'smooth',
|
behavior: 'smooth'
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -32,34 +32,50 @@
|
|||||||
[ApplicationStatus.Expired]: 0,
|
[ApplicationStatus.Expired]: 0,
|
||||||
[ApplicationStatus.Applyed]: 0,
|
[ApplicationStatus.Applyed]: 0,
|
||||||
[ApplicationStatus.TasksToDo]: 0,
|
[ApplicationStatus.TasksToDo]: 0,
|
||||||
|
[ApplicationStatus.LinkedApplication]: 0,
|
||||||
Linkedin: 0,
|
Linkedin: 0,
|
||||||
Glassdoor: 0,
|
Glassdoor: 0,
|
||||||
'Unknown Source': 0,
|
'Unknown Source': 0,
|
||||||
Applications: applications.length
|
Applications: applications.length
|
||||||
};
|
};
|
||||||
|
|
||||||
const baseLinks: { source: NodeType; target: NodeType; value: 0 | 1 }[] = [
|
const showPercentage: string[] = [
|
||||||
{ source: 'Linkedin', target: 'Applications', value: 0 },
|
`${ApplicationStatus.ToApply}`,
|
||||||
{ source: 'Glassdoor', target: 'Applications', value: 0 },
|
`${ApplicationStatus.Ignore}`,
|
||||||
{ source: 'Unknown Source', target: 'Applications', value: 0 },
|
`${ApplicationStatus.Expired}`,
|
||||||
{ source: 'Applications', target: ApplicationStatus.ToApply, value: 1 },
|
`${ApplicationStatus.Applyed}`,
|
||||||
{ source: 'Applications', target: ApplicationStatus.Ignore, value: 1 },
|
`${ApplicationStatus.LinkedApplication}`,
|
||||||
{ source: 'Applications', target: ApplicationStatus.Expired, value: 1 },
|
`${ApplicationStatus.ApplyedButSaidNo}`,
|
||||||
{ source: 'Applications', target: ApplicationStatus.WorkingOnIt, value: 1 },
|
`${ApplicationStatus.TasksToDo}`
|
||||||
{ source: 'Applications', target: ApplicationStatus.Applyed, value: 1 },
|
|
||||||
|
|
||||||
{
|
|
||||||
source: ApplicationStatus.Applyed,
|
|
||||||
target: ApplicationStatus.ApplyedButSaidNo,
|
|
||||||
value: 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
source: ApplicationStatus.Applyed,
|
|
||||||
target: ApplicationStatus.TasksToDo,
|
|
||||||
value: 1
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const baseLinks: { source: NodeType; target: NodeType; value: 0 | 1; end?: boolean }[] =
|
||||||
|
[
|
||||||
|
{ source: 'Linkedin', target: 'Applications', value: 0 },
|
||||||
|
{ source: 'Glassdoor', target: 'Applications', value: 0 },
|
||||||
|
{ source: 'Unknown Source', target: 'Applications', value: 0 },
|
||||||
|
{ source: 'Applications', target: ApplicationStatus.ToApply, value: 1 },
|
||||||
|
{ source: 'Applications', target: ApplicationStatus.Ignore, value: 1 },
|
||||||
|
{ source: 'Applications', target: ApplicationStatus.Expired, value: 1 },
|
||||||
|
{ source: 'Applications', target: ApplicationStatus.Applyed, value: 1 },
|
||||||
|
{
|
||||||
|
source: 'Applications',
|
||||||
|
target: ApplicationStatus.LinkedApplication,
|
||||||
|
value: 1
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
source: ApplicationStatus.Applyed,
|
||||||
|
target: ApplicationStatus.ApplyedButSaidNo,
|
||||||
|
value: 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
source: ApplicationStatus.Applyed,
|
||||||
|
target: ApplicationStatus.TasksToDo,
|
||||||
|
value: 1
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
applications.forEach((a) => {
|
applications.forEach((a) => {
|
||||||
if (a.url.includes('linkedin')) {
|
if (a.url.includes('linkedin')) {
|
||||||
nodeTypes['Linkedin'] += 1;
|
nodeTypes['Linkedin'] += 1;
|
||||||
@ -68,8 +84,16 @@
|
|||||||
} else {
|
} else {
|
||||||
nodeTypes['Unknown Source'] += 1;
|
nodeTypes['Unknown Source'] += 1;
|
||||||
}
|
}
|
||||||
nodeTypes[a.status] += 1;
|
if (a.status !== ApplicationStatus.WorkingOnIt) {
|
||||||
if ([ApplicationStatus.ApplyedButSaidNo, ApplicationStatus.TasksToDo].includes(a.status) ) {
|
nodeTypes[a.status] += 1;
|
||||||
|
} else {
|
||||||
|
nodeTypes[ApplicationStatus.ToApply] += 1;
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
[ApplicationStatus.ApplyedButSaidNo, ApplicationStatus.TasksToDo].includes(
|
||||||
|
a.status
|
||||||
|
)
|
||||||
|
) {
|
||||||
nodeTypes[ApplicationStatus.Applyed] += 1;
|
nodeTypes[ApplicationStatus.Applyed] += 1;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -84,8 +108,9 @@
|
|||||||
value: nodeTypes[a],
|
value: nodeTypes[a],
|
||||||
originalValue: a,
|
originalValue: a,
|
||||||
id: '',
|
id: '',
|
||||||
color: 'red',
|
index: i,
|
||||||
index: i
|
percentage: Math.trunc((nodeTypes[a] / applications.length) * 100),
|
||||||
|
end: showPercentage.includes(`${a}`)
|
||||||
};
|
};
|
||||||
if (Number.isNaN(Number(a))) {
|
if (Number.isNaN(Number(a))) {
|
||||||
base.id = a as string;
|
base.id = a as string;
|
||||||
@ -115,7 +140,7 @@
|
|||||||
let sankey = mySankey()
|
let sankey = mySankey()
|
||||||
.nodeWidth(20)
|
.nodeWidth(20)
|
||||||
.nodePadding(10)
|
.nodePadding(10)
|
||||||
.size([bounding.width, bounding.height]);
|
.size([bounding.width, bounding.height - 20]);
|
||||||
|
|
||||||
let path = sankey.link();
|
let path = sankey.link();
|
||||||
|
|
||||||
@ -202,7 +227,7 @@
|
|||||||
.attr('text-anchor', 'end')
|
.attr('text-anchor', 'end')
|
||||||
.attr('transform', null)
|
.attr('transform', null)
|
||||||
.text(function (d) {
|
.text(function (d) {
|
||||||
return `${d.id} (${d.value})`;
|
return `${d.id} (${d.value} ${d.end ? `${d.percentage}%` : ''})`;
|
||||||
})
|
})
|
||||||
.filter(function (d) {
|
.filter(function (d) {
|
||||||
return d.x < bounding.width / 2;
|
return d.x < bounding.width / 2;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { Application } from '$lib/ApplicationsStore.svelte';
|
import { ApplicationStatus, ApplicationStatusMaping, type Application } from '$lib/ApplicationsStore.svelte';
|
||||||
import { post, put } from '$lib/utils';
|
import { post, put } from '$lib/utils';
|
||||||
|
|
||||||
let {
|
let {
|
||||||
@ -27,6 +27,7 @@
|
|||||||
async function submit(item: Application) {
|
async function submit(item: Application) {
|
||||||
try {
|
try {
|
||||||
application.linked_application = item.id;
|
application.linked_application = item.id;
|
||||||
|
application.status = ApplicationStatus.LinkedApplication;
|
||||||
await put('application/update', application);
|
await put('application/update', application);
|
||||||
dialog.close();
|
dialog.close();
|
||||||
onreload(item);
|
onreload(item);
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
import { userStore } from '$lib/UserStore.svelte';
|
import { userStore } from '$lib/UserStore.svelte';
|
||||||
import LinkApplication from './LinkApplication.svelte';
|
import LinkApplication from './LinkApplication.svelte';
|
||||||
import ApplicationsList from '../ApplicationsList.svelte';
|
import ApplicationsList from '../ApplicationsList.svelte';
|
||||||
|
import TasksToDoList from '../TasksToDoList.svelte';
|
||||||
|
|
||||||
let activeItem: Application | undefined = $state();
|
let activeItem: Application | undefined = $state();
|
||||||
|
|
||||||
@ -435,7 +436,9 @@
|
|||||||
<DropZone icon="trash-fill text-danger" ondrop={() => remove()}
|
<DropZone icon="trash-fill text-danger" ondrop={() => remove()}
|
||||||
>Delete it</DropZone
|
>Delete it</DropZone
|
||||||
>
|
>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if [ApplicationStatus.WorkingOnIt, ApplicationStatus.TasksToDo].includes(activeItem.status)}
|
||||||
<!-- Applyed -->
|
<!-- Applyed -->
|
||||||
<DropZone
|
<DropZone
|
||||||
icon="server text-confirm"
|
icon="server text-confirm"
|
||||||
|
Loading…
Reference in New Issue
Block a user