-
Notifications
You must be signed in to change notification settings - Fork 9
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 #74 from usrcovid19datafactory/feature/new-categories
CR: New Campaign 2024 2025
- Loading branch information
Showing
12 changed files
with
203 additions
and
78 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<configuration> | ||
<system.webServer> | ||
<staticContent> | ||
<mimeMap fileExtension=".json" mimeType="application/json" /> | ||
<mimeMap fileExtension=".woff" mimeType="font/woff" /> | ||
<mimeMap fileExtension=".woff2" mimeType="font/woff" /> | ||
</staticContent> | ||
</system.webServer> | ||
</configuration> | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { baseURL, loadData } from "../loadData"; | ||
import { useEffect, useState } from 'react'; | ||
import { AgeDoses } from "../containers/agedoses"; | ||
import {CampaignContext} from './CampaignContext' | ||
import { Total } from "../components/Total"; | ||
import { CampaignHistory } from "./Campaign-History"; | ||
|
||
const context = { | ||
total:{ | ||
title:'Dati Campagna vaccinale anti Covid-19 2023/2024 fino al 17/09/2024', | ||
subtitle: 'Dati e statistiche sulla vaccinazione anti Covid-19 a partire da 24 Settembre 2023 al 17 Settembre 2024', | ||
showLastUpdate: false, | ||
periodTitle: 'Totale somministrazioni fino al 17/09/2024' | ||
}, | ||
ageDoses:{ | ||
title:"Somministrazioni di XBB 1.5 per fascia d'età - fino al 17/09/2024" | ||
} | ||
} | ||
|
||
export const Campaign20232024 = () => { | ||
|
||
const [summary, setSummary] = useState({}); | ||
|
||
useEffect(() => { | ||
// campagna 2023-2024 | ||
const campagnaUrl = `${baseURL}/somministrazioni-vaccini-latest-campagna-2023-2024.json`; | ||
const summaryUrl = `${baseURL}/somministrazioni-vaccini-summary-latest-campagna-2023-2024.json`; | ||
|
||
loadData({campagnaUrl, summaryUrl}).then((d) => { | ||
setSummary(d); | ||
}); | ||
}, []); | ||
|
||
return ( | ||
<CampaignContext.Provider value={context}> | ||
<Total summary={summary} /> {/* Totale Somministrazioni campagna attuale */} | ||
<AgeDoses data={summary} /> {/* Grafico Somministrazioni per fascia d'età dati storici */} | ||
<div className="row mt-5 mb-5"> | ||
<div className="flag-green col-md-4 col-3"></div> | ||
<div className="col-md-4 col-6"> | ||
<img className="col-md-12" src="ministero.png" alt="logo-ministero" /> | ||
</div> | ||
<div className="flag-red col-md-4 col-3"></div> | ||
</div> | ||
<CampaignHistory summary={summary}/> | ||
</CampaignContext.Provider> | ||
) | ||
} | ||
|
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,55 @@ | ||
import { baseURL, loadData } from "../loadData"; | ||
import { useEffect, useState } from 'react'; | ||
import { AgeDoses } from "../containers/agedoses"; | ||
import {CampaignContext} from './CampaignContext'; | ||
import { Total } from "../components/Total"; | ||
import { Weeks } from "../containers/weeks"; | ||
import { hideLoader } from "../utils"; | ||
|
||
const context = { | ||
total:{ | ||
title: 'Campagna vaccinale Autunno-Inverno 2024/2025', | ||
subtitle: 'I dati sono aggiornati su base settimanale e sono disponibili in formato aperto con il dettaglio giornaliero.', | ||
showLastUpdate: true, | ||
periodTitle: 'Totale somministrazioni dal 17/09/2024', | ||
periodSubtitle: 'Il dato può subire variazioni negative a seguito di rettifiche da parte delle regioni.' | ||
}, | ||
weeks:{ | ||
title:"Somministrazioni su base settimanale" | ||
}, | ||
ageDoses:{ | ||
title:"Somministrazioni per fascia d'età" | ||
} | ||
} | ||
|
||
export const Campaign20242025 = () => { | ||
|
||
const [summary, setSummary] = useState({}); | ||
|
||
useEffect(() => { | ||
// campagna 2024-2025 | ||
const campagnaUrl = `${baseURL}/somministrazioni-vaccini-latest-campagna-2024-2025.json`; | ||
const summaryUrl = `${baseURL}/somministrazioni-vaccini-summary-latest-campagna-2024-2025.json`; | ||
|
||
loadData({campagnaUrl, summaryUrl}).then((d) => { | ||
setSummary(d); | ||
hideLoader(); | ||
}); | ||
}, []); | ||
|
||
return ( | ||
<CampaignContext.Provider value={context}> | ||
<Total summary={summary} /> {/* Totale Somministrazioni campagna attuale */} | ||
<Weeks data={summary} /> {/* Grafico Andamento Settimanale delle Somministrazioni */} | ||
<AgeDoses data={summary} /> {/* Grafico Somministrazioni per fascia d'età dati storici */} | ||
<div className="row mt-5 mb-5"> | ||
<div className="flag-green col-md-4 col-3"></div> | ||
<div className="col-md-4 col-6"> | ||
<img className="col-md-12" src="ministero.png" alt="logo-ministero" /> | ||
</div> | ||
<div className="flag-red col-md-4 col-3"></div> | ||
</div> | ||
</CampaignContext.Provider> | ||
) | ||
} | ||
|
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,12 @@ | ||
import { AgeDosesHistory } from "../containers/agedosesHistory"; | ||
import { Databox } from "../containers/databox"; | ||
import { TotalHistory } from "../components/TotalHistory"; | ||
|
||
export const CampaignHistory = ({summary}) => { | ||
return (<> | ||
<TotalHistory summary={summary} /> {/* Totale Somministrazioni storiche */} | ||
<AgeDosesHistory data={summary} /> {/* Grafico Somministrazioni per fascia d'età dati storici */} | ||
<Databox data={summary} /> {/* Box riepilogo dati storici */} | ||
</>) | ||
} | ||
|
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,18 @@ | ||
import { createContext, useContext } from 'react'; | ||
|
||
const defaultValue = { | ||
weeks:{ title: "" }, | ||
total:{ title: "" , subtitle: "", showLastUpdate: false, periodTitle: "", periodSubtitle: ""}, | ||
ageDoses:{ title: ""}, | ||
} | ||
|
||
export const CampaignContext = createContext(defaultValue) | ||
|
||
const raise = () => { | ||
throw new Error('useAmbienteContext must be used inside a AmbienteContext providing a valid selector'); | ||
} | ||
|
||
export const useCampaignContext = (name) => { | ||
const context = useContext(CampaignContext) ?? raise() | ||
return Reflect.get(context, name); | ||
}; |
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
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
Oops, something went wrong.