feat(jobs): expose discovery provenance
This commit is contained in:
@@ -1,11 +1,26 @@
|
||||
import { FormEvent, useState } from "react";
|
||||
import { Alert, Box, Button, Card, CardActions, CardContent, CircularProgress, Stack, TextField, Typography } from "@mui/material";
|
||||
import { Alert, Box, Button, Card, CardActions, CardContent, Chip, CircularProgress, Stack, TextField, Typography } from "@mui/material";
|
||||
import SearchIcon from "@mui/icons-material/Search";
|
||||
import AddIcon from "@mui/icons-material/Add";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { api } from "../api";
|
||||
|
||||
type DiscoveredJob = { id: string; title: string; company?: string; location?: string; modifiedAt?: string; url: string; source: string; countryCode: string; };
|
||||
type DiscoveredJob = {
|
||||
id: string;
|
||||
title: string;
|
||||
company?: string;
|
||||
location?: string;
|
||||
modifiedAt?: string;
|
||||
deadline?: string;
|
||||
url: string;
|
||||
source: string;
|
||||
sourceName?: string;
|
||||
acquisitionType?: string;
|
||||
retrievedAt?: string;
|
||||
countryCode: string;
|
||||
};
|
||||
|
||||
const formatDate = (value?: string) => value ? new Date(value).toLocaleDateString() : null;
|
||||
|
||||
export default function JobDiscoveryPage() {
|
||||
const navigate = useNavigate();
|
||||
@@ -38,9 +53,17 @@ export default function JobDiscoveryPage() {
|
||||
{jobs.map((job) => (
|
||||
<Card key={job.id} variant="outlined">
|
||||
<CardContent>
|
||||
<Chip label={job.sourceName || job.source.toUpperCase()} size="small" color="primary" variant="outlined" sx={{ mb: 1 }} />
|
||||
<Typography variant="h6" sx={{ fontWeight: 800 }}>{job.title}</Typography>
|
||||
<Typography color="text.secondary">{[job.company, job.location].filter(Boolean).join(" · ")}</Typography>
|
||||
<Typography variant="caption" color="text.secondary">NAV · Norway{job.modifiedAt ? " · Updated " + new Date(job.modifiedAt).toLocaleDateString() : ""}</Typography>
|
||||
<Stack spacing={0.25} sx={{ mt: 1 }}>
|
||||
<Typography variant="caption" color="text.secondary">
|
||||
{job.acquisitionType === "searched" ? "Searched listing" : "Source type unavailable"}
|
||||
{formatDate(job.retrievedAt) ? ` · Retrieved ${formatDate(job.retrievedAt)}` : ""}
|
||||
</Typography>
|
||||
{formatDate(job.modifiedAt) ? <Typography variant="caption" color="text.secondary">Listing updated {formatDate(job.modifiedAt)}</Typography> : null}
|
||||
{formatDate(job.deadline) ? <Typography variant="body2" color="text.primary">Application deadline: {formatDate(job.deadline)}</Typography> : null}
|
||||
</Stack>
|
||||
</CardContent>
|
||||
<CardActions>
|
||||
<Button href={job.url} target="_blank" rel="noreferrer">View listing</Button>
|
||||
|
||||
Reference in New Issue
Block a user