-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip: remove unused components and restructure question handling in th…
…e store, introduced mockup guide
- Loading branch information
Showing
8 changed files
with
64 additions
and
77 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,29 @@ | ||
"use client"; | ||
|
||
import { useQuestionsStore } from "../../providers/storeProvider"; | ||
|
||
export default function Page() { | ||
const guideNumber = useQuestionsStore((state) => state.guideNumber); | ||
const guideContent = useQuestionsStore((state) => state.guideContent); | ||
const prevGuide = useQuestionsStore((state) => state.prevGuide); | ||
const nextGuide = useQuestionsStore((state) => state.nextGuide); | ||
return ( | ||
<main className="flex min-h-screen flex-col items-center p-24"> | ||
<div className="bg-red-200"> | ||
<h2>Collection</h2> | ||
{guideContent?.map((guide: string, index) => { | ||
if (guideNumber === index + 1) { | ||
return ( | ||
<div key={index} className="m-4 bg-red-400"> | ||
<span>{guide}</span> | ||
</div> | ||
); | ||
} | ||
})} | ||
</div> | ||
|
||
<button onClick={nextGuide}>Skip question</button> | ||
<button onClick={prevGuide}>Prev question</button> | ||
</main> | ||
); | ||
} |
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,19 @@ | ||
// use middleware for redirection | ||
"use client"; | ||
import { usePathname, useRouter } from "next/navigation"; | ||
import { useEffect } from "react"; | ||
import { useQuestionsStore } from "../providers/storeProvider"; | ||
export default function Page() { | ||
const path = usePathname(); | ||
const router = useRouter(); | ||
const guideNumber = useQuestionsStore((state) => state.guideNumber); | ||
console.log(typeof path); | ||
useEffect(() => { | ||
console.log("Use effect"); | ||
if (path === "/abc/navod") { | ||
router.push(`/abc/navod/${guideNumber}`); | ||
} | ||
}, []); | ||
|
||
return <h1>Redirect to guide</h1>; | ||
} |
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 was deleted.
Oops, something went wrong.