Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
sspenst committed Sep 30, 2023
1 parent ef97d7c commit e23cf72
Show file tree
Hide file tree
Showing 22 changed files with 720 additions and 34 deletions.
4 changes: 4 additions & 0 deletions components/cards/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ export default function Card({ children, id, title, tooltip }: CardProps) {
const tooltipId = `card-tooltip-${id}`;

return (
<<<<<<< HEAD
<div className='flex flex-col justify-center rounded-lg border max-w-full w-fit'
=======
<div className='flex flex-col justify-center rounded-lg border max-w-full'
>>>>>>> c883f344 (`/home` tweaks (#1001))
id={id}
style={{
backgroundColor: 'var(--bg-color-2)',
Expand Down
83 changes: 83 additions & 0 deletions components/cards/chapterSelectCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ import getPngDataClient from '../../helpers/getPngDataClient';
import styles from './SelectCard.module.css';

interface ChapterSelectCardBaseProps {
<<<<<<< HEAD
<<<<<<< HEAD
complete?: boolean;
=======
>>>>>>> c883f344 (`/home` tweaks (#1001))
=======
complete?: boolean;
>>>>>>> dc89605e (ch4 preview (#1006))
disabled?: boolean;
disabledStr?: string;
href: string;
Expand All @@ -16,7 +23,14 @@ interface ChapterSelectCardBaseProps {
}

function ChapterSelectCardBase({
<<<<<<< HEAD
<<<<<<< HEAD
complete,
=======
>>>>>>> c883f344 (`/home` tweaks (#1001))
=======
complete,
>>>>>>> dc89605e (ch4 preview (#1006))
disabled,
disabledStr,
href,
Expand Down Expand Up @@ -77,16 +91,40 @@ function ChapterSelectCardBase({
interface ChapterSelectCardProps {
chapter: number;
chapterUnlocked?: number;
<<<<<<< HEAD
<<<<<<< HEAD
href?: string;
}

export default function ChapterSelectCard({ chapter, chapterUnlocked, href }: ChapterSelectCardProps) {
=======
}

export default function ChapterSelectCard({ chapter, chapterUnlocked }: ChapterSelectCardProps) {
>>>>>>> c883f344 (`/home` tweaks (#1001))
=======
href?: string;
}

export default function ChapterSelectCard({ chapter, chapterUnlocked, href }: ChapterSelectCardProps) {
>>>>>>> cf73c37e (more intuitive campaign button)
switch (chapter) {
case 1:
return (
<ChapterSelectCardBase
<<<<<<< HEAD
<<<<<<< HEAD
complete={!!chapterUnlocked && chapterUnlocked > 1}
href={href ?? '/chapter1'}
<<<<<<< HEAD
=======
=======
complete={!!chapterUnlocked && chapterUnlocked > 1}
>>>>>>> dc89605e (ch4 preview (#1006))
href={'/chapter1'}
>>>>>>> c883f344 (`/home` tweaks (#1001))
=======
>>>>>>> cf73c37e (more intuitive campaign button)
id='chapter1'
levelData={'00000000\n00000000\n00000000\n00000000'}
subtitle={'Grassroots'}
Expand All @@ -96,10 +134,23 @@ export default function ChapterSelectCard({ chapter, chapterUnlocked, href }: Ch
case 2:
return (
<ChapterSelectCardBase
<<<<<<< HEAD
<<<<<<< HEAD
complete={!!chapterUnlocked && chapterUnlocked > 2}
disabled={chapterUnlocked ? chapterUnlocked < 2 : false}
disabledStr={'Complete Chapter 1 to unlock Chapter 2!'}
href={href ?? '/chapter2'}
<<<<<<< HEAD
=======
=======
complete={!!chapterUnlocked && chapterUnlocked > 2}
>>>>>>> dc89605e (ch4 preview (#1006))
disabled={chapterUnlocked ? chapterUnlocked < 2 : false}
disabledStr={'Complete Chapter 1 to unlock Chapter 2!'}
href={'/chapter2'}
>>>>>>> c883f344 (`/home` tweaks (#1001))
=======
>>>>>>> cf73c37e (more intuitive campaign button)
id='chapter2'
levelData={'005E0C00\n0G070005\n10005010\n005100I0'}
subtitle={'Into the Depths'}
Expand All @@ -109,27 +160,59 @@ export default function ChapterSelectCard({ chapter, chapterUnlocked, href }: Ch
case 3:
return (
<ChapterSelectCardBase
<<<<<<< HEAD
<<<<<<< HEAD
complete={!!chapterUnlocked && chapterUnlocked > 3}
disabled={chapterUnlocked ? chapterUnlocked < 3 : false}
disabledStr={'Complete Chapter 2 to unlock Chapter 3!'}
href={href ?? '/chapter3'}
<<<<<<< HEAD
=======
=======
complete={!!chapterUnlocked && chapterUnlocked > 3}
>>>>>>> dc89605e (ch4 preview (#1006))
disabled={chapterUnlocked ? chapterUnlocked < 3 : false}
disabledStr={'Complete Chapter 2 to unlock Chapter 3!'}
href={'/chapter3'}
>>>>>>> c883f344 (`/home` tweaks (#1001))
=======
>>>>>>> cf73c37e (more intuitive campaign button)
id='chapter3'
levelData={'B519F0G0\n10JH5H52\n75F02J08\n02050B10'}
subtitle={'Brain Busters'}
title={'Chapter 3'}
/>
);
<<<<<<< HEAD
<<<<<<< HEAD
case 4:
return (
<ChapterSelectCardBase
disabled={!href}
href={href ?? '/play'}
=======
case 4:
return (
<ChapterSelectCardBase
<<<<<<< HEAD
disabled={true}
href={'/play'}
>>>>>>> dc89605e (ch4 preview (#1006))
=======
disabled={!href}
href={href ?? '/play'}
>>>>>>> cf73c37e (more intuitive campaign button)
id='chapter4'
levelData={'65G9F0G5\nGBJ5GH5I\n50FF25DG\nJ5I5H505'}
subtitle={'Coming soon...'}
title={'Chapter 4'}
/>
);
<<<<<<< HEAD
=======
>>>>>>> c883f344 (`/home` tweaks (#1001))
=======
>>>>>>> dc89605e (ch4 preview (#1006))
default:
return null;
}
Expand Down
33 changes: 33 additions & 0 deletions components/formatted/formattedUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,40 @@ export default function FormattedUser({ className, id, noLinks, noTooltip, onCli

return (<>
<div
<<<<<<< HEAD
<<<<<<< HEAD
className={classNames('flex items-center gap-2 truncate w-fit max-w-full', className)}
=======
className='flex items-center gap-2 truncate w-fit'
data-tooltip-html={renderToStaticMarkup(
<div className='flex flex-col gap-0.5 p-1 items-start text-sm'>
{!userExtendedData ? <LoadingSpinner /> : <>
<span className='font-bold text-base'>{userExtendedData.user.name}</span>
{!userExtendedData.user.ts ? <span>Unregistered</span> : <>
<div className='flex gap-1'>
<span className='font-medium'>Rank:</span>
<PlayerRank
levelsSolvedByDifficulty={userExtendedData.levelsSolvedByDifficulty}
user={user}
/>
</div>
<div className='flex gap-1'>
<span className='font-medium'>Levels Solved:</span>
<span className='gray'>{userExtendedData.user.score}</span>
</div>
<div className='flex gap-1'>
<span className='font-medium'>Registered:</span>
<FormattedDate ts={userExtendedData.user.ts} />
</div>
</>}
</>}
</div>
)}
data-tooltip-id={tooltipId}
>>>>>>> 7fe3d9c4 (solved and completed terminology (#994))
=======
className={classNames('flex items-center gap-2 truncate w-fit max-w-full', className)}
>>>>>>> c883f344 (`/home` tweaks (#1001))
onMouseOut={() => {
if (setTimer.current) {
clearTimeout(setTimer.current);
Expand Down
70 changes: 70 additions & 0 deletions components/homepage/homeLoggedIn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,29 @@ export default function HomeLoggedIn({
}
<div className='flex flex-col gap-4 m-4 items-center'>
<div className='flex flex-col md:flex-row justify-center items-center flex-wrap gap-4 max-w-full'>
<<<<<<< HEAD
<<<<<<< HEAD
<Card id='campaign' title='Pathology Official Campaign'>
<div className='p-3'>
<ChapterSelectCard chapter={user.chapterUnlocked ?? 1} href='/play' />
=======
<Card
id='campaign'
title={
<Link className='font-bold hover:underline' href='/play'>
Pathology Official Campaign
</Link>
}
tooltip='Click here to go to the chapter select screen, or continue with the chapter button below!'
>
<div className='p-3'>
<ChapterSelectCard chapter={user.chapterUnlocked ?? 1} />
>>>>>>> c883f344 (`/home` tweaks (#1001))
=======
<Card id='campaign' title='Pathology Official Campaign'>
<div className='p-3'>
<ChapterSelectCard chapter={user.chapterUnlocked ?? 1} href='/play' />
>>>>>>> cf73c37e (more intuitive campaign button)
</div>
</Card>
<div className='flex flex-col items-center md:items-start gap-2 max-w-full'>
Expand Down Expand Up @@ -107,23 +127,59 @@ export default function HomeLoggedIn({
</div>
</div>
<div className='flex flex-wrap justify-center m-4 gap-4'>
<<<<<<< HEAD
<<<<<<< HEAD
<RecommendedLevel
id='level-of-day'
level={levelOfDay}
title='Level of the Day'
=======
<RecommendedLevel
id='level-of-day'
level={levelOfDay}
<<<<<<< HEAD
title='Level of the Day 🗓️'
>>>>>>> 8ac2e750 (Playhistory (#988))
=======
title='Level of the Day'
>>>>>>> c883f344 (`/home` tweaks (#1001))
tooltip={'Every day there is a new level of the day. Difficulty increases throughout the week!'}
/>
<RecommendedLevel
id='recommended-level'
level={recommendedLevel}
<<<<<<< HEAD
<<<<<<< HEAD
title='Try this Level'
tooltip={'This is a quality level with similar difficulty to levels you\'ve played recently.'}
/>
=======
title='Try this Level 🫴'
tooltip={'This is a quality level with similar difficulty to levels you\'ve played recently.'}
/>
{/* <RecommendedLevel id='recommended-unattempted-level' level={recommendedUnattemptedLevel} title='Unexplored' /> */}
>>>>>>> 8ac2e750 (Playhistory (#988))
=======
title='Try this Level'
tooltip={'This is a quality level with similar difficulty to levels you\'ve played recently.'}
/>
>>>>>>> c883f344 (`/home` tweaks (#1001))
<RecommendedLevel
id='last-level-played'
level={lastLevelPlayed}
title={
<div className='flex items-center gap-2'>
<<<<<<< HEAD
<<<<<<< HEAD
=======
<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor' className='bi bi-clock-history' viewBox='0 0 16 16'>
<path d='M8.515 1.019A7 7 0 0 0 8 1V0a8 8 0 0 1 .589.022l-.074.997zm2.004.45a7.003 7.003 0 0 0-.985-.299l.219-.976c.383.086.76.2 1.126.342l-.36.933zm1.37.71a7.01 7.01 0 0 0-.439-.27l.493-.87a8.025 8.025 0 0 1 .979.654l-.615.789a6.996 6.996 0 0 0-.418-.302zm1.834 1.79a6.99 6.99 0 0 0-.653-.796l.724-.69c.27.285.52.59.747.91l-.818.576zm.744 1.352a7.08 7.08 0 0 0-.214-.468l.893-.45a7.976 7.976 0 0 1 .45 1.088l-.95.313a7.023 7.023 0 0 0-.179-.483zm.53 2.507a6.991 6.991 0 0 0-.1-1.025l.985-.17c.067.386.106.778.116 1.17l-1 .025zm-.131 1.538c.033-.17.06-.339.081-.51l.993.123a7.957 7.957 0 0 1-.23 1.155l-.964-.267c.046-.165.086-.332.12-.501zm-.952 2.379c.184-.29.346-.594.486-.908l.914.405c-.16.36-.345.706-.555 1.038l-.845-.535zm-.964 1.205c.122-.122.239-.248.35-.378l.758.653a8.073 8.073 0 0 1-.401.432l-.707-.707z' />
<path d='M8 1a7 7 0 1 0 4.95 11.95l.707.707A8.001 8.001 0 1 1 8 0v1z' />
<path d='M7.5 3a.5.5 0 0 1 .5.5v5.21l3.248 1.856a.5.5 0 0 1-.496.868l-3.5-2A.5.5 0 0 1 7 9V3.5a.5.5 0 0 1 .5-.5z' />
</svg>
>>>>>>> 8ac2e750 (Playhistory (#988))
=======
>>>>>>> c883f344 (`/home` tweaks (#1001))
<Link className='font-bold hover:underline' href='/play-history'>
Last Played
</Link>
Expand All @@ -133,7 +189,21 @@ export default function HomeLoggedIn({
</div>
}
tooltip='Resume your last play. Click to see your play history.'
<<<<<<< HEAD
/>
=======
<RecommendedLevel id='level-of-day' level={levelOfDay} title='Level of the Day 🗓️'
tooltip={'Every day, there is a new level of the day. Difficulty increases throughout the week!'} />
<RecommendedLevel id='recommended-level' level={recommendedLevel} title='Try this Level 🫴'
tooltip={'This is a quality level close to your skill level that you have not completed yet.'}
/>

{/* extra check to hide the level if it is already completed (in case of corrupted playattempt data) */}
{lastLevelPlayed && lastLevelPlayed.leastMoves !== lastLevelPlayed.userMoves && <RecommendedLevel id='last-level-played' level={lastLevelPlayed} title='Continue Playing ↪' tooltip='Resume your last play. Click to see your play history.' />}
>>>>>>> 7060c231 (homepage tweaks)
=======
/>
>>>>>>> 8ac2e750 (Playhistory (#988))
</div>
<div className='flex justify-center m-6'>
<div className='max-w-xs space-y-2 md:space-y-0 md:space-x-4 flex flex-col md:flex-row rounded-md justify-center'>
Expand Down
39 changes: 39 additions & 0 deletions components/homepage/recommendedLevel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,56 @@ import LoadingCard from '../cards/loadingCard';
import SelectCard from '../cards/selectCard';

interface RecommendedLevelProps {
<<<<<<< HEAD
<<<<<<< HEAD
hrefOverride?: string;
=======
>>>>>>> c883f344 (`/home` tweaks (#1001))
id: string;
level?: EnrichedLevel | null;
<<<<<<< HEAD
onClick?: (option: SelectOption) => void;
=======
>>>>>>> 7060c231 (homepage tweaks)
=======
hrefOverride?: string;
id: string;
level?: EnrichedLevel | null;
onClick?: (option: SelectOption) => void;
>>>>>>> 58800b84 (post level modal and tooltips (#1000))
title: JSX.Element | string;
tooltip?: string;
}

<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> 58800b84 (post level modal and tooltips (#1000))
export default function RecommendedLevel({ hrefOverride, id, level, onClick, title, tooltip }: RecommendedLevelProps): JSX.Element {
return (
<Card id={id} title={title} tooltip={tooltip}>
=======
export default function RecommendedLevel({ id, level, title, tooltip }: RecommendedLevelProps): JSX.Element {
return (
<<<<<<< HEAD
<div className='flex flex-col justify-center rounded-lg border'
id={id}
style={{
backgroundColor: 'var(--bg-color-2)',
borderColor: 'var(--bg-color-3)',
}}
>
<h2 className='self-center px-4 pt-3 text-lg font-bold' data-tooltip-id={tooltipId} data-tooltip-content={tooltip}>
{title}
</h2>
<<<<<<< HEAD
>>>>>>> 7060c231 (homepage tweaks)
=======
<StyledTooltip id={tooltipId} />
>>>>>>> 8ac2e750 (Playhistory (#988))
=======
<Card id={id} title={title} tooltip={tooltip}>
>>>>>>> c883f344 (`/home` tweaks (#1001))
{level === undefined ? <LoadingCard /> :
!level ?
<SelectCard
Expand Down
Loading

0 comments on commit e23cf72

Please sign in to comment.