-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add createdAt and updatedAt fields to Vote model
- Loading branch information
Showing
17 changed files
with
639 additions
and
446 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,66 @@ | ||
import type { User } from "@prisma/client"; | ||
import { Link } from "@remix-run/react"; | ||
import { TranslationLanguageSelect } from "./TranslationLanguageSelect"; | ||
import { Form, useSubmit } from "@remix-run/react"; | ||
|
||
type UserWithoutPassword = Omit<User, "password">; | ||
|
||
interface HeaderProps { | ||
user: UserWithoutPassword | null; | ||
user: UserWithoutPassword | null; | ||
language: string; | ||
} | ||
|
||
export function Header({ user }: HeaderProps) { | ||
return ( | ||
<header className="bg-white shadow-sm"> | ||
<div className="max-w-7xl mx-auto py-4 px-4 sm:px-6 lg:px-8 flex justify-between items-center"> | ||
<h1 className="text-3xl font-bold text-gray-900">EveEve</h1> | ||
<nav> | ||
{user ? ( | ||
<div className="flex items-center space-x-4"> | ||
<span className="text-gray-700">ようこそ、{user.name}さん!</span> | ||
<Link | ||
to="/auth/logout" | ||
className="text-blue-600 hover:text-blue-800 font-medium" | ||
> | ||
ログアウト | ||
</Link> | ||
</div> | ||
) : ( | ||
<div className="space-x-4"> | ||
<Link | ||
to="/auth/login" | ||
className="text-blue-600 hover:text-blue-800 font-medium" | ||
> | ||
ログイン | ||
</Link> | ||
<Link | ||
to="/auth/signup" | ||
className="text-blue-600 hover:text-blue-800 font-medium" | ||
> | ||
サインアップ | ||
</Link> | ||
</div> | ||
)} | ||
</nav> | ||
</div> | ||
</header> | ||
); | ||
} | ||
export function Header({ user, language }: HeaderProps) { | ||
const submit = useSubmit(); | ||
|
||
const handleLanguageChange = (newLanguage: string) => { | ||
const formData = new FormData(); | ||
formData.append("language", newLanguage); | ||
submit(formData, { method: "post" }); | ||
}; | ||
return ( | ||
<header className="bg-white shadow-sm"> | ||
<div className="max-w-7xl mx-auto py-4 px-4 sm:px-6 lg:px-8 flex justify-between items-center"> | ||
<Link to="/"> | ||
<h1 className="text-3xl font-bold text-gray-900">EveEve</h1> | ||
</Link> | ||
<div className="flex items-center space-x-4"> | ||
<Form method="post"> | ||
<TranslationLanguageSelect | ||
value={language} | ||
onChange={handleLanguageChange} | ||
/> | ||
</Form> | ||
<nav> | ||
{user ? ( | ||
<div className="flex items-center space-x-4"> | ||
<span className="text-gray-700">ようこそ、{user.name}さん!</span> | ||
<Link | ||
to="/auth/logout" | ||
className="text-blue-600 hover:text-blue-800 font-medium" | ||
> | ||
ログアウト | ||
</Link> | ||
</div> | ||
) : ( | ||
<div className="space-x-4"> | ||
<Link | ||
to="/auth/login" | ||
className="text-blue-600 hover:text-blue-800 font-medium" | ||
> | ||
ログイン | ||
</Link> | ||
<Link | ||
to="/auth/signup" | ||
className="text-blue-600 hover:text-blue-800 font-medium" | ||
> | ||
サインアップ | ||
</Link> | ||
</div> | ||
)} | ||
</nav> | ||
</div> | ||
</div> | ||
</header> | ||
); | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
import * as React from "react" | ||
import * as React from "react"; | ||
|
||
import { cn } from "~/utils" | ||
import { cn } from "~/utils"; | ||
|
||
export interface TextareaProps | ||
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {} | ||
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {} | ||
|
||
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>( | ||
({ className, ...props }, ref) => { | ||
return ( | ||
<textarea | ||
className={cn( | ||
"flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50", | ||
className | ||
)} | ||
ref={ref} | ||
{...props} | ||
/> | ||
) | ||
} | ||
) | ||
Textarea.displayName = "Textarea" | ||
({ className, ...props }, ref) => { | ||
return ( | ||
<textarea | ||
className={cn( | ||
"flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50", | ||
className, | ||
)} | ||
ref={ref} | ||
{...props} | ||
/> | ||
); | ||
}, | ||
); | ||
Textarea.displayName = "Textarea"; | ||
|
||
export { Textarea } | ||
export { Textarea }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,28 @@ | ||
import type { Page } from "@prisma/client"; | ||
import { useLoaderData } from "@remix-run/react"; | ||
import type { PageVersion } from "@prisma/client"; | ||
import { useLoaderData, useMatches } from "@remix-run/react"; | ||
import type { RootLoaderData } from "~/root"; // root.tsxからインポート | ||
|
||
interface LoaderData { | ||
pageList: Page[]; | ||
pageVersionList: PageVersion[]; | ||
} | ||
|
||
export function TranslatedList() { | ||
const { pageList } = useLoaderData<LoaderData>(); | ||
return <div>TranslatedList</div>; | ||
} | ||
const { pageVersionList } = useLoaderData<LoaderData>(); | ||
const matches = useMatches(); | ||
const rootData = matches[0].data as RootLoaderData; | ||
const language = rootData.language; | ||
|
||
return ( | ||
<div> | ||
<h2>Translated List (Language: {language})</h2> | ||
<ul> | ||
{pageVersionList.map((pageVersion) => ( | ||
<li key={pageVersion.id}> | ||
{/* ページのタイトルや他の情報を表示 */} | ||
{pageVersion.title} - {pageVersion.url} | ||
</li> | ||
))} | ||
</ul> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.