Skip to content

Commit

Permalink
more intuitive campaign button
Browse files Browse the repository at this point in the history
  • Loading branch information
sspenst committed Sep 30, 2023
1 parent f1dd274 commit cf73c37
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
13 changes: 7 additions & 6 deletions components/cards/chapterSelectCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,16 @@ function ChapterSelectCardBase({
interface ChapterSelectCardProps {
chapter: number;
chapterUnlocked?: number;
href?: string;
}

export default function ChapterSelectCard({ chapter, chapterUnlocked }: ChapterSelectCardProps) {
export default function ChapterSelectCard({ chapter, chapterUnlocked, href }: ChapterSelectCardProps) {
switch (chapter) {
case 1:
return (
<ChapterSelectCardBase
complete={!!chapterUnlocked && chapterUnlocked > 1}
href={'/chapter1'}
href={href ?? '/chapter1'}
id='chapter1'
levelData={'00000000\n00000000\n00000000\n00000000'}
subtitle={'Grassroots'}
Expand All @@ -98,7 +99,7 @@ export default function ChapterSelectCard({ chapter, chapterUnlocked }: ChapterS
complete={!!chapterUnlocked && chapterUnlocked > 2}
disabled={chapterUnlocked ? chapterUnlocked < 2 : false}
disabledStr={'Complete Chapter 1 to unlock Chapter 2!'}
href={'/chapter2'}
href={href ?? '/chapter2'}
id='chapter2'
levelData={'005E0C00\n0G070005\n10005010\n005100I0'}
subtitle={'Into the Depths'}
Expand All @@ -111,7 +112,7 @@ export default function ChapterSelectCard({ chapter, chapterUnlocked }: ChapterS
complete={!!chapterUnlocked && chapterUnlocked > 3}
disabled={chapterUnlocked ? chapterUnlocked < 3 : false}
disabledStr={'Complete Chapter 2 to unlock Chapter 3!'}
href={'/chapter3'}
href={href ?? '/chapter3'}
id='chapter3'
levelData={'B519F0G0\n10JH5H52\n75F02J08\n02050B10'}
subtitle={'Brain Busters'}
Expand All @@ -121,8 +122,8 @@ export default function ChapterSelectCard({ chapter, chapterUnlocked }: ChapterS
case 4:
return (
<ChapterSelectCardBase
disabled={true}
href={'/play'}
disabled={!href}
href={href ?? '/play'}
id='chapter4'
levelData={'65G9F0G5\nGBJ5GH5I\n50FF25DG\nJ5I5H505'}
subtitle={'Coming soon...'}
Expand Down
12 changes: 2 additions & 10 deletions components/homepage/homeLoggedIn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,9 @@ 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'>
<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!'
>
<Card id='campaign' title='Pathology Official Campaign'>
<div className='p-3'>
<ChapterSelectCard chapter={user.chapterUnlocked ?? 1} />
<ChapterSelectCard chapter={user.chapterUnlocked ?? 1} href='/play' />
</div>
</Card>
<div className='flex flex-col items-center md:items-start gap-2 max-w-full'>
Expand Down

0 comments on commit cf73c37

Please sign in to comment.