feat(status): add public repair status page
This commit is contained in:
parent
a284bbc188
commit
efdc4d5be1
6 changed files with 425 additions and 4 deletions
170
app/globals.css
170
app/globals.css
|
|
@ -488,6 +488,156 @@ h3 {
|
|||
line-height: 1;
|
||||
}
|
||||
|
||||
.status-page {
|
||||
min-height: calc(100vh - 78px);
|
||||
padding: 72px 0;
|
||||
background:
|
||||
linear-gradient(135deg, rgba(244, 246, 248, 0.96), rgba(232, 238, 246, 0.94)),
|
||||
url("/workbench-signal.svg");
|
||||
background-position: center;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.status-page-inner {
|
||||
display: grid;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.status-card {
|
||||
border: 1px solid rgba(8, 42, 96, 0.12);
|
||||
border-radius: var(--radius);
|
||||
background: rgba(255, 255, 255, 0.97);
|
||||
padding: 34px;
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
.status-card-narrow {
|
||||
width: min(760px, 100%);
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.status-card h1 {
|
||||
margin-bottom: 10px;
|
||||
color: var(--ink);
|
||||
font-size: clamp(36px, 5vw, 58px);
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.status-title-row {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 24px;
|
||||
margin-bottom: 26px;
|
||||
}
|
||||
|
||||
.status-badge,
|
||||
.status-pill {
|
||||
display: inline-flex;
|
||||
min-height: 32px;
|
||||
align-items: center;
|
||||
border-radius: 999px;
|
||||
border: 1px solid rgba(30, 159, 184, 0.24);
|
||||
background: rgba(30, 159, 184, 0.1);
|
||||
color: var(--navy);
|
||||
font-size: 13px;
|
||||
font-weight: 800;
|
||||
padding: 0 12px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.status-summary {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 14px;
|
||||
margin: 0 0 34px;
|
||||
}
|
||||
|
||||
.status-summary div {
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius);
|
||||
background: #f8fafc;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.status-summary dt {
|
||||
margin-bottom: 8px;
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
font-weight: 800;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.status-summary dd {
|
||||
margin: 0;
|
||||
color: var(--ink);
|
||||
font-size: 17px;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.status-timeline-section h2 {
|
||||
margin-bottom: 20px;
|
||||
font-size: clamp(26px, 3vw, 34px);
|
||||
}
|
||||
|
||||
.public-status-timeline {
|
||||
display: grid;
|
||||
gap: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.public-status-timeline li {
|
||||
position: relative;
|
||||
border-left: 2px solid #d7e0ea;
|
||||
padding: 0 0 18px 26px;
|
||||
}
|
||||
|
||||
.public-status-timeline li:last-child {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.timeline-dot {
|
||||
position: absolute;
|
||||
left: -8px;
|
||||
top: 15px;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
border: 3px solid #fff;
|
||||
border-radius: 999px;
|
||||
background: var(--steel);
|
||||
box-shadow: 0 0 0 1px rgba(8, 42, 96, 0.12);
|
||||
}
|
||||
|
||||
.public-status-timeline li.is-current .timeline-dot {
|
||||
background: var(--orange);
|
||||
}
|
||||
|
||||
.timeline-content {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 18px;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius);
|
||||
background: #fff;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.timeline-title {
|
||||
margin-bottom: 8px;
|
||||
color: var(--ink);
|
||||
font-size: 17px;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.timeline-content time,
|
||||
.status-muted {
|
||||
color: var(--muted);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.admin-login-page {
|
||||
min-height: 100vh;
|
||||
display: grid;
|
||||
|
|
@ -1263,10 +1413,28 @@ h3 {
|
|||
.admin-shell,
|
||||
.admin-kpis,
|
||||
.admin-detail-grid,
|
||||
.media-grid {
|
||||
.media-grid,
|
||||
.status-summary {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.status-page {
|
||||
padding: 38px 0;
|
||||
}
|
||||
|
||||
.status-card {
|
||||
padding: 22px;
|
||||
}
|
||||
|
||||
.status-title-row,
|
||||
.timeline-content {
|
||||
display: grid;
|
||||
}
|
||||
|
||||
.status-badge {
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
.admin-sidebar {
|
||||
position: static;
|
||||
height: auto;
|
||||
|
|
|
|||
137
app/status/[token]/page.tsx
Normal file
137
app/status/[token]/page.tsx
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
import type { Metadata } from "next";
|
||||
import Link from "next/link";
|
||||
import { fetchOlympusRepairStatus, type OlympusRepairStatus } from "@/lib/olympus/status";
|
||||
|
||||
type PageProps = {
|
||||
params: Promise<{
|
||||
token: string;
|
||||
}>;
|
||||
};
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Reparaturstatus | Funktechnik Schubert",
|
||||
description: "Öffentlicher Reparaturstatus für Kunden von Funktechnik Schubert.",
|
||||
robots: {
|
||||
index: false,
|
||||
follow: false,
|
||||
},
|
||||
};
|
||||
|
||||
function formatDate(value: string) {
|
||||
return new Intl.DateTimeFormat("de-DE", {
|
||||
dateStyle: "medium",
|
||||
timeStyle: "short",
|
||||
}).format(new Date(value));
|
||||
}
|
||||
|
||||
function StatusError({ title, text }: { title: string; text: string }) {
|
||||
return (
|
||||
<section className="status-page">
|
||||
<div className="container status-page-inner">
|
||||
<div className="status-card status-card-narrow">
|
||||
<p className="eyebrow">Reparaturstatus</p>
|
||||
<h1>{title}</h1>
|
||||
<p className="lead">{text}</p>
|
||||
<div className="actions">
|
||||
<Link className="button" href="/reparatur">Reparatur anfragen</Link>
|
||||
<Link className="button light" href="/kontakt">Kontakt aufnehmen</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
function StatusTimeline({ status }: { status: OlympusRepairStatus }) {
|
||||
if (status.status_history_public.length === 0) {
|
||||
return <p className="status-muted">Noch keine Statushistorie vorhanden.</p>;
|
||||
}
|
||||
|
||||
const latestIndex = status.status_history_public.length - 1;
|
||||
|
||||
return (
|
||||
<ol className="public-status-timeline">
|
||||
{status.status_history_public.map((item, index) => (
|
||||
<li key={`${item.status}-${item.created_at}-${index}`} className={index === latestIndex ? "is-current" : ""}>
|
||||
<span className="timeline-dot" aria-hidden="true" />
|
||||
<div className="timeline-content">
|
||||
<div>
|
||||
<p className="timeline-title">{item.status_label}</p>
|
||||
{index === latestIndex && <span className="status-pill">Aktueller Status</span>}
|
||||
</div>
|
||||
<time dateTime={item.created_at}>{formatDate(item.created_at)}</time>
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
);
|
||||
}
|
||||
|
||||
export default async function RepairStatusPage({ params }: PageProps) {
|
||||
const { token } = await params;
|
||||
const result = await fetchOlympusRepairStatus(token);
|
||||
|
||||
if (!result.ok && result.reason === "invalid") {
|
||||
return (
|
||||
<StatusError
|
||||
title="Statuslink nicht aktiv"
|
||||
text="Dieser Statuslink ist ungültig oder nicht mehr aktiv."
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (!result.ok) {
|
||||
return (
|
||||
<StatusError
|
||||
title="Status momentan nicht abrufbar"
|
||||
text="Der Reparaturstatus ist momentan nicht abrufbar. Bitte versuchen Sie es später erneut oder kontaktieren Sie uns direkt."
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
const status = result.status;
|
||||
const device = `${status.device_manufacturer} ${status.device_model}`.trim();
|
||||
|
||||
return (
|
||||
<section className="status-page">
|
||||
<div className="container status-page-inner">
|
||||
<div className="status-card">
|
||||
<p className="eyebrow">Reparaturstatus</p>
|
||||
<div className="status-title-row">
|
||||
<div>
|
||||
<h1>Reparaturstatus</h1>
|
||||
<p className="lead">Hier sehen Sie den aktuellen Stand Ihrer Reparatur.</p>
|
||||
</div>
|
||||
<span className="status-badge">{status.public_status_label}</span>
|
||||
</div>
|
||||
|
||||
<dl className="status-summary">
|
||||
<div>
|
||||
<dt>Reparaturnummer</dt>
|
||||
<dd>{status.repair_number}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Gerät</dt>
|
||||
<dd>{device || "Nicht angegeben"}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Aktueller Status</dt>
|
||||
<dd>{status.public_status_label}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Letzte Aktualisierung</dt>
|
||||
<dd>{formatDate(status.updated_at)}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
<div className="status-timeline-section">
|
||||
<h2>Statusverlauf</h2>
|
||||
<StatusTimeline status={status} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue