-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: deep dip scene redesign (#179)
* feat: deep dip scene redesign * fix: z-index layering
- Loading branch information
Showing
7 changed files
with
232 additions
and
67 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import * as React from 'react'; | ||
import clsx from 'clsx'; | ||
import { useCurrentProgress, useGlobalLeaderboard } from '../pre-stream/utils/deep-dip'; | ||
import { ResultBlock, ResultBlockDivider, ResultBlockFallback } from './result-block'; | ||
|
||
export function DeepDip2Leaderboard({ className }: React.ComponentPropsWithoutRef<'div'>) { | ||
const { leaderboard, isLoading: isLeaderboardLoading } = useGlobalLeaderboard(); | ||
const { progress, isLoading: isProgressLoading } = useCurrentProgress(); | ||
const truncatedLeaderboard = leaderboard?.length ? leaderboard.slice(0, 10) : []; | ||
|
||
return ( | ||
<div className={clsx('flex flex-col items-center flex-1 space-y-3', className)}> | ||
<div className="flex items-center justify-between flex-1 w-full max-w-7xl px-6 bg-chungking-black/90 rounded-lg"> | ||
<div className="text-chungking-white text-4xl font-bold">Current Standings</div> | ||
</div> | ||
<div className="flex flex-col flex-1 w-full max-w-7xl space-y-3"> | ||
<div className="flex flex-col space-y-2"> | ||
{isLeaderboardLoading | ||
? Array(10) | ||
.fill(undefined) | ||
.map((_, key) => <ResultBlockFallback key={key} />) | ||
: truncatedLeaderboard.map(item => <ResultBlock key={item.wsid} result={item} />)} | ||
</div> | ||
|
||
{isProgressLoading ? ( | ||
<> | ||
<ResultBlockDivider /> | ||
<ResultBlockFallback /> | ||
</> | ||
) : progress ? ( | ||
<> | ||
<ResultBlockDivider /> | ||
<ResultBlock result={progress} /> | ||
</> | ||
) : null} | ||
</div> | ||
</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,34 @@ | ||
import * as React from 'react'; | ||
import { LeaderboardResult } from '~/server/modules/deepdip/get-global-leaderboard'; | ||
|
||
export interface ResultBlockProps { | ||
result: LeaderboardResult; | ||
} | ||
|
||
export function ResultBlockDivider() { | ||
return ( | ||
<div className="flex items-center justify-center h-[16px] bg-chungking-black/90 rounded-lg" /> | ||
); | ||
} | ||
|
||
export function ResultBlockFallback() { | ||
return ( | ||
<div className="flex items-center justify-between h-[56px] bg-chungking-black/90 rounded-lg" /> | ||
); | ||
} | ||
|
||
export function ResultBlock({ result }: ResultBlockProps) { | ||
return ( | ||
<div className="flex items-center justify-between bg-chungking-black/90 rounded-lg gap-6 p-1"> | ||
<div className="flex items-center justify-center w-[84px] h-[48px] rounded-md bg-chungking-blue-500"> | ||
<span className="text-chungking-white text-3xl font-bold">{result.rank}</span> | ||
</div> | ||
<div className="flex items-center justify-start flex-1 pr-3"> | ||
<span className="text-chungking-white text-3xl">{result.name}</span> | ||
</div> | ||
<div className="flex items-center justify-center px-2 w-[160px] h-[48px] rounded-md bg-chungking-white"> | ||
<span className="text-chungking-black text-3xl font-bold">{result.height.toFixed(1)}m</span> | ||
</div> | ||
</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
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,14 @@ | ||
import * as React from 'react'; | ||
import { NextPage } from 'next'; | ||
|
||
import { OverlayLayout } from '~/layouts/overlay-layout'; | ||
import { createNextPage } from '~/lib/create-next-page'; | ||
import { PreStreamDeepDipScene } from '~/modules/pre-stream/pre-stream-deep-dip'; | ||
|
||
const DeepDipEndScenePage: NextPage = () => { | ||
return <PreStreamDeepDipScene headerText="Thanks for watching!" variant="end" />; | ||
}; | ||
|
||
export default createNextPage(DeepDipEndScenePage, { | ||
layout: OverlayLayout, | ||
}); |
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,14 @@ | ||
import * as React from 'react'; | ||
import { NextPage } from 'next'; | ||
|
||
import { OverlayLayout } from '~/layouts/overlay-layout'; | ||
import { createNextPage } from '~/lib/create-next-page'; | ||
import { PreStreamDeepDipScene } from '~/modules/pre-stream/pre-stream-deep-dip'; | ||
|
||
const DeepDipPreStreamScenePage: NextPage = () => { | ||
return <PreStreamDeepDipScene headerText="Starting soon." variant="pre-stream" />; | ||
}; | ||
|
||
export default createNextPage(DeepDipPreStreamScenePage, { | ||
layout: OverlayLayout, | ||
}); |
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