-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update single round UI and slightly update the mobile UI
- Loading branch information
Showing
6 changed files
with
144 additions
and
72 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { useAccount } from "wagmi"; | ||
|
||
import { ConnectButton } from "~/components/ConnectButton"; | ||
import { Info } from "~/components/Info"; | ||
import { JoinButton } from "~/components/JoinButton"; | ||
import { Button } from "~/components/ui/Button"; | ||
import { Heading } from "~/components/ui/Heading"; | ||
import { useMaci } from "~/contexts/Maci"; | ||
import { useIsMobile } from "~/hooks/useIsMobile"; | ||
import { useRoundState } from "~/utils/state"; | ||
import { ERoundState, type IRoundData } from "~/utils/types"; | ||
|
||
interface ISingleRoundHome { | ||
round: IRoundData; | ||
} | ||
|
||
export const SingleRoundHome = ({ round }: ISingleRoundHome): JSX.Element => { | ||
const { isConnected } = useAccount(); | ||
const { isRegistered } = useMaci(); | ||
const isMobile = useIsMobile(); | ||
const roundState = useRoundState({ pollId: round.pollId }); | ||
|
||
return ( | ||
<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="mb-0 mt-4 max-w-screen-lg text-center sm:mt-0" size="6xl"> | ||
{round.roundId} | ||
</Heading> | ||
|
||
<p className="text-gray-400">{round.description}</p> | ||
|
||
<Button size="auto" variant={roundState === ERoundState.RESULTS ? "tertiary" : "secondary"}> | ||
<a href={`/rounds/${round.pollId}`}>View Projects</a> | ||
</Button> | ||
|
||
{roundState === ERoundState.RESULTS && ( | ||
<Button size="auto" variant="primary"> | ||
<a href={`/rounds/${round.pollId}`}>View Results</a> | ||
</Button> | ||
)} | ||
|
||
{!isConnected && !isMobile && <p className="text-gray-400">Connect your wallet to get started.</p>} | ||
|
||
{isMobile && (roundState === ERoundState.APPLICATION || roundState === ERoundState.VOTING) && <ConnectButton />} | ||
|
||
{isConnected && !isRegistered && <JoinButton />} | ||
|
||
<Info showAppState pollId={round.pollId} showBallot={false} showRoundInfo={false} size="default" /> | ||
</div> | ||
); | ||
}; |
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,8 @@ | ||
import { createBreakpoint } from "react-use"; | ||
|
||
export function useIsMobile(): boolean { | ||
const useBreakpoint = createBreakpoint({ XL: 1280, L: 768, S: 350 }); | ||
const breakpoint = useBreakpoint(); | ||
|
||
return breakpoint === "S"; | ||
} |
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