-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: add version number * feat: basic implementation of settings form * feat: basic templates * feat: polished onboarding experience * chore: remove log * fix: more spacing * chore: version bump * fix: adjusted setting gaps
- Loading branch information
1 parent
e808f86
commit 0a0cb0f
Showing
12 changed files
with
638 additions
and
25 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 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
Empty file.
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,98 @@ | ||
"use client"; | ||
import { usePreferences } from "@/components/preferences-provider"; | ||
import { SettingsFormForOnboarding } from "@/components/settings-modal"; | ||
import { TemplateSelector } from "@/components/template-selector"; | ||
import { | ||
Card, | ||
CardContent, | ||
CardDescription, | ||
CardHeader, | ||
CardTitle, | ||
} from "@/components/ui/card"; | ||
import { Highlight } from "@/components/ui/card-stack"; | ||
import { useDevice } from "@/lib/hooks/useMediaQuery"; | ||
import { PreferencesTranslations } from "@/lib/translationObjects"; | ||
import { cn } from "@/lib/utils"; | ||
import { motion } from "framer-motion"; | ||
import useTranslation from "next-translate/useTranslation"; | ||
import { useState } from "react"; | ||
|
||
export function Onboarding() { | ||
const { t } = useTranslation("common"); | ||
const preferences = usePreferences(); | ||
const { isMobile, isTablet, isDesktop } = useDevice(); | ||
|
||
const preferencesTranslations: PreferencesTranslations = { | ||
title: t("preferences.title"), | ||
description: t("preferences.description"), | ||
gradeDecimals: t("preferences.grade-decimals"), | ||
gradeDecimalsDescription: t("preferences.grade-decimals-description"), | ||
gradeDecimalsPlaceholder: t("preferences.grade-decimals-placeholder"), | ||
keepModalsOpen: t("preferences.keep-modals-open"), | ||
keepModalsOpenDescription: t("preferences.keep-modals-open-description"), | ||
passingGrade: t("preferences.passing-grade"), | ||
passingGradeDescription: t("preferences.passing-grade-description"), | ||
passingGradePlaceholder: t("preferences.passing-grade-placeholder"), | ||
minimumGrade: t("preferences.minimum-grade"), | ||
minimumGradeDescription: t("preferences.minimum-grade-description"), | ||
minimumGradePlaceholder: t("preferences.minimum-grade-placeholder"), | ||
maximumGrade: t("preferences.maximum-grade"), | ||
maximumGradeDescription: t("preferences.maximum-grade-description"), | ||
maximumGradePlaceholder: t("preferences.maximum-grade-placeholder"), | ||
passingInverse: t("preferences.passing-inverse"), | ||
passingInverseDescription: t("preferences.passing-inverse-description"), | ||
alertTitle: t("preferences.alert-title"), | ||
alertDescription: t("preferences.alert-description"), | ||
}; | ||
|
||
const [selectedTemplate, setSelectedTemplate] = useState<string>(); | ||
|
||
if (preferences.isDefault) | ||
return ( | ||
<div className="fixed inset-0 flex flex-col items-center justify-start bg-background z-50 pt-8 overflow-scroll"> | ||
<div className="items-center gap-8 flex flex-col"> | ||
<h1 className="text-4xl font-bold tracking-tight text-white-900 sm:text-6xl"> | ||
<span className="text-muted-foreground">Grades</span> | ||
<br /> | ||
Onboarding | ||
</h1> | ||
</div> | ||
<div | ||
className={cn( | ||
"pt-12 flex items-start", | ||
selectedTemplate && "gap-x-20 gap-y-12", | ||
isMobile ? "flex-col" : "flex-row" | ||
)} | ||
> | ||
<TemplateSelector setSelectedTemplate={setSelectedTemplate} /> | ||
<motion.div | ||
layout | ||
transition={{ | ||
type: "spring", | ||
stiffness: 260, | ||
damping: 20, | ||
}} | ||
> | ||
{selectedTemplate && ( | ||
<Card className={cn(isMobile ? "max-w-80" : "max-w-md")}> | ||
<CardHeader> | ||
<CardTitle>Advanced Settings</CardTitle> | ||
<CardDescription> | ||
Hit <Highlight>Save</Highlight> to apply your changes and | ||
complete the onboarding. | ||
<br /> You can change this in the settings at any time. | ||
</CardDescription> | ||
</CardHeader> | ||
<CardContent> | ||
<SettingsFormForOnboarding | ||
selectedTemplate={selectedTemplate || "percentage"} | ||
translations={preferencesTranslations} | ||
/> | ||
</CardContent> | ||
</Card> | ||
)} | ||
</motion.div> | ||
</div> | ||
</div> | ||
); | ||
} |
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
Oops, something went wrong.