From 7b4bf02beebf28cf5a8f86d60e679ee3fb9fe381 Mon Sep 17 00:00:00 2001 From: barshathakuri Date: Fri, 22 Nov 2024 14:32:17 +0545 Subject: [PATCH] Subscription page integration --- package.json | 2 +- src/components/Badge/index.tsx | 21 - src/components/Badge/styles.module.css | 6 - .../AlertInfo/AreaInfoDetail/index.tsx | 1 - src/views/AllSourcesFeeds/index.tsx | 1 - src/views/HistoricalAlerts/index.tsx | 30 +- src/views/Home/AlertsMap/index.tsx | 14 +- src/views/Home/AlertsTable/index.tsx | 16 +- .../ActiveTableActions/index.tsx | 19 +- .../ArchiveTableActions/index.tsx | 15 +- .../AlertInfoItem/index.tsx | 2 +- .../SubscriptionDetail/index.tsx | 261 ++++++++--- .../SubscriptionDetail/styles.module.css | 9 +- .../SubscriptionTableItem/index.tsx | 94 ++-- .../SubscriptionTableItem/styles.module.css | 9 +- src/views/MySubscription/common.tsx | 42 -- src/views/MySubscription/index.tsx | 414 +++++++++++++++--- src/views/NewSubscriptionModal/index.tsx | 278 ++++++++---- yarn.lock | 14 +- 19 files changed, 883 insertions(+), 365 deletions(-) delete mode 100644 src/components/Badge/index.tsx delete mode 100644 src/components/Badge/styles.module.css delete mode 100644 src/views/MySubscription/common.tsx diff --git a/package.json b/package.json index 6b0f0406..ac4f2472 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "@graphql-codegen/typescript-operations": "^4.2.0", "@hcaptcha/react-hcaptcha": "^1.11.0", "@ifrc-go/icons": "^1.3.3", - "@ifrc-go/ui": "^1.1.2", + "@ifrc-go/ui": "^1.2.1", "@mapbox/mapbox-gl-draw": "^1.4.3", "@placemarkio/geo-viewport": "^1.0.2", "@sentry/react": "^7.81.1", diff --git a/src/components/Badge/index.tsx b/src/components/Badge/index.tsx deleted file mode 100644 index 52ec6a8b..00000000 --- a/src/components/Badge/index.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { Container } from '@ifrc-go/ui'; - -import styles from './styles.module.css'; - -interface Props { - title: string; -} - -function Badge(props: Props) { - const { - title, - } = props; - - return ( - - {title} - - ); -} - -export default Badge; diff --git a/src/components/Badge/styles.module.css b/src/components/Badge/styles.module.css deleted file mode 100644 index 43bfb743..00000000 --- a/src/components/Badge/styles.module.css +++ /dev/null @@ -1,6 +0,0 @@ -.badge { - display: flex; - border-radius: 1em; - background-color: var(--go-ui-color-gray-20); - padding: var(--go-ui-spacing-2xs) var(--go-ui-spacing-sm); -} diff --git a/src/views/AlertDetails/AlertInfo/AreaInfoDetail/index.tsx b/src/views/AlertDetails/AlertInfo/AreaInfoDetail/index.tsx index 18e5e7be..b958d8f0 100644 --- a/src/views/AlertDetails/AlertInfo/AreaInfoDetail/index.tsx +++ b/src/views/AlertDetails/AlertInfo/AreaInfoDetail/index.tsx @@ -236,7 +236,6 @@ function AreaInfoDetail(props: Props) { onChange={setSelectedFeature} /> )} - withGridViewInFilter headingLevel={4} >
diff --git a/src/views/AllSourcesFeeds/index.tsx b/src/views/AllSourcesFeeds/index.tsx index f80cb43b..b10ca554 100644 --- a/src/views/AllSourcesFeeds/index.tsx +++ b/src/views/AllSourcesFeeds/index.tsx @@ -117,7 +117,6 @@ export function Component() { heading={strings.sourceFeedsTitle} > [numbe type Certainty = NonNullable[number]; type Category = NonNullable[number]; -type AlertType = NonNullable['alerts']>['items']>[number]; +type AlertType = NonNullable['alerts']>['items']>[number]; type Admin1 = AlertType['admin1s'][number]; const adminKeySelector = (admin1: AdminOption) => admin1.id; @@ -168,8 +166,6 @@ const categoryKeySelector = (category: Category) => category.key; const alertKeySelector = (item: AlertType) => item.id; const PAGE_SIZE = 20; -const ASC = 'ASC'; -const DESC = 'DESC'; // eslint-disable-next-line import/prefer-default-export export function Component() { @@ -190,21 +186,11 @@ export function Component() { filter: {}, }); - const order = useMemo(() => { - if (isNotDefined(sortState.sorting)) { - return undefined; - } - return { - [sortState.sorting.name]: sortState.sorting.direction === 'asc' ? ASC : DESC, - }; - }, [sortState.sorting]); - const variables = useMemo<{ filters: AlertFilter, pagination: OffsetPaginationInput }>(() => ({ pagination: { offset, limit, }, - order, filters: { urgency: filter.urgency, severity: filter.severity, @@ -221,7 +207,6 @@ export function Component() { } : undefined, }, }), [ - order, limit, offset, filter, @@ -232,8 +217,8 @@ export function Component() { previousData, data: alertInfosResponse = previousData, error: alertInfoError, - } = useQuery( - ALERT_INFORMATIONS, + } = useQuery( + HISTORICAL_ALERT_INFORMATIONS, { skip: isNotDefined(variables), variables, @@ -374,7 +359,6 @@ export function Component() { className={styles.alertsTable} heading={heading} withHeaderBorder - withGridViewInFilter actions={( ({ - name: '', - alertFilters: { - urgency: selectedUrgencyTypes, - severity: selectedSeverityTypes, - certainty: selectedCertaintyTypes, - country: activeCountryId ?? '', - admin1s: activeAdmin1Id ? [activeAdmin1Id] : [], - }, + filterAlertUrgencies: selectedUrgencyTypes, + filterAlertCertainties: selectedCertaintyTypes, + filterAlertSeverities: selectedSeverityTypes, + filterAlertCountry: activeCountryId || '', + filterAlertAdmin1s: activeAdmin1Id ? [activeAdmin1Id] : [], }), [ selectedUrgencyTypes, selectedSeverityTypes, @@ -251,7 +248,6 @@ export function Component() { contentViewType="grid" numPreferredGridContentColumns={3} filters={} - withGridViewInFilter > {showSubscriptionModal && ( ({ + id: '', name: '', - alertFilters: { - urgency: selectedUrgencyTypes, - severity: selectedSeverityTypes, - certainty: selectedCertaintyTypes, - country: activeCountryId ?? '', - admin1s: activeAdmin1Id ? [activeAdmin1Id] : [], - }, + filterAlertUrgencies: selectedUrgencyTypes, + filterAlertCertainties: selectedCertaintyTypes, + filterAlertSeverities: selectedSeverityTypes, + filterAlertCategories: selectedCategoryTypes, + filterAlertCountry: activeCountryId || '', + filterAlertAdmin1s: activeAdmin1Id ? [activeAdmin1Id] : [], }), [ selectedUrgencyTypes, selectedSeverityTypes, selectedCertaintyTypes, activeCountryId, activeAdmin1Id, + selectedCategoryTypes, ]); return ( @@ -317,7 +318,6 @@ export function Component() {
)} withHeaderBorder - withGridViewInFilter actions={(
diff --git a/yarn.lock b/yarn.lock index 44d5ccf0..943b34a8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1699,12 +1699,18 @@ resolved "https://registry.yarnpkg.com/@ifrc-go/icons/-/icons-1.3.3.tgz#6a4aaf8a06ba237d2de269e84a1561f0a395deb1" integrity sha512-43sLUn0jH3v+gkJC0bT6oYWlsPg9isAT/x/qYhmZHb53iQOlWjUC9fNNSQq3nzklH7+mvHhXFXBbotSeFEtLhw== -"@ifrc-go/ui@^1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@ifrc-go/ui/-/ui-1.1.2.tgz#ece85236abb661ad5cb4cd5e99ec63525feda9c8" - integrity sha512-BiKNoe72xrNkDSqf14dsu3w8f4h20Q2C91VWAX1ZWV64pGf6exZwxMGPQm6RPL299R6m47eTwHQndyQZJCjXoQ== +"@ifrc-go/icons@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@ifrc-go/icons/-/icons-2.0.1.tgz#7b8fe49ceed3e51de182bd97bcdbc6c9e9914351" + integrity sha512-j0KXz5UgUgVBfSljx6XATBWchj1tDckaGX+uI86QTO63teP5zCd6osR9q/e6H3jv8bzil1sdUmVt4VOwSX6xhw== + +"@ifrc-go/ui@^1.2.1": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@ifrc-go/ui/-/ui-1.2.1.tgz#12f611a2200cbf00f3e82c0a10cf5aa79d75dd28" + integrity sha512-ZdWffxnowjtY8wgIuheS4mf3P1JnoKKaEC8yrf0JHceb3fCenMXJqMBQEdRMaJNBtd4MhQhuls53uErzX/l2gA== dependencies: "@changesets/cli" "^2.27.1" + "@ifrc-go/icons" "^2.0.1" "@togglecorp/fujs" "^2.1.1" react-focus-on "^3.9.1" sanitize-html "^2.11.0"