import NavBar from "../components/NavBar" import {Icon} from "@iconify/react"; import {getLanguage, isLoggedIn, isStepCompleted} from "../logic/sdk"; import React from "react"; import "./Course.sass" import {Step} from "../logic/CourseData"; import {useLocation, useNavigate} from "react-router-dom"; function CourseButton(props: {state: 'active' | 'locked' | 'completed', index: number}) { let cs = 'course-button ' + {active: 'green', locked: 'gray', completed: 'gold'}[props.state]; const icon = {active: 'solar:star-bold', locked: 'solar:lock-bold', completed: 'mingcute:check-fill'}[props.state]; // Parameters for the sin wave const amplitude = 50; // Change this value to adjust the wave's height const frequency = 1; // Change this value to adjust the wave's frequency // Calculate the horizontal translation const translateXValue = amplitude * Math.sin(props.index * frequency); return
} export default function Course() { const location = useLocation(); const navigate = useNavigate(); if (!isLoggedIn()) { window.location.href = '/login'; return
; } // Get language const lang = getLanguage(); function click(step: Step) { navigate('/lesson', {state: {questions: step.questions, home: location.pathname}}) } return (
{lang.name}
1
{lang.data.map((chapter, i) =>
Chapter 1, Section 1
{chapter.name}
{chapter.steps.map((step, i) =>
click(step)}>
)} {[...Array(5)].map((_, i) => )}
)}
) }