-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from prefeitura-rio/staging
Staging
- Loading branch information
Showing
35 changed files
with
1,263 additions
and
247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
src/app/(demo)/previsao-de-chuva/1h2h3h/[1h2h3hTipo]/page.tsx
This file was deleted.
Oops, something went wrong.
71 changes: 71 additions & 0 deletions
71
src/app/(demo)/previsao-de-chuva/v1/[...modelView]/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
"use client"; | ||
|
||
import React, { useEffect, useState } from "react"; | ||
import { ModelLayout } from "@/components/admin-panel/model-layout"; | ||
import { TabsDemo } from "@/components/tabs-demo"; | ||
import { InfoButton } from "@/components/info-button"; | ||
import ModelLayer from "@/components/rionowcast-v1-map"; | ||
import ColorLabel from "@/components/color-label"; | ||
import { LineChartComponent } from "@/components/ui/line-chart"; | ||
|
||
interface ModelViewProps { | ||
params: { | ||
modelView: string[]; | ||
}; | ||
} | ||
|
||
const ModelView = ({ params }: ModelViewProps) => { | ||
const [view] = params.modelView; | ||
const [data, setData] = useState<any>(null); | ||
const [error, setError] = useState<string | null>(null); | ||
const time_horizon_ = "1h"; | ||
|
||
useEffect(() => { | ||
const fetchData = async () => { | ||
try { | ||
const rootUrl = process.env.NEXT_PUBLIC_ENV === 'production' | ||
? process.env.NEXT_PUBLIC_ROOT_URL_PROD | ||
: process.env.NEXT_PUBLIC_ROOT_URL_DEV; | ||
const apiUrl = `${rootUrl}nowcasting_models/info/v1`; | ||
const response = await fetch(apiUrl); | ||
const result = await response.json(); | ||
setData(result); | ||
} catch (error) { | ||
console.error('Error fetching data:', error); | ||
} | ||
}; | ||
|
||
fetchData(); | ||
}, [view]); | ||
|
||
if (error) { | ||
return <div>{error}</div>; | ||
} | ||
|
||
const product = data?.product || {}; | ||
const values_range = data?.values_range || {}; | ||
const legend = data?.legend || { colors: [] }; | ||
|
||
if (!product || !values_range || !legend) { | ||
return <div>Invalid data</div>; | ||
} | ||
|
||
const { name, unit } = product; | ||
const valueRange = [values_range.min, values_range.max]; | ||
const stepRange = legend.colors.map((colorStop: any) => colorStop?.value); | ||
const productLabel = legend.colors.map((colorStop: any) => ({ | ||
color: colorStop.color, | ||
value: colorStop.value, | ||
})); | ||
|
||
return ( | ||
<ModelLayout title="Modelo"> | ||
<> | ||
<ModelLayer name={name} modelView={view} time_horizon={time_horizon_} /> | ||
<ColorLabel colorStops={productLabel} unit={unit} /> | ||
</> | ||
</ModelLayout> | ||
); | ||
}; | ||
|
||
export default ModelView; |
20 changes: 0 additions & 20 deletions
20
src/app/(demo)/previsao-de-chuva/xyyhzh/[xyyhzhTipo]/page.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.