Skip to content

Commit b1a715c

Browse files
[64] add a main menu button to the motion generator
1 parent fd566f2 commit b1a715c

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/components/MotionGenerator.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import { useRouter } from "next/navigation";
1010
import { MotionDisplay } from "./MotionDisplay";
1111
import { MotionsFilter } from "./MotionsFilter";
1212
import { useLang } from "@/lib/useLang";
13+
import { LinkButton } from "./LinkButton";
14+
import { IconPlayCircle } from "./icons/PlayCircle";
15+
import { IconList } from "./icons/List";
1316

1417
const MotionGenerator = () => {
1518
const [motion, setMotion] = useState<motion | null>(null);
@@ -18,7 +21,10 @@ const MotionGenerator = () => {
1821

1922
function generateMotion(): motion {
2023
const filteredMotions = motions.filter((motion) => {
21-
return motion.type && enabledMotionTypes.includes(motion.type as motionTypeCode);
24+
return (
25+
motion.type &&
26+
enabledMotionTypes.includes(motion.type as motionTypeCode)
27+
);
2228
});
2329
return filteredMotions[Math.floor(Math.random() * filteredMotions.length)];
2430
}
@@ -30,9 +36,9 @@ const MotionGenerator = () => {
3036
});
3137
}
3238

33-
const [enabledMotionTypes, setEnabledMotionTypes] = useState<motionTypeCode[]>([
34-
...motionTypesArray,
35-
]);
39+
const [enabledMotionTypes, setEnabledMotionTypes] = useState<
40+
motionTypeCode[]
41+
>([...motionTypesArray]);
3642

3743
/** Calls {@link generateMotion()} on page load. */
3844
useEffect(() => {
@@ -61,6 +67,7 @@ const MotionGenerator = () => {
6167
router.push("/oxford-debate/setup");
6268
}}
6369
/>
70+
<LinkButton href="/" text={useLang("mainMenu")} icon={IconList} />
6471
</section>
6572
<hr className="border-b-2 mt-8 mb-8 rounded border-neutral-800 my-2 w-full" />
6673
<section className="flex flex-col xl:flex-row items-center">
@@ -79,8 +86,10 @@ const MotionGenerator = () => {
7986
router.push("/oxford-debate/setup");
8087
}}
8188
/>
89+
<LinkButton href="/" text={useLang("mainMenu")} icon={IconList} />
8290
</section>
8391
<MotionDisplay motion={motion} />
92+
<div className="flex flex-row flex-wrap justify-center gap-2"></div>
8493
</section>
8594
</div>
8695
);

0 commit comments

Comments
 (0)