This repository has been archived by the owner on Nov 13, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Showing
20 changed files
with
594 additions
and
404 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
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,83 @@ | ||
import React from 'react'; | ||
import useReviewSighting from '../../models/sighting/useReviewSighting'; | ||
import Text from '../Text'; | ||
import Alert from '../Alert'; | ||
import ButtonMenu from '../ButtonMenu'; | ||
|
||
export default function ReviewSighting({ | ||
sightingGuid, | ||
matchStatus, | ||
}) { | ||
const { | ||
mutate: reviewSighting, | ||
error, | ||
clearError, | ||
} = useReviewSighting(); | ||
|
||
const sendRequest = async status => { | ||
const operations = [ | ||
{ | ||
op: 'replace', | ||
path: '/match_state', | ||
value: status, | ||
}, | ||
]; | ||
await reviewSighting({ sightingGuid, operations }); | ||
}; | ||
|
||
const buttonActions = [ | ||
{ | ||
id: 'mark-sighting-unreviewed', | ||
labelId: 'UNREVIEWED', | ||
onClick: async () => { | ||
sendRequest('unreviewed'); | ||
}, | ||
}, | ||
{ | ||
id: 'mark-sighting-in-progress', | ||
labelId: 'IN_PROGRESS', | ||
onClick: async () => { | ||
sendRequest('in_progress'); | ||
}, | ||
}, | ||
{ | ||
id: 'mark-sighting-reviewed', | ||
labelId: 'REVIEWED', | ||
onClick: async () => { | ||
sendRequest('reviewed'); | ||
}, | ||
}, | ||
{ | ||
id: 'mark-sighting-unidentifiable', | ||
labelId: 'UNIDENTIFIABLE', | ||
onClick: async () => { | ||
sendRequest('unidentifiable'); | ||
}, | ||
}, | ||
]; | ||
|
||
return ( | ||
<div | ||
style={{ display: 'flex', alignItems: 'center', marginTop: 20 }} | ||
> | ||
<Text id="STATUS" /> | ||
<ButtonMenu | ||
display="secondary" | ||
buttonId="match-actions" | ||
style={{ marginLeft: 24 }} | ||
actions={buttonActions} | ||
id={matchStatus?.toUpperCase() || 'UNPROCESSED'} | ||
disabled={!matchStatus} | ||
/> | ||
{error && ( | ||
<Alert | ||
severity="error" | ||
onClose={clearError} | ||
style={{ margin: '16px 16px', maxWidth: 400 }} | ||
> | ||
{error} | ||
</Alert> | ||
)} | ||
</div> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.