Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add floating mobile menu #58

Merged
merged 2 commits into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: fix reload bug
Change form element to div
  • Loading branch information
zsh-eng committed Apr 21, 2024
commit 16c2914ac548a9cb98da47a331f380719ed19558
10 changes: 3 additions & 7 deletions src/components/flashcard/flashcard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
AlertDialogTrigger,
} from "@/components/ui/alert-dialog";
import { buttonVariants } from "@/components/ui/button";
import { UiCard } from "@/components/ui/card";
import {
Dialog,
DialogContent,
Expand All @@ -38,7 +37,7 @@ import { cn } from "@/utils/ui";
import { zodResolver } from "@hookform/resolvers/zod";
import _ from "lodash";
import { FilePenIcon, Info, Telescope, TrashIcon } from "lucide-react";
import { useEffect, useRef, useState } from "react";
import { useRef, useState } from "react";
import { useForm } from "react-hook-form";

type Props = {
Expand Down Expand Up @@ -174,10 +173,7 @@ export default function Flashcard({
</div>

<Form {...form}>
<form
action=""
className="col-span-8 grid grid-cols-8 place-items-end gap-x-4 gap-y-4 sm:grid-rows-[2fr_1fr]"
>
<div className="col-span-8 grid grid-cols-8 place-items-end gap-x-4 gap-y-4 sm:grid-rows-[2fr_1fr]">
<div
className={cn(
"col-span-8 flex h-full min-h-80 w-full items-center overflow-y-auto border border-input sm:col-span-4 sm:min-h-96",
Expand Down Expand Up @@ -229,7 +225,7 @@ export default function Flashcard({
setOpen={setOpen}
/>
</div>
</form>
</div>
</Form>
</div>
);
Expand Down
2 changes: 2 additions & 0 deletions src/hooks/card/use-grade-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export function useGradeCard(options?: GradeMutationOptions): GradeMutation {
},

async onSuccess() {
await utils.card.sessionData.cancel();
const sessionData = utils.card.sessionData.getData();
// Refetch periodically to get more cards
// We don't use infinite queries here because there is no pagination
Expand All @@ -43,6 +44,7 @@ export function useGradeCard(options?: GradeMutationOptions): GradeMutation {
)
return;

console.log("Invalidated");
await utils.card.sessionData.invalidate();
},

Expand Down