Skip to content

Commit

Permalink
Merge pull request #13 from Nervonment/v0.3.x
Browse files Browse the repository at this point in the history
v0.3.3
  • Loading branch information
Nervonment authored Jun 19, 2024
2 parents 388217a + 59d0c92 commit 7d079a9
Show file tree
Hide file tree
Showing 19 changed files with 541 additions and 288 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"editor.tabSize": 2
}
Binary file added app/fonts/HarmonyOS_Sans_SC_Bold.ttf
Binary file not shown.
Binary file added app/fonts/HarmonyOS_Sans_SC_Regular.ttf
Binary file not shown.
18 changes: 14 additions & 4 deletions app/layout.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,36 @@
import localFont from "next/font/local";
import { Inter } from "next/font/google";
import "./globals.css";
import { cn } from "@/lib/utils";
import { ThemeProvider } from "@/components/theme-provider";
import SettingsProvider from "@/components/SettingsProvider";

const inter = Inter({ subsets: ["latin"] });

const harmonyOSSans = localFont({
src: './fonts/HarmonyOS_Sans_SC_Regular.ttf',
display: 'swap'
});

export const metadata = {
title: "Create Next App",
description: "Generated by create next app",
title: "Sudoxide",
description: "",
};

export default function RootLayout({ children }) {

return (
<html lang="en">
<body className={cn(inter.className)}>
<body className={cn(inter.className, harmonyOSSans)}>
<ThemeProvider
attribute="class"
defaultTheme="system"
enableSystem
disableTransitionOnChange
>
{children}
<SettingsProvider>
{children}
</SettingsProvider>
</ThemeProvider>
</body>
</html>
Expand Down
22 changes: 9 additions & 13 deletions app/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,30 @@ import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover
import { Separator } from "@/components/ui/separator";
import { Slider } from "@/components/ui/slider";
import { Switch } from "@/components/ui/switch";
import { SettingsContext } from "@/lib/SettingsContext";
import useSettings from "@/lib/useSettings";
import { cn, difficultyDesc } from "@/lib/utils";
import { getVersion } from "@tauri-apps/api/app";
import { invoke } from "@tauri-apps/api/tauri";
import { checkUpdate, installUpdate } from "@tauri-apps/api/updater";
import { ChevronDown, HelpCircle, Loader2, Settings2 } from "lucide-react";
import { useTheme } from "next-themes";
import { Poppins } from "next/font/google";
import Link from "next/link";
import { useEffect, useState } from "react";
import { useContext, useEffect, useState } from "react";

export default function Home() {
const [difficulty, setDifficulty] = useState(2);
const [markingAssist, setMarkingAssist] = useState(false);
const [beginWithMarks, setBeginWithMarks] = useState(false);
const {
difficulty, setDifficulty,
markingAssist, setMarkingAssist,
beginWithMarks, setBeginWithMarks
} = useContext(SettingsContext);

const [appVersion, setAppversion] = useState("");
const [updateDialogOpen, setUpdateDialogOpen] = useState(false);
const [updateManifest, setUpdateManifest] = useState({});
const [updating, setUpdating] = useState(false);
const [updateFailed, setUpdateFailed] = useState(false);

useEffect(() => {
invoke('get_difficulty').then((difficulty) => setDifficulty(difficulty));
invoke('get_marking_assist').then((markingAssist) => setMarkingAssist(markingAssist));
invoke('get_begin_with_marks').then((beginWithMarks) => setBeginWithMarks(beginWithMarks));
}, []);

useEffect(() => {
getVersion().then(setAppversion);
Expand Down Expand Up @@ -96,7 +95,6 @@ export default function Home() {
defaultValue={[difficulty]}
onValueChange={([value]) => {
setDifficulty(value);
invoke('set_difficulty', { newDifficulty: value });
}}
max={5}
step={1}
Expand All @@ -117,7 +115,6 @@ export default function Home() {
checked={markingAssist}
onCheckedChange={(checked) => {
setMarkingAssist(checked);
invoke('set_marking_assist', { markingAssist: checked });
}}
/>
</div>
Expand All @@ -136,7 +133,6 @@ export default function Home() {
checked={beginWithMarks}
onCheckedChange={(checked) => {
setBeginWithMarks(checked);
invoke('set_begin_with_marks', { beginWithMarks: checked });
}}
/>
</div>
Expand Down
Loading

0 comments on commit 7d079a9

Please sign in to comment.