diff --git a/__mocks__/getRepresentatives/handlers.ts b/__mocks__/getRepresentatives/handlers.ts index f5e5c59..7bbf3fb 100644 --- a/__mocks__/getRepresentatives/handlers.ts +++ b/__mocks__/getRepresentatives/handlers.ts @@ -10,7 +10,6 @@ export const getRepresentativesHandlers = [ is_alternate: false, workshop_id: BigInt(1).toString(), email: 'john@johnson.com', - color: '#000000', wallet_address: 'addr1isdufnpoasidjfopmaimdfmopisadj', name: 'John Johnson', }, @@ -21,7 +20,6 @@ export const getRepresentativesHandlers = [ is_alternate: true, workshop_id: BigInt(1).toString(), email: 'mike@mickelson.com', - color: '#000000', wallet_address: 'addr1oqwieuroijfvaondsfipoaapoidjf', name: 'Mike Mickelson', }, @@ -32,7 +30,6 @@ export const getRepresentativesHandlers = [ is_alternate: false, workshop_id: BigInt(2).toString(), email: 'jack@jackson.com', - color: '#000000', wallet_address: 'addr1kidjfsadjfoadspjfoaidsfadsop', name: 'Jack Jackson', }, @@ -43,7 +40,6 @@ export const getRepresentativesHandlers = [ is_alternate: true, workshop_id: BigInt(2).toString(), email: 'rob@robertson.com', - color: '#000000', wallet_address: 'addr1iwoiuwqxpoieujsoidpjfkfjhpqowmfoa', name: 'Robert Robertson', }, @@ -54,7 +50,6 @@ export const getRepresentativesHandlers = [ is_alternate: false, workshop_id: BigInt(3).toString(), email: 'connor@connorson.com', - color: '#000000', wallet_address: 'addr1opijpoiuoimnlkjipoujpoimlkkm', name: 'Connor Connorson', }, @@ -65,7 +60,6 @@ export const getRepresentativesHandlers = [ is_alternate: true, workshop_id: BigInt(3).toString(), email: 'kyle@kyleson.com', - color: '#000000', wallet_address: 'addr1adfasdfwerwqersdvfzxfvsadf', name: 'Kyle Kyleson', }, diff --git a/__mocks__/updateUser/errorHandlers.ts b/__mocks__/updateUser/errorHandlers.ts index 1b1ebce..10c3d96 100644 --- a/__mocks__/updateUser/errorHandlers.ts +++ b/__mocks__/updateUser/errorHandlers.ts @@ -4,7 +4,7 @@ export const updateUserActiveVoteHandler = [ http.post('/api/updateUser', async () => { return HttpResponse.json( { - pollId: BigInt(-1).toString(), + userId: BigInt(-1).toString(), message: 'You cannot update user information while a Poll is actively voting.', }, @@ -17,7 +17,7 @@ export const updateUserNoNameHandler = [ http.post('/api/updateUser', async () => { return HttpResponse.json( { - pollId: BigInt(-1).toString(), + userId: BigInt(-1).toString(), message: 'Name must be provided.', }, { status: 400 }, @@ -29,7 +29,7 @@ export const updateUserNoEmailHandler = [ http.post('/api/updateUser', async () => { return HttpResponse.json( { - pollId: BigInt(-1).toString(), + userId: BigInt(-1).toString(), message: 'Email must be provided.', }, { status: 400 }, @@ -41,7 +41,7 @@ export const updateUserNoWalletAddressHandler = [ http.post('/api/updateUser', async () => { return HttpResponse.json( { - pollId: BigInt(-1).toString(), + userId: BigInt(-1).toString(), message: 'Wallet address must be provided.', }, { status: 400 }, @@ -53,7 +53,7 @@ export const updateUserTooLongNameHandler = [ http.post('/api/updateUser', async () => { return HttpResponse.json( { - pollId: BigInt(-1).toString(), + userId: BigInt(-1).toString(), message: 'Name must be less than 100 characters.', }, { status: 400 }, @@ -65,7 +65,7 @@ export const updateUserTooLongEmailHandler = [ http.post('/api/updateUser', async () => { return HttpResponse.json( { - pollId: BigInt(-1).toString(), + userId: BigInt(-1).toString(), message: 'Email must be less than 100 characters.', }, { status: 400 }, @@ -77,7 +77,7 @@ export const updateUserTooLongWalletAddressHandler = [ http.post('/api/updateUser', async () => { return HttpResponse.json( { - pollId: BigInt(-1).toString(), + userId: BigInt(-1).toString(), message: 'Wallet Address must be less than 100 characters.', }, { status: 400 }, @@ -89,7 +89,7 @@ export const updateUserInternalErrorHandler = [ http.post('/api/updateUser', async () => { return HttpResponse.json( { - pollId: BigInt(-1).toString(), + userId: BigInt(-1).toString(), message: 'Error updating User Information.', }, { status: 500 }, @@ -101,7 +101,7 @@ export const updateUserInvalidSessionHandler = [ http.post('/api/updateUser', async () => { return HttpResponse.json( { - success: false, + userId: BigInt(-1).toString(), message: 'You must be signed in as an Organizer update user information.', }, @@ -114,7 +114,7 @@ export const updateUserNotOrganizerHandler = [ http.post('/api/updateUser', async () => { return HttpResponse.json( { - success: false, + userId: BigInt(-1).toString(), message: 'You must be an Organizer to update user information.', }, { status: 401 }, diff --git a/__tests__/components/coordinator/manageRepresentativesTable/stripsWhitespaceFromWalletAddress.test.tsx b/__tests__/components/coordinator/manageRepresentativesTable/stripsWhitespaceFromWalletAddress.test.tsx new file mode 100644 index 0000000..a0bbb19 --- /dev/null +++ b/__tests__/components/coordinator/manageRepresentativesTable/stripsWhitespaceFromWalletAddress.test.tsx @@ -0,0 +1,33 @@ +import { render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import { Toaster } from 'react-hot-toast'; +import { expect, test } from 'vitest'; + +import { ManageRepresentativesTable } from '@/components/coordinator/manageRepresentativesTable'; + +test('strips whitespace from wallet address', async () => { + const user = userEvent.setup(); + render( + <> + + {}} /> + , + ); + + const editButton = await screen.findByTestId('edit-representative-info-1'); + await user.click(editButton); + + const input = screen.getByDisplayValue('addr1isdufnpoasidjfopmaimdfmopisadj'); + await user.clear(input); + await user.type(input, ' coStakeAddress '); + + const saveButton = await screen.findByTestId('save-representative-info-1'); + await user.click(saveButton); + + // Wait for the success toast to appear + const successToast = await screen.findByText('User info updated!'); + expect(successToast).toBeDefined(); + + const newWalletAddress = await screen.findByText('coStakeAddress'); + expect(newWalletAddress).toBeDefined(); +}); diff --git a/public/cardano.png b/public/cardano.png new file mode 100644 index 0000000..dbdcf49 Binary files /dev/null and b/public/cardano.png differ diff --git a/src/components/buttons/connectWalletButton.tsx b/src/components/buttons/connectWalletButton.tsx index 21b9aff..cd4a48e 100644 --- a/src/components/buttons/connectWalletButton.tsx +++ b/src/components/buttons/connectWalletButton.tsx @@ -17,11 +17,16 @@ import { paths } from '@/paths'; import { connectWallet } from '@/lib/connectWallet'; import { getUser } from '@/lib/helpers/getUser'; +interface Props { + isHomepage?: boolean; +} + /** * A button to connect a wallet to a variety of cip-30 compatible wallets * @returns Connect Wallet Button */ -export function ConnectWalletButton(): JSX.Element { +export function ConnectWalletButton(props: Props): JSX.Element { + const { isHomepage } = props; const [open, setOpen] = useState(false); const [anchorEl, setAnchorEl] = useState(null); const [connecting, setConnecting] = useState(false); @@ -192,8 +197,24 @@ export function ConnectWalletButton(): JSX.Element { )} - {session.status === 'authenticated' && ( + {isHomepage ? ( + <> + ) : session.status === 'authenticated' ? ( Wallet connected + ) : ( + + Wallet not connected + )} + {wallets} ); diff --git a/src/components/buttons/deletePollButton.tsx b/src/components/buttons/deletePollButton.tsx index 3b9f6fc..d055f11 100644 --- a/src/components/buttons/deletePollButton.tsx +++ b/src/components/buttons/deletePollButton.tsx @@ -1,6 +1,5 @@ import { useState } from 'react'; import { useRouter } from 'next/router'; -import { DeleteRounded } from '@mui/icons-material'; import Button from '@mui/material/Button'; import { useSession } from 'next-auth/react'; import toast from 'react-hot-toast'; @@ -45,12 +44,12 @@ export function DeletePollButton(props: Props): JSX.Element { return ( ); } else { diff --git a/src/components/buttons/downloadPollVotesButton.tsx b/src/components/buttons/downloadPollVotesButton.tsx index 3acf3bc..60acb66 100644 --- a/src/components/buttons/downloadPollVotesButton.tsx +++ b/src/components/buttons/downloadPollVotesButton.tsx @@ -33,11 +33,12 @@ export function DownloadPollVotesButton(props: Props): JSX.Element { return ( ); } diff --git a/src/components/buttons/downloadUserVotesButton.tsx b/src/components/buttons/downloadUserVotesButton.tsx index 7f74d5d..5b43f1b 100644 --- a/src/components/buttons/downloadUserVotesButton.tsx +++ b/src/components/buttons/downloadUserVotesButton.tsx @@ -33,11 +33,12 @@ export function DownloadUserVotesButton(props: Props): JSX.Element { return ( ); } diff --git a/src/components/buttons/voteOnPollButtons.tsx b/src/components/buttons/voteOnPollButtons.tsx index 53e6756..89cf7f9 100644 --- a/src/components/buttons/voteOnPollButtons.tsx +++ b/src/components/buttons/voteOnPollButtons.tsx @@ -133,7 +133,9 @@ export function VoteOnPollButtons(props: Props): JSX.Element { variant="outlined" color="success" sx={{ - width: '150px', + width: '170px', + py: 2, + borderRadius: '60px !important', }} endIcon={} size="large" @@ -141,13 +143,16 @@ export function VoteOnPollButtons(props: Props): JSX.Element { disabled={disabled || !isActiveVoter} data-testid="vote-yes-button" > - Yes + Vote Yes + + ); +} diff --git a/src/components/layout/layout.tsx b/src/components/layout/layout.tsx index 3c7ab06..2c0d110 100644 --- a/src/components/layout/layout.tsx +++ b/src/components/layout/layout.tsx @@ -2,6 +2,7 @@ import { useTheme } from '@mui/material'; import Box from '@mui/material/Box'; import { Toaster } from 'react-hot-toast'; +import { Footer } from '@/components/layout/footer'; import { Navbar } from '@/components/layout/navbar'; interface Props { @@ -61,6 +62,7 @@ export function Layout(props: Props): JSX.Element { > {children} +