-
Notifications
You must be signed in to change notification settings - Fork 2
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
Feature/translateedit #27
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import * as React from "react"; | ||
|
||
import { cn } from "~/utils"; | ||
|
||
export interface TextareaProps | ||
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"; | ||
|
||
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CodeRabbit
cn
関数のインポート元が不明確です。~/utils
から正しくインポートされているか確認してください。