feat: build Onyx SSR shell and plan hero with mock data
This commit is contained in:
1 parent
84c20992f9
commit
2db494fb10
34 files changed
+3197
-2
No files matched your search
@@ -0,0 +1,79 @@
|
||||
// Server-side mock dataset. Shapes follow /home/noel/Documents/Hackathon_2026/CONTRACT.md.
|
||||
// The files are imported (not read from disk at runtime) so the Nitro build bundles them
|
||||
// into the SSR output and the app renders before the Go API exists.
|
||||
import context from '../../mock/context.json'
|
||||
import demo from '../../mock/demo.json'
|
||||
import meta from '../../mock/meta.json'
|
||||
import scenario from '../../mock/scenario.json'
|
||||
import scenarios from '../../mock/scenarios.json'
|
||||
import sensors from '../../mock/sensors.json'
|
||||
|
||||
import forecast01 from '../../mock/forecast/hn-stadtgalerie-01.json'
|
||||
import forecast02 from '../../mock/forecast/hn-kaiserstrasse-02.json'
|
||||
import forecast03 from '../../mock/forecast/hn-marktplatz-03.json'
|
||||
import forecast04 from '../../mock/forecast/hn-kilianskirche-04.json'
|
||||
import forecast05 from '../../mock/forecast/hn-rathaus-05.json'
|
||||
import forecast06 from '../../mock/forecast/hn-neckartor-06.json'
|
||||
import forecast07 from '../../mock/forecast/hn-suelmerstrasse-07.json'
|
||||
import forecast08 from '../../mock/forecast/hn-harmonie-08.json'
|
||||
|
||||
import series01 from '../../mock/series/hn-stadtgalerie-01.json'
|
||||
import series02 from '../../mock/series/hn-kaiserstrasse-02.json'
|
||||
import series03 from '../../mock/series/hn-marktplatz-03.json'
|
||||
import series04 from '../../mock/series/hn-kilianskirche-04.json'
|
||||
import series05 from '../../mock/series/hn-rathaus-05.json'
|
||||
import series06 from '../../mock/series/hn-neckartor-06.json'
|
||||
import series07 from '../../mock/series/hn-suelmerstrasse-07.json'
|
||||
import series08 from '../../mock/series/hn-harmonie-08.json'
|
||||
|
||||
import type {
|
||||
ContextResponse,
|
||||
ForecastResponse,
|
||||
MetaResponse,
|
||||
ScenarioPreset,
|
||||
ScenarioState,
|
||||
Sensor,
|
||||
SeriesResponse,
|
||||
} from '../../shared/types'
|
||||
|
||||
export const mockMeta = meta as MetaResponse
|
||||
export const mockContext = context as ContextResponse
|
||||
export const mockSensors = sensors as Sensor[]
|
||||
export const mockScenarios = scenarios as ScenarioPreset[]
|
||||
export const mockScenario = scenario as ScenarioState
|
||||
export const mockDemo = demo as {
|
||||
now: string
|
||||
plan_start: string
|
||||
plan_end: string
|
||||
timezone: string
|
||||
}
|
||||
|
||||
const forecasts: Record<string, ForecastResponse> = {
|
||||
'hn-stadtgalerie-01': forecast01,
|
||||
'hn-kaiserstrasse-02': forecast02,
|
||||
'hn-marktplatz-03': forecast03,
|
||||
'hn-kilianskirche-04': forecast04,
|
||||
'hn-rathaus-05': forecast05,
|
||||
'hn-neckartor-06': forecast06,
|
||||
'hn-suelmerstrasse-07': forecast07,
|
||||
'hn-harmonie-08': forecast08,
|
||||
} as Record<string, ForecastResponse>
|
||||
|
||||
const series: Record<string, SeriesResponse> = {
|
||||
'hn-stadtgalerie-01': series01,
|
||||
'hn-kaiserstrasse-02': series02,
|
||||
'hn-marktplatz-03': series03,
|
||||
'hn-kilianskirche-04': series04,
|
||||
'hn-rathaus-05': series05,
|
||||
'hn-neckartor-06': series06,
|
||||
'hn-suelmerstrasse-07': series07,
|
||||
'hn-harmonie-08': series08,
|
||||
} as Record<string, SeriesResponse>
|
||||
|
||||
export function getMockForecast(sensorId: string): ForecastResponse | undefined {
|
||||
return forecasts[sensorId]
|
||||
}
|
||||
|
||||
export function getMockSeries(sensorId: string): SeriesResponse | undefined {
|
||||
return series[sensorId]
|
||||
}
|
||||
Reference in new issue
Block a user