Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
.direnv
.wrangler
CLAUDE.local.md
2 changes: 1 addition & 1 deletion client/.env.preview
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
VITE_API_ENDPOINT=https://api.itsuhima-staging.utcode.net
VITE_API_ENDPOINT=/api
VITE_FRONTEND_ORIGIN=https://itsuhima-staging.utcode.net
2 changes: 1 addition & 1 deletion client/.env.production
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
VITE_API_ENDPOINT=https://api.itsuhima.utcode.net
VITE_API_ENDPOINT=/api
VITE_FRONTEND_ORIGIN=https://itsuhima.utcode.net
2 changes: 2 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ dist-ssr
*.local
.env

.wrangler

# Editor directories and files
.vscode/*
!.vscode/extensions.json
Expand Down
26 changes: 26 additions & 0 deletions client/functions/api/[[path]].ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/// <reference types="@cloudflare/workers-types" />

interface Env {
API_ENDPOINT: string;
}

// biome-ignore lint/suspicious/noExplicitAny: This is a Cloudflare Worker context
export async function onRequest(context: EventContext<Env, any, any>): Promise<Response> {
const { request, env } = context;
const url = new URL(request.url);
const backendUrl = env.API_ENDPOINT + url.pathname.replace(/^\/api/, "") + url.search;

const proxied = new Request(backendUrl, {
method: request.method,
headers: request.headers,
body: request.method !== "GET" && request.method !== "HEAD" ? request.body : undefined,
redirect: "manual",
});

const response = await fetch(proxied);
return new Response(response.body, {
status: response.status,
statusText: response.statusText,
headers: response.headers,
});
}
46 changes: 25 additions & 21 deletions client/src/pages/eventId/Submission.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export default function SubmissionPage() {
const myGuestId = meAsGuest?.id;
const isHost = project?.isHost;

const [mode, setMode] = useState<"view" | "edit" | "confirm">("edit");
const [mode, setMode] = useState<"view" | "edit" | "confirm">("view");

const [guestName, setGuestName] = useState(meAsGuest?.name ?? "");

Expand Down Expand Up @@ -275,15 +275,15 @@ export default function SubmissionPage() {

return (
<>
<div className="flex h-[100dvh] flex-col bg-base-200">
<div className="flex h-dvh flex-col bg-base-200">
<Header compact />
{loading ? (
<div className="flex w-full flex-1 items-center justify-center">
<span className="loading loading-dots loading-md text-base-content/40" />
</div>
) : !project ? (
<div className="mx-auto flex w-full max-w-7xl flex-col items-center justify-center gap-4 px-4 py-16 sm:px-6 lg:px-8">
<div className="flex min-h-[400px] w-full flex-col items-center justify-center gap-4 rounded-xl border border-base-300 bg-base-100 p-8 text-center shadow-sm">
<div className="flex min-h-100 w-full flex-col items-center justify-center gap-4 rounded-xl border border-base-300 bg-base-100 p-8 text-center shadow-sm">
<p className="text-base-content/70 text-xl">イベントが見つかりませんでした。</p>
<NavLink to="/" className="btn btn-primary">
ホームに戻る
Expand Down Expand Up @@ -414,7 +414,7 @@ export default function SubmissionPage() {
<p className="pt-1 font-medium text-base-content text-sm">{guest.name}</p>
{commentText && (
<div className="mt-1.5 w-fit max-w-full rounded-2xl rounded-tl-none bg-base-300 px-3 py-2 text-base-content text-sm">
<span className="whitespace-pre-wrap break-words">{commentText}</span>
<span className="wrap-break-word whitespace-pre-wrap">{commentText}</span>
</div>
)}
</div>
Expand Down Expand Up @@ -449,27 +449,31 @@ export default function SubmissionPage() {
}}
>
<LuPencil className="h-4 w-4" />
<span className="hidden sm:inline">日程を変更する</span>
<span className="sm:hidden">日程変更</span>
{meAsGuest ? (
<>
<span className="hidden sm:inline">日程を変更する</span>
<span className="sm:hidden">日程変更</span>
</>
) : (
<span>提出する</span>
)}
</button>
</div>
) : (
<div className="flex items-center justify-between gap-2">
{!!myGuestId && (
<button
type="button"
className="btn btn-sm btn-outline shrink-0"
disabled={loading}
onClick={() => {
setEditingSlots([]);
setGuestName(meAsGuest?.name ?? "");
setComment(meAsGuest?.comment ?? "");
setMode("view");
}}
>
<span>キャンセル</span>
</button>
)}
<button
type="button"
className="btn btn-sm btn-outline shrink-0"
disabled={loading}
onClick={() => {
setEditingSlots(meAsGuest?.slots ?? []);
setGuestName(meAsGuest?.name ?? "");
setComment(meAsGuest?.comment ?? "");
setMode("view");
}}
>
<span>キャンセル</span>
</button>
<button
type="button"
className="btn btn-sm btn-primary ml-auto inline-flex shrink-0 gap-1.5"
Expand Down
Loading