import { useState } from 'react'; import { Link } from 'react-router-dom'; import { api } from '../api/client'; import { useAction } from '../lib/hooks'; import { useGateway } from '../lib/gateway'; import { useToast } from '../lib/toast'; import { num, when } from '../lib/format'; import { Banner, Button, Card, Confirm, Loading, PageHead, Tiles } from '../components/ui'; export function RecommendationsPage() { const { status, error, loading, reload } = useGateway(); const { wrap } = useToast(); const { busy, run } = useAction(); const [confirming, setConfirming] = useState(false); const forYou = status?.forYou; const running = Boolean(status?.forYouRunning); const act = (action: string, key: string, message: string) => run(key, async () => { await wrap(() => api.post('/admin/api/for-you', { action }), message); setConfirming(false); await reload(); }); return ( <> {loading ? ( ) : ( <> {running ? 'For You maintenance running…' : 'Prepared pools normally refresh in the background.'} } >
Open the inspector} > <> )} {confirming ? ( void act('full-import', 'full', 'Backfill started.')} onCancel={() => setConfirming(false)} /> ) : null} ); }