Add the settings home screen (mock 1p)
/settings now renders the Settings home: the "Our kitchen" shared household banner and grouped cards for Household (Regular dinners, Google Calendar, Household), Alerts (Notifications & Google Chat) and Admin (AI assistant, with the Admin tag and grape-300 inset ring). Each row links to its settings page. The Household row shows the live timezone and dinner time from GET /api/v1/settings/household, and the AI assistant row the live provider and model from GET /api/v1/settings/ai. Regular dinners, Google Calendar and Notifications show no status line: the server has no dinners, Google Calendar or notification endpoint yet. Shell tests now render the routes inside the API and query providers. Maestro task: 97b50e29-b8a7-4e99-918d-99fa1b239313 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { QueryClientProvider } from '@tanstack/react-query'
|
||||
import { useState, type ReactNode } from 'react'
|
||||
import { ApiProvider, createApiClient, createQueryClient, createVerifiedSession } from '../api/index.ts'
|
||||
import { createNetworkStatus } from '../pwa/networkStatus.ts'
|
||||
import { fakeLocation, jsonResponse } from './fetchStub.ts'
|
||||
|
||||
// SETTINGS_API answers the settings home's requests, for stubFetchByPath.
|
||||
export const SETTINGS_API = {
|
||||
'/api/v1/settings/household': () => jsonResponse(200, { timezone: 'America/New_York', dinner_time: '17:30' }),
|
||||
'/api/v1/settings/ai': () => jsonResponse(200, { provider: 'anthropic', model: 'claude-sonnet-4-5' }),
|
||||
}
|
||||
|
||||
// ApiProviders gives the pages under test what App gives them: an API client
|
||||
// on https://mealquest.test and a fresh query client.
|
||||
export function ApiProviders({ children }: { children: ReactNode }) {
|
||||
const [api] = useState(() =>
|
||||
createApiClient(fakeLocation(), createNetworkStatus(window), createVerifiedSession(localStorage)),
|
||||
)
|
||||
const [queryClient] = useState(createQueryClient)
|
||||
return (
|
||||
<ApiProvider client={api}>
|
||||
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
|
||||
</ApiProvider>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user