Skip to content

Commit

Permalink
fix: nav bar display and the singleRound stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
kittybest committed Dec 9, 2024
1 parent 5f2e7df commit 5892845
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/interface/src/layouts/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ export interface ILayoutProps extends PropsWithChildren<LayoutProps> {
export interface IAdminLayoutProps extends PropsWithChildren<LayoutProps> {
sidebar?: "left" | "right";
sidebarComponent?: ReactNode;
roundId?: string;
pollId?: string;
}
10 changes: 5 additions & 5 deletions packages/interface/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ const HomePage = (): JSX.Element => {
const { isRegistered } = useMaci();
const isAdmin = useIsAdmin();
const { rounds } = useRound();
const singleRound = useMemo(() => rounds?.[0], [rounds]);
const singleRound = useMemo(() => (rounds && rounds.length === 1 ? rounds[0] : undefined), [rounds]);

return (
<Layout pollId={singleRound ? singleRound.pollId : ""} type="home">
{singleRound && rounds!.length === 1 && <SingleRoundHome round={singleRound} />}
{singleRound && <SingleRoundHome round={singleRound} />}

{rounds && rounds.length > 1 && (
{!singleRound && (
<div className="flex h-auto w-screen flex-col items-center justify-center gap-4 bg-blue-50 px-2 pb-4 sm:h-[90vh] dark:bg-black">
<Heading className="mt-4 max-w-screen-lg text-center sm:mt-0" size="6xl">
{config.eventName}
Expand All @@ -51,11 +51,11 @@ const HomePage = (): JSX.Element => {
</div>
)}

{isConnected && !isAdmin && rounds.length === 0 && (
{isConnected && !isAdmin && rounds && rounds.length === 0 && (
<p className="text-gray-400">There are no rounds deployed.</p>
)}

<RoundsList />
{rounds && rounds.length > 1 && <RoundsList />}
</div>
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const ConfirmProjectPage = ({ pollId }: { pollId: string }): JSX.Element => {

if (project === undefined) {
return (
<Layout>
<Layout pollId={pollId}>
<div className="flex w-full justify-center">
<div className="flex flex-col items-center gap-4 md:max-w-screen-sm lg:max-w-screen-md xl:max-w-screen-lg">
<Heading as="h2" size="4xl">
Expand All @@ -54,7 +54,7 @@ const ConfirmProjectPage = ({ pollId }: { pollId: string }): JSX.Element => {
}

return (
<Layout>
<Layout pollId={pollId}>
<div className="flex w-fit justify-center sm:w-full">
<div className="flex flex-col items-center gap-4 md:max-w-screen-sm lg:max-w-screen-md xl:max-w-screen-lg">
{project.recipient.initialized === false ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface IApplicationsPageProps {
}

const ApplicationsPage = ({ pollId }: IApplicationsPageProps): JSX.Element => (
<AdminLayout roundId={pollId} title="Review applications">
<AdminLayout pollId={pollId} title="Review applications">
<ApplicationsToApprove pollId={pollId} />
</AdminLayout>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const NewProjectPage = ({ pollId }: { pollId: string }): JSX.Element => {
const state = useRoundState({ pollId });

return (
<Layout>
<Layout pollId={pollId}>
<div className="flex w-full justify-center">
<div className="flex flex-col gap-4 md:max-w-screen-sm lg:max-w-screen-md xl:max-w-screen-lg">
<Heading as="h3" size="3xl">
Expand Down

0 comments on commit 5892845

Please sign in to comment.