-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8785c25
commit 00a9601
Showing
16 changed files
with
307 additions
and
11 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
6 changes: 6 additions & 0 deletions
6
src/views/MySubscription/SubscriptionDetail/AlertInfoItem/i18n.json
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,6 @@ | ||
{ | ||
"namespace": "alertInfo", | ||
"strings": { | ||
"alertInfoView": "View" | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
src/views/MySubscription/SubscriptionDetail/AlertInfoItem/index.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,43 @@ | ||
import { Container } from '@ifrc-go/ui'; | ||
import { useTranslation } from '@ifrc-go/ui/hooks'; | ||
|
||
import Link from '#components/Link'; | ||
|
||
import i18n from './i18n.json'; | ||
import styles from './styles.module.css'; | ||
|
||
interface Props { | ||
alertId: string; | ||
alertTitle: string; | ||
alertDescription?: string; | ||
} | ||
|
||
function AlertInfoItem(props: Props) { | ||
const strings = useTranslation(i18n); | ||
|
||
const { | ||
alertId, | ||
alertTitle, | ||
alertDescription, | ||
} = props; | ||
|
||
return ( | ||
<Container | ||
className={styles.alertDetail} | ||
heading={alertTitle} | ||
headingLevel={4} | ||
actions={( | ||
<Link | ||
to="alertDetails" | ||
urlParams={{ alertId }} | ||
variant="secondary" | ||
> | ||
{strings.alertInfoView} | ||
</Link> | ||
)} | ||
footerContent={alertDescription} | ||
/> | ||
); | ||
} | ||
|
||
export default AlertInfoItem; |
4 changes: 4 additions & 0 deletions
4
src/views/MySubscription/SubscriptionDetail/AlertInfoItem/styles.module.css
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,4 @@ | ||
.alert-detail { | ||
background-color: var(--go-ui-color-gray-20); | ||
padding: var(--go-ui-spacing-md); | ||
} |
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,9 @@ | ||
{ | ||
"namespace": "subscriptionDetail", | ||
"strings": { | ||
"subscriptionDetailTitle": "Subscription Detail", | ||
"subscriptionHeading": "Subscription", | ||
"filterStartDateFrom": "Start date from", | ||
"filterStartDateTo": "Start date To" | ||
} | ||
} |
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,131 @@ | ||
import { useCallback } from 'react'; | ||
import { | ||
Container, | ||
DateInput, | ||
List, | ||
} from '@ifrc-go/ui'; | ||
import { useTranslation } from '@ifrc-go/ui/hooks'; | ||
|
||
import Page from '#components/Page'; | ||
import { stringIdSelector } from '#utils/selectors'; | ||
|
||
import { | ||
AlertInfo, | ||
SubscriptionAndAlertDetail, | ||
} from '../common'; | ||
import AlertInfoItem from './AlertInfoItem'; | ||
|
||
import i18n from './i18n.json'; | ||
import styles from './styles.module.css'; | ||
|
||
// eslint-disable-next-line import/prefer-default-export | ||
export function Component() { | ||
const strings = useTranslation(i18n); | ||
|
||
const subscriptionAndAlertDetail: SubscriptionAndAlertDetail[] = [ | ||
{ | ||
id: '1', | ||
alertFilter: ['Future', 'Severe', 'Nepal'], | ||
alertInfo: [ | ||
{ | ||
id: '1', | ||
alertId: '101', | ||
alertTitle: 'Flood Alert', | ||
alertDescription: 'Severe flooding expected in the coastal region.', | ||
}, | ||
{ | ||
id: '2', | ||
alertId: '102', | ||
alertTitle: 'Heatwave Warning', | ||
alertDescription: 'Extreme heatwave affecting northern regions.', | ||
}, | ||
{ | ||
id: '3', | ||
alertId: '103', | ||
alertTitle: 'Earthquake Advisory', | ||
alertDescription: 'Possible aftershocks in the affected areas.', | ||
}, | ||
], | ||
}, | ||
]; | ||
|
||
const alertInfo: AlertInfo[] = [ | ||
{ | ||
id: '1', | ||
alertId: '101', | ||
alertTitle: 'Flood Alert', | ||
alertDescription: 'Severe flooding expected in the coastal region.', | ||
}, | ||
{ | ||
id: '2', | ||
alertId: '102', | ||
alertTitle: 'Heatwave Warning', | ||
alertDescription: 'Extreme heatwave affecting northern regions.', | ||
}, | ||
{ | ||
id: '3', | ||
alertId: '103', | ||
alertTitle: 'Earthquake Advisory', | ||
alertDescription: 'Possible aftershocks in the affected areas.', | ||
}, | ||
]; | ||
|
||
const rendererParams = useCallback((_: string, value: AlertInfo) => ({ | ||
alertId: value.alertId, | ||
alertTitle: value.alertTitle, | ||
alertDescription: value?.alertDescription, | ||
}), []); | ||
|
||
return ( | ||
<Page | ||
className={styles.subscriptionDetail} | ||
title={strings.subscriptionDetailTitle} | ||
// TODO: Add subscription heading and description | ||
heading={strings.subscriptionHeading} | ||
> | ||
<Container | ||
childrenContainerClassName={styles.alertFilters} | ||
withGridViewInFilter | ||
filters={( | ||
<> | ||
<DateInput | ||
name="startDateFrom" | ||
label={strings.filterStartDateFrom} | ||
value={undefined} | ||
onChange={() => { }} | ||
/> | ||
<DateInput | ||
name="startDateTo" | ||
label={strings.filterStartDateTo} | ||
value={undefined} | ||
onChange={() => { }} | ||
/> | ||
</> | ||
)} | ||
> | ||
<div className={styles.badgeContainer}> | ||
{subscriptionAndAlertDetail?.map((filter) => ( | ||
<div | ||
key={filter.id} | ||
className={styles.badge} | ||
> | ||
{filter.alertFilter} | ||
</div> | ||
))} | ||
</div> | ||
<List | ||
className={styles.alertItem} | ||
data={alertInfo} | ||
renderer={AlertInfoItem} | ||
rendererParams={rendererParams} | ||
keySelector={stringIdSelector} | ||
pending={false} | ||
errored={false} | ||
filtered={false} | ||
/> | ||
</Container> | ||
</Page> | ||
); | ||
} | ||
|
||
Component.displayName = 'SubscriptionDetail'; |
25 changes: 25 additions & 0 deletions
25
src/views/MySubscription/SubscriptionDetail/styles.module.css
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,25 @@ | ||
.subscription-detail { | ||
.alert-filters { | ||
display: flex; | ||
flex-direction: column; | ||
gap: var(--go-ui-spacing-md); | ||
|
||
.badge-container { | ||
display: flex; | ||
gap: var(--go-ui-spacing-md); | ||
|
||
.badge { | ||
border-radius: 1em; | ||
background-color: var(--go-ui-color-gray-20); | ||
padding: var(--go-ui-spacing-2xs) var(--go-ui-spacing-sm); | ||
} | ||
} | ||
|
||
.alert-item { | ||
display: flex; | ||
flex-direction: column; | ||
gap: var(--go-ui-spacing-md); | ||
} | ||
} | ||
|
||
} |
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,6 @@ | ||
{ | ||
"namespace": "subscriptionItem", | ||
"strings": { | ||
"subscriptionItemView": "View" | ||
} | ||
} |
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.