refactor: separate components
This commit is contained in:
parent
5d7a57fd00
commit
06c708b160
12 changed files with 1295 additions and 1293 deletions
|
|
@ -5,7 +5,7 @@ import { AppFooter } from '../components/layout/AppFooter'
|
||||||
import { GoGuessHeader } from '../components/layout/GoGuessHeader'
|
import { GoGuessHeader } from '../components/layout/GoGuessHeader'
|
||||||
import { WorkspaceUtilities } from '../components/layout/WorkspaceUtilities'
|
import { WorkspaceUtilities } from '../components/layout/WorkspaceUtilities'
|
||||||
import { NotFound } from '../components/ui/NotFound'
|
import { NotFound } from '../components/ui/NotFound'
|
||||||
import { CalendarPage, InboxPage, ScheduledInterviewPage } from '../features/interviews'
|
import { InboxPage, ScheduledInterviewPage } from '../features/interviews'
|
||||||
import { CreateJobPage, JobDetailPage, JobsPage } from '../features/jobs'
|
import { CreateJobPage, JobDetailPage, JobsPage } from '../features/jobs'
|
||||||
import {
|
import {
|
||||||
CreateParticipantPage,
|
CreateParticipantPage,
|
||||||
|
|
@ -13,7 +13,7 @@ import {
|
||||||
ParticipantsPage,
|
ParticipantsPage,
|
||||||
} from '../features/participants'
|
} from '../features/participants'
|
||||||
import { QuestionLibraryPage, QuestionPage } from '../features/questions'
|
import { QuestionLibraryPage, QuestionPage } from '../features/questions'
|
||||||
import { ProfilePage, UsersPage } from '../features/users'
|
import {CalendarPage, ProfilePage, UsersPage} from '../features/users'
|
||||||
|
|
||||||
export function AuthenticatedApp({ onLogout }: { onLogout: () => void }) {
|
export function AuthenticatedApp({ onLogout }: { onLogout: () => void }) {
|
||||||
const [open, setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
|
|
|
||||||
|
|
@ -5,3 +5,9 @@ export function errorMessage(error: unknown) {
|
||||||
? error.message
|
? error.message
|
||||||
: 'Something went wrong'
|
: 'Something went wrong'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function message(error: unknown) {
|
||||||
|
return error instanceof ApiError || error instanceof Error
|
||||||
|
? error.message
|
||||||
|
: 'Something went wrong'
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
export { useAuthSession } from './Account'
|
export { useAuthSession } from './Account'
|
||||||
export { ErrorAlert } from './ErrorAlert'
|
export { ErrorAlert } from './ErrorAlert'
|
||||||
export { errorMessage } from './errorMessage'
|
export { errorMessage, message } from './errorMessage'
|
||||||
export { Loading } from './Loading'
|
export { Loading } from './Loading'
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,6 @@ export function SideBar({
|
||||||
icon={<CircleHelp size={20} />}
|
icon={<CircleHelp size={20} />}
|
||||||
close={close}
|
close={close}
|
||||||
/>
|
/>
|
||||||
<NavItem to="/calendar" label="Calendar" icon={<CalendarDays size={20} />} close={close} />
|
|
||||||
<NavItem to="/users" label="Users" icon={<UserRound size={20} />} close={close} />
|
<NavItem to="/users" label="Users" icon={<UserRound size={20} />} close={close} />
|
||||||
</nav>
|
</nav>
|
||||||
<div className="sidebar-bottom">
|
<div className="sidebar-bottom">
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,18 @@
|
||||||
import { Inbox } from 'lucide-react'
|
import {CalendarDays, Inbox, Mail} from 'lucide-react'
|
||||||
import { NavLink } from 'react-router-dom'
|
import {NavLink} from 'react-router-dom'
|
||||||
import type { User } from '../../types'
|
import type {User} from '../../types'
|
||||||
|
|
||||||
export function WorkspaceUtilities({ user }: { user: User | null }) {
|
export function WorkspaceUtilities({user}: { user: User | null }) {
|
||||||
const profileLabel = user?.displayName || user?.email || 'Profile'
|
const profileLabel = user?.displayName || user?.email || 'Profile'
|
||||||
return (
|
return (
|
||||||
<nav className="workspace-utilities" aria-label="Account navigation">
|
<nav className="workspace-utilities" aria-label="Account navigation">
|
||||||
<NavLink className="utility-link" to="/inbox">
|
<NavLink className="utility-link" to="/inbox">
|
||||||
<Inbox size={18} aria-hidden="true" />
|
<Mail size={18} aria-hidden="true"/>
|
||||||
<span>Inbox</span>
|
<span>Invitations</span>
|
||||||
|
</NavLink>
|
||||||
|
<NavLink className="utility-link" to="/calendar">
|
||||||
|
<CalendarDays size={18} aria-hidden="true"/>
|
||||||
|
<span>Calendar</span>
|
||||||
</NavLink>
|
</NavLink>
|
||||||
<NavLink className="utility-link profile-utility" to="/profile">
|
<NavLink className="utility-link profile-utility" to="/profile">
|
||||||
<span className="avatar tiny" aria-hidden="true">
|
<span className="avatar tiny" aria-hidden="true">
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ export function PageHeader({
|
||||||
<header className="page-header">
|
<header className="page-header">
|
||||||
<div>
|
<div>
|
||||||
<span className="eyebrow">{eyebrow}</span>
|
<span className="eyebrow">{eyebrow}</span>
|
||||||
<h1>{title}</h1>
|
|
||||||
{description && <p>{description}</p>}
|
{description && <p>{description}</p>}
|
||||||
</div>
|
</div>
|
||||||
{action}
|
{action}
|
||||||
|
|
|
||||||
|
|
@ -15,13 +15,13 @@ export const footerLinkGroups: FooterLinkGroup[] = [
|
||||||
{ label: 'Jobs', href: '/jobs' },
|
{ label: 'Jobs', href: '/jobs' },
|
||||||
{ label: 'Participants', href: '/participants' },
|
{ label: 'Participants', href: '/participants' },
|
||||||
{ label: 'Question library', href: '/questions' },
|
{ label: 'Question library', href: '/questions' },
|
||||||
{ label: 'Calendar', href: '/calendar' },
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Useful links',
|
title: 'Useful links',
|
||||||
links: [
|
links: [
|
||||||
{ label: 'Your inbox', href: '/inbox' },
|
{ label: 'Your inbox', href: '/inbox' },
|
||||||
|
{ label: 'Calendar', href: '/calendar' },
|
||||||
{ label: 'Your profile', href: '/profile' },
|
{ label: 'Your profile', href: '/profile' },
|
||||||
{ label: 'Interview team', href: '/users' },
|
{ label: 'Interview team', href: '/users' },
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
export { CalendarPage, InboxPage, ParticipantMeetingPage, ScheduledInterviewPage } from './pages'
|
export { InboxPage, ParticipantMeetingPage, ScheduledInterviewPage } from './pages'
|
||||||
export { ScheduleInterviewForm } from './components/ScheduleInterviewForm'
|
export { ScheduleInterviewForm } from './components/ScheduleInterviewForm'
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,11 @@
|
||||||
import { Check, Copy, UsersRound, X } from 'lucide-react'
|
import {Check, Copy, UsersRound, X} from 'lucide-react'
|
||||||
import { type FormEvent, useEffect, useMemo, useState } from 'react'
|
import {type FormEvent, useEffect, useState} from 'react'
|
||||||
import { Link, useParams } from 'react-router-dom'
|
import {Link, useParams} from 'react-router-dom'
|
||||||
import { api, ApiError } from '../../api/client'
|
import {api} from '../../api/client'
|
||||||
import type { ParticipantMeeting, ScheduledInterview } from '../../types'
|
import type {ParticipantMeeting, ScheduledInterview} from '../../types'
|
||||||
import { ErrorAlert, Loading } from '../../components/ui/AsyncState'
|
import {ErrorAlert, Loading} from '../../components/ui/AsyncState'
|
||||||
import { DateAndPlace, InterviewCard } from './components/InterviewCard'
|
import {DateAndPlace, InterviewCard} from './components/InterviewCard'
|
||||||
|
import {message} from "../../components/actions";
|
||||||
function message(error: unknown) {
|
|
||||||
return error instanceof ApiError || error instanceof Error
|
|
||||||
? error.message
|
|
||||||
: 'Something went wrong'
|
|
||||||
}
|
|
||||||
|
|
||||||
export function InboxPage() {
|
export function InboxPage() {
|
||||||
const [items, setItems] = useState<ScheduledInterview[]>([])
|
const [items, setItems] = useState<ScheduledInterview[]>([])
|
||||||
|
|
@ -44,9 +39,9 @@ export function InboxPage() {
|
||||||
<p>Respond to interview invitations assigned to you.</p>
|
<p>Respond to interview invitations assigned to you.</p>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
{error && <ErrorAlert error={error} />}
|
{error && <ErrorAlert error={error}/>}
|
||||||
{loading ? (
|
{loading ? (
|
||||||
<Loading />
|
<Loading/>
|
||||||
) : (
|
) : (
|
||||||
<section className="meeting-list">
|
<section className="meeting-list">
|
||||||
{items.map((item) => (
|
{items.map((item) => (
|
||||||
|
|
@ -57,14 +52,14 @@ export function InboxPage() {
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => void respond(item.id, 'accepted')}
|
onClick={() => void respond(item.id, 'accepted')}
|
||||||
>
|
>
|
||||||
<Check size={17} /> Accept
|
<Check size={17}/> Accept
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
className="button secondary danger"
|
className="button secondary danger"
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => void respond(item.id, 'declined')}
|
onClick={() => void respond(item.id, 'declined')}
|
||||||
>
|
>
|
||||||
<X size={17} /> Decline
|
<X size={17}/> Decline
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</InterviewCard>
|
</InterviewCard>
|
||||||
|
|
@ -81,62 +76,6 @@ export function InboxPage() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function CalendarPage() {
|
|
||||||
const [items, setItems] = useState<ScheduledInterview[]>([])
|
|
||||||
const [error, setError] = useState('')
|
|
||||||
const [loading, setLoading] = useState(true)
|
|
||||||
useEffect(() => {
|
|
||||||
void api
|
|
||||||
.calendar()
|
|
||||||
.then(setItems)
|
|
||||||
.catch((value) => setError(message(value)))
|
|
||||||
.finally(() => setLoading(false))
|
|
||||||
}, [])
|
|
||||||
const groups = useMemo(() => {
|
|
||||||
return [...items]
|
|
||||||
.sort((a, b) => a.startsAt.localeCompare(b.startsAt))
|
|
||||||
.reduce<Record<string, ScheduledInterview[]>>((result, item) => {
|
|
||||||
const key = new Date(item.startsAt).toLocaleDateString(undefined, {
|
|
||||||
weekday: 'long',
|
|
||||||
month: 'long',
|
|
||||||
day: 'numeric',
|
|
||||||
year: 'numeric',
|
|
||||||
})
|
|
||||||
;(result[key] ??= []).push(item)
|
|
||||||
return result
|
|
||||||
}, {})
|
|
||||||
}, [items])
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<header className="page-header">
|
|
||||||
<div>
|
|
||||||
<span className="eyebrow">Schedule</span>
|
|
||||||
<h1>Calendar</h1>
|
|
||||||
<p>Your accepted and organized interviews, grouped by date.</p>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
{error && <ErrorAlert error={error} />}
|
|
||||||
{loading ? (
|
|
||||||
<Loading />
|
|
||||||
) : (
|
|
||||||
Object.entries(groups).map(([date, interviews]) => (
|
|
||||||
<section className="calendar-day" key={date}>
|
|
||||||
<h2>{date}</h2>
|
|
||||||
<div className="meeting-list">
|
|
||||||
{interviews.map((item) => (
|
|
||||||
<InterviewCard interview={item} key={item.id}>
|
|
||||||
<Link className="button secondary" to={`/scheduled-interviews/${item.id}`}>
|
|
||||||
Open session
|
|
||||||
</Link>
|
|
||||||
</InterviewCard>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
))
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export function ScheduledInterviewPage() {
|
export function ScheduledInterviewPage() {
|
||||||
const id = Number(useParams().id)
|
const id = Number(useParams().id)
|
||||||
|
|
@ -180,7 +119,7 @@ export function ScheduledInterviewPage() {
|
||||||
if (event.type === 'document.updated') {
|
if (event.type === 'document.updated') {
|
||||||
setDocument(event.sharedDocument)
|
setDocument(event.sharedDocument)
|
||||||
setInterview((current) =>
|
setInterview((current) =>
|
||||||
current ? { ...current, sharedDocument: event.sharedDocument } : current,
|
current ? {...current, sharedDocument: event.sharedDocument} : current,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -241,8 +180,8 @@ export function ScheduledInterviewPage() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!interview && !error) return <Loading />
|
if (!interview && !error) return <Loading/>
|
||||||
if (!interview) return <ErrorAlert error={error} />
|
if (!interview) return <ErrorAlert error={error}/>
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Link className="back-link" to="/calendar">
|
<Link className="back-link" to="/calendar">
|
||||||
|
|
@ -256,8 +195,8 @@ export function ScheduledInterviewPage() {
|
||||||
</div>
|
</div>
|
||||||
<span className={`status status-${interview.status}`}>{interview.status}</span>
|
<span className={`status status-${interview.status}`}>{interview.status}</span>
|
||||||
</header>
|
</header>
|
||||||
{error && <ErrorAlert error={error} />}
|
{error && <ErrorAlert error={error}/>}
|
||||||
<DateAndPlace interview={interview} />
|
<DateAndPlace interview={interview}/>
|
||||||
<div className="session-actions">
|
<div className="session-actions">
|
||||||
<button
|
<button
|
||||||
className="button secondary"
|
className="button secondary"
|
||||||
|
|
@ -265,7 +204,7 @@ export function ScheduledInterviewPage() {
|
||||||
onClick={() => void copyParticipantLink(interview.candidateUrl)}
|
onClick={() => void copyParticipantLink(interview.candidateUrl)}
|
||||||
aria-label="Copy participant interview link"
|
aria-label="Copy participant interview link"
|
||||||
>
|
>
|
||||||
{linkCopied ? <Check size={17} /> : <Copy size={17} />}
|
{linkCopied ? <Check size={17}/> : <Copy size={17}/>}
|
||||||
{linkCopied ? 'Link copied' : 'Copy participant link'}
|
{linkCopied ? 'Link copied' : 'Copy participant link'}
|
||||||
</button>
|
</button>
|
||||||
{interview.status !== 'started' && interview.status !== 'completed' && (
|
{interview.status !== 'started' && interview.status !== 'completed' && (
|
||||||
|
|
@ -356,7 +295,7 @@ export function ScheduledInterviewPage() {
|
||||||
<div className="user-list">
|
<div className="user-list">
|
||||||
{interview.attendees.map((attendee) => (
|
{interview.attendees.map((attendee) => (
|
||||||
<article className="user-row" key={attendee.userId}>
|
<article className="user-row" key={attendee.userId}>
|
||||||
<UsersRound />
|
<UsersRound/>
|
||||||
<div>
|
<div>
|
||||||
<strong>{attendee.displayName}</strong>
|
<strong>{attendee.displayName}</strong>
|
||||||
<small>{attendee.email}</small>
|
<small>{attendee.email}</small>
|
||||||
|
|
@ -385,7 +324,7 @@ export function ParticipantMeetingPage() {
|
||||||
if (event.type !== 'document.updated') return
|
if (event.type !== 'document.updated') return
|
||||||
latestDocument = event.sharedDocument
|
latestDocument = event.sharedDocument
|
||||||
setMeeting((current) =>
|
setMeeting((current) =>
|
||||||
current ? { ...current, sharedDocument: event.sharedDocument } : current,
|
current ? {...current, sharedDocument: event.sharedDocument} : current,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
controller.signal,
|
controller.signal,
|
||||||
|
|
@ -427,12 +366,12 @@ export function ParticipantMeetingPage() {
|
||||||
</header>
|
</header>
|
||||||
{!meeting && !error && (
|
{!meeting && !error && (
|
||||||
<section className="interview-card">
|
<section className="interview-card">
|
||||||
<Loading />
|
<Loading/>
|
||||||
</section>
|
</section>
|
||||||
)}
|
)}
|
||||||
{error && (
|
{error && (
|
||||||
<section className="interview-card">
|
<section className="interview-card">
|
||||||
<ErrorAlert error={error} />
|
<ErrorAlert error={error}/>
|
||||||
</section>
|
</section>
|
||||||
)}
|
)}
|
||||||
{meeting && (
|
{meeting && (
|
||||||
|
|
@ -441,7 +380,7 @@ export function ParticipantMeetingPage() {
|
||||||
<h1>{meeting.jobTitle}</h1>
|
<h1>{meeting.jobTitle}</h1>
|
||||||
<p>Welcome, {meeting.participantName}.</p>
|
<p>Welcome, {meeting.participantName}.</p>
|
||||||
<span className={`status status-${meeting.status}`}>{meeting.status}</span>
|
<span className={`status status-${meeting.status}`}>{meeting.status}</span>
|
||||||
<DateAndPlace interview={meeting} />
|
<DateAndPlace interview={meeting}/>
|
||||||
<section className="public-document" aria-labelledby="shared-document-title">
|
<section className="public-document" aria-labelledby="shared-document-title">
|
||||||
<h2 id="shared-document-title">Shared documentation</h2>
|
<h2 id="shared-document-title">Shared documentation</h2>
|
||||||
<div>{meeting.sharedDocument || 'No shared documentation has been added yet.'}</div>
|
<div>{meeting.sharedDocument || 'No shared documentation has been added yet.'}</div>
|
||||||
|
|
|
||||||
|
|
@ -12,30 +12,22 @@ import {
|
||||||
Trash2,
|
Trash2,
|
||||||
X,
|
X,
|
||||||
} from 'lucide-react'
|
} from 'lucide-react'
|
||||||
import { type FormEvent, type ReactNode, useEffect, useState } from 'react'
|
import {type ReactNode, SyntheticEvent, useEffect, useState} from 'react'
|
||||||
import { Link, useNavigate, useParams } from 'react-router-dom'
|
import {Link, useNavigate, useParams} from 'react-router-dom'
|
||||||
import { api } from '../../api/client'
|
import {api} from '../../api/client'
|
||||||
import { ErrorAlert, errorMessage, Loading } from '../../components/actions'
|
import {ErrorAlert, errorMessage, Loading} from '../../components/actions'
|
||||||
import { FormActions, FormField } from '../../components/form'
|
import {FormActions, FormField} from '../../components/form'
|
||||||
import { EmptyState, Fact, Metric, StatusBadge } from '../../components/ui/Display'
|
import {EmptyState, Fact, Metric, StatusBadge} from '../../components/ui/Display'
|
||||||
import { NotFound } from '../../components/ui/NotFound'
|
import {NotFound} from '../../components/ui/NotFound'
|
||||||
import { PageHeader } from '../../components/ui/PageHeader'
|
import {PageHeader} from '../../components/ui/PageHeader'
|
||||||
import { useData } from '../../app/useData'
|
import {useData} from '../../app/useData'
|
||||||
import { CodePanel } from '../assessments/CodeReview'
|
import {CodePanel} from '../assessments/CodeReview'
|
||||||
import { ScheduleInterviewForm } from '../interviews'
|
import {ScheduleInterviewForm} from '../interviews'
|
||||||
import { Avatar, SkillList } from '../participants'
|
import {Avatar, SkillList} from '../participants'
|
||||||
import type {
|
import type {CandidateMatch, Interview, Invitation, Job, JobStatus, Question, ScheduledInterview,} from '../../types'
|
||||||
CandidateMatch,
|
|
||||||
Interview,
|
|
||||||
Invitation,
|
|
||||||
Job,
|
|
||||||
JobStatus,
|
|
||||||
Question,
|
|
||||||
ScheduledInterview,
|
|
||||||
} from '../../types'
|
|
||||||
|
|
||||||
export function JobsPage() {
|
export function JobsPage() {
|
||||||
const { jobs, loading, error, reload } = useData()
|
const {jobs, loading, error, reload, participants} = useData()
|
||||||
const [query, setQuery] = useState('')
|
const [query, setQuery] = useState('')
|
||||||
const filtered = jobs.filter((job) =>
|
const filtered = jobs.filter((job) =>
|
||||||
`${job.title} ${job.position} ${job.seniority} ${job.labels.join(' ')}`
|
`${job.title} ${job.position} ${job.seniority} ${job.labels.join(' ')}`
|
||||||
|
|
@ -50,14 +42,14 @@ export function JobsPage() {
|
||||||
description="Create roles, build assessments, and compare candidate fit."
|
description="Create roles, build assessments, and compare candidate fit."
|
||||||
action={
|
action={
|
||||||
<Link to="/jobs/new" className="button primary">
|
<Link to="/jobs/new" className="button primary">
|
||||||
<Plus size={18} /> Create job
|
<Plus size={18}/> Create job
|
||||||
</Link>
|
</Link>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
{error && <ErrorAlert message={error} retry={reload} />}
|
{error && <ErrorAlert message={error} retry={reload}/>}
|
||||||
<section className="metrics">
|
<section className="metrics">
|
||||||
<Metric label="Job postings" value={String(jobs.length)} />
|
<Metric label="Job postings" value={String(jobs.length)}/>
|
||||||
<Metric label="Participants" value="—" />
|
<Metric label="Participants" value={String(participants.length)}/>
|
||||||
<Metric
|
<Metric
|
||||||
label="Assessments"
|
label="Assessments"
|
||||||
value={String(jobs.reduce((sum, job) => sum + job.questions.length, 0))}
|
value={String(jobs.reduce((sum, job) => sum + job.questions.length, 0))}
|
||||||
|
|
@ -66,7 +58,7 @@ export function JobsPage() {
|
||||||
<section className="card">
|
<section className="card">
|
||||||
<div className="toolbar">
|
<div className="toolbar">
|
||||||
<label className="search-field">
|
<label className="search-field">
|
||||||
<Search size={18} />
|
<Search size={18}/>
|
||||||
<span className="sr-only">Search jobs</span>
|
<span className="sr-only">Search jobs</span>
|
||||||
<input
|
<input
|
||||||
value={query}
|
value={query}
|
||||||
|
|
@ -77,7 +69,7 @@ export function JobsPage() {
|
||||||
<span className="result-count">{filtered.length} jobs</span>
|
<span className="result-count">{filtered.length} jobs</span>
|
||||||
</div>
|
</div>
|
||||||
{loading ? (
|
{loading ? (
|
||||||
<Loading />
|
<Loading/>
|
||||||
) : (
|
) : (
|
||||||
<div className="table-wrap">
|
<div className="table-wrap">
|
||||||
<table>
|
<table>
|
||||||
|
|
@ -103,11 +95,11 @@ export function JobsPage() {
|
||||||
<small>{job.labels.join(' · ') || 'No labels'}</small>
|
<small>{job.labels.join(' · ') || 'No labels'}</small>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<StatusBadge value={job.seniority} />
|
<StatusBadge value={job.seniority}/>
|
||||||
</td>
|
</td>
|
||||||
<td>{job.position}</td>
|
<td>{job.position}</td>
|
||||||
<td>
|
<td>
|
||||||
<StatusBadge value={job.status} />
|
<StatusBadge value={job.status}/>
|
||||||
</td>
|
</td>
|
||||||
<td>{job.questions.length}</td>
|
<td>{job.questions.length}</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
@ -116,7 +108,7 @@ export function JobsPage() {
|
||||||
to={`/jobs/${job.id}`}
|
to={`/jobs/${job.id}`}
|
||||||
aria-label={`View ${job.title}`}
|
aria-label={`View ${job.title}`}
|
||||||
>
|
>
|
||||||
<ChevronRight />
|
<ChevronRight/>
|
||||||
</Link>
|
</Link>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
@ -126,7 +118,7 @@ export function JobsPage() {
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{!loading && !filtered.length && !error && (
|
{!loading && !filtered.length && !error && (
|
||||||
<EmptyState title="No jobs found" description="Create a job or adjust your search." />
|
<EmptyState title="No jobs found" description="Create a job or adjust your search."/>
|
||||||
)}
|
)}
|
||||||
</section>
|
</section>
|
||||||
</>
|
</>
|
||||||
|
|
@ -191,14 +183,14 @@ export function JobDetailPage() {
|
||||||
active = false
|
active = false
|
||||||
}
|
}
|
||||||
}, [id])
|
}, [id])
|
||||||
if (loading) return <Loading />
|
if (loading) return <Loading/>
|
||||||
if (error) return <ErrorAlert message={error} retry={load} />
|
if (error) return <ErrorAlert message={error} retry={load}/>
|
||||||
if (!job) return <NotFound />
|
if (!job) return <NotFound/>
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Link className="back-link" to="/jobs">
|
<Link className="back-link" to="/jobs">
|
||||||
<ArrowLeft size={17} /> All jobs
|
<ArrowLeft size={17}/> All jobs
|
||||||
</Link>
|
</Link>
|
||||||
<PageHeader
|
<PageHeader
|
||||||
eyebrow={`${job.seniority} · ${job.position}`}
|
eyebrow={`${job.seniority} · ${job.position}`}
|
||||||
|
|
@ -230,24 +222,24 @@ export function JobDetailPage() {
|
||||||
<h2>About the role</h2>
|
<h2>About the role</h2>
|
||||||
<p>{job.description}</p>
|
<p>{job.description}</p>
|
||||||
<h3>Required skills</h3>
|
<h3>Required skills</h3>
|
||||||
<SkillList skills={job.requiredSkills} />
|
<SkillList skills={job.requiredSkills}/>
|
||||||
<h3>Additional skills</h3>
|
<h3>Additional skills</h3>
|
||||||
<SkillList skills={job.additionalSkills} />
|
<SkillList skills={job.additionalSkills}/>
|
||||||
</section>
|
</section>
|
||||||
<aside className="card facts">
|
<aside className="card facts">
|
||||||
<h2>Job details</h2>
|
<h2>Job details</h2>
|
||||||
<Fact label="Seniority" value={job.seniority} />
|
<Fact label="Seniority" value={job.seniority}/>
|
||||||
<Fact label="Position" value={job.position} />
|
<Fact label="Position" value={job.position}/>
|
||||||
<Fact label="Status" value={job.status} />
|
<Fact label="Status" value={job.status}/>
|
||||||
<Fact label="Duration" value={`${job.durationMinutes} minutes`} />
|
<Fact label="Duration" value={`${job.durationMinutes} minutes`}/>
|
||||||
<Fact label="Labels" value={job.labels.join(', ') || 'None'} />
|
<Fact label="Labels" value={job.labels.join(', ') || 'None'}/>
|
||||||
<Fact label="Created" value={new Date(job.createdAt).toLocaleDateString()} />
|
<Fact label="Created" value={new Date(job.createdAt).toLocaleDateString()}/>
|
||||||
<JobSettings job={job} onUpdated={setJob} />
|
<JobSettings job={job} onUpdated={setJob}/>
|
||||||
</aside>
|
</aside>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{tab === 'questions' && <JobQuestionsView job={job} onUpdated={setJob} />}
|
{tab === 'questions' && <JobQuestionsView job={job} onUpdated={setJob}/>}
|
||||||
{tab === 'candidates' && <CandidateMatchView matches={matches} />}
|
{tab === 'candidates' && <CandidateMatchView matches={matches}/>}
|
||||||
{tab === 'invitations' && (
|
{tab === 'invitations' && (
|
||||||
<InvitationsView
|
<InvitationsView
|
||||||
job={job}
|
job={job}
|
||||||
|
|
@ -267,18 +259,18 @@ export function JobDetailPage() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function JobSettings({ job, onUpdated }: { job: Job; onUpdated: (job: Job) => void }) {
|
function JobSettings({job, onUpdated}: { job: Job; onUpdated: (job: Job) => void }) {
|
||||||
const [status, setStatus] = useState<JobStatus>(job.status)
|
const [status, setStatus] = useState<JobStatus>(job.status)
|
||||||
const [durationMinutes, setDurationMinutes] = useState(job.durationMinutes)
|
const [durationMinutes, setDurationMinutes] = useState(job.durationMinutes)
|
||||||
const [saving, setSaving] = useState(false)
|
const [saving, setSaving] = useState(false)
|
||||||
const [error, setError] = useState('')
|
const [error, setError] = useState('')
|
||||||
|
|
||||||
async function save(event: FormEvent) {
|
async function save(event: SyntheticEvent<HTMLFormElement>) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
setSaving(true)
|
setSaving(true)
|
||||||
setError('')
|
setError('')
|
||||||
try {
|
try {
|
||||||
onUpdated(await api.jobs.update(job.id, { status, durationMinutes }))
|
onUpdated(await api.jobs.update(job.id, {status, durationMinutes}))
|
||||||
} catch (requestError) {
|
} catch (requestError) {
|
||||||
setError(errorMessage(requestError))
|
setError(errorMessage(requestError))
|
||||||
} finally {
|
} finally {
|
||||||
|
|
@ -309,7 +301,7 @@ function JobSettings({ job, onUpdated }: { job: Job; onUpdated: (job: Job) => vo
|
||||||
onChange={(event) => setDurationMinutes(Number(event.target.value))}
|
onChange={(event) => setDurationMinutes(Number(event.target.value))}
|
||||||
/>
|
/>
|
||||||
</FormField>
|
</FormField>
|
||||||
{error && <ErrorAlert message={error} />}
|
{error && <ErrorAlert message={error}/>}
|
||||||
<button className="button secondary wide" type="submit" disabled={saving}>
|
<button className="button secondary wide" type="submit" disabled={saving}>
|
||||||
{saving ? 'Saving…' : 'Save interview settings'}
|
{saving ? 'Saving…' : 'Save interview settings'}
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -317,7 +309,7 @@ function JobSettings({ job, onUpdated }: { job: Job; onUpdated: (job: Job) => vo
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function JobQuestionsView({ job, onUpdated }: { job: Job; onUpdated: (job: Job) => void }) {
|
function JobQuestionsView({job, onUpdated}: { job: Job; onUpdated: (job: Job) => void }) {
|
||||||
const [query, setQuery] = useState('')
|
const [query, setQuery] = useState('')
|
||||||
const [results, setResults] = useState<Question[]>([])
|
const [results, setResults] = useState<Question[]>([])
|
||||||
const [error, setError] = useState('')
|
const [error, setError] = useState('')
|
||||||
|
|
@ -345,7 +337,7 @@ function JobQuestionsView({ job, onUpdated }: { job: Job; onUpdated: (job: Job)
|
||||||
setError('')
|
setError('')
|
||||||
try {
|
try {
|
||||||
await api.jobs.attachQuestion(job.id, question.id)
|
await api.jobs.attachQuestion(job.id, question.id)
|
||||||
onUpdated({ ...job, questions: [...job.questions, question] })
|
onUpdated({...job, questions: [...job.questions, question]})
|
||||||
} catch (requestError) {
|
} catch (requestError) {
|
||||||
setError(errorMessage(requestError))
|
setError(errorMessage(requestError))
|
||||||
}
|
}
|
||||||
|
|
@ -386,7 +378,7 @@ function JobQuestionsView({ job, onUpdated }: { job: Job; onUpdated: (job: Job)
|
||||||
onClick={() => void detach(question)}
|
onClick={() => void detach(question)}
|
||||||
aria-label={`Detach ${question.text}`}
|
aria-label={`Detach ${question.text}`}
|
||||||
>
|
>
|
||||||
<Trash2 size={16} /> Detach
|
<Trash2 size={16}/> Detach
|
||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
@ -411,7 +403,7 @@ function JobQuestionsView({ job, onUpdated }: { job: Job; onUpdated: (job: Job)
|
||||||
</div>
|
</div>
|
||||||
<div className="panel-padding">
|
<div className="panel-padding">
|
||||||
<label className="search-field">
|
<label className="search-field">
|
||||||
<Search size={18} />
|
<Search size={18}/>
|
||||||
<span className="sr-only">Search question library</span>
|
<span className="sr-only">Search question library</span>
|
||||||
<input
|
<input
|
||||||
value={query}
|
value={query}
|
||||||
|
|
@ -419,7 +411,7 @@ function JobQuestionsView({ job, onUpdated }: { job: Job; onUpdated: (job: Job)
|
||||||
placeholder="Search question library…"
|
placeholder="Search question library…"
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
{error && <ErrorAlert message={error} />}
|
{error && <ErrorAlert message={error}/>}
|
||||||
</div>
|
</div>
|
||||||
<div className="question-list compact">
|
<div className="question-list compact">
|
||||||
{results
|
{results
|
||||||
|
|
@ -434,7 +426,7 @@ function JobQuestionsView({ job, onUpdated }: { job: Job; onUpdated: (job: Job)
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => void attach(question)}
|
onClick={() => void attach(question)}
|
||||||
>
|
>
|
||||||
<Plus size={16} /> Attach
|
<Plus size={16}/> Attach
|
||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
@ -453,7 +445,7 @@ function InvitationsView({
|
||||||
onInvited,
|
onInvited,
|
||||||
onInvitationUpdated,
|
onInvitationUpdated,
|
||||||
onScheduled,
|
onScheduled,
|
||||||
}: {
|
}: {
|
||||||
job: Job
|
job: Job
|
||||||
matches: CandidateMatch[]
|
matches: CandidateMatch[]
|
||||||
invitations: Invitation[]
|
invitations: Invitation[]
|
||||||
|
|
@ -511,9 +503,9 @@ function InvitationsView({
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="eligible-list">
|
<div className="eligible-list">
|
||||||
{eligible.map(({ participant }) => (
|
{eligible.map(({participant}) => (
|
||||||
<article className="eligible-row" key={participant.id}>
|
<article className="eligible-row" key={participant.id}>
|
||||||
<Avatar person={participant} />
|
<Avatar person={participant}/>
|
||||||
<div>
|
<div>
|
||||||
<strong>
|
<strong>
|
||||||
{participant.firstName} {participant.lastName}
|
{participant.firstName} {participant.lastName}
|
||||||
|
|
@ -526,14 +518,14 @@ function InvitationsView({
|
||||||
disabled={sendingId === participant.id}
|
disabled={sendingId === participant.id}
|
||||||
onClick={() => void send(participant.id)}
|
onClick={() => void send(participant.id)}
|
||||||
>
|
>
|
||||||
<Send size={16} />{' '}
|
<Send size={16}/>{' '}
|
||||||
{sendingId === participant.id ? 'Generating…' : 'Generate invitation'}
|
{sendingId === participant.id ? 'Generating…' : 'Generate invitation'}
|
||||||
</button>
|
</button>
|
||||||
</article>
|
</article>
|
||||||
))}
|
))}
|
||||||
{!eligible.length && <p className="muted">All eligible candidates have been invited.</p>}
|
{!eligible.length && <p className="muted">All eligible candidates have been invited.</p>}
|
||||||
</div>
|
</div>
|
||||||
{error && <ErrorAlert message={error} />}
|
{error && <ErrorAlert message={error}/>}
|
||||||
<div className="invitation-list">
|
<div className="invitation-list">
|
||||||
{invitations.map((invitation) => (
|
{invitations.map((invitation) => (
|
||||||
<article className="invitation-row" key={invitation.id}>
|
<article className="invitation-row" key={invitation.id}>
|
||||||
|
|
@ -541,7 +533,7 @@ function InvitationsView({
|
||||||
<strong>{invitation.participantName}</strong>
|
<strong>{invitation.participantName}</strong>
|
||||||
<small>{invitation.participantEmail}</small>
|
<small>{invitation.participantEmail}</small>
|
||||||
</div>
|
</div>
|
||||||
<StatusBadge value={invitation.status} />
|
<StatusBadge value={invitation.status}/>
|
||||||
<code>{invitation.participantUrl}</code>
|
<code>{invitation.participantUrl}</code>
|
||||||
<button
|
<button
|
||||||
className="button secondary"
|
className="button secondary"
|
||||||
|
|
@ -549,7 +541,7 @@ function InvitationsView({
|
||||||
onClick={() => void copy(invitation.participantUrl)}
|
onClick={() => void copy(invitation.participantUrl)}
|
||||||
aria-label={`Copy interview URL for ${invitation.participantName}`}
|
aria-label={`Copy interview URL for ${invitation.participantName}`}
|
||||||
>
|
>
|
||||||
<Copy size={16} /> Copy URL
|
<Copy size={16}/> Copy URL
|
||||||
</button>
|
</button>
|
||||||
{['accepted', 'completed'].includes(invitation.status) && (
|
{['accepted', 'completed'].includes(invitation.status) && (
|
||||||
<button
|
<button
|
||||||
|
|
@ -564,7 +556,7 @@ function InvitationsView({
|
||||||
</article>
|
</article>
|
||||||
))}
|
))}
|
||||||
{!invitations.length && (
|
{!invitations.length && (
|
||||||
<EmptyState title="No invitations" description="Invite a candidate to this interview." />
|
<EmptyState title="No invitations" description="Invite a candidate to this interview."/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{review && (
|
{review && (
|
||||||
|
|
@ -573,7 +565,7 @@ function InvitationsView({
|
||||||
onClose={() => setReview(undefined)}
|
onClose={() => setReview(undefined)}
|
||||||
onOutcome={(invitation) => {
|
onOutcome={(invitation) => {
|
||||||
onInvitationUpdated(invitation)
|
onInvitationUpdated(invitation)
|
||||||
setReview((current) => current && { ...current, invitation })
|
setReview((current) => current && {...current, invitation})
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
@ -604,7 +596,7 @@ function InvitationsView({
|
||||||
key={invitation.id}
|
key={invitation.id}
|
||||||
onClick={() => setScheduling(invitation)}
|
onClick={() => setScheduling(invitation)}
|
||||||
>
|
>
|
||||||
<CalendarDays size={17} /> Schedule {invitation.participantName}
|
<CalendarDays size={17}/> Schedule {invitation.participantName}
|
||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
{scheduledInterviews.map((interview) => (
|
{scheduledInterviews.map((interview) => (
|
||||||
|
|
@ -619,7 +611,7 @@ function InvitationsView({
|
||||||
{new Date(interview.startsAt).toLocaleString()} · {interview.location}
|
{new Date(interview.startsAt).toLocaleString()} · {interview.location}
|
||||||
</small>
|
</small>
|
||||||
</span>
|
</span>
|
||||||
<StatusBadge value={interview.status} />
|
<StatusBadge value={interview.status}/>
|
||||||
</Link>
|
</Link>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -631,7 +623,7 @@ function InvitationAnswerReview({
|
||||||
interview,
|
interview,
|
||||||
onClose,
|
onClose,
|
||||||
onOutcome,
|
onOutcome,
|
||||||
}: {
|
}: {
|
||||||
interview: Interview
|
interview: Interview
|
||||||
onClose: () => void
|
onClose: () => void
|
||||||
onOutcome: (invitation: Invitation) => void
|
onOutcome: (invitation: Invitation) => void
|
||||||
|
|
@ -677,7 +669,7 @@ function InvitationAnswerReview({
|
||||||
disabled={saving}
|
disabled={saving}
|
||||||
onClick={() => void decide('passed')}
|
onClick={() => void decide('passed')}
|
||||||
>
|
>
|
||||||
<Check size={18} /> Pass candidate
|
<Check size={18}/> Pass candidate
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
className="button fail"
|
className="button fail"
|
||||||
|
|
@ -685,14 +677,14 @@ function InvitationAnswerReview({
|
||||||
disabled={saving}
|
disabled={saving}
|
||||||
onClick={() => void decide('failed')}
|
onClick={() => void decide('failed')}
|
||||||
>
|
>
|
||||||
<X size={18} /> Fail candidate
|
<X size={18}/> Fail candidate
|
||||||
</button>
|
</button>
|
||||||
{interview.invitation.outcome && <StatusBadge value={interview.invitation.outcome} />}
|
{interview.invitation.outcome && <StatusBadge value={interview.invitation.outcome}/>}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{error && <ErrorAlert message={error} />}
|
{error && <ErrorAlert message={error}/>}
|
||||||
<div className="review-heading-actions">
|
<div className="review-heading-actions">
|
||||||
<StatusBadge value={interview.invitation.status} />
|
<StatusBadge value={interview.invitation.status}/>
|
||||||
<button className="button ghost" type="button" onClick={onClose}>
|
<button className="button ghost" type="button" onClick={onClose}>
|
||||||
Close review
|
Close review
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -708,7 +700,7 @@ function InvitationAnswerReview({
|
||||||
<span className="question-type">{question.type.replace('_', ' ')}</span>
|
<span className="question-type">{question.type.replace('_', ' ')}</span>
|
||||||
<h3>{question.text}</h3>
|
<h3>{question.text}</h3>
|
||||||
{question.type === 'code_review' && question.codeSnippet && (
|
{question.type === 'code_review' && question.codeSnippet && (
|
||||||
<CodePanel codeSnippet={question.codeSnippet} />
|
<CodePanel codeSnippet={question.codeSnippet}/>
|
||||||
)}
|
)}
|
||||||
{(question.type === 'multiple_choice' || question.type === 'radio') &&
|
{(question.type === 'multiple_choice' || question.type === 'radio') &&
|
||||||
question.options.length > 0 && (
|
question.options.length > 0 && (
|
||||||
|
|
@ -741,18 +733,18 @@ export function QuestionRow({
|
||||||
question,
|
question,
|
||||||
number,
|
number,
|
||||||
action,
|
action,
|
||||||
}: {
|
}: {
|
||||||
question: Question
|
question: Question
|
||||||
number?: number
|
number?: number
|
||||||
action?: ReactNode
|
action?: ReactNode
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<article className="question-row">
|
<article className="question-row">
|
||||||
{number ? <span className="question-number">{number}</span> : <CircleHelp size={22} />}
|
{number ? <span className="question-number">{number}</span> : <CircleHelp size={22}/>}
|
||||||
<div>
|
<div>
|
||||||
<div className="question-meta">
|
<div className="question-meta">
|
||||||
<h3>{question.type.replace('_', ' ')}</h3>
|
<h3>{question.type.replace('_', ' ')}</h3>
|
||||||
{question.deprecated && <StatusBadge value="deprecated" />}
|
{question.deprecated && <StatusBadge value="deprecated"/>}
|
||||||
</div>
|
</div>
|
||||||
<p>{question.text}</p>
|
<p>{question.text}</p>
|
||||||
{question.options.length > 0 && <small>{question.options.join(' · ')}</small>}
|
{question.options.length > 0 && <small>{question.options.join(' · ')}</small>}
|
||||||
|
|
@ -773,7 +765,7 @@ export function QuestionRow({
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function CandidateMatchView({ matches }: { matches: CandidateMatch[] }) {
|
function CandidateMatchView({matches}: { matches: CandidateMatch[] }) {
|
||||||
return (
|
return (
|
||||||
<section className="card">
|
<section className="card">
|
||||||
<div className="section-heading">
|
<div className="section-heading">
|
||||||
|
|
@ -782,14 +774,14 @@ function CandidateMatchView({ matches }: { matches: CandidateMatch[] }) {
|
||||||
<p>Trait alignment calculated by the API.</p>
|
<p>Trait alignment calculated by the API.</p>
|
||||||
</div>
|
</div>
|
||||||
<span className="ai-label">
|
<span className="ai-label">
|
||||||
<Sparkles size={16} /> Match insight
|
<Sparkles size={16}/> Match insight
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="match-list">
|
<div className="match-list">
|
||||||
{matches.map((match, index) => (
|
{matches.map((match, index) => (
|
||||||
<article className="match-card" key={match.participant.id}>
|
<article className="match-card" key={match.participant.id}>
|
||||||
<span className="rank">{index + 1}</span>
|
<span className="rank">{index + 1}</span>
|
||||||
<Avatar person={match.participant} />
|
<Avatar person={match.participant}/>
|
||||||
<div className="match-person">
|
<div className="match-person">
|
||||||
<Link to={`/participants/${match.participant.id}`}>
|
<Link to={`/participants/${match.participant.id}`}>
|
||||||
{match.participant.firstName} {match.participant.lastName}
|
{match.participant.firstName} {match.participant.lastName}
|
||||||
|
|
@ -802,7 +794,7 @@ function CandidateMatchView({ matches }: { matches: CandidateMatch[] }) {
|
||||||
<strong>{match.matchedTraits.length}</strong>
|
<strong>{match.matchedTraits.length}</strong>
|
||||||
</div>
|
</div>
|
||||||
<span className="score-track">
|
<span className="score-track">
|
||||||
<span style={{ width: `${Math.min(match.score, 100)}%` }} />
|
<span style={{width: `${Math.min(match.score, 100)}%`}}/>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="score">
|
<div className="score">
|
||||||
|
|
@ -829,12 +821,12 @@ function CandidateMatchView({ matches }: { matches: CandidateMatch[] }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function CreateJobPage() {
|
export function CreateJobPage() {
|
||||||
const { createJob } = useData()
|
const {createJob} = useData()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const [saving, setSaving] = useState(false)
|
const [saving, setSaving] = useState(false)
|
||||||
const [error, setError] = useState('')
|
const [error, setError] = useState('')
|
||||||
|
|
||||||
async function submit(event: FormEvent<HTMLFormElement>) {
|
async function submit(event: SyntheticEvent<HTMLFormElement>) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
setSaving(true)
|
setSaving(true)
|
||||||
setError('')
|
setError('')
|
||||||
|
|
@ -864,7 +856,7 @@ export function CreateJobPage() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Link className="back-link" to="/jobs">
|
<Link className="back-link" to="/jobs">
|
||||||
<ArrowLeft size={17} /> Cancel
|
<ArrowLeft size={17}/> Cancel
|
||||||
</Link>
|
</Link>
|
||||||
<PageHeader
|
<PageHeader
|
||||||
eyebrow="New posting"
|
eyebrow="New posting"
|
||||||
|
|
@ -876,33 +868,33 @@ export function CreateJobPage() {
|
||||||
<h2>Role information</h2>
|
<h2>Role information</h2>
|
||||||
<div className="form-grid">
|
<div className="form-grid">
|
||||||
<FormField label="Job title" htmlFor="title">
|
<FormField label="Job title" htmlFor="title">
|
||||||
<input id="title" name="title" required />
|
<input id="title" name="title" required/>
|
||||||
</FormField>
|
</FormField>
|
||||||
<FormField label="Position" htmlFor="position">
|
<FormField label="Position" htmlFor="position">
|
||||||
<input id="position" name="position" required placeholder="e.g. Backend Engineer" />
|
<input id="position" name="position" required placeholder="e.g. Backend Engineer"/>
|
||||||
</FormField>
|
</FormField>
|
||||||
<FormField label="Seniority" htmlFor="seniority">
|
<FormField label="Seniority" htmlFor="seniority">
|
||||||
<input id="seniority" name="seniority" required placeholder="e.g. Senior" />
|
<input id="seniority" name="seniority" required placeholder="e.g. Senior"/>
|
||||||
</FormField>
|
</FormField>
|
||||||
<FormField label="Labels" htmlFor="labels" hint="Comma separated">
|
<FormField label="Labels" htmlFor="labels" hint="Comma separated">
|
||||||
<input id="labels" name="labels" />
|
<input id="labels" name="labels"/>
|
||||||
</FormField>
|
</FormField>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="form-section">
|
<div className="form-section">
|
||||||
<h2>Role profile</h2>
|
<h2>Role profile</h2>
|
||||||
<FormField label="Description" htmlFor="description">
|
<FormField label="Description" htmlFor="description">
|
||||||
<textarea id="description" name="description" required rows={7} />
|
<textarea id="description" name="description" required rows={7}/>
|
||||||
</FormField>
|
</FormField>
|
||||||
<FormField label="Required skills" htmlFor="requiredSkills" hint="Comma separated">
|
<FormField label="Required skills" htmlFor="requiredSkills" hint="Comma separated">
|
||||||
<input id="requiredSkills" name="requiredSkills" required />
|
<input id="requiredSkills" name="requiredSkills" required/>
|
||||||
</FormField>
|
</FormField>
|
||||||
<FormField label="Additional skills" htmlFor="additionalSkills" hint="Comma separated">
|
<FormField label="Additional skills" htmlFor="additionalSkills" hint="Comma separated">
|
||||||
<input id="additionalSkills" name="additionalSkills" />
|
<input id="additionalSkills" name="additionalSkills"/>
|
||||||
</FormField>
|
</FormField>
|
||||||
</div>
|
</div>
|
||||||
{error && <ErrorAlert message={error} />}
|
{error && <ErrorAlert message={error}/>}
|
||||||
<FormActions saving={saving} cancelTo="/jobs" label="Create job" />
|
<FormActions saving={saving} cancelTo="/jobs" label="Create job"/>
|
||||||
</form>
|
</form>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
62
frontend/src/features/users/CalendarPage.tsx
Normal file
62
frontend/src/features/users/CalendarPage.tsx
Normal file
|
|
@ -0,0 +1,62 @@
|
||||||
|
import {ScheduledInterview} from "../../types";
|
||||||
|
import {useEffect, useMemo, useState} from "react";
|
||||||
|
import {message} from "../../components/actions";
|
||||||
|
import {api} from "../../api/client";
|
||||||
|
import {ErrorAlert, Loading} from "../../components/ui/AsyncState";
|
||||||
|
import {InterviewCard} from "../interviews/components/InterviewCard";
|
||||||
|
import {Link} from "react-router-dom";
|
||||||
|
|
||||||
|
export function CalendarPage() {
|
||||||
|
const [items, setItems] = useState<ScheduledInterview[]>([])
|
||||||
|
const [error, setError] = useState('')
|
||||||
|
const [loading, setLoading] = useState(true)
|
||||||
|
useEffect(() => {
|
||||||
|
void api
|
||||||
|
.calendar()
|
||||||
|
.then(setItems)
|
||||||
|
.catch((value) => setError(message(value)))
|
||||||
|
.finally(() => setLoading(false))
|
||||||
|
}, [])
|
||||||
|
const groups = useMemo(() => {
|
||||||
|
return [...items]
|
||||||
|
.sort((a, b) => a.startsAt.localeCompare(b.startsAt))
|
||||||
|
.reduce<Record<string, ScheduledInterview[]>>((result, item) => {
|
||||||
|
const key = new Date(item.startsAt).toLocaleDateString(undefined, {
|
||||||
|
weekday: 'long',
|
||||||
|
month: 'long',
|
||||||
|
day: 'numeric',
|
||||||
|
year: 'numeric',
|
||||||
|
})
|
||||||
|
;(result[key] ??= []).push(item)
|
||||||
|
return result
|
||||||
|
}, {})
|
||||||
|
}, [items])
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<header className="page-header">
|
||||||
|
<div>
|
||||||
|
<span className="eyebrow">Schedule</span>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
{error && <ErrorAlert error={error}/>}
|
||||||
|
{loading ? (
|
||||||
|
<Loading/>
|
||||||
|
) : (
|
||||||
|
Object.entries(groups).map(([date, interviews]) => (
|
||||||
|
<section className="calendar-day" key={date}>
|
||||||
|
<h2>{date}</h2>
|
||||||
|
<div className="meeting-list">
|
||||||
|
{interviews.map((item) => (
|
||||||
|
<InterviewCard interview={item} key={item.id}>
|
||||||
|
<Link className="button secondary" to={`/scheduled-interviews/${item.id}`}>
|
||||||
|
Open session
|
||||||
|
</Link>
|
||||||
|
</InterviewCard>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
@ -1,2 +1,3 @@
|
||||||
export { ProfilePage } from './ProfilePage'
|
export {ProfilePage} from './ProfilePage';
|
||||||
export { UsersPage } from './UsersPage'
|
export {UsersPage} from './UsersPage';
|
||||||
|
export {CalendarPage} from './CalendarPage';
|
||||||
Loading…
Add table
Add a link
Reference in a new issue