feat(260723-lvg): add "Jetzt abrufen" manual poll button to tender radar

PollNowButton sits next to the settings gear in the tender-radar header,
mirrors the DKV spinner/disabled UX, and bumps a refreshKey on success to
refetch ResultsList without touching any filter. Failure surfaces an
i18n error (de/en parity). pollNow() client hits POST
/modules/tender-radar/poll-now.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-23 15:54:43 +02:00
parent 7502f97e85
commit bdaf154f66
7 changed files with 268 additions and 24 deletions
@@ -1,11 +1,12 @@
'use client';
import { Suspense } from 'react';
import { Suspense, useState } from 'react';
import { useTranslations } from 'next-intl';
import { useRouter, useSearchParams } from 'next/navigation';
import Link from 'next/link';
import { CoverageBanner } from './components/CoverageBanner';
import { FilterPanel } from './components/FilterPanel';
import { PollNowButton } from './components/PollNowButton';
import { ResultsList } from './components/ResultsList';
import { SavedSearchBar } from './components/SavedSearchBar';
import { TenderDetail } from './components/TenderDetail';
@@ -38,12 +39,18 @@ import { TenderDetail } from './components/TenderDetail';
*
* Plan 14-05 (CONFIG-03/UI-06, D-10): all strings render via the
* tenderRadar i18n namespace — no more hardcoded German literals.
*
* Quick 260723-lvg: PollNowButton sits next to the settings gear and
* bumps `refreshKey` on a successful poll, driving a ResultsList refetch —
* same parent-increments-refreshKey pattern DKV uses for
* InvoiceHistoryTable (STATE decision 07-05).
*/
function TenderRadarContent() {
const t = useTranslations('tenderRadar');
const router = useRouter();
const searchParams = useSearchParams();
const tenderId = searchParams.get('tender');
const [refreshKey, setRefreshKey] = useState(0);
const closeDetail = () => {
const next = new URLSearchParams(searchParams.toString());
@@ -58,30 +65,35 @@ function TenderRadarContent() {
{t('page.title')}
</h1>
{/*
* Einstellungen-Link. Absolute literal href (NOT the dynamic
* [category]/[moduleSlug] basePath): the tender-radar settings page
* only exists as the literal route /modules/tender-radar/settings —
* the dynamic settings route returns "Modul nicht gefunden" for this
* module, so the gear must point at the literal path directly.
*/}
<Link
href="/modules/tender-radar/settings"
className="rounded border border-border px-3 py-2 text-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
title={t('page.settingsTitle')}
aria-label={t('page.settingsTitle')}
>
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
<circle cx="12" cy="12" r="3" />
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z" />
</svg>
</Link>
{/* Right-side cluster: settings gear + "Jetzt abrufen" trigger */}
<div className="flex items-center gap-2">
{/*
* Einstellungen-Link. Absolute literal href (NOT the dynamic
* [category]/[moduleSlug] basePath): the tender-radar settings page
* only exists as the literal route /modules/tender-radar/settings —
* the dynamic settings route returns "Modul nicht gefunden" for this
* module, so the gear must point at the literal path directly.
*/}
<Link
href="/modules/tender-radar/settings"
className="rounded border border-border px-3 py-2 text-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
title={t('page.settingsTitle')}
aria-label={t('page.settingsTitle')}
>
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
<circle cx="12" cy="12" r="3" />
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z" />
</svg>
</Link>
<PollNowButton onPolled={() => setRefreshKey((k) => k + 1)} />
</div>
</div>
<CoverageBanner />
<SavedSearchBar />
<FilterPanel />
<ResultsList />
<ResultsList refreshKey={refreshKey} />
{tenderId && <TenderDetail tenderId={tenderId} onClose={closeDetail} />}
</div>