-
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
eb6e906
commit 8785c25
Showing
11 changed files
with
689 additions
and
5 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
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": "alertActions", | ||
"strings": { | ||
"alertTableViewDetailsTitle": "View Details" | ||
} | ||
} |
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,56 @@ | ||
import { useCallback } from 'react'; | ||
import { generatePath } from 'react-router-dom'; | ||
import { CopyLineIcon } from '@ifrc-go/icons'; | ||
import { Button } from '@ifrc-go/ui'; | ||
import { useTranslation } from '@ifrc-go/ui/hooks'; | ||
|
||
import Link from '#components/Link'; | ||
import { AlertInformationsQuery } from '#generated/types/graphql'; | ||
import useAlert from '#hooks/useAlert'; | ||
import routes from '#routes'; | ||
|
||
import i18n from './i18n.json'; | ||
import styles from './styles.module.css'; | ||
|
||
type AlertType = NonNullable<NonNullable<NonNullable<AlertInformationsQuery['public']>['alerts']>['items']>[number]; | ||
|
||
export interface Props { | ||
data: AlertType; | ||
} | ||
function AlertActions(props: Props) { | ||
const { data } = props; | ||
const strings = useTranslation(i18n); | ||
const alert = useAlert(); | ||
|
||
const url = generatePath( | ||
routes.alertDetails.absolutePath, | ||
{ alertId: data.id }, | ||
); | ||
|
||
const handleClick = useCallback(() => { | ||
navigator.clipboard.writeText(`${window.location.origin}${url}`); | ||
alert.show('Link copied to clipboard'); | ||
}, [url, alert]); | ||
|
||
return ( | ||
<div className={styles.alertActions}> | ||
<Link | ||
className={styles.viewDetailsCopyLink} | ||
to="alertDetails" | ||
urlParams={{ alertId: data.id }} | ||
> | ||
{strings.alertTableViewDetailsTitle} | ||
</Link> | ||
<Button | ||
name={undefined} | ||
onClick={handleClick} | ||
variant="tertiary" | ||
title="Copy alert URL" | ||
> | ||
<CopyLineIcon /> | ||
</Button> | ||
</div> | ||
); | ||
} | ||
|
||
export default AlertActions; |
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 @@ | ||
.alert-actions{ | ||
display: flex; | ||
gap: var(--go-ui-spacing-sm); | ||
} | ||
|
||
|
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,33 @@ | ||
{ | ||
"namespace": "historicalAlerts", | ||
"strings": { | ||
"allOngoingAlertTitle":"Past 3 Months Alerts ({numAppeals}) ", | ||
"historicalAlertTableEventTitle":"Event" , | ||
"historicalAlertTableCategoryTitle":"Event Categories", | ||
"historicalAlertTableRegionTitle":"Region", | ||
"historicalAlertTableCountryTitle":"Country", | ||
"historicalAlertTableActionsTitle":"Actions", | ||
"historicalAlertTableAdminsTitle":"Admin1s", | ||
"historicalAlertTableSentLabel":"Sent", | ||
"tableViewAllSources": "View All Sources", | ||
"historicalAlertTitle": "IFRC Alert Hub - Historical Alerts", | ||
"historicalAlert": "Historical Alerts", | ||
"filterCountriesPlaceholder": "All Countries", | ||
"filterAdmin1Placeholder": "All Admin1", | ||
"filterUrgencyPlaceholder": "All Urgency Types", | ||
"filterSeverityPlaceholder": "All Severity Types", | ||
"filterCertaintyPlaceholder": "All Certainty Types", | ||
"filterCountriesLabel": "Country", | ||
"filterAdmin1Label": "Admin1", | ||
"filterUrgencyLabel": "Urgency Level", | ||
"filterSeverityLabel": "Severity Level", | ||
"filterCertaintyLabel": "Certainty Level", | ||
"filterRegionsLabel": "Regions", | ||
"filterRegionsPlaceholder": "All Regions", | ||
"filterCategoriesLabel": "Event Categories", | ||
"filterCategoriesPlaceholder": "All Event Categories", | ||
"filterStartDateFrom":"Start date from", | ||
"filterStartDateTo":"Start date To", | ||
"historicalAlertDescription": "IFRC Alert Hub provides global emergency alerts, empowering communities to protect lives and livelihoods. Easily access and filter past alerts from the latest months to stay informed." | ||
} | ||
} |
Oops, something went wrong.