-
Notifications
You must be signed in to change notification settings - Fork 180
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
27c28df
commit 6c6fe0f
Showing
3 changed files
with
90 additions
and
92 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
54 changes: 54 additions & 0 deletions
54
app/webpacker/components/Panel/pages/EditPersonPage/index.jsx
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,54 @@ | ||
import React, { useState } from 'react'; | ||
import { Button, Item } from 'semantic-ui-react'; | ||
import WcaSearch from '../../../SearchWidget/WcaSearch'; | ||
import SEARCH_MODELS from '../../../SearchWidget/SearchModel'; | ||
import Loading from '../../../Requests/Loading'; | ||
import useQueryParams from '../../../../lib/hooks/useQueryParams'; | ||
import EditPersonForm from './EditPersonForm'; | ||
|
||
export default function EditPersonPage() { | ||
const [queryParams, updateQueryParam] = useQueryParams(); | ||
const [loading, setLoading] = useState(false); | ||
const { wcaId } = queryParams; | ||
|
||
if (loading) return <Loading />; | ||
|
||
return ( | ||
<> | ||
<div> | ||
To know the difference between fix and update, refer to the Delegate Handbook's | ||
"Requesting Changes to Personal Data" section. | ||
</div> | ||
{wcaId | ||
? ( | ||
<> | ||
<Item> | ||
<Item.Content> | ||
<Item.Header>{`WCA ID: ${wcaId}`}</Item.Header> | ||
<Item.Description> | ||
<Button onClick={() => { | ||
setLoading(true); | ||
updateQueryParam('wcaId', ''); | ||
}} | ||
> | ||
Clear | ||
</Button> | ||
</Item.Description> | ||
</Item.Content> | ||
</Item> | ||
<EditPersonForm wcaId={wcaId} /> | ||
</> | ||
) | ||
: ( | ||
<WcaSearch | ||
onChange={(e, { value }) => { | ||
setLoading(true); | ||
updateQueryParam('wcaId', value.id); | ||
}} | ||
multiple={false} | ||
model={SEARCH_MODELS.person} | ||
/> | ||
)} | ||
</> | ||
); | ||
} |