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,
InviteCardGeneral,
} from "@/app/[locale]/(admin)/create/invite-card";
import { VoteSelect } from "@/app/[locale]/(admin)/create/vote-select";
import {
PageContainer,
PageContent,
@ -299,20 +300,13 @@ function Poll({
<div className="grid grow gap-2">
{options.map((option, i) => (
<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}
>
<Checkbox id={`option${i}`} name={`option${i}`} />
<label className="grow font-medium" htmlFor={`option${i}`}>
{dayjs(option.start).format("DD MMM YYYY")}
</label>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="ghost" size="sm">
<MoreHorizontalIcon className="text-muted-foreground size-4" />
</Button>
</DropdownMenuTrigger>
</DropdownMenu>
<VoteSelect id={`option${i}`} name={`option${i}`} />
</div>
))}
</div>
@ -346,7 +340,7 @@ function CreateFormInput() {
}}
value={searchParams?.get("tab") ?? "event"}
>
{/* <div className="p-4">
<div className="mb-4">
<TabsList className="w-full">
<TabsTrigger
value="event"
@ -362,7 +356,7 @@ function CreateFormInput() {
Form
</TabsTrigger>
</TabsList>
</div> */}
</div>
<TabsContent value="event">
<GeneralForm />
</TabsContent>
@ -395,17 +389,15 @@ function CreateFormPreview() {
}}
>
<div className="text-muted-foreground">Step 1 of 2</div>
{form.watch("form.type") === "poll" && (
<Poll
prompt={
form.watch("form.poll.prompt") ||
t("pollPromptPlaceholder", {
defaultValue: "Select as many dates as you can attend",
})
}
options={form.watch("form.poll.options", [])}
/>
)}
<Poll
prompt={
form.watch("form.poll.prompt") ||
t("pollPromptPlaceholder", {
defaultValue: "Select as many dates as you can attend",
})
}
options={form.watch("form.poll.options", [])}
/>
</div>
</InviteCardForm>
</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,
className,
}: 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({

View file

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