Delete the old job code now that the tracker runs on its own
Test and deploy / test (push) Successful in 1m9s
Test and deploy / deploy (push) Successful in 1m33s

The job tracker has run from its own image at /jobs/ since 931b02c, so its
old copy here goes: the GraphQL schema, resolvers and models for
applications, references, sources, leads and the search profile; the
capture and email handlers and services; the Python posting reader, lead
scorer and email classifier; the Vue pages, stores and the capture-token
card on the Environment tab; and the userscript (nginx already redirects
its old URL to /jobs/).

The six old tables stay in the stp database: AutoMigrate never drops
anything, and dropping them is a manual step. The env variables stay in
the registry, where they already belong to the jobs service.

Docs (CLAUDE.md, DEPLOYMENT.md and the three READMEs) now describe the
site without the tracker, and DEPLOYMENT.md lists the jobs service and
./jobs-data.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-14 17:35:18 +01:00
co-authored by Claude Opus 5.5
parent 931b02c9e4
commit 99fe175ebf
72 changed files with 123 additions and 16046 deletions
-129
View File
@@ -1,129 +0,0 @@
<script setup>
/**
* The "add an application" form on `/cv/jobs`. Rendered only by
* JobApplications.vue; it creates through stores/jobApplications.js, so the new
* row appears in the parent's table without the two having to talk.
*
* Like JobReferences.vue it reports through the parent's single error banner:
* `fail` carries the error, `ok` says a create succeeded.
*
* Its root sits inside the parent's `.ja-root`, which jobs-shared.css relies on.
*/
import { ref } from "vue";
import { useJobApplicationsStore } from "@/stores/jobApplications";
import { STATUS_OPTIONS } from "./jobStatus";
import "./jobs-shared.css";
const emit = defineEmits(["fail", "ok"]);
const store = useJobApplicationsStore();
function today() {
return new Date().toISOString().substring(0, 10);
}
function blankForm() {
return {
jobTitle: "",
company: "",
location: "",
url: "",
status: "applied",
notes: "",
// Logging an application on the day you send it is the common case, so the
// date defaults to today rather than landing null and ageing as unknown.
appliedAt: today(),
};
}
const form = ref(blankForm());
async function createApplication() {
if (!form.value.jobTitle.trim() || !form.value.company.trim()) return;
try {
await store.create({
jobTitle: form.value.jobTitle.trim(),
company: form.value.company.trim(),
status: form.value.status,
location: form.value.location || undefined,
url: form.value.url || undefined,
notes: form.value.notes || undefined,
appliedAt: form.value.appliedAt
? new Date(form.value.appliedAt).toISOString()
: undefined,
});
form.value = blankForm();
emit("ok");
} catch (err) {
// The form is left as typed so the create can be retried.
emit("fail", err);
}
}
</script>
<template>
<form class="ja-form" @submit.prevent="createApplication">
<div class="ja-form-row">
<input
v-model="form.jobTitle"
class="ja-input"
placeholder="Job title *"
required
/>
<input
v-model="form.company"
class="ja-input"
placeholder="Company *"
required
/>
<select v-model="form.status" class="ja-input ja-select">
<option v-for="s in STATUS_OPTIONS" :key="s.value" :value="s.value">
{{ s.label }}
</option>
</select>
</div>
<div class="ja-form-row">
<input
v-model="form.location"
class="ja-input"
placeholder="Location"
/>
<input v-model="form.url" class="ja-input" placeholder="URL" />
<input
v-model="form.appliedAt"
class="ja-input"
type="date"
title="Applied date"
/>
</div>
<div class="ja-form-row">
<textarea
v-model="form.notes"
class="ja-input ja-textarea"
placeholder="Notes"
/>
<button type="submit" class="cv-btn cv-btn-primary">Add</button>
</div>
</form>
</template>
<style scoped>
/* Inputs are styled by jobs-shared.css; buttons are .cv-btn from CVLayout.vue. */
.ja-form {
display: flex;
flex-direction: column;
gap: 0.5rem;
margin-bottom: 1.5rem;
}
.ja-form-row {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
}
.ja-textarea {
resize: vertical;
min-height: 2.4rem;
}
</style>
-841
View File
@@ -1,841 +0,0 @@
<script setup>
/**
* Route `/cv/jobs` (guarded by `meta.requiresAdmin`) — a private tracker for job
* applications and for the reusable reference snippets that feed the CV copy.
*
* This view owns the page frame, the single error banner and the applications
* table (pipeline bar, filter/sort, inline editing via an `editingId` plus a
* scratch copy of the row). The two other pieces are components beside it:
* JobReferences.vue (the Quick Reference box, a separate table) and
* JobApplicationForm.vue (the add form). Data access is in
* stores/jobApplications.js and stores/jobAppReferences.js; nothing here calls
* gql() directly.
*
* Rows also arrive from three places that are not this page: the email
* pipeline, the browser userscript in `public/job-capture.user.js`, which the
* header links to for installing, and the leads inbox at `/cv/leads`
* (JobLeads.vue), where tracking a lead adds it here as Saved.
*/
import { ref, computed, onMounted } from "vue";
import { RouterLink } from "vue-router";
import { storeToRefs } from "pinia";
import { useJobApplicationsStore } from "@/stores/jobApplications";
import { STATUS_OPTIONS, OPEN_STATUSES } from "./jobStatus";
import JobReferences from "./JobReferences.vue";
import JobApplicationForm from "./JobApplicationForm.vue";
import "./jobs-shared.css";
const store = useJobApplicationsStore();
const { applications } = storeToRefs(store);
const editingId = ref(null);
const editForm = ref({});
const error = ref("");
const STALE_DAYS = 14;
// The captured posting text for the one row whose description is open.
// `undefined` in the cache means "not fetched", `""` means "fetched, none saved".
const descriptionId = ref(null);
const descriptions = ref({});
// Filter/sort state. All of it runs over the already-loaded array — the query
// has no arguments and the dataset is one person's applications.
const search = ref("");
const statusFilter = ref(null);
const sortKey = ref("updatedAt");
const sortDir = ref("desc");
function fail(err) {
console.error(err);
// The realistic failure here is a lapsed 7-day cookie: the router guard only
// checks the in-memory admin flag, so every mutation returns "admin access
// required" while the page still looks signed in.
error.value = String(err?.message ?? err);
}
function clearError() {
error.value = "";
}
async function fetchApplications() {
// The store's fetch() records its failure instead of throwing.
await store.fetch();
if (store.error) fail(store.error);
}
function startEdit(app) {
// Switching rows mid-edit would throw away unsaved typing silently, and the
// Edit button sits in every row, so the misclick is easy to make.
if (editingId.value !== null && editingId.value !== app.id && isEditDirty()) {
if (!confirm("Discard unsaved changes to the row you are editing?")) return;
}
editingId.value = app.id;
editForm.value = {
jobTitle: app.jobTitle,
company: app.company,
location: app.location ?? "",
url: app.url ?? "",
status: app.status,
notes: app.notes ?? "",
appliedAt: app.appliedAt ? app.appliedAt.substring(0, 10) : "",
};
}
function isEditDirty() {
const app = applications.value.find((a) => a.id === editingId.value);
if (!app) return false;
const e = editForm.value;
return (
e.jobTitle !== app.jobTitle ||
e.company !== app.company ||
e.location !== (app.location ?? "") ||
e.url !== (app.url ?? "") ||
e.status !== app.status ||
e.notes !== (app.notes ?? "") ||
e.appliedAt !== (app.appliedAt ? app.appliedAt.substring(0, 10) : "")
);
}
function cancelEdit() {
editingId.value = null;
editForm.value = {};
}
async function saveEdit(id) {
try {
// Optional fields send `''` rather than `undefined` when emptied: the
// resolver skips fields that are absent, so `|| undefined` would turn
// "delete this wrong URL" into a silent no-op that re-renders the old
// value. appliedAt has no empty representation, so clearing it is not
// offered — the field stays as it was.
await store.update(id, {
jobTitle: editForm.value.jobTitle,
company: editForm.value.company,
status: editForm.value.status,
location: editForm.value.location ?? "",
url: editForm.value.url ?? "",
notes: editForm.value.notes ?? "",
appliedAt: editForm.value.appliedAt
? new Date(editForm.value.appliedAt).toISOString()
: undefined,
});
editingId.value = null;
error.value = "";
} catch (err) {
// editingId is deliberately left set: the row stays open with the typing
// intact so the save can be retried.
fail(err);
}
}
/** Status is the field that changes most, so it is editable straight from the pill. */
async function setStatus(app, status) {
if (status === app.status) return;
try {
await store.update(app.id, { status });
error.value = "";
} catch (err) {
fail(err);
}
}
async function toggleDescription(app) {
if (descriptionId.value === app.id) {
descriptionId.value = null;
return;
}
descriptionId.value = app.id;
if (descriptions.value[app.id] !== undefined) return;
try {
descriptions.value[app.id] = await store.fetchDescription(app.id);
} catch (err) {
descriptionId.value = null;
fail(err);
}
}
async function deleteApplication(app) {
// Delete sits next to Edit in a 0.4rem-gap row and the notes it takes with
// it are not recoverable through any UI path.
if (!confirm(`Delete the ${app.jobTitle} application at ${app.company}?`))
return;
try {
await store.remove(app.id);
error.value = "";
} catch (err) {
fail(err);
}
}
function exportCsv() {
const headers = [
"Job Title",
"Company",
"Status",
"Location",
"URL",
"Applied",
"Notes",
"Created",
];
const rows = applications.value.map((a) => [
a.jobTitle,
a.company,
a.status,
a.location ?? "",
a.url ?? "",
a.appliedAt ? a.appliedAt.substring(0, 10) : "",
a.notes ?? "",
a.createdAt ? a.createdAt.substring(0, 10) : "",
]);
const escape = (v) => `"${String(v).replace(/"/g, '""')}"`;
// CRLF joins and a BOM because the destination for an exported tracker is
// Excel, which otherwise reads the UTF-8 as the local ANSI codepage (so "£"
// and accents arrive mangled) and mis-splits LF-only rows.
const csv =
"\ufeff" +
[headers, ...rows].map((r) => r.map(escape).join(",")).join("\r\n");
const blob = new Blob([csv], { type: "text/csv;charset=utf-8" });
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = "job_applications.csv";
a.click();
URL.revokeObjectURL(url);
}
function statusLabel(status) {
return (
STATUS_OPTIONS.find((s) => s.value === status?.toLowerCase())?.label ??
status
);
}
function statusClass(status) {
return `ja-badge-${status?.toLowerCase() ?? "unknown"}`;
}
/** Whole days between a timestamp and now; null when there is no date. */
function daysSince(iso) {
if (!iso) return null;
return Math.floor((Date.now() - new Date(iso).getTime()) / 86400000);
}
function ageLabel(app) {
// createdAt is the fallback: an application logged without an applied date
// still has a meaningful age.
const days = daysSince(app.appliedAt ?? app.createdAt);
return days === null ? "—" : days === 0 ? "today" : `${days}d`;
}
/** A row worth chasing: still open, and nothing has moved it in a fortnight. */
function isStale(app) {
if (!OPEN_STATUSES.includes(app.status?.toLowerCase())) return false;
const days = daysSince(app.updatedAt ?? app.createdAt);
return days !== null && days >= STALE_DAYS;
}
const statusCounts = computed(() => {
const counts = {};
for (const app of applications.value) {
const key = app.status?.toLowerCase();
counts[key] = (counts[key] ?? 0) + 1;
}
return counts;
});
const visibleApplications = computed(() => {
const q = search.value.trim().toLowerCase();
const rows = applications.value.filter((app) => {
if (statusFilter.value && app.status?.toLowerCase() !== statusFilter.value)
return false;
if (!q) return true;
// Notes are searched because the email pipeline appends its findings
// there, making them the de-facto history of the application.
return [app.jobTitle, app.company, app.location, app.notes]
.filter(Boolean)
.some((field) => field.toLowerCase().includes(q));
});
const dir = sortDir.value === "asc" ? 1 : -1;
return [...rows].sort((a, b) => {
const av = a[sortKey.value] ?? "";
const bv = b[sortKey.value] ?? "";
// Rows missing the sort field go last in either direction rather than
// clustering at whichever end empty-string happens to sort to.
if (!av && bv) return 1;
if (av && !bv) return -1;
if (av === bv) return 0;
return av > bv ? dir : -dir;
});
});
function toggleSort(key) {
if (sortKey.value === key) {
sortDir.value = sortDir.value === "asc" ? "desc" : "asc";
} else {
sortKey.value = key;
sortDir.value = "desc";
}
}
function toggleStatusFilter(status) {
statusFilter.value = statusFilter.value === status ? null : status;
}
onMounted(fetchApplications);
</script>
<template>
<div class="ja-root">
<div class="ja-header">
<div class="ja-header-left">
<RouterLink to="/cv" class="ja-back">← CV</RouterLink>
<h2 class="ja-heading">Job Applications</h2>
</div>
<div class="ja-header-right">
<!-- Postings the server found by itself; tracking one there adds it
to this page as Saved. -->
<RouterLink to="/cv/leads" class="cv-btn ja-btn-link">Leads</RouterLink>
<!-- A plain link to a static file: Violentmonkey intercepts any
navigation to a URL ending in .user.js and offers to install it.
The token it then asks for is generated on the admin panel. -->
<a
class="cv-btn"
href="/job-capture.user.js"
target="_blank"
rel="noopener"
title="Violentmonkey userscript that adds the job you are viewing. After installing, generate a capture token on the admin panel and paste it into the script's menu: Configure job capture."
>
Install capture script
</a>
<button
class="cv-btn"
@click="exportCsv"
:disabled="!applications.length"
>
Export CSV
</button>
</div>
</div>
<div v-if="error" class="ja-error" role="alert">
<span>{{ error }}</span>
<button class="cv-btn cv-btn-sm" @click="error = ''">Dismiss</button>
</div>
<JobReferences @fail="fail" @ok="clearError" />
<JobApplicationForm @fail="fail" @ok="clearError" />
<!-- Pipeline bar: counts at a glance, each one a filter toggle. -->
<div class="ja-pipeline" v-if="applications.length">
<button
v-for="s in STATUS_OPTIONS"
:key="s.value"
class="ja-pipe-tile"
:class="{ 'ja-pipe-active': statusFilter === s.value }"
@click="toggleStatusFilter(s.value)"
>
<span class="ja-pipe-count">{{ statusCounts[s.value] ?? 0 }}</span>
<span class="ja-pipe-label">{{ s.label }}</span>
</button>
</div>
<div class="ja-filterbar" v-if="applications.length">
<input
v-model="search"
class="ja-input"
type="search"
placeholder="Search title, company, location, notes…"
/>
<span class="ja-count"
>{{ visibleApplications.length }} / {{ applications.length }}</span
>
</div>
<table class="ja-table" v-if="visibleApplications.length">
<thead>
<tr>
<th class="ja-sortable" @click="toggleSort('jobTitle')">Title</th>
<th class="ja-sortable" @click="toggleSort('company')">Company</th>
<th class="ja-sortable" @click="toggleSort('status')">Status</th>
<th>Location</th>
<th class="ja-sortable" @click="toggleSort('appliedAt')">Applied</th>
<th>Notes</th>
<th></th>
</tr>
</thead>
<tbody>
<template v-for="app in visibleApplications" :key="app.id">
<tr v-if="editingId !== app.id" :class="{ 'ja-stale': isStale(app) }">
<td data-label="Title">
<a
v-if="app.url"
:href="app.url"
target="_blank"
rel="noopener"
class="ja-link"
>{{ app.jobTitle }}</a
>
<span v-else>{{ app.jobTitle }}</span>
</td>
<td data-label="Company">{{ app.company }}</td>
<td data-label="Status">
<select
class="ja-badge ja-badge-select"
:class="statusClass(app.status)"
:value="app.status?.toLowerCase()"
@change="setStatus(app, $event.target.value)"
>
<option
v-for="s in STATUS_OPTIONS"
:key="s.value"
:value="s.value"
>
{{ s.label }}
</option>
<!-- A status the pipeline wrote that we no longer list still
needs to render rather than showing a blank select. -->
<option
v-if="!STATUS_OPTIONS.some((s) => s.value === app.status)"
:value="app.status"
>
{{ statusLabel(app.status) }}
</option>
</select>
</td>
<td data-label="Location">{{ app.location || "—" }}</td>
<td
data-label="Applied"
:title="app.appliedAt ? app.appliedAt.substring(0, 10) : ''"
>
{{ ageLabel(app) }}
</td>
<td class="ja-notes-cell" data-label="Notes" :title="app.notes">
{{ app.notes ?? "" }}
</td>
<td class="ja-actions">
<button
class="cv-btn cv-btn-sm"
title="Posting text saved when the job was captured"
@click="toggleDescription(app)"
>
{{ descriptionId === app.id ? "Hide" : "Posting" }}
</button>
<button class="cv-btn cv-btn-sm" @click="startEdit(app)">
Edit
</button>
<button
class="cv-btn cv-btn-sm cv-btn-danger"
@click="deleteApplication(app)"
>
Delete
</button>
</td>
</tr>
<tr v-else class="ja-edit-row">
<td data-label="Title">
<input
v-model="editForm.jobTitle"
class="ja-input ja-input-sm"
placeholder="Job title"
/>
<input
v-model="editForm.url"
class="ja-input ja-input-sm"
placeholder="URL"
/>
</td>
<td data-label="Company">
<input
v-model="editForm.company"
class="ja-input ja-input-sm"
placeholder="Company"
/>
</td>
<td data-label="Status">
<select
v-model="editForm.status"
class="ja-input ja-input-sm ja-select"
>
<option
v-for="s in STATUS_OPTIONS"
:key="s.value"
:value="s.value"
>
{{ s.label }}
</option>
</select>
</td>
<td data-label="Location">
<input
v-model="editForm.location"
class="ja-input ja-input-sm"
placeholder="Location"
/>
</td>
<td data-label="Applied">
<input
v-model="editForm.appliedAt"
class="ja-input ja-input-sm"
type="date"
/>
</td>
<td data-label="Notes">
<!-- Textarea, not an input: the pipeline appends newline-joined
findings here, so notes are routinely multi-line. -->
<textarea
v-model="editForm.notes"
class="ja-input ja-input-sm ja-edit-notes"
placeholder="Notes"
/>
</td>
<td class="ja-actions">
<button
class="cv-btn cv-btn-sm cv-btn-primary"
@click="saveEdit(app.id)"
>
Save
</button>
<button class="cv-btn cv-btn-sm" @click="cancelEdit">
Cancel
</button>
</td>
</tr>
<tr v-if="descriptionId === app.id" class="ja-desc-row">
<td colspan="7">
<p v-if="descriptions[app.id] === undefined" class="ja-empty">
Loading…
</p>
<pre v-else-if="descriptions[app.id]" class="ja-desc">{{
descriptions[app.id]
}}</pre>
<p v-else class="ja-empty">
No posting text saved — only jobs added with the capture script
have one.
</p>
</td>
</tr>
</template>
</tbody>
</table>
<p v-else-if="applications.length" class="ja-empty">
No applications match this filter.
</p>
<p v-else class="ja-empty">No applications yet.</p>
</div>
</template>
<style scoped>
/* Colours are the paper palette from CVLayout.vue; buttons are .cv-btn from
there too. The input classes (.ja-input, .ja-input-sm, .ja-select) are in
jobs-shared.css because the child components use them as well. */
.ja-root {
padding: 1.5rem;
border-top: 2px solid var(--color-ink-soft);
background: var(--color-paper-tint);
}
.ja-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 1rem;
}
.ja-header-left {
display: flex;
align-items: center;
gap: 1rem;
}
.ja-header-right {
display: flex;
align-items: center;
gap: 0.5rem;
flex-wrap: wrap;
justify-content: flex-end;
}
.ja-back {
font-size: 0.85rem;
color: var(--color-ink-muted);
text-decoration: none;
}
.ja-back:hover {
color: var(--color-ink);
}
.ja-btn-link {
text-decoration: none;
}
.ja-heading {
font-size: 1.1rem;
font-weight: 600;
color: var(--color-ink-soft);
}
.ja-error {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
margin-bottom: 1rem;
padding: 0.5rem 0.75rem;
border: 1px solid #b91c1c;
border-radius: 4px;
background: #fef2f2;
color: #7f1d1d;
font-size: 0.85rem;
}
.ja-edit-notes {
resize: vertical;
min-height: 3.5rem;
}
/* Pipeline bar */
.ja-pipeline {
display: flex;
gap: 0.4rem;
flex-wrap: wrap;
margin-bottom: 0.75rem;
}
.ja-pipe-tile {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.1rem;
padding: 0.4rem 0.7rem;
border: 1px solid var(--color-line-soft);
border-radius: 4px;
background: var(--color-paper);
cursor: pointer;
min-width: 68px;
}
.ja-pipe-tile:hover {
background: var(--color-paper-shade);
}
.ja-pipe-active {
border-color: var(--color-ink);
background: var(--color-paper-shade);
}
.ja-pipe-count {
font-size: 1rem;
font-weight: 600;
color: var(--color-ink-soft);
}
.ja-pipe-label {
font-size: 0.7rem;
color: var(--color-ink-muted);
}
.ja-filterbar {
display: flex;
align-items: center;
gap: 0.75rem;
margin-bottom: 0.75rem;
}
.ja-count {
font-size: 0.8rem;
color: var(--color-ink-faint);
white-space: nowrap;
}
/* Applications table */
.ja-table {
width: 100%;
border-collapse: collapse;
font-size: 0.85rem;
}
.ja-table th,
.ja-table td {
text-align: left;
padding: 0.45rem 0.6rem;
border-bottom: 1px solid var(--color-line-soft);
vertical-align: middle;
}
.ja-table th {
font-weight: 600;
color: var(--color-ink-muted);
background: var(--color-paper-shade);
}
.ja-sortable {
cursor: pointer;
user-select: none;
}
.ja-sortable:hover {
color: var(--color-ink);
}
.ja-table tr:hover td {
background: var(--color-paper-shade);
}
/* Open for a fortnight with nothing moving — the follow-up queue. */
.ja-stale td:first-child {
box-shadow: inset 3px 0 0 var(--color-ink-muted);
}
.ja-edit-row td {
padding: 0.3rem 0.4rem;
vertical-align: top;
}
.ja-actions {
display: flex;
gap: 0.4rem;
white-space: nowrap;
}
.ja-notes-cell {
max-width: 200px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* The posting text is long, so it scrolls inside the row instead of pushing
the rest of the table off the screen. */
.ja-desc {
max-height: 22rem;
overflow: auto;
margin: 0;
padding: 0.6rem;
border: 1px solid var(--color-line-soft);
border-radius: 4px;
background: var(--color-paper);
font-family: inherit;
font-size: 0.8rem;
white-space: pre-wrap;
}
.ja-desc-row:hover td {
background: transparent;
}
.ja-link {
color: var(--color-ink-link);
text-decoration: none;
}
.ja-link:hover {
text-decoration: underline;
}
/* Status pill, doubling as an inline select. Palette is CVLayout's paper
tokens with a per-status tint, rather than off-theme Tailwind colours. */
.ja-badge {
display: inline-block;
padding: 0.15rem 0.5rem;
border-radius: 10px;
font-size: 0.78rem;
font-weight: 500;
border: 1px solid var(--color-line);
background: var(--color-paper-shade);
color: var(--color-ink-soft);
}
.ja-badge-select {
cursor: pointer;
appearance: none;
}
.ja-badge-saved {
background: var(--color-paper);
color: var(--color-ink-muted);
border-style: dashed;
}
.ja-badge-applied {
background: #eef2ff;
color: #3730a3;
}
.ja-badge-screening {
background: #fefce8;
color: #854d0e;
}
.ja-badge-assessment {
background: #fff7ed;
color: #9a3412;
}
.ja-badge-interviewing {
background: #f5f3ff;
color: #5b21b6;
}
.ja-badge-offer {
background: #f0fdf4;
color: #166534;
}
.ja-badge-rejected {
background: #fef2f2;
color: #991b1b;
}
.ja-badge-withdrawn {
background: var(--color-paper-shade);
color: var(--color-ink-faint);
}
.ja-empty {
color: var(--color-ink-faint);
font-size: 0.9rem;
}
/* Seven columns plus an action cell will not fit a phone, so the table becomes
stacked cards with the header text carried by each cell's data-label. */
@media (max-width: 640px) {
.ja-table thead {
display: none;
}
.ja-table,
.ja-table tbody,
.ja-table tr,
.ja-table td {
display: block;
width: 100%;
}
.ja-table tr {
margin-bottom: 0.75rem;
border: 1px solid var(--color-line-soft);
border-radius: 6px;
background: var(--color-paper);
}
.ja-table td {
border-bottom: none;
padding: 0.3rem 0.6rem;
}
.ja-table td[data-label]::before {
content: attr(data-label);
display: block;
font-size: 0.7rem;
text-transform: uppercase;
color: var(--color-ink-faint);
}
.ja-notes-cell {
max-width: none;
white-space: pre-wrap;
overflow: visible;
}
.ja-stale td:first-child {
box-shadow: inset 0 3px 0 var(--color-ink-muted);
}
}
</style>
-660
View File
@@ -1,660 +0,0 @@
<script setup>
/**
* Route `/cv/leads` (guarded by `meta.requiresAdmin`) — the leads inbox:
* postings the server found on its own, waiting to be tracked or dismissed.
*
* The server side is backend/services/job_leads.go. On a timer, or when
* "Check now" is pressed here, it polls the sources (JobSources.vue), keeps
* the postings that pass the keyword filter and has Claude score them against
* the profile (JobSearchProfile.vue). Nothing reaches the tracker at /cv/jobs
* until **Track** is pressed on a lead, which adds it there as Saved.
*
* This view owns the page frame, the single error banner, the run button and
* the list. Data access is in stores/jobLeads.js; nothing here calls gql().
*
* There are three server jobs. "Check now" polls the sources and scores up to
* forty new leads; "Score unscored" polls nothing and scores the whole
* backlog; "Rescore all" scores every inbox lead again, for after the profile
* or the model has changed. Each takes from seconds to many minutes, so the
* button does not wait: the server starts the job and this page polls its
* status, then reloads the list when it finishes.
*/
import { ref, computed, onMounted, onBeforeUnmount } from "vue";
import { RouterLink } from "vue-router";
import { storeToRefs } from "pinia";
import { useJobLeadsStore } from "@/stores/jobLeads";
import { useJobSearchProfileStore } from "@/stores/jobSearchProfile";
import JobSources from "./JobSources.vue";
import JobSearchProfile from "./JobSearchProfile.vue";
import "./jobs-shared.css";
const TABS = [
{ value: "new", label: "Inbox" },
{ value: "promoted", label: "Tracked" },
{ value: "dismissed", label: "Dismissed" },
];
// Labels for JobLead.sourceKind; a COPY of the kinds in JobSources.vue.
const SOURCE_LABELS = { greenhouse: "Greenhouse", lever: "Lever", ashby: "Ashby", adzuna: "Adzuna", reed: "Reed" };
const POLL_MS = 3000;
const store = useJobLeadsStore();
const { leads, status, loading } = storeToRefs(store);
const { profile } = storeToRefs(useJobSearchProfileStore());
const error = ref("");
const tab = ref("new");
const search = ref("");
// Two separate "show me the rest" switches: leads scored below the profile's
// minimum (already loaded, hidden here), and leads the keyword filter
// rejected (not loaded at all until asked for — that is most of every board).
const showLowScores = ref(false);
const showUnmatched = ref(false);
// "score" is the order the server sends; "posted" re-sorts here by the
// posting's own date.
const sortBy = ref("score");
const busyId = ref(null);
const sourcesBox = ref(null);
// The posting text for the one lead whose description is open.
// `undefined` in the cache means "not fetched", `""` means "fetched, none".
const descriptionId = ref(null);
const descriptions = ref({});
function fail(err) {
console.error(err);
error.value = String(err?.message ?? err);
}
function clearError() {
error.value = "";
}
async function fetchLeads() {
// The store's fetch() records its failure instead of throwing.
await store.fetch({ includeUnmatched: showUnmatched.value });
if (store.error) fail(store.error);
}
const minScore = computed(() => profile.value?.minScore ?? 0);
/** An unscored lead is never "low": no score is not a bad score. */
const isLow = (lead) => lead.score != null && lead.score < minScore.value;
const counts = computed(() => {
const out = { new: 0, promoted: 0, dismissed: 0 };
for (const lead of leads.value) if (lead.state in out) out[lead.state]++;
return out;
});
const inTab = computed(() => leads.value.filter((lead) => lead.state === tab.value));
const hiddenLow = computed(() =>
tab.value === "new" && !showLowScores.value ? inTab.value.filter(isLow).length : 0,
);
/** When the posting went up; when we first saw it if the source gave no date. */
const postedTime = (lead) => new Date(lead.postedAt ?? lead.createdAt).getTime();
// The server already sorts best-first, unscored after scored, newest first
// within a score, so by score this only filters. By date it re-sorts a copy;
// Array.sort is stable, so postings of the same day stay best-first.
const visibleLeads = computed(() => {
const needle = search.value.trim().toLowerCase();
const shown = inTab.value.filter((lead) => {
if (tab.value === "new" && !showLowScores.value && isLow(lead)) return false;
if (!needle) return true;
return [lead.jobTitle, lead.company, lead.location, lead.scoreReasons]
.some((field) => field?.toLowerCase().includes(needle));
});
if (sortBy.value === "posted") shown.sort((a, b) => postedTime(b) - postedTime(a));
return shown;
});
function scoreClass(lead) {
if (lead.score == null) return "jl-score-none";
if (lead.score >= 80) return "jl-score-high";
if (lead.score >= 60) return "jl-score-mid";
return "jl-score-low";
}
/** The tooltip says when, which during a rescore is how to tell new from old. */
function scoreTitle(lead) {
if (lead.score == null) return "Not scored";
const when = lead.scoredAt
? `, scored ${new Date(lead.scoredAt).toLocaleString(undefined, { dateStyle: "medium", timeStyle: "short" })}`
: "";
return `Fit score ${lead.score} out of 100${when}`;
}
function ageLabel(lead) {
const at = lead.postedAt ?? lead.createdAt;
if (!at) return "";
const days = Math.floor((Date.now() - new Date(at).getTime()) / 86_400_000);
const age = days <= 0 ? "today" : days === 1 ? "1 day ago" : `${days} days ago`;
return lead.postedAt ? `posted ${age}` : `found ${age}`;
}
async function act(lead, action) {
busyId.value = lead.id;
try {
await store[action](lead.id);
if (descriptionId.value === lead.id) descriptionId.value = null;
error.value = "";
} catch (err) {
fail(err);
} finally {
busyId.value = null;
}
}
async function toggleDescription(lead) {
if (descriptionId.value === lead.id) {
descriptionId.value = null;
return;
}
descriptionId.value = lead.id;
if (descriptions.value[lead.id] !== undefined) return;
try {
descriptions.value[lead.id] = await store.fetchDescription(lead.id);
} catch (err) {
descriptionId.value = null;
fail(err);
}
}
async function toggleUnmatched() {
showUnmatched.value = !showUnmatched.value;
await fetchLeads();
}
// Run and poll
let pollTimer = null;
function stopPolling() {
clearTimeout(pollTimer);
pollTimer = null;
}
/** Poll until the run finishes, then reload what it changed. */
async function pollStatus() {
const current = await store.fetchStatus();
if (current?.running) {
// Scores are saved one at a time, so reloading as it goes lets a long
// "Score unscored" fill the list in rather than sit still for minutes.
await fetchLeads();
pollTimer = setTimeout(pollStatus, POLL_MS);
return;
}
stopPolling();
if (current?.lastError) fail(current.lastError);
await Promise.all([fetchLeads(), sourcesBox.value?.refresh()]);
}
/** Start one of the server jobs ("runSync", "scoreAll", "rescoreAll") and wait on it. */
async function start(job) {
try {
// false means a job was already going (the scheduler's, say); either way
// there is now one to wait for.
await store[job]();
error.value = "";
status.value = { ...(status.value ?? {}), running: true };
stopPolling();
pollTimer = setTimeout(pollStatus, POLL_MS);
} catch (err) {
fail(err);
}
}
// Matched inbox leads that have a score: what "Rescore all" would redo, on
// top of the unscored ones.
const scoredCount = computed(
() => leads.value.filter((lead) => lead.state === "new" && lead.matched && lead.score != null).length,
);
function rescore() {
const total = scoredCount.value + unscoredCount.value;
// One Claude call per lead, and it replaces scores that were paid for.
if (!confirm(`Score all ${total} inbox leads again? This makes one Claude call per lead.`)) return;
start("rescoreAll");
}
// Matched inbox leads with no score: what "Score unscored" would work
// through. A lead Claude failed on three times stays in this count, though
// the server will not try it again.
const unscoredCount = computed(
() => leads.value.filter((lead) => lead.state === "new" && lead.matched && lead.score == null).length,
);
const running = computed(() => !!status.value?.running);
const lastRun = computed(() => {
if (running.value) return "Working…";
if (!status.value?.lastRunAt) return "";
const when = new Date(status.value.lastRunAt).toLocaleString(undefined, { dateStyle: "medium", timeStyle: "short" });
return `Last checked ${when}`;
});
onMounted(async () => {
await fetchLeads();
// Arriving mid-run (the scheduler's, or one started before a reload) should
// look the same as having pressed the button.
const current = await store.fetchStatus();
if (current?.running) pollTimer = setTimeout(pollStatus, POLL_MS);
});
onBeforeUnmount(stopPolling);
</script>
<template>
<div class="ja-root jl-root">
<div class="jl-header">
<div class="jl-header-left">
<RouterLink to="/cv/jobs" class="jl-back">← Tracker</RouterLink>
<h2 class="jl-heading">Job Leads</h2>
</div>
<div class="jl-header-right">
<span class="jl-hint">{{ lastRun }}</span>
<button
v-if="scoredCount"
class="cv-btn"
:disabled="running"
title="Score every inbox lead again, including ones already scored. Use after changing the profile or the model. Old scores stay until replaced."
@click="rescore"
>
Rescore all
</button>
<button
v-if="unscoredCount"
class="cv-btn"
:disabled="running"
title="Score every unscored lead in the inbox against the profile, without polling the sources. One Claude call per lead."
@click="start('scoreAll')"
>
Score unscored ({{ unscoredCount }})
</button>
<button
class="cv-btn cv-btn-primary"
:disabled="running"
title="Poll every source now, then score up to 40 new leads. Profile and keyword changes take effect on a run."
@click="start('runSync')"
>
{{ running ? "Working…" : "Check now" }}
</button>
</div>
</div>
<div v-if="error" class="jl-error" role="alert">
<span>{{ error }}</span>
<button class="cv-btn cv-btn-sm" @click="error = ''">Dismiss</button>
</div>
<JobSearchProfile @fail="fail" @ok="clearError" />
<JobSources ref="sourcesBox" @fail="fail" @ok="clearError" />
<div class="jl-tabs">
<button
v-for="t in TABS"
:key="t.value"
class="jl-tab"
:class="{ 'jl-tab-active': tab === t.value }"
@click="tab = t.value"
>
<span class="jl-tab-count">{{ counts[t.value] }}</span>
<span class="jl-tab-label">{{ t.label }}</span>
</button>
</div>
<div class="jl-filterbar">
<input v-model="search" class="ja-input" type="search" placeholder="Search title, company, location, reasons…" />
<select v-model="sortBy" class="ja-input ja-select jl-sort" title="Order of the list">
<option value="score">Best score first</option>
<option value="posted">Newest posting first</option>
</select>
<label v-if="tab === 'new'" class="jl-check">
<input v-model="showLowScores" type="checkbox" />
Below {{ minScore }}<template v-if="hiddenLow"> ({{ hiddenLow }} hidden)</template>
</label>
<label v-if="tab === 'new'" class="jl-check" title="Postings the keyword filter rejected. They are never scored.">
<input :checked="showUnmatched" type="checkbox" @change="toggleUnmatched" />
Filtered out
</label>
</div>
<article
v-for="lead in visibleLeads"
:key="lead.id"
class="jl-lead"
:class="{ 'jl-lead-unmatched': !lead.matched && lead.state === 'new' }"
>
<div class="jl-score" :class="scoreClass(lead)" :title="scoreTitle(lead)">
{{ lead.score ?? "–" }}
</div>
<div class="jl-lead-body">
<div class="jl-lead-title">
<a v-if="lead.url" :href="lead.url" target="_blank" rel="noopener" class="jl-link">{{ lead.jobTitle }}</a>
<span v-else>{{ lead.jobTitle }}</span>
<span class="jl-lead-company">{{ lead.company }}</span>
</div>
<div class="jl-lead-meta">
<span v-if="lead.location">{{ lead.location }}</span>
<span>{{ SOURCE_LABELS[lead.sourceKind] ?? lead.sourceKind }}</span>
<span>{{ ageLabel(lead) }}</span>
<span v-if="!lead.matched && lead.state === 'new'">filtered out</span>
</div>
<p v-if="lead.scoreReasons" class="jl-lead-reasons">{{ lead.scoreReasons }}</p>
<pre v-if="descriptionId === lead.id" class="jl-desc">{{
descriptions[lead.id] === undefined ? "Loading…" : descriptions[lead.id] || "The source gave no description."
}}</pre>
</div>
<div class="jl-lead-actions">
<button class="cv-btn cv-btn-sm" @click="toggleDescription(lead)">
{{ descriptionId === lead.id ? "Hide" : "Posting" }}
</button>
<template v-if="lead.state === 'new'">
<button
class="cv-btn cv-btn-sm cv-btn-primary"
:disabled="busyId === lead.id"
title="Add to the tracker as Saved"
@click="act(lead, 'promote')"
>
Track
</button>
<button class="cv-btn cv-btn-sm" :disabled="busyId === lead.id" @click="act(lead, 'dismiss')">Dismiss</button>
</template>
<button v-else-if="lead.state === 'dismissed'" class="cv-btn cv-btn-sm" :disabled="busyId === lead.id" @click="act(lead, 'restore')">
Restore
</button>
<RouterLink v-else to="/cv/jobs" class="cv-btn cv-btn-sm jl-btn-link">In tracker</RouterLink>
</div>
</article>
<p v-if="!visibleLeads.length" class="jl-empty">
<template v-if="loading">Loading…</template>
<template v-else-if="tab !== 'new'">Nothing here.</template>
<template v-else-if="hiddenLow">Nothing at or above {{ minScore }}. Tick "Below {{ minScore }}" to see the rest.</template>
<template v-else-if="!leads.length">No leads yet. Add a source above, then press "Check now".</template>
<template v-else>The inbox is empty.</template>
</p>
</div>
</template>
<!-- Unscoped on purpose, for the same reason as jobs-shared.css: the two child
components render the boxes these classes style, and a scoped rule stops
at a child's root element. Every selector is under .jl-root. -->
<style>
.jl-root .jl-box {
margin-bottom: 1rem;
padding: 0.75rem 1rem;
border: 1px solid var(--color-line-soft);
border-radius: 6px;
background: var(--color-paper);
}
.jl-root .jl-box-heading {
font-size: 1rem;
font-weight: 600;
color: var(--color-ink-soft);
cursor: pointer;
}
.jl-root .jl-box-heading > span {
margin-left: 0.6rem;
font-weight: 400;
}
.jl-root .jl-hint {
font-size: 0.8rem;
color: var(--color-ink-faint);
}
.jl-root p.jl-hint {
margin: 0.5rem 0 0;
}
.jl-root .jl-warn {
font-size: 0.8rem;
color: var(--color-ink-danger);
}
</style>
<style scoped>
/* Colours are the paper palette from CVLayout.vue; buttons are .cv-btn from
there too, and the inputs are styled by jobs-shared.css. The frame matches
the tracker page's (.ja-root and friends in JobApplications.vue), whose
rules are scoped to that component and so are repeated here. */
.jl-root {
padding: 1.5rem;
border-top: 2px solid var(--color-ink-soft);
background: var(--color-paper-tint);
}
.jl-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
margin-bottom: 1rem;
}
.jl-header-left,
.jl-header-right {
display: flex;
align-items: center;
gap: 1rem;
}
.jl-back {
font-size: 0.85rem;
color: var(--color-ink-muted);
text-decoration: none;
}
.jl-back:hover {
color: var(--color-ink);
}
.jl-heading {
font-size: 1.1rem;
font-weight: 600;
color: var(--color-ink-soft);
}
.jl-error {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
margin-bottom: 1rem;
padding: 0.5rem 0.75rem;
border: 1px solid #b91c1c;
border-radius: 4px;
background: #fef2f2;
color: #7f1d1d;
font-size: 0.85rem;
}
.jl-tabs {
display: flex;
gap: 0.5rem;
margin-bottom: 0.75rem;
}
.jl-tab {
display: flex;
align-items: baseline;
gap: 0.4rem;
padding: 0.4rem 0.9rem;
border: 1px solid var(--color-line-soft);
border-radius: 6px;
background: var(--color-paper);
color: var(--color-ink-muted);
cursor: pointer;
}
.jl-tab-active {
border-color: var(--color-ink-soft);
color: var(--color-ink);
}
.jl-tab-count {
font-size: 1.05rem;
font-weight: 600;
}
.jl-tab-label {
font-size: 0.8rem;
}
.jl-filterbar {
display: flex;
align-items: center;
gap: 1rem;
margin-bottom: 0.75rem;
}
.jl-sort {
flex: 0 0 auto;
}
.jl-check {
display: flex;
align-items: center;
gap: 0.35rem;
font-size: 0.8rem;
color: var(--color-ink-muted);
white-space: nowrap;
cursor: pointer;
}
.jl-lead {
display: flex;
align-items: flex-start;
gap: 0.9rem;
margin-bottom: 0.5rem;
padding: 0.7rem 0.9rem;
border: 1px solid var(--color-line-soft);
border-radius: 6px;
background: var(--color-paper);
}
.jl-lead-unmatched {
opacity: 0.6;
}
/* The score reads as a number first; the tint only groups it. Same tints as
the tracker's status pills. */
.jl-score {
flex: 0 0 2.6rem;
padding: 0.35rem 0;
border-radius: 6px;
font-size: 1rem;
font-weight: 600;
text-align: center;
color: var(--color-ink-soft);
background: var(--color-paper-shade);
}
.jl-score-high {
background: #dcfce7;
color: #14532d;
}
.jl-score-mid {
background: #fef9c3;
color: #713f12;
}
.jl-score-none {
color: var(--color-ink-faint);
}
.jl-lead-body {
flex: 1;
min-width: 0;
}
.jl-lead-title {
font-size: 0.95rem;
font-weight: 600;
color: var(--color-ink);
}
.jl-lead-company {
margin-left: 0.5rem;
font-weight: 400;
color: var(--color-ink-muted);
}
.jl-link {
color: var(--color-ink-link);
text-decoration: none;
}
.jl-link:hover {
text-decoration: underline;
}
.jl-lead-meta {
display: flex;
flex-wrap: wrap;
gap: 0.25rem 0.9rem;
margin-top: 0.15rem;
font-size: 0.8rem;
color: var(--color-ink-faint);
}
.jl-lead-reasons {
margin: 0.4rem 0 0;
font-size: 0.85rem;
color: var(--color-ink-soft);
}
/* The posting text is long, so it scrolls inside the card. */
.jl-desc {
max-height: 22rem;
overflow: auto;
margin: 0.6rem 0 0;
padding: 0.6rem;
border: 1px solid var(--color-line-soft);
border-radius: 4px;
background: var(--color-paper-tint);
font-family: inherit;
font-size: 0.8rem;
white-space: pre-wrap;
}
.jl-lead-actions {
display: flex;
gap: 0.4rem;
white-space: nowrap;
}
.jl-btn-link {
text-decoration: none;
}
.jl-empty {
color: var(--color-ink-faint);
font-size: 0.9rem;
}
@media (max-width: 640px) {
.jl-header,
.jl-filterbar {
flex-wrap: wrap;
}
.jl-lead {
flex-wrap: wrap;
}
.jl-lead-body {
flex-basis: calc(100% - 3.5rem);
}
.jl-lead-actions {
flex-basis: 100%;
}
}
</style>
-250
View File
@@ -1,250 +0,0 @@
<script setup>
/**
* The "Quick Reference" box on `/cv/jobs`: reusable profile/experience snippets
* to copy into application forms, with inline editing. Rendered only by
* JobApplications.vue; data comes from stores/jobAppReferences.js.
*
* It has no error display of its own — the page has one banner, in the parent,
* so failures are emitted as `fail` (with the error) and every successful
* mutation emits `ok` so the parent can clear a stale message.
*
* Its root sits inside the parent's `.ja-root`, which jobs-shared.css relies on.
*/
import { ref, onMounted } from "vue";
import { storeToRefs } from "pinia";
import { useJobAppReferencesStore } from "@/stores/jobAppReferences";
import "./jobs-shared.css";
const emit = defineEmits(["fail", "ok"]);
const store = useJobAppReferencesStore();
const { references } = storeToRefs(store);
const refForm = ref({ category: "profile", label: "", value: "" });
const editingRefId = ref(null);
const editRefForm = ref({});
const REF_CATEGORIES = ["profile", "experience"];
async function fetchReferences() {
// The store's fetch() records its failure instead of throwing.
await store.fetch();
if (store.error) emit("fail", store.error);
}
async function createReference() {
if (!refForm.value.label || !refForm.value.value) return;
try {
await store.create({
category: refForm.value.category,
label: refForm.value.label,
value: refForm.value.value,
});
refForm.value = { category: refForm.value.category, label: "", value: "" };
emit("ok");
} catch (err) {
emit("fail", err);
}
}
function startRefEdit(ref) {
editingRefId.value = ref.id;
editRefForm.value = {
category: ref.category,
label: ref.label,
value: ref.value,
};
}
function cancelRefEdit() {
editingRefId.value = null;
editRefForm.value = {};
}
async function saveRefEdit(id) {
try {
await store.update(id, {
category: editRefForm.value.category || undefined,
label: editRefForm.value.label || undefined,
value: editRefForm.value.value || undefined,
});
editingRefId.value = null;
emit("ok");
} catch (err) {
emit("fail", err);
}
}
async function deleteReference(ref) {
if (!confirm(`Delete the reference "${ref.label}"?`)) return;
try {
await store.remove(ref.id);
emit("ok");
} catch (err) {
emit("fail", err);
}
}
function refsByCategory(category) {
return references.value.filter((r) => r.category === category);
}
function copyToClipboard(text) {
navigator.clipboard.writeText(text);
}
onMounted(fetchReferences);
</script>
<template>
<div class="ja-ref-section">
<h3 class="ja-ref-heading">Quick Reference</h3>
<div v-for="cat in REF_CATEGORIES" :key="cat" class="ja-ref-category">
<h4 class="ja-ref-cat-label">{{ cat }}</h4>
<div
v-for="ref in refsByCategory(cat)"
:key="ref.id"
class="ja-ref-item"
>
<template v-if="editingRefId !== ref.id">
<span class="ja-ref-label">{{ ref.label }}</span>
<span class="ja-ref-value" :title="ref.value">{{ ref.value }}</span>
<button
class="cv-btn cv-btn-sm"
@click="copyToClipboard(ref.value)"
title="Copy"
>
Copy
</button>
<button class="cv-btn cv-btn-sm" @click="startRefEdit(ref)">
Edit
</button>
<button
class="cv-btn cv-btn-sm cv-btn-danger"
@click="deleteReference(ref)"
>
Delete
</button>
</template>
<template v-else>
<select
v-model="editRefForm.category"
class="ja-input ja-input-sm ja-select"
>
<option v-for="c in REF_CATEGORIES" :key="c" :value="c">
{{ c }}
</option>
</select>
<input
v-model="editRefForm.label"
class="ja-input ja-input-sm"
placeholder="Label"
/>
<input
v-model="editRefForm.value"
class="ja-input ja-input-sm"
placeholder="Value"
/>
<button
class="cv-btn cv-btn-sm cv-btn-primary"
@click="saveRefEdit(ref.id)"
>
Save
</button>
<button class="cv-btn cv-btn-sm" @click="cancelRefEdit">
Cancel
</button>
</template>
</div>
<p v-if="!refsByCategory(cat).length" class="ja-ref-empty">
No {{ cat }} items yet.
</p>
</div>
<form class="ja-ref-form" @submit.prevent="createReference">
<select v-model="refForm.category" class="ja-input ja-select">
<option v-for="c in REF_CATEGORIES" :key="c" :value="c">
{{ c }}
</option>
</select>
<input
v-model="refForm.label"
class="ja-input"
placeholder="Label *"
required
/>
<input
v-model="refForm.value"
class="ja-input"
placeholder="Value *"
required
/>
<button type="submit" class="cv-btn cv-btn-primary">Add</button>
</form>
</div>
</template>
<style scoped>
/* Colours are the paper palette from CVLayout.vue; buttons are .cv-btn from
there too, and the inputs are styled by jobs-shared.css. */
.ja-ref-section {
margin-bottom: 1.5rem;
padding: 1rem;
border: 1px solid var(--color-line-soft);
border-radius: 6px;
background: var(--color-paper);
}
.ja-ref-heading {
font-size: 1rem;
font-weight: 600;
margin-bottom: 0.75rem;
color: var(--color-ink-soft);
}
.ja-ref-category {
margin-bottom: 0.75rem;
}
.ja-ref-cat-label {
font-size: 0.85rem;
font-weight: 600;
color: var(--color-ink-muted);
text-transform: capitalize;
margin-bottom: 0.35rem;
}
.ja-ref-item {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.3rem 0;
}
.ja-ref-label {
font-size: 0.85rem;
font-weight: 500;
color: var(--color-ink-soft);
min-width: 80px;
}
.ja-ref-value {
font-size: 0.85rem;
color: var(--color-ink-muted);
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.ja-ref-empty {
font-size: 0.8rem;
color: var(--color-ink-faint);
margin: 0.2rem 0;
}
.ja-ref-form {
display: flex;
gap: 0.5rem;
margin-top: 0.75rem;
flex-wrap: wrap;
}
</style>
-167
View File
@@ -1,167 +0,0 @@
<script setup>
/**
* The "Search profile" box on `/cv/leads`: what a lead is judged against.
* Rendered only by JobLeads.vue; data comes from stores/jobSearchProfile.js.
*
* Two different things are edited here. The keyword lists drive a cheap
* filter on the server that decides which postings are shown and scored at
* all; the profile text is what Claude scores those against. Both take effect
* on the next run, not on save — the parent says so beside "Check now".
*
* Like JobReferences.vue it has no error display of its own: failures are
* emitted as `fail` and successes as `ok`, for the page's single banner.
*/
import { ref, computed, watch, onMounted } from "vue";
import { storeToRefs } from "pinia";
import { useJobSearchProfileStore } from "@/stores/jobSearchProfile";
import "./jobs-shared.css";
const emit = defineEmits(["fail", "ok"]);
const store = useJobSearchProfileStore();
const { profile } = storeToRefs(store);
const blank = () => ({ profile: "", includeKeywords: "", excludeKeywords: "", locations: "", minScore: 60 });
const form = ref(blank());
const saving = ref(false);
function reset() {
form.value = profile.value
? {
profile: profile.value.profile,
includeKeywords: profile.value.includeKeywords,
excludeKeywords: profile.value.excludeKeywords,
locations: profile.value.locations,
minScore: profile.value.minScore,
}
: blank();
}
watch(profile, reset);
const dirty = computed(
() => !!profile.value && Object.keys(form.value).some((key) => form.value[key] !== profile.value[key]),
);
// Open by default until there is something in it: an empty profile means no
// lead is ever scored, which is worth making obvious.
const isEmpty = computed(() => !!profile.value && !profile.value.profile.trim());
async function save() {
saving.value = true;
try {
await store.save({ ...form.value, minScore: Number(form.value.minScore) || 0 });
emit("ok");
} catch (err) {
emit("fail", err);
} finally {
saving.value = false;
}
}
onMounted(async () => {
await store.fetch();
if (store.error) emit("fail", store.error);
reset();
});
</script>
<template>
<details class="jl-box" :open="isEmpty">
<summary class="jl-box-heading">
Search profile
<span v-if="isEmpty" class="jl-warn">empty — leads will not be scored</span>
</summary>
<form class="jl-profile" @submit.prevent="save">
<label class="jl-field jl-field-wide">
<span>About you and what you want</span>
<textarea
v-model="form.profile"
class="ja-input jl-textarea"
rows="8"
placeholder="Experience, skills, the kind of role, level, location and working arrangement you are after. Each lead is scored against this text and nothing else."
></textarea>
</label>
<label class="jl-field">
<span>Title must include one of</span>
<textarea v-model="form.includeKeywords" class="ja-input jl-textarea" rows="4" placeholder="engineer&#10;developer"></textarea>
</label>
<label class="jl-field">
<span>Title must not include</span>
<textarea v-model="form.excludeKeywords" class="ja-input jl-textarea" rows="4" placeholder="intern&#10;principal"></textarea>
</label>
<label class="jl-field">
<span>Location must include one of</span>
<textarea v-model="form.locations" class="ja-input jl-textarea" rows="4" placeholder="london&#10;remote"></textarea>
</label>
<p class="jl-hint jl-field-wide">
One entry per line; an empty list is no restriction. Title keywords match whole words, so
"intern" does not exclude "Internal". Only leads that pass are shown and scored.
</p>
<div class="jl-profile-actions jl-field-wide">
<label class="jl-inline">
Hide leads scoring below
<input v-model="form.minScore" class="ja-input jl-num" type="number" min="0" max="100" />
</label>
<button type="button" class="cv-btn cv-btn-sm" :disabled="!dirty || saving" @click="reset">Reset</button>
<button type="submit" class="cv-btn cv-btn-sm cv-btn-primary" :disabled="!dirty || saving">
{{ saving ? "Saving…" : "Save" }}
</button>
</div>
</form>
</details>
</template>
<style scoped>
/* The box and its heading (.jl-box, .jl-box-heading, .jl-hint, .jl-warn) are
in JobLeads.vue's unscoped block, shared with JobSources.vue. */
.jl-profile {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 0.75rem;
margin-top: 0.75rem;
}
.jl-field {
display: flex;
flex-direction: column;
gap: 0.25rem;
font-size: 0.8rem;
color: var(--color-ink-muted);
}
.jl-field-wide {
grid-column: 1 / -1;
}
.jl-textarea {
resize: vertical;
font-family: inherit;
line-height: 1.4;
}
.jl-profile-actions {
display: flex;
align-items: center;
gap: 0.5rem;
}
.jl-inline {
display: flex;
align-items: center;
gap: 0.5rem;
margin-right: auto;
font-size: 0.8rem;
color: var(--color-ink-muted);
}
.jl-num {
flex: 0 0 4.5rem;
min-width: 0;
}
@media (max-width: 640px) {
.jl-profile {
grid-template-columns: 1fr;
}
}
</style>
-198
View File
@@ -1,198 +0,0 @@
<script setup>
/**
* The "Sources" box on `/cv/leads`: the watch list the lead fetcher polls.
* Rendered only by JobLeads.vue; data comes from stores/jobSources.js.
*
* A source is either one company's job board (Greenhouse, Lever, Ashby —
* identified by the slug in the board's URL) or a keyword search (Adzuna,
* Reed — which need API keys set on the admin panel's Environment tab). The
* kinds are a COPY of the list in backend/services/job_sources.go; the server
* rejects any other.
*
* Like JobReferences.vue it has no error display of its own: failures are
* emitted as `fail` and successes as `ok`, for the page's single banner.
*/
import { ref, computed, onMounted } from "vue";
import { storeToRefs } from "pinia";
import { useJobSourcesStore } from "@/stores/jobSources";
import "./jobs-shared.css";
const emit = defineEmits(["fail", "ok"]);
const KINDS = [
{ value: "greenhouse", label: "Greenhouse", board: true, hint: "boards.greenhouse.io/<slug>" },
{ value: "lever", label: "Lever", board: true, hint: "jobs.lever.co/<slug>" },
{ value: "ashby", label: "Ashby", board: true, hint: "jobs.ashbyhq.com/<slug>" },
{ value: "adzuna", label: "Adzuna search", board: false },
{ value: "reed", label: "Reed search", board: false },
];
const kindOf = (value) => KINDS.find((k) => k.value === value) ?? { label: value, board: true };
const store = useJobSourcesStore();
const { sources } = storeToRefs(store);
const blank = (kind = "greenhouse") => ({ kind, label: "", token: "", query: "", location: "" });
const form = ref(blank());
const formKind = computed(() => kindOf(form.value.kind));
async function fetchSources() {
// The store's fetch() records its failure instead of throwing.
await store.fetch();
if (store.error) emit("fail", store.error);
}
defineExpose({ refresh: fetchSources });
async function createSource() {
try {
await store.create({ ...form.value });
form.value = blank(form.value.kind);
emit("ok");
} catch (err) {
emit("fail", err);
}
}
async function toggleEnabled(source) {
try {
await store.update(source.id, { enabled: !source.enabled });
emit("ok");
} catch (err) {
emit("fail", err);
}
}
async function deleteSource(source) {
// Its leads stay: the server keeps them so that re-adding the source does
// not bring back everything already dismissed.
if (!confirm(`Stop watching ${source.label}? Leads already found are kept.`)) return;
try {
await store.remove(source.id);
emit("ok");
} catch (err) {
emit("fail", err);
}
}
function describe(source) {
if (kindOf(source.kind).board) return source.token;
return source.location ? `"${source.query}" in ${source.location}` : `"${source.query}"`;
}
function lastPoll(source) {
if (!source.lastFetchedAt) return "not polled yet";
const when = new Date(source.lastFetchedAt).toLocaleString(undefined, { dateStyle: "medium", timeStyle: "short" });
return `${source.lastCount} listed · ${when}`;
}
onMounted(fetchSources);
</script>
<template>
<details class="jl-box" :open="!sources.length">
<summary class="jl-box-heading">
Sources
<span class="jl-hint">{{ sources.filter((s) => s.enabled).length }} watched</span>
<span v-if="sources.some((s) => s.lastError)" class="jl-warn">one or more failing</span>
</summary>
<div v-for="source in sources" :key="source.id" class="jl-source" :class="{ 'jl-source-off': !source.enabled }">
<span class="jl-source-kind">{{ kindOf(source.kind).label }}</span>
<span class="jl-source-label">{{ source.label }}</span>
<span class="jl-source-what" :title="describe(source)">{{ describe(source) }}</span>
<span v-if="source.lastError" class="jl-warn jl-source-status" :title="source.lastError">{{ source.lastError }}</span>
<span v-else class="jl-hint jl-source-status">{{ lastPoll(source) }}</span>
<button class="cv-btn cv-btn-sm" @click="toggleEnabled(source)">
{{ source.enabled ? "Pause" : "Resume" }}
</button>
<button class="cv-btn cv-btn-sm cv-btn-danger" @click="deleteSource(source)">Delete</button>
</div>
<p v-if="!sources.length" class="jl-hint">
Nothing is being watched. Add a company's job board, or a keyword search, below.
</p>
<form class="jl-source-form" @submit.prevent="createSource">
<select v-model="form.kind" class="ja-input ja-select">
<option v-for="k in KINDS" :key="k.value" :value="k.value">{{ k.label }}</option>
</select>
<template v-if="formKind.board">
<input v-model="form.label" class="ja-input" placeholder="Company name *" required />
<input v-model="form.token" class="ja-input" :placeholder="`Board slug * — ${formKind.hint}`" required />
</template>
<template v-else>
<input v-model="form.query" class="ja-input" placeholder="Keywords * — e.g. golang backend" required />
<input v-model="form.location" class="ja-input" placeholder="Location — e.g. London" />
</template>
<button type="submit" class="cv-btn cv-btn-primary">Add</button>
</form>
<p v-if="!formKind.board" class="jl-hint">
{{ formKind.label }} needs its API key set under Admin → Environment → Job leads.
</p>
</details>
</template>
<style scoped>
/* The box and its heading (.jl-box, .jl-box-heading, .jl-hint, .jl-warn) are
in JobLeads.vue's unscoped block, shared with JobSearchProfile.vue. */
.jl-source {
display: flex;
align-items: center;
gap: 0.6rem;
padding: 0.3rem 0;
font-size: 0.85rem;
}
.jl-source:first-of-type {
margin-top: 0.75rem;
}
.jl-source-off {
opacity: 0.55;
}
.jl-source-kind {
flex: 0 0 6.5rem;
color: var(--color-ink-muted);
}
.jl-source-label {
flex: 0 0 9rem;
font-weight: 500;
color: var(--color-ink-soft);
}
.jl-source-what {
flex: 1 1 6rem;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: var(--color-ink-muted);
}
.jl-source-status {
flex: 1 1 10rem;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-align: right;
}
.jl-source-form {
display: flex;
gap: 0.5rem;
margin-top: 0.75rem;
flex-wrap: wrap;
}
@media (max-width: 640px) {
.jl-source {
flex-wrap: wrap;
}
.jl-source-status {
flex-basis: 100%;
text-align: left;
}
}
</style>
-31
View File
@@ -1,31 +0,0 @@
/**
* The job-application status vocabulary, as the tracker at /cv/jobs shows it.
*
* This is a COPY. The source of truth is server-side: `enum JobStatus` in
* backend/graph/schema/job_application.graphql, ranked by `statusOrder` in
* backend/services/email_sync.go (the email pipeline only ever moves a row
* forward through that order). The server rejects any value outside the enum,
* so a status added here alone cannot be saved — add it there first.
*
* There is a third copy in vue/public/job-capture.user.js (STATUS_LABELS). A
* userscript is a single file installed into the browser and cannot import
* modules, so it has to be kept in step by hand.
*
* Values are the lowercase keys that go over the wire; labels are display-only.
*/
export const STATUS_OPTIONS = [
// Captured from the browser but not applied to yet. No email produces it.
{ value: "saved", label: "Saved" },
{ value: "applied", label: "Applied" },
{ value: "screening", label: "Screening" },
{ value: "assessment", label: "Assessment" },
{ value: "interviewing", label: "Interviewing" },
{ value: "offer", label: "Offer" },
{ value: "rejected", label: "Rejected" },
{ value: "withdrawn", label: "Withdrawn" },
];
// Statuses still in play — used to decide whether a row is worth chasing.
// "saved" is absent on purpose: nobody owes a reply on a job not applied to.
export const OPEN_STATUSES = ["applied", "screening", "assessment", "interviewing"];
-39
View File
@@ -1,39 +0,0 @@
/*
* Form controls shared by the job tracker's components (JobApplications.vue and
* the JobReferences / JobApplicationForm components it renders).
*
* These lived in JobApplications.vue's scoped block until the page was split.
* Scoped styles stop at a child component's root element, so the inputs inside
* the children would have lost them; this file is imported by each component
* instead. It is unscoped, so every selector is prefixed with the page's
* `.ja-root` class — which also keeps the specificity at (0,2,0), the same as
* the scoped originals, so they still beat CVLayout's `.cv-layout input`.
*
* Colours are the paper palette from CVLayout.vue.
*/
.ja-root .ja-input {
padding: 0.35rem 0.6rem;
border: 1px solid var(--color-line);
border-radius: 4px;
font-size: 0.85rem;
background: var(--color-paper);
flex: 1;
min-width: 120px;
}
.ja-root .ja-input:focus {
outline: none;
border-color: var(--color-ink-muted);
}
.ja-root .ja-select {
cursor: pointer;
}
.ja-root .ja-input-sm {
padding: 0.2rem 0.4rem;
font-size: 0.8rem;
width: 100%;
min-width: 0;
}