diff --git a/packages/web/src/components/Admin/JudgingSessionList/JudgingSessionActionsMenu.tsx b/packages/web/src/components/Admin/JudgingSessionList/JudgingSessionActionsMenu.tsx index d5a23ac4e..ae0dfd193 100644 --- a/packages/web/src/components/Admin/JudgingSessionList/JudgingSessionActionsMenu.tsx +++ b/packages/web/src/components/Admin/JudgingSessionList/JudgingSessionActionsMenu.tsx @@ -1,14 +1,6 @@ import React from 'react'; -import { useRouter } from 'next/router'; -import { - Menu, - MenuButton, - Button, - MenuList, - MenuItem, - MenuItemProps, - useClipboard, -} from '@chakra-ui/react'; +import NextLink from 'next/link'; +import { Menu, MenuButton, Button, MenuList, MenuItem, useClipboard } from '@chakra-ui/react'; import { BsChevronDown } from 'react-icons/bs'; import { ExpoJudgingSession, CriteriaJudgingSession } from '@hangar/shared'; import { openSuccessToast } from '../../utils/CustomToast'; @@ -18,14 +10,9 @@ type JudgingSessionActionsMenuProps = { judgingSession: ExpoJudgingSession | CriteriaJudgingSession; }; -const menuItemStyle: MenuItemProps = { - py: 3, -}; - export const JudgingSessionActionsMenu: React.FC = ({ judgingSession, }) => { - const router = useRouter(); const judgingSessionType = 'criteriaList' in judgingSession ? 'criteriaJudgingSession' : 'expoJudgingSession'; @@ -45,7 +32,7 @@ export const JudgingSessionActionsMenu: React.FC { onCopy(); openSuccessToast({ title: 'Link copied to clipboard' }); @@ -54,23 +41,17 @@ export const JudgingSessionActionsMenu: React.FC Copy Invite Link - { - void router.push(invitePath); - }} - > - Join Session - + + + Join Session + + - { - void router.push(`/admin/${judgingSessionType}/${judgingSession.id}`); - }} - > - See Results - + + + See Results + + ); diff --git a/packages/web/src/components/Admin/JudgingSessionList/JudgingSessionsOptionsButton/JudgingSessionOptionsButton.tsx b/packages/web/src/components/Admin/JudgingSessionList/JudgingSessionsOptionsButton/JudgingSessionOptionsButton.tsx index 70dff9b64..9c1a6f5fb 100644 --- a/packages/web/src/components/Admin/JudgingSessionList/JudgingSessionsOptionsButton/JudgingSessionOptionsButton.tsx +++ b/packages/web/src/components/Admin/JudgingSessionList/JudgingSessionsOptionsButton/JudgingSessionOptionsButton.tsx @@ -1,13 +1,12 @@ import React from 'react'; import { Text, IconButton, Menu, MenuButton, MenuList, MenuItem } from '@chakra-ui/react'; import { ExpoJudgingSession } from '@hangar/shared'; -import { useRouter } from 'next/router'; +import NextLink from 'next/link'; import { BsThreeDots } from 'react-icons/bs'; import { openErrorToast, openSuccessToast } from '../../../utils/CustomToast'; import { useExpoJudgingSessionStore } from '../../../../stores/expoJudgingSession'; export const JudgingSessionOptionsButton: React.FC = () => { - const router = useRouter(); const { addExpoJudgingSession } = useExpoJudgingSessionStore(); let expoJudgingSession: ExpoJudgingSession | undefined; @@ -36,14 +35,11 @@ export const JudgingSessionOptionsButton: React.FC = () => { Create Expo Judging Session - { - void router.push('/admin/createCriteriaJudgingSession'); - }} - > - Create Criteria Judging Session - + + + Create Criteria Judging Session + + ); diff --git a/packages/web/src/components/Prizes/PrizeCard.tsx b/packages/web/src/components/Prizes/PrizeCard.tsx index 25c08b994..666028df4 100644 --- a/packages/web/src/components/Prizes/PrizeCard.tsx +++ b/packages/web/src/components/Prizes/PrizeCard.tsx @@ -1,6 +1,6 @@ import { ListItem, Heading, Flex, Text, Button } from '@chakra-ui/react'; import { Prize } from '@hangar/shared'; -import { useRouter } from 'next/router'; +import NextLink from 'next/link'; import { colors } from '../../theme'; type PrizeCardProps = { @@ -11,7 +11,6 @@ const RANKING = ['🥇', '🥈', '🥉']; const BONUS = '✨'; export const PrizeCard: React.FC = ({ prize }) => { - const router = useRouter(); const { name, description, position, isBonus, winner } = prize; return ( @@ -26,13 +25,9 @@ export const PrizeCard: React.FC = ({ prize }) => { {description} {winner && ( - + + + )} diff --git a/packages/web/src/components/layout/AppLayout/NavBar/NavElements/PageLinks/AdminDashboard.tsx b/packages/web/src/components/layout/AppLayout/NavBar/NavElements/PageLinks/AdminDashboard.tsx index ddc4a0587..a509ccb77 100644 --- a/packages/web/src/components/layout/AppLayout/NavBar/NavElements/PageLinks/AdminDashboard.tsx +++ b/packages/web/src/components/layout/AppLayout/NavBar/NavElements/PageLinks/AdminDashboard.tsx @@ -1,16 +1,8 @@ import { Link } from '@chakra-ui/react'; -import { useRouter } from 'next/router'; +import NextLink from 'next/link'; -export const AdminDashboard: React.FC = () => { - const router = useRouter(); - - return ( - { - void router.push('/admin/dashboard'); - }} - > - Admin Dashboard - - ); -}; +export const AdminDashboard: React.FC = () => ( + + Admin Dashboard + +); diff --git a/packages/web/src/components/layout/AppLayout/NavBar/NavElements/PageLinks/MyProject.tsx b/packages/web/src/components/layout/AppLayout/NavBar/NavElements/PageLinks/MyProject.tsx index 51de624e3..ff91d84fb 100644 --- a/packages/web/src/components/layout/AppLayout/NavBar/NavElements/PageLinks/MyProject.tsx +++ b/packages/web/src/components/layout/AppLayout/NavBar/NavElements/PageLinks/MyProject.tsx @@ -1,21 +1,15 @@ import { Link } from '@chakra-ui/react'; -import { useRouter } from 'next/router'; +import NextLink from 'next/link'; import { useUserStore } from '../../../../../../stores/user'; export const MyProject: React.FC = () => { - const router = useRouter(); const { user } = useUserStore(); if (!user?.project) return null; return ( - { - void router.push(`/project/${user.project}`); - }} - > - My Project - + + My Project + ); }; diff --git a/packages/web/src/components/layout/AppLayout/NavBar/NavElements/PageLinks/Prizes.tsx b/packages/web/src/components/layout/AppLayout/NavBar/NavElements/PageLinks/Prizes.tsx index a4dce14c0..b08c4518c 100644 --- a/packages/web/src/components/layout/AppLayout/NavBar/NavElements/PageLinks/Prizes.tsx +++ b/packages/web/src/components/layout/AppLayout/NavBar/NavElements/PageLinks/Prizes.tsx @@ -1,16 +1,8 @@ import { Link } from '@chakra-ui/react'; -import { useRouter } from 'next/router'; +import NextLink from 'next/link'; -export const Prizes: React.FC = () => { - const router = useRouter(); - - return ( - { - void router.push('/#prizes'); - }} - > - Prizes - - ); -}; +export const Prizes: React.FC = () => ( + + Prizes + +); diff --git a/packages/web/src/components/layout/AppLayout/NavBar/NavElements/PageLinks/Schedule.tsx b/packages/web/src/components/layout/AppLayout/NavBar/NavElements/PageLinks/Schedule.tsx index ff58a9c6d..4b0b7c7c3 100644 --- a/packages/web/src/components/layout/AppLayout/NavBar/NavElements/PageLinks/Schedule.tsx +++ b/packages/web/src/components/layout/AppLayout/NavBar/NavElements/PageLinks/Schedule.tsx @@ -1,16 +1,8 @@ import { Link } from '@chakra-ui/react'; -import { useRouter } from 'next/router'; +import NextLink from 'next/link'; -export const Schedule: React.FC = () => { - const router = useRouter(); - - return ( - { - void router.push('/schedule'); - }} - > - Schedule - - ); -}; +export const Schedule: React.FC = () => ( + + Schedule + +); diff --git a/packages/web/src/components/layout/AppLayout/NavBar/NavLogo.tsx b/packages/web/src/components/layout/AppLayout/NavBar/NavLogo.tsx index f5a9fa4e0..ab8cda206 100644 --- a/packages/web/src/components/layout/AppLayout/NavBar/NavLogo.tsx +++ b/packages/web/src/components/layout/AppLayout/NavBar/NavLogo.tsx @@ -1,14 +1,13 @@ import { Heading } from '@chakra-ui/react'; import { Config } from '@hangar/shared'; -import { useRouter } from 'next/router'; +import NextLink from 'next/link'; const LOGO_HEIGHT = { base: '24px', sm: '28px', md: '40px' }; -export const NavLogo: React.FC = () => { - const router = useRouter(); - - return ( +export const NavLogo: React.FC = () => ( + { lineHeight={LOGO_HEIGHT} cursor="pointer" mb={1} - onClick={() => { - void router.push('/'); - }} > {Config.global.appName} - ); -}; + +); diff --git a/packages/web/src/pages/judgingSessionComplete.tsx b/packages/web/src/pages/judgingSessionComplete.tsx index 4dcba2d9c..70524fcae 100644 --- a/packages/web/src/pages/judgingSessionComplete.tsx +++ b/packages/web/src/pages/judgingSessionComplete.tsx @@ -1,7 +1,7 @@ import React, { useEffect } from 'react'; import { NextPage } from 'next'; import { Box, Button, keyframes } from '@chakra-ui/react'; -import { useRouter } from 'next/router'; +import NextLink from 'next/link'; import { PageContainer } from '../components/layout/PageContainer'; import { useConfetti } from '../pageUtils/Confetti/Confetti'; @@ -28,7 +28,6 @@ const largeIcon = { const animation = `${bob} infinite 2s linear`; const SessionComplete: NextPage = () => { - const router = useRouter(); const [trigger1, Cannon1] = useConfetti(); const [trigger2, Cannon2] = useConfetti(); @@ -53,14 +52,11 @@ const SessionComplete: NextPage = () => { You can safely close your browser - + + + );