From 2439875bf8342e45ab681c750123720504b32f39 Mon Sep 17 00:00:00 2001 From: acaptutorials Date: Wed, 18 Sep 2024 22:59:51 +0800 Subject: [PATCH 1/2] docs: server setup * indicate reference to the pagasa seasonal weather forecast rainfall table --- .../articles/provinces-municipalities.mdx | 12 ++++--- docs/pages/changelog.mdx | 2 +- docs/pages/installation/server-setup.mdx | 35 +++++++++++-------- 3 files changed, 29 insertions(+), 20 deletions(-) diff --git a/docs/pages/articles/provinces-municipalities.mdx b/docs/pages/articles/provinces-municipalities.mdx index e3c4521e..b5b20507 100644 --- a/docs/pages/articles/provinces-municipalities.mdx +++ b/docs/pages/articles/provinces-municipalities.mdx @@ -18,7 +18,7 @@ export function FAQBox({ title, children, open=false }) { ## Data Source -ACAP uses a combination of the [PAGASA 10-day weather forecast Excel files](https://www.pagasa.dost.gov.ph/climate/climate-prediction/10-day-climate-forecast) and the [PAGASA Seasonal Forecast- Rainfall Analysis Table](https://www.pagasa.dost.gov.ph/climate/climate-prediction/seasonal-forecast) as a data source for its region, provinces, and municipalities list. +ACAP uses a combination of the [PAGASA 10-day weather forecast Excel files](https://www.pagasa.dost.gov.ph/climate/climate-prediction/10-day-climate-forecast) and the [PAGASA Seasonal Forecast- Forecast Rainfall Analysis Table](https://www.pagasa.dost.gov.ph/climate/climate-prediction/seasonal-forecast) as a data source for its region, provinces, and municipalities list. ## FAQs @@ -27,17 +27,19 @@ ACAP uses the provinces and municipalities list defined in the [PAGASA 10-day we -ACAP uses the region-province grouping from the [PAGASA Seasonal Forecast](https://www.pagasa.dost.gov.ph/climate/climate-prediction/seasonal-forecast) - Rainfall Analysis Table to determine which provinces belong to a region as a reference since it also processes provincial seasonal weather forecast information from the PAGASA Seasonal Forecast. ACAP expects province naming from the two (2) data sources (PAGASA 10-day and Seasonal weather forecasts) to match since both are data products produced by PAGASA. +ACAP uses the region-province grouping from the [PAGASA Seasonal Forecast](https://www.pagasa.dost.gov.ph/climate/climate-prediction/seasonal-forecast) - Forecast Rainfall Analysis Table to determine which provinces belong to a region as a reference since it also processes provincial seasonal weather forecast information from the PAGASA Seasonal Forecast. ACAP expects province naming from the two (2) data sources (PAGASA 10-day and Seasonal weather forecasts) to match since both are data products produced by PAGASA. + +> Regions with a memorandum of agreement with PAGASA also receive Seasonal Weather Forecast data in an Excel file containing the Seasonal Forecast Rainfall Analysis Table through email. ACAP initializes its province list during the [Server Setup](/installation/server-setup/#initialize-provinces-and-municipalities) stage. -No. After more recent tests, it came to light that some province names defined in the PAGASA Seasonal Forecast (Rainfall Table) may not always match the province names defined in the PAGASA 10-day Excel files. +No. After more recent tests, it came to light that some province names defined in the PAGASA Seasonal Forecast (Forecast Rainfall Analysis Table) may not always match the province names defined in the PAGASA 10-day Excel files. -For example, as of _September 17, 2024_, the `"Davao Occidental"` province is present in the PAGASA Seasonal Forecast (Rainfall Table) under **Region XI (Davao Region)**. However, it is missing in the PAGASA 10-Day Excel files. +For example, as of _September 17, 2024_, the `"Davao Occidental"` province is present in the PAGASA Seasonal Forecast (Forecast Rainfall Analysis Table) under **Region XI (Davao Region)**. However, it is missing in the PAGASA 10-Day Excel files. -Similarly, the `"Shariff Kabunsuan"` province is available in the PAGASA 10-Day Excel files, but it is nowhere to be found in the PAGASA Seasonal Forecast (Rainfall Table). +Similarly, the `"Shariff Kabunsuan"` province is available in the PAGASA 10-Day Excel files, but it is nowhere to be found in the PAGASA Seasonal Forecast (Forecast Rainfall Analysis Table). Refer to the [Regional Provinces / Municipalities Inconsistency](#regional-provinces--municipalities-inconsistency) section for more information about possible causes of region/province/municipality naming inconsistencies. diff --git a/docs/pages/changelog.mdx b/docs/pages/changelog.mdx index 80f3c4c3..124651a0 100644 --- a/docs/pages/changelog.mdx +++ b/docs/pages/changelog.mdx @@ -135,7 +135,7 @@ _June 2023 onwards_ #### Changed -- Used `.env` variables to manage region-specific static text in the front end, ensuring the base model of the application can be extended and adapted for multiple regions with different (text content) requirements, allowing easier regional static text replacement. +- Used `.env` variables to manage region-specific static text in the front end, ensuring the base model of the application can be easily adapted for multiple regions with different text content requirements, allowing easier regional static text replacement. - Use `nda` values for null/empty seasonal weather forecast data in the backend and front end, borrowed from the ongoing ACAP-RCMAS API development. diff --git a/docs/pages/installation/server-setup.mdx b/docs/pages/installation/server-setup.mdx index e4d5009d..f9d47849 100644 --- a/docs/pages/installation/server-setup.mdx +++ b/docs/pages/installation/server-setup.mdx @@ -45,28 +45,35 @@ Create a `.env` file inside the **/server** directory. Copy the contents of the ### Initialize provinces and municipalities -Run ACAP's `"pagasa:municipalities"` NPM script to get a list of the latest PAGASA-updated municipalities and province names. + +ACAP refers to the [PAGASA Seasonal Forecast - Forecast Rainfall Analysis Table](https://www.pagasa.dost.gov.ph/climate/climate-prediction/seasonal-forecast) for its regional provinces list, matching the province names with those listed in the [PAGASA 10-day Weather Forecast Excel](https://www.pagasa.dost.gov.ph/climate/climate-prediction/10-day-climate-forecast) files. -1. First navigate to the server directory from the command line then run: +ACAP expects province naming from the two (2) data sources to match since both are data products produced by PAGASA. + + +Run ACAP's `"pagasa:municipalities"` NPM script to get a list of the PAGASA municipalities and province names. + +1. First, navigate to the server directory from the command line, then run: ```bash copy npm run pagasa:municipalities ``` -2. Enter PAGASA's 10-day excel file URL when prompted. - - These files, updated daily around 8:00 AM are available on https://www.pagasa.dost.gov.ph/climate/climate-prediction/10-day-climate-forecast - - Enter a specific PAGASA's 10-day excel file URL when prompted: + > **INFO:** The `"pagasa:municipalities"` NPM script uses a static-encoded region/province mapping file, manually encoded in 2024 with reference from the PAGASA Seasonal Forecast - Forecast Rainfall Analysis table. +2. Enter PAGASA's 10-day Excel file URL when prompted. + - These files, updated daily around 8:00 AM, are available on https://www.pagasa.dost.gov.ph/climate/climate-prediction/10-day-climate-forecast + - Enter a specific PAGASA's 10-day Excel file URL when prompted: ```bash copy https://pubfiles.pagasa.dost.gov.ph/pagasaweb/files/climate/tendayweatheroutlook/day1.xlsx - ``` -3. Replace the `PROVINCES` and `PROVINCES_ARCHIVE` variables with the comma-separated province names of your new target region resulting from **step #2**. -4. Replace the `DEFAULT_PROVINCE` .env variable with any province name from the `PROVINCES` comma-separated province names. + ````` +3. Double-check the resulting province names from **step #2** with those listed in the latest [PAGASA Seasonal Forecast - Forecast Rainfall Analysis](https://www.pagasa.dost.gov.ph/climate/climate-prediction/seasonal-forecast) table. Take note of **new province(s)** not included in the generated list, or **remove** provinces no longer present in the Forecast Rainfall Analysis table. + + The `"pagasa:municipalities"` NPM script may generate an outdated or incorrect list of provinces of a region depending on several factors. - -The `"pagasa:municipalities"` NPM script may generate an outdated or incorrect list of provinces of a region depending on several factors. + - Visit the [Provinces and Municipalities FAQs](/articles/provinces-municipalities/#faqs) or the [Regional Provinces / Municipalities Inconsistency](/articles/provinces-municipalities/#regional-provinces--municipalities-inconsistency) sections for more information on why this may happen. -- Visit the [Provinces and Municipalities FAQs](/articles/provinces-municipalities/#faqs) or the [Regional Provinces / Municipalities Inconsistency](/articles/provinces-municipalities/#regional-provinces--municipalities-inconsistency) sections for more information on why this may happen. - -- Refer to the [Updating Regional Provinces](/articles/provinces-municipalities/#updating-regional-provinces) guide for possible troubleshooting methods if you notice missing provinces or municipalities after running this script. - + - Refer to the [Updating Regional Provinces](/articles/provinces-municipalities/#updating-regional-provinces) guide for possible troubleshooting methods if you notice missing provinces or municipalities after running this script. + +4. Replace the `PROVINCES` and `PROVINCES_ARCHIVE` variables with the comma-separated province names of your new target region resulting from **steps #2 and #3**. +5. Replace the `DEFAULT_PROVINCE` .env variable with any province name from the `PROVINCES` comma-separated province names. ### Create new superadmin password From 8d6895db281b8d2858b71b51adc8e99664578107 Mon Sep 17 00:00:00 2001 From: acaptutorials Date: Wed, 18 Sep 2024 23:23:48 +0800 Subject: [PATCH 2/2] fix: faqsbox darkmode style, #36 * detect dark/light mode theme on ssg client --- .../articles/provinces-municipalities.mdx | 45 +++++++++++++------ 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/docs/pages/articles/provinces-municipalities.mdx b/docs/pages/articles/provinces-municipalities.mdx index b5b20507..1d6ed3a0 100644 --- a/docs/pages/articles/provinces-municipalities.mdx +++ b/docs/pages/articles/provinces-municipalities.mdx @@ -1,17 +1,36 @@ +import { useEffect, useState, useMemo } from 'react' import { Callout, FileTree, Steps } from 'nextra/components' - -export function FAQBox({ title, children, open=false }) { - return ( -
- - {title} - -
{children}
-
- ) +import { useTheme } from 'next-themes' + +export function FAQBox({ title, children, open = false }) { + const [isClient, setIsClient] = useState(false) + const { theme, resolvedTheme } = useTheme() + + useEffect(() => { + setIsClient(true) + }, []) + + const detailsBgStyle = useMemo(() => { + const bg = resolvedTheme === 'dark' + ? 'bg-neutral-800' + : 'bg-neutral-50' + + return `last-of-type:mb-0 rounded-lg ${bg} p-2 mt-4` + }, [resolvedTheme]) + + return !isClient + ?
...
+ : ( +
+ + {title} + +
{children}
+
+ ) } # Provinces and Municipalities