diff --git a/components/Layout/Layout.tsx b/components/Layout/Layout.tsx index 9f8b99e4..64830dbd 100644 --- a/components/Layout/Layout.tsx +++ b/components/Layout/Layout.tsx @@ -19,8 +19,8 @@ const roleNavigations = { "vault", "identifier", ], - admin: ["scanner", "visitors", "badges", "users", "events"], - manager: ["badges", "prizes", "identifier"], + admin: ["scanner", "visitors", "badges", "leaderboard", "users", "events"], + manager: ["badges", "leaderboard", "prizes", "identifier"], }; type LayoutProps = { @@ -35,7 +35,6 @@ export default function Layout({ title, description, basePath = "attendee", - navigation, children, }: LayoutProps) { const { user, logout } = useAuth(); @@ -43,7 +42,7 @@ export default function Layout({ const router = useRouter(); const currentHref = router.asPath; - const links = navigation || roleNavigations[user.type]; + const links = roleNavigations[user.type]; const openNavbar = () => { setIsNavbarOpen(true); diff --git a/components/Navbar/index.jsx b/components/Navbar/index.jsx index b476674f..e7986c02 100644 --- a/components/Navbar/index.jsx +++ b/components/Navbar/index.jsx @@ -26,6 +26,7 @@ const userNavigation = (type) => { return [{ name: "Dashboard", slug: "/attendee/profile" }]; case USER.ROLES.MANAGER: return [ + { name: "Leaderboard", slug: "/manager/leaderboard" }, { name: "Give Badges", slug: "/manager/badges" }, { name: "Give Prizes", slug: "/manager/prizes" }, ]; diff --git a/context/Auth/withAuth.js b/context/Auth/withAuth.js index d99a20a3..e455bfe5 100644 --- a/context/Auth/withAuth.js +++ b/context/Auth/withAuth.js @@ -39,6 +39,7 @@ export function withAuth(WrappedComponent) { "/manager/prizes", "/manager/prizes/[uuid]", "/manager/identifier", + "/manager/leaderboard", "/attendees/[uuid]", ].includes(router.pathname) ) { diff --git a/layout/Manager/Badges/Badges.tsx b/layout/Manager/Badges/Badges.tsx index 65998253..b87203b3 100644 --- a/layout/Manager/Badges/Badges.tsx +++ b/layout/Manager/Badges/Badges.tsx @@ -9,8 +9,6 @@ import ErrorMessage from "@components/ErrorMessage"; import Filter from "@components/BadgeFilter"; import QRScanner, { FEEDBACK } from "@components/QRScanner"; -const navigation = ["badges", "prizes", "identifier"]; - function Badges() { const [allBadges, updateAllBadges] = useState([]); const [filter, updateFilter] = useState(null); @@ -71,12 +69,7 @@ function Badges() { }; return ( - + {showScanner ? (
diff --git a/layout/Manager/Prize/Prize.tsx b/layout/Manager/Prize/Prize.tsx index 58c19cc9..3d132fc5 100644 --- a/layout/Manager/Prize/Prize.tsx +++ b/layout/Manager/Prize/Prize.tsx @@ -8,8 +8,6 @@ import { withAuth } from "@context/Auth"; import Layout from "@components/Layout"; import Button from "@components/Button"; -const navigation = ["badges", "prizes", "identifier"]; - function Prize() { const router = useRouter(); const { uuid } = router.query; @@ -61,7 +59,6 @@ function Prize() {
diff --git a/layout/Manager/Prizes/Prizes.tsx b/layout/Manager/Prizes/Prizes.tsx index bd73e588..90231eed 100644 --- a/layout/Manager/Prizes/Prizes.tsx +++ b/layout/Manager/Prizes/Prizes.tsx @@ -6,8 +6,6 @@ import { withAuth, useAuth } from "@context/Auth"; import Layout from "@components/Layout"; import QRScanner, { FEEDBACK } from "@components/QRScanner"; -const navigation = ["badges", "prizes", "identifier"]; - function Prizes() { const { user } = useAuth(); const router = useRouter(); @@ -23,7 +21,6 @@ function Prizes() {
diff --git a/layout/Sponsor/Dashboard/Dashboard.tsx b/layout/Sponsor/Dashboard/Dashboard.tsx index 65b2dcc0..3d16e758 100644 --- a/layout/Sponsor/Dashboard/Dashboard.tsx +++ b/layout/Sponsor/Dashboard/Dashboard.tsx @@ -8,19 +8,15 @@ import SponsorPrizeButton from "@layout/moonstone/sponsor/dashboard/SponsorPrize import SponsorBadgeButton from "@layout/moonstone/sponsor/dashboard/SponsorBadgeButton"; import ParticipantSelector from "@layout/moonstone/sponsor/dashboard/ParticipantSelector"; -interface Props {} - -const SponsorDashboard: React.FC = () => { +const SponsorDashboard: React.FC = () => { const participants: string[] = ["Nome 1", "Nome 2", "Nome 3", "Nome 4"]; const onParticipantChange = (p: string) => {}; - const navigation = ["scanner", "dashboard", "visitors"]; return (
diff --git a/layout/Sponsor/Scanner/Scanner.tsx b/layout/Sponsor/Scanner/Scanner.tsx index 4c813b37..b60215fa 100644 --- a/layout/Sponsor/Scanner/Scanner.tsx +++ b/layout/Sponsor/Scanner/Scanner.tsx @@ -5,11 +5,7 @@ import { withAuth, useAuth } from "@context/Auth"; import QRScanner, { FEEDBACK } from "@components/QRScanner"; import Layout from "@components/Layout"; -interface Props {} - -const navigation = ["scanner", "visitors"]; - -const SponsorBadges: React.FC = () => { +const SponsorBadges: React.FC = () => { const { user } = useAuth(); const pauseRef = useRef(false); const [feedback, setFeedback] = useState( @@ -51,7 +47,6 @@ const SponsorBadges: React.FC = () => {
diff --git a/layout/Sponsor/Spotlight/Spotlight.tsx b/layout/Sponsor/Spotlight/Spotlight.tsx index 522da446..61482053 100644 --- a/layout/Sponsor/Spotlight/Spotlight.tsx +++ b/layout/Sponsor/Spotlight/Spotlight.tsx @@ -1,19 +1,12 @@ import { withAuth } from "@context/Auth"; -import SpotlightButton from "@layout/moonstone/sponsor/spotlight/SpotlightButton"; - import Layout from "@components/Layout"; -interface Props {} - -const Spotlight: React.FC = () => { - const navigation = ["scanner", "dashboard", "spotlight", "visitors"]; - +const Spotlight: React.FC = () => { return (
diff --git a/layout/Sponsor/Visitors/Visitors.tsx b/layout/Sponsor/Visitors/Visitors.tsx index 846156b7..6761b803 100644 --- a/layout/Sponsor/Visitors/Visitors.tsx +++ b/layout/Sponsor/Visitors/Visitors.tsx @@ -1,13 +1,10 @@ import { useState, useEffect } from "react"; import { withAuth, useAuth } from "@context/Auth"; -import Pagination from "../components/Pagination"; import Layout from "@components/Layout"; import { downloadCVInBulk, getCompanyVisitors } from "@lib/api"; -interface Props {} - interface Visitor { id: string; name: string; @@ -16,9 +13,7 @@ interface Visitor { cv: string; } -const navigation = ["scanner", "visitors"]; - -const SponsorVisitors: React.FC = () => { +const SponsorVisitors: React.FC = () => { const { user } = useAuth(); const [visitors, setVisitors] = useState([]); const [downloading, setDownloading] = useState(false); @@ -65,7 +60,6 @@ const SponsorVisitors: React.FC = () => {
diff --git a/layout/Attendee/Leaderboard/Leaderboard.tsx b/layout/shared/Leaderboard/Leaderboard.tsx similarity index 100% rename from layout/Attendee/Leaderboard/Leaderboard.tsx rename to layout/shared/Leaderboard/Leaderboard.tsx diff --git a/layout/Attendee/Leaderboard/components/Table/index.tsx b/layout/shared/Leaderboard/components/Table/index.tsx similarity index 100% rename from layout/Attendee/Leaderboard/components/Table/index.tsx rename to layout/shared/Leaderboard/components/Table/index.tsx diff --git a/layout/Attendee/Leaderboard/components/index.ts b/layout/shared/Leaderboard/components/index.ts similarity index 100% rename from layout/Attendee/Leaderboard/components/index.ts rename to layout/shared/Leaderboard/components/index.ts diff --git a/layout/Attendee/Leaderboard/index.ts b/layout/shared/Leaderboard/index.ts similarity index 100% rename from layout/Attendee/Leaderboard/index.ts rename to layout/shared/Leaderboard/index.ts diff --git a/pages/attendee/leaderboard.tsx b/pages/attendee/leaderboard.tsx index da9f7d1c..e25d4484 100644 --- a/pages/attendee/leaderboard.tsx +++ b/pages/attendee/leaderboard.tsx @@ -1 +1 @@ -export { default } from "@layout/Attendee/Leaderboard"; +export { default } from "@layout/shared/Leaderboard"; diff --git a/pages/manager/leaderboard.tsx b/pages/manager/leaderboard.tsx new file mode 100644 index 00000000..e25d4484 --- /dev/null +++ b/pages/manager/leaderboard.tsx @@ -0,0 +1 @@ +export { default } from "@layout/shared/Leaderboard";