diff --git a/src/App/routes/index.tsx b/src/App/routes/index.tsx
index 61d690ba..8859e413 100644
--- a/src/App/routes/index.tsx
+++ b/src/App/routes/index.tsx
@@ -57,6 +57,20 @@ const homeLayout = customWrapRoute({
},
});
+const mySubscription = customWrapRoute({
+ parent: rootLayout,
+ path: 'subscriptions',
+ component: {
+ render: () => import('#views/MySubscription'),
+ props: {},
+ },
+ context: {
+ title: 'My Subscriptions',
+ // TODO: Change visibility after login feature
+ visibility: 'anything',
+ },
+});
+
const homeIndex = customWrapRoute({
parent: homeLayout,
index: true,
@@ -218,6 +232,7 @@ const wrappedRoutes = {
pageNotFound,
login,
recoverAccount,
+ mySubscription,
};
export const unwrappedRoutes = unwrapRoute(Object.values(wrappedRoutes));
diff --git a/src/components/Navbar/i18n.json b/src/components/Navbar/i18n.json
index 78595b24..9d2e6223 100644
--- a/src/components/Navbar/i18n.json
+++ b/src/components/Navbar/i18n.json
@@ -6,6 +6,6 @@
"appAbout": "About",
"appResources": "Resources",
"headerMenuHome": "Home",
- "headerMenuMySubscription": "My Subscription"
+ "headerMenuMySubscription": "My Subscriptions"
}
}
diff --git a/src/components/Navbar/index.tsx b/src/components/Navbar/index.tsx
index f84881db..de2821f0 100644
--- a/src/components/Navbar/index.tsx
+++ b/src/components/Navbar/index.tsx
@@ -79,9 +79,15 @@ function Navbar(props: Props) {
>
{strings.headerMenuHome}
+
+ {strings.headerMenuMySubscription}
+
);
}
+
export default Navbar;
diff --git a/src/components/Navbar/styles.module.css b/src/components/Navbar/styles.module.css
index 7785e42f..f976e946 100644
--- a/src/components/Navbar/styles.module.css
+++ b/src/components/Navbar/styles.module.css
@@ -50,7 +50,6 @@
}
.menu-item:hover {
- text-decoration: underline;
color: var(--go-ui-color-primary-red);
}
diff --git a/src/views/Home/AlertFilters/index.tsx b/src/views/Home/AlertFilters/index.tsx
index c4dc0b02..ac32b497 100644
--- a/src/views/Home/AlertFilters/index.tsx
+++ b/src/views/Home/AlertFilters/index.tsx
@@ -55,65 +55,65 @@ const categoryLabelSelector = (category: Category) => category.label;
const ALERT_ENUMS = gql`
query AlertEnums {
enums {
- AlertInfoCertainty {
- key
- label
- }
- AlertInfoUrgency {
- label
- key
- }
- AlertInfoSeverity {
- key
- label
- }
- AlertInfoCategory {
- key
- label
- }
+ AlertInfoCertainty {
+ key
+ label
+ }
+ AlertInfoUrgency {
+ label
+ key
+ }
+ AlertInfoSeverity {
+ key
+ label
+ }
+ AlertInfoCategory {
+ key
+ label
+ }
}
}`;
const ADMIN_LIST = gql`
query FilteredAdminList($filters:Admin1Filter, $pagination: OffsetPaginationInput) {
public {
- id
- admin1s(filters: $filters, pagination: $pagination) {
- items {
- id
- name
- countryId
- alertCount
+ id
+ admin1s(filters: $filters, pagination: $pagination) {
+ items {
+ id
+ name
+ countryId
+ alertCount
+ }
}
- }
}
- }
+}
`;
const REGION_LIST = gql`
query RegionList {
public {
id
- regions {
- items {
- id
- name
- ifrcGoId
+ regions {
+ items {
+ id
+ name
+ ifrcGoId
+ }
}
- }
}
- }
+}
`;
const ALL_COUNTRY_LIST = gql`
query AllCountryList {
- public {
- id
- allCountries {
- name
- id
+ public {
+ id
+ allCountries {
+ name
+ id
+ }
}
- }
}
`;
diff --git a/src/views/Home/AlertsMap/Sidebar/CountryDetail/index.tsx b/src/views/Home/AlertsMap/Sidebar/CountryDetail/index.tsx
index aac0fd6f..11b6e1f4 100644
--- a/src/views/Home/AlertsMap/Sidebar/CountryDetail/index.tsx
+++ b/src/views/Home/AlertsMap/Sidebar/CountryDetail/index.tsx
@@ -36,23 +36,23 @@ import styles from './styles.module.css';
const COUNTRY_DETAIL = gql`
query CountryDetail($countryId: ID!) {
- public {
- id
- country(pk: $countryId) {
- id
- bbox
- name
- iso3
- ifrcGoId
- alertCount
- admin1s {
+ public {
id
- countryId
- filteredAlertCount
- name
- }
+ country(pk: $countryId) {
+ id
+ bbox
+ name
+ iso3
+ ifrcGoId
+ alertCount
+ admin1s {
+ id
+ countryId
+ filteredAlertCount
+ name
+ }
+ }
}
- }
}
`;
diff --git a/src/views/Home/AlertsMap/i18n.json b/src/views/Home/AlertsMap/i18n.json
index 64c9deea..dcca6882 100644
--- a/src/views/Home/AlertsMap/i18n.json
+++ b/src/views/Home/AlertsMap/i18n.json
@@ -6,6 +6,7 @@
"ongoingAlertCountries": "Ongoing Alert Countries",
"backToAlertsLabel": "Back to Alerts",
"alertViewDetails": "View Details",
- "alertInfo": "The IFRC AlertHub shows current warnings from official alerting agencies. These warnings have a start time (when the event might happen) and an end time (when it's expected to be over). The IFRC Alert Hub shows warnings that are happening right now (their start time has already passed) but aren't finished yet (their end time hasn't come yet)."
+ "alertInfo": "The IFRC AlertHub shows current warnings from official alerting agencies. These warnings have a start time (when the event might happen) and an end time (when it's expected to be over). The IFRC Alert Hub shows warnings that are happening right now (their start time has already passed) but aren't finished yet (their end time hasn't come yet).",
+ "alertNewSubscription": "New Subscription"
}
}
diff --git a/src/views/Home/AlertsMap/index.tsx b/src/views/Home/AlertsMap/index.tsx
index 0154322c..bab79f74 100644
--- a/src/views/Home/AlertsMap/index.tsx
+++ b/src/views/Home/AlertsMap/index.tsx
@@ -7,12 +7,19 @@ import {
gql,
useQuery,
} from '@apollo/client';
-import { ChevronRightLineIcon } from '@ifrc-go/icons';
import {
+ AddLineIcon,
+ ChevronRightLineIcon,
+} from '@ifrc-go/icons';
+import {
+ Button,
Container,
InfoPopup,
} from '@ifrc-go/ui';
-import { useTranslation } from '@ifrc-go/ui/hooks';
+import {
+ useBooleanState,
+ useTranslation,
+} from '@ifrc-go/ui/hooks';
import { resolveToString } from '@ifrc-go/ui/utils';
import {
isDefined,
@@ -28,6 +35,7 @@ import {
FilteredCountryListQueryVariables,
} from '#generated/types/graphql';
import useFilterState from '#hooks/useFilterState';
+import NewSubscriptionModal from '#views/NewSubscriptionModal';
import AlertDataContext from '../AlertDataContext';
import AlertFilters from '../AlertFilters';
@@ -77,12 +85,21 @@ type AlertPointProperties = {
export function Component() {
const strings = useTranslation(i18n);
const alertFilters = useAlertFilters();
+
+ const [showSubscriptionModal, {
+ setTrue: setShowSubscriptionModalTrue,
+ setFalse: setShowSubscriptionModalFalse,
+ }] = useBooleanState(false);
+
const {
activeAdmin1Id,
activeCountryId,
activeAlertId,
activeCountryDetails,
activeAdmin1Details,
+ selectedUrgencyTypes,
+ selectedCertaintyTypes,
+ selectedSeverityTypes,
} = useContext(AlertDataContext);
// FIXME: We should remove useFilterState as we are not using any feature
@@ -170,6 +187,22 @@ export function Component() {
[totalAlertCount, activeCountryDetails, activeAdmin1Details, strings],
);
+ const defaultSubscription = useMemo(() => ({
+ id: '',
+ title: '',
+ urgency: selectedUrgencyTypes,
+ severity: selectedSeverityTypes,
+ certainty: selectedCertaintyTypes,
+ country: activeCountryId,
+ admin1: activeAdmin1Id,
+ }), [
+ selectedUrgencyTypes,
+ selectedSeverityTypes,
+ selectedCertaintyTypes,
+ activeCountryId,
+ activeAdmin1Id,
+ ]);
+
return (
- )}
- >
- {strings.mapViewAllSources}
-
+
+
+ )}
+ >
+ {strings.alertNewSubscription}
+
+
+ )}
+ >
+ {strings.mapViewAllSources}
+
+
)}
overlayPending
pending={countryListLoading}
@@ -204,6 +252,12 @@ export function Component() {
filters={}
withGridViewInFilter
>
+ {showSubscriptionModal && (
+
+ )}