Skip to content

Commit

Permalink
fix dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
Anchel123 committed Jan 8, 2025
1 parent cd44bcf commit cc959bf
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/components/CreateGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

"use client"

import { Dispatch, SetStateAction, useState } from "react"
import { useState } from "react"
import { AlertCircle, PlusCircle } from "lucide-react"
import { prepareArg, securedFetch } from "@/lib/utils"
import { useToast } from "@/components/ui/use-toast"
Expand All @@ -12,7 +12,7 @@ import CloseDialog from "./CloseDialog"
import Input from "./ui/Input"

interface Props {
onSetGraphName: Dispatch<SetStateAction<string>>
onSetGraphName: (name: string) => void
type: string
trigger?: React.ReactNode
}
Expand Down
15 changes: 13 additions & 2 deletions app/graph/Tutorial.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from "@/components/ui/carousel";
import { Drawer, DrawerContent } from "@/components/ui/drawer";
import { Drawer, DrawerContent, DrawerHeader, DrawerTitle } from "@/components/ui/drawer";
import { Dispatch, SetStateAction, useEffect, useState } from "react";
import Link from 'next/link'
import { Checkbox } from "@/components/ui/checkbox";
import { VisuallyHidden } from "@radix-ui/react-visually-hidden";
import CreateGraph from "../components/CreateGraph";

interface Props {
Expand All @@ -18,6 +19,11 @@ export default function Tutorial({ onSetGraphName }: Props) {
setOpen(localStorage.getItem("tutorial") !== "false")
}, [])

const handleSetGraphName = (name: string) => {
onSetGraphName(name)
setOpen(false)
}

return (
<Drawer open={open} onOpenChange={(o) => {
if (showAgain) {
Expand All @@ -26,6 +32,11 @@ export default function Tutorial({ onSetGraphName }: Props) {
setOpen(o)
}}>
<DrawerContent className="flex flex-col">
<VisuallyHidden>
<DrawerHeader>
<DrawerTitle/>
</DrawerHeader>
</VisuallyHidden>
<div className="flex justify-center items-center p-8">
<Carousel className="w-1/2 h-1/2">
<CarouselContent>
Expand All @@ -40,7 +51,7 @@ export default function Tutorial({ onSetGraphName }: Props) {
</CarouselItem>
<CarouselItem className="border flex flex-col gap-4 justify-center items-center">
<CreateGraph
onSetGraphName={onSetGraphName}
onSetGraphName={handleSetGraphName}
type="Graph"
/>
<p>
Expand Down
9 changes: 6 additions & 3 deletions app/settings/users/AddUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { CreateUser } from "@/app/api/user/model";
import Button from "@/app/components/ui/Button";
import FormComponent, { Error, Field } from "@/app/components/FormComponent";
import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetTrigger } from "@/components/ui/sheet";
import { VisuallyHidden } from "@radix-ui/react-visually-hidden";

export default function AddUser({ onAddUser }: {
onAddUser: (user: CreateUser) => void
Expand Down Expand Up @@ -94,9 +95,11 @@ export default function AddUser({ onAddUser }: {
</Button>
</SheetTrigger>
<SheetContent className="flex flex-col gap-6">
<SheetHeader>
<SheetTitle className="text-2xl text-white">Add User</SheetTitle>
</SheetHeader>
<VisuallyHidden>
<SheetHeader>
<SheetTitle />
</SheetHeader>
</VisuallyHidden>
<FormComponent
handleSubmit={handleAddUser}
fields={fields}
Expand Down
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"@radix-ui/react-tabs": "^1.1.2",
"@radix-ui/react-toast": "^1.2.4",
"@radix-ui/react-tooltip": "^1.0.7",
"@radix-ui/react-visually-hidden": "^1.1.1",
"autoprefixer": "^10.4.20",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
Expand Down

0 comments on commit cc959bf

Please sign in to comment.