Stelle den Frontend-MVP und die v0.3-API auf develop bereit, damit Dev API und PWA zusammen deployen.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
827e6a2a11
commit
b276758ee1
152 files changed
+25846
-34
No files matched your search
@@ -0,0 +1,53 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useParams } from "react-router-dom";
|
||||
import { api } from "../api";
|
||||
import { EmptyState, ErrorState, LoadingState } from "../components/State";
|
||||
|
||||
export function CandidateDetailPage() {
|
||||
const { projectId = "", candidateId = "" } = useParams();
|
||||
const detail = useQuery({
|
||||
queryKey: ["candidate", projectId, candidateId],
|
||||
queryFn: () => api.candidate(projectId, candidateId),
|
||||
});
|
||||
const history = useQuery({
|
||||
queryKey: ["observations", projectId, candidateId],
|
||||
queryFn: () => api.observations(projectId, candidateId),
|
||||
});
|
||||
if (detail.isLoading) return <LoadingState />;
|
||||
if (detail.isError) return <ErrorState message={(detail.error as Error).message} />;
|
||||
const item = detail.data!;
|
||||
return (
|
||||
<section className="grid">
|
||||
<h1>{item.title}</h1>
|
||||
<div className="card">
|
||||
<p>
|
||||
{item.manufacturer} {item.model}
|
||||
</p>
|
||||
<p>
|
||||
Preis: {item.current_best_price || "–"} {item.currency || ""}
|
||||
</p>
|
||||
<p>Ranking: {item.ranking_status}</p>
|
||||
<p>Diff: {item.current_diff_status}</p>
|
||||
<p>Lifecycle: {item.product_lifecycle_status}</p>
|
||||
</div>
|
||||
<div className="card">
|
||||
<h2>Attribute</h2>
|
||||
{(item.current_dynamic_attributes || []).map((attr) => (
|
||||
<p key={attr.raw_name}>
|
||||
{attr.raw_name}: {String(attr.normalized_value ?? "")} {attr.unit || ""}
|
||||
</p>
|
||||
))}
|
||||
</div>
|
||||
<div className="card">
|
||||
<h2>Historie</h2>
|
||||
{history.isLoading ? <LoadingState /> : null}
|
||||
{(history.data?.items || []).length === 0 ? <EmptyState>Noch keine Beobachtungen.</EmptyState> : null}
|
||||
{(history.data?.items || []).map((obs) => (
|
||||
<p key={obs.observation_id}>
|
||||
{obs.observed_at}: {obs.best_price} {obs.currency}
|
||||
</p>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user