This commit is contained in:
Luke Vella 2024-02-17 13:10:38 +08:00
parent 00df1a2e40
commit 283a073201
4 changed files with 49 additions and 23 deletions

View file

@ -41,6 +41,7 @@ import {
InviteCardForm, InviteCardForm,
InviteCardGeneral, InviteCardGeneral,
} from "@/app/[locale]/(admin)/create/invite-card"; } from "@/app/[locale]/(admin)/create/invite-card";
import { VoteSelect } from "@/app/[locale]/(admin)/create/vote-select";
import { import {
PageContainer, PageContainer,
PageContent, PageContent,
@ -299,20 +300,13 @@ function Poll({
<div className="grid grow gap-2"> <div className="grid grow gap-2">
{options.map((option, i) => ( {options.map((option, i) => (
<div <div
className="flex items-center gap-x-4 rounded-md border bg-white px-4 py-3" className="flex items-center gap-x-4 rounded-md border px-3 py-2"
key={i} key={i}
> >
<Checkbox id={`option${i}`} name={`option${i}`} />
<label className="grow font-medium" htmlFor={`option${i}`}> <label className="grow font-medium" htmlFor={`option${i}`}>
{dayjs(option.start).format("DD MMM YYYY")} {dayjs(option.start).format("DD MMM YYYY")}
</label> </label>
<DropdownMenu> <VoteSelect id={`option${i}`} name={`option${i}`} />
<DropdownMenuTrigger asChild>
<Button variant="ghost" size="sm">
<MoreHorizontalIcon className="text-muted-foreground size-4" />
</Button>
</DropdownMenuTrigger>
</DropdownMenu>
</div> </div>
))} ))}
</div> </div>
@ -346,7 +340,7 @@ function CreateFormInput() {
}} }}
value={searchParams?.get("tab") ?? "event"} value={searchParams?.get("tab") ?? "event"}
> >
{/* <div className="p-4"> <div className="mb-4">
<TabsList className="w-full"> <TabsList className="w-full">
<TabsTrigger <TabsTrigger
value="event" value="event"
@ -362,7 +356,7 @@ function CreateFormInput() {
Form Form
</TabsTrigger> </TabsTrigger>
</TabsList> </TabsList>
</div> */} </div>
<TabsContent value="event"> <TabsContent value="event">
<GeneralForm /> <GeneralForm />
</TabsContent> </TabsContent>
@ -395,7 +389,6 @@ function CreateFormPreview() {
}} }}
> >
<div className="text-muted-foreground">Step 1 of 2</div> <div className="text-muted-foreground">Step 1 of 2</div>
{form.watch("form.type") === "poll" && (
<Poll <Poll
prompt={ prompt={
form.watch("form.poll.prompt") || form.watch("form.poll.prompt") ||
@ -405,7 +398,6 @@ function CreateFormPreview() {
} }
options={form.watch("form.poll.options", [])} options={form.watch("form.poll.options", [])}
/> />
)}
</div> </div>
</InviteCardForm> </InviteCardForm>
</InviteCard> </InviteCard>

View file

@ -0,0 +1,33 @@
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "@rallly/ui/dropdown-menu";
import {
CheckCircle2Icon,
ChevronDown,
CircleIcon,
XCircleIcon,
} from "lucide-react";
export function VoteSelect() {
return (
<DropdownMenu>
<DropdownMenuTrigger className="flex h-7 items-center gap-x-2 rounded-md px-2.5">
<CircleIcon className="text-muted-foreground size-4" />
<ChevronDown className="text-muted-foreground size-4" />
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuItem className="gap-x-2">
<CheckCircle2Icon className="text-muted-foreground size-4" />
<span>Yes</span>
</DropdownMenuItem>
<DropdownMenuItem className="gap-x-2">
<XCircleIcon className="text-muted-foreground size-4" />
<span>No</span>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
);
}

View file

@ -5,7 +5,7 @@ export function PageContainer({
children, children,
className, className,
}: React.PropsWithChildren<{ className?: string }>) { }: React.PropsWithChildren<{ className?: string }>) {
return <div className={cn("h-screen", className)}>{children}</div>; return <div className={cn("min-h-screen", className)}>{children}</div>;
} }
export function PageTitle({ export function PageTitle({

View file

@ -211,6 +211,7 @@ model SchedulingPoll {
userId String @map("user_id") userId String @map("user_id")
user User @relation(fields: [userId], references: [id]) user User @relation(fields: [userId], references: [id])
prompt String? prompt String?
draft Boolean @default(true)
createdAt DateTime @default(now()) @map("created_at") createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at") updatedAt DateTime @updatedAt @map("updated_at")
eventTitle String @map("event_title") eventTitle String @map("event_title")