Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: register #127

Merged
merged 1 commit into from
Dec 31, 2023
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
10 changes: 5 additions & 5 deletions app/(app)/matches/MatchCreateButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export function MatchCreateButton({ className }: { className?: string }) {
labelPlacement="outside-left"
endContent={
<div className="pointer-events-none flex items-center">
<span className="text-sm text-default-400">円</span>
<span className="text-small text-default-400">円</span>
</div>
}
{...register("chipRate")}
Expand All @@ -240,7 +240,7 @@ export function MatchCreateButton({ className }: { className?: string }) {
hideIndicator
classNames={{
titleWrapper: "text-right",
title: "text-sm text-primary",
title: "text-small text-primary",
}}
>
<div className="space-y-3 px-1">
Expand All @@ -254,7 +254,7 @@ export function MatchCreateButton({ className }: { className?: string }) {
labelPlacement="outside-left"
endContent={
<div className="pointer-events-none flex items-center">
<span className="text-sm text-default-400">
<span className="text-small text-default-400">
</span>
</div>
Expand All @@ -272,7 +272,7 @@ export function MatchCreateButton({ className }: { className?: string }) {
labelPlacement="outside-left"
endContent={
<div className="pointer-events-none flex items-center">
<span className="text-sm text-default-400">
<span className="text-small text-default-400">
</span>
</div>
Expand All @@ -290,7 +290,7 @@ export function MatchCreateButton({ className }: { className?: string }) {
labelPlacement="outside-left"
endContent={
<div className="pointer-events-none flex shrink-0 items-center">
<span className="text-sm text-default-400">
<span className="text-small text-default-400">
点返し
</span>
</div>
Expand Down
21 changes: 12 additions & 9 deletions app/(app)/matches/[matchId]/GameInputModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,18 +196,21 @@ export function GameInputModal({
endContent={
<div className="pointer-events-none flex shrink-0 items-center gap-1">
<span
className={classNames("mt-0.5 text-xs", {
"text-default-400":
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
watch(
`playerPoints.${index}.points`,
) === "",
})}
className={classNames(
"mt-0.5 text-tiny",
{
"text-default-400":
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
watch(
`playerPoints.${index}.points`,
) === "",
},
)}
>
00
</span>
<span className="text-sm text-default-400">
<span className="text-small text-default-400">
</span>
</div>
Expand Down
13 changes: 0 additions & 13 deletions app/(auth)/login/layout.tsx

This file was deleted.

9 changes: 7 additions & 2 deletions app/(auth)/login/page.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
import { Metadata } from "next";
import Link from "next/link";
import { Divider } from "~/components/Divider";
import { Form } from "./Form";
import { SocialProviders } from "./SocialProviders";

export const metadata: Metadata = {
title: "ログイン",
};

export default function Login() {
return (
<>
<h1 className="mx-auto mb-2 w-fit text-lg font-bold">ログイン</h1>
<h1 className="mx-auto mb-2 w-fit text-large font-bold">ログイン</h1>
<SocialProviders />
<div className="flex items-center gap-4">
<Divider className="shrink" />
<span>or</span>
<Divider className="shrink" />
</div>
<Form />
<p className="text-center text-sm">
<p className="text-center text-small">
アカウントをお持ちでない方は
<Link className="link" href="/sign-up">
新規登録
Expand Down
63 changes: 63 additions & 0 deletions app/(auth)/register/Form.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
"use client";

import classNames from "classnames";
import { useFormState } from "react-dom";
import { Button } from "~/components/Button";
import { Input } from "~/components/Input";
import { updateProfile } from "~/lib/actions/updateProfile";
import {
JANRECO_ID_MAX_LENGTH,
JANRECO_ID_MIN_LENGTH,
NAME_MAX_LENGTH,
} from "~/lib/utils/schemas";

export function Form({
className,
userId,
}: {
className?: string;
userId: string;
}) {
const [state, formAction] = useFormState(updateProfile, {});

return (
<form
className={classNames(className, "py-4")}
action={formAction}
noValidate
>
<p className="mb-6 text-small text-foreground-light">
ユーザーIDと名前を決めてください。
<br />
ユーザーIDはユーザー検索に使用されます。名前は成績表に表示されます。
</p>
<div className="space-y-2.5">
<input id="id" name="id" type="text" hidden value={userId} readOnly />
<Input
id="janrecoId"
type="text"
name="janrecoId"
required
label="ユーザーID"
errorMessage={state.errors?.janrecoId?.[0]}
description={`半角英数字${JANRECO_ID_MIN_LENGTH}~${JANRECO_ID_MAX_LENGTH}文字で入力してください`}
/>
<Input
id="name"
name="name"
label="名前"
type="text"
autoComplete="name"
required
errorMessage={state.errors?.name?.[0]}
description={`${NAME_MAX_LENGTH}文字以内で入力してください`}
/>
<div className="flex justify-end">
<Button className="ml-auto" color="primary" type="submit">
決定
</Button>
</div>
</div>
</form>
);
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { Metadata } from "next";
import { redirect } from "next/navigation";
import Logo from "~/components/Logo";
import { services } from "~/lib/services";
import { createSupabaseServerComponentClient } from "~/lib/utils/supabase/serverComponentClient";
import ProfileForm from "./ProfileForm";
import { Form } from "./Form";

export const metadata: Metadata = {
title: "ユーザー情報登録",
Expand All @@ -19,9 +18,11 @@ export default async function Register() {
}

return (
<div className="flex min-h-screen flex-col gap-4 p-5">
<Logo className="shrink-0 text-3xl" />
<ProfileForm className="grow" userId={user.id} />
</div>
<>
<h1 className="mx-auto mb-2 w-fit text-large font-bold">
ユーザー情報登録
</h1>
<Form userId={user.id} />
</>
);
}
13 changes: 0 additions & 13 deletions app/(auth)/sign-up/layout.tsx

This file was deleted.

9 changes: 7 additions & 2 deletions app/(auth)/sign-up/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import { Metadata } from "next";
import Link from "next/link";
import { Form } from "./Form";

export const metadata: Metadata = {
title: "新規登録",
};

export default function Login() {
return (
<>
<h1 className="mx-auto mb-2 w-fit text-lg font-bold">新規登録</h1>
<h1 className="mx-auto mb-2 w-fit text-large font-bold">新規登録</h1>
<Form />
<p className="text-center text-sm">
<p className="text-center text-small">
既にアカウントをお持ちの方は
<Link className="link" href="/login">
ログイン
Expand Down
7 changes: 0 additions & 7 deletions app/(register)/layout.tsx

This file was deleted.

Loading