Skip to content

Commit

Permalink
feat: editor id 기반 invtation 정보 불러오기 및 ScrollArea 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
xilucks committed Aug 23, 2024
1 parent 4b20e3d commit 7df6075
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/app/(main)/i/[subdomain]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { notFound } from "next/navigation";
import Recursive from "~/components/editor/elements/recursive";
import FloatingActionButton from "~/components/editor/fab";
import EditorProvider from "~/components/editor/provider";
import { ScrollArea } from "~/components/ui/scroll-area";
import { getInvitationByEventUrl } from "~/lib/db/schema/invitations.query";

type Props = {
Expand Down Expand Up @@ -54,11 +55,11 @@ export default async function Page({ params }: Props) {
editorState={{ isPreviewMode: true }}
>
<main className="relative mx-auto max-w-lg">
<div className={"h-lvh overflow-y-auto"}>
<ScrollArea className={"h-lvh overflow-y-auto"}>
{invitation.customFields.elements.map((childElement) => (
<Recursive key={childElement.id} element={childElement} />
))}
</div>
</ScrollArea>
<FloatingActionButton />
</main>
</EditorProvider>
Expand Down
7 changes: 5 additions & 2 deletions src/components/editor/fab/invitation-response-fab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ import { Drawer } from "vaul";
import AttendanceFalseDefault from "~/assets/attendance/attendance-false-default.svg";
import AttendanceTrueDefault from "~/assets/attendance/attendance-true-default.svg";
import ImageRadio from "~/components/editor/fab/image-radio";
import { useEditor } from "~/components/editor/provider";
import { Button } from "~/components/ui/button";
import { Input } from "~/components/ui/input";
import { Label } from "~/components/ui/label";
import { SheetHeader, SheetTitle } from "~/components/ui/sheet";
import { createInvitationResponses } from "~/lib/db/schema/invitation_response.query";
import { getInvitationByEventUrl } from "~/lib/db/schema/invitations.query";
import { getInvitationById } from "~/lib/db/schema/invitations.query";

export default function InvitationResponseFab() {
return (
Expand All @@ -38,10 +39,12 @@ function InvitationResponseForm() {
const params = useParams<{ subdomain: string }>();
const [invitationId, setInvitationId] = useState<string>("");

const { editor } = useEditor();

useEffect(() => {
(async () => {
try {
const invitation = await getInvitationByEventUrl(params.subdomain);
const invitation = await getInvitationById(editor.config.invitationId);
return setInvitationId(invitation.id);
} catch (error) {
console.error("Failed to fetch invitation:", error);
Expand Down

0 comments on commit 7df6075

Please sign in to comment.