-
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
"Fix code formatting issues and add translation language select component" #25
Conversation
以下は、指定された内容に基づく最終的な回答です。 ウォークスルーこの変更セットには、新しいコンポーネント 変更点
Uplevel your code reviews with CodeRabbit ProCodeRabbit ProIf you like this project, please support us by purchasing the Pro version. The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects. |
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.
Files selected (34)
- web/ tailwind.config.ts (1)
- web/app/components/GoogleForm.tsx (1)
- web/app/components/Header.tsx (1)
- web/app/components/ui/alert.tsx (1)
- web/app/components/ui/button.tsx (1)
- web/app/components/ui/card.tsx (1)
- web/app/components/ui/input.tsx (1)
- web/app/components/ui/label.tsx (1)
- web/app/components/ui/select.tsx (1)
- web/app/components/ui/separator.tsx (1)
- web/app/entry.server.tsx (6)
- web/app/root.tsx (2)
- web/app/routes/_index/route.tsx (4)
- web/app/routes/_index/utils/gemini.ts (2)
- web/app/routes/_index/utils/translation.ts (3)
- web/app/routes/api.auth.callback.google.ts (1)
- web/app/routes/auth.login.tsx (1)
- web/app/routes/auth.logout.tsx (1)
- web/app/routes/auth.signup.tsx (1)
- web/app/routes/components/TranslationLanguageSelect.tsx (1)
- web/app/routes/components/URLInputForm.tsx (1)
- web/app/routes/components/URLTranslationForm.tsx (1)
- web/app/routes/components/translatedList.tsx (2)
- web/app/routes/reader.$encodedUrl/route.tsx (2)
- web/app/utils.ts (1)
- web/app/utils/auth.server.ts (1)
- web/app/utils/session.server.ts (1)
- web/app/utils/signup.server.ts (1)
- web/app/utils/userReadHistory.ts (1)
- web/app/utils/userService.ts (1)
- web/biome.json (1)
- web/components.json (1)
- web/package.json (1)
- web/test/translation.test.ts (1)
Files not summarized due to errors (1)
- web/app/routes/auth.signup.tsx (diff tokens exceeds limit)
Files skipped from review due to trivial changes (22)
- web/ tailwind.config.ts
- web/app/components/GoogleForm.tsx
- web/app/components/ui/alert.tsx
- web/app/components/ui/button.tsx
- web/app/components/ui/card.tsx
- web/app/components/ui/input.tsx
- web/app/components/ui/label.tsx
- web/app/components/ui/separator.tsx
- web/app/routes/_index/utils/translation.ts
- web/app/routes/api.auth.callback.google.ts
- web/app/routes/auth.logout.tsx
- web/app/routes/components/translatedList.tsx
- web/app/routes/reader.$encodedUrl/route.tsx
- web/app/utils.ts
- web/app/utils/auth.server.ts
- web/app/utils/session.server.ts
- web/app/utils/userReadHistory.ts
- web/app/utils/userService.ts
- web/components.json
- web/test/translation.test.ts
- web/app/routes/auth.login.tsx (diff too large)
- web/app/routes/auth.signup.tsx (diff too large)
Review comments generated (22)
- Review: 6
- LGTM: 16
Tips
Chat with CodeRabbit Bot (@coderabbitai
)
- Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
- Invite the bot into a review comment chain by tagging
@coderabbitai
in a reply.
Code suggestions
- The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
- You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.
Pausing incremental reviews
- Add
@coderabbitai: ignore
anywhere in the PR description to pause further reviews from the bot.
return ( | ||
<div className="container mx-auto max-w-2xl py-8"> | ||
<Card> | ||
<Form method="post" {...getFormProps(form)} className="space-y-4"> | ||
<div className="flex space-x-2"> | ||
<Input | ||
type="url" | ||
name="url" | ||
placeholder="URLを入力" | ||
required | ||
className="flex-grow" | ||
/> | ||
<Button | ||
type="submit" | ||
disabled={navigation.state === "submitting"} | ||
> | ||
{navigation.state === "submitting" ? "処理中..." : "翻訳を開始"} | ||
</Button> | ||
</div> | ||
</Form> | ||
|
||
{actionData?.result.status === "error" && ( | ||
<Alert variant="destructive" className="mt-4"> | ||
<AlertDescription> | ||
<ul id={field.url.errorId}> | ||
{field.url.errors} | ||
</ul> | ||
</AlertDescription> | ||
</Alert> | ||
)} | ||
|
||
{actionData?.result.status === "success" && ( | ||
<div className="mt-4"> | ||
<Link | ||
to={`/reader/${encodeURIComponent(actionData.url)}`} | ||
className="text-blue-500 hover:underline" | ||
> | ||
<h2 className="text-xl font-semibold">{actionData.title}</h2> | ||
</Link> | ||
</div> | ||
)} | ||
</Card> | ||
</div> | ||
<Card> | ||
<URLTranslationForm /> | ||
</Card> | ||
</div> |
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.
useActionData
とuseNavigation
の削除により、フォームのバリデーションやエラーメッセージの表示が失われています。これらの機能を復元するために、以下の修正を提案します。
export default function Index() {
- return (
- <div className="container mx-auto max-w-2xl py-8">
- <Card>
- <URLTranslationForm />
- </Card>
- </div>
+ const actionData = useActionData<typeof action>();
+ const navigation = useNavigation();
+
+ return (
+ <div className="container mx-auto max-w-2xl py-8">
+ <Card>
+ <Form method="post" className="space-y-4">
+ <div className="flex space-x-2">
+ <Input
+ type="url"
+ name="url"
+ placeholder="URLを入力"
+ required
+ className="flex-grow"
+ />
+ <Button
+ type="submit"
+ disabled={navigation.state === "submitting"}
+ >
+ {navigation.state === "submitting" ? "処理中..." : "翻訳を開始"}
+ </Button>
+ </div>
+ </Form>
+
+ {actionData?.result.status === "error" && (
+ <Alert variant="destructive" className="mt-4">
+ <AlertDescription>
+ <ul>
+ {actionData.result.errors.map((error, index) => (
+ <li key={index}>{error}</li>
+ ))}
+ </ul>
+ </AlertDescription>
+ </Alert>
+ )}
+
+ {actionData?.result.status === "success" && (
+ <div className="mt-4">
+ <Link
+ to={`/reader/${encodeURIComponent(actionData.url)}`}
+ className="text-blue-500 hover:underline"
+ >
+ <h2 className="text-xl font-semibold">{actionData.title}</h2>
+ </Link>
+ </div>
+ )}
+ </Card>
+ </div>
);
}
className="text-blue-600 hover:text-blue-800 font-medium" | ||
> |
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.
|
||
export function URLTranslationForm() { | ||
const navigation = useNavigation(); | ||
const [targetLanguage, setTargetLanguage] = useState("ja"); |
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.
}, | ||
onSubmit(event, { formData }) { | ||
event.preventDefault(); | ||
console.log("Form submitted", Object.fromEntries(formData)); |
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.
<Button type="submit" disabled={navigation.state === "submitting"}> | ||
{navigation.state === "submitting" ? "翻訳中..." : "翻訳開始"} | ||
</Button> |
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.
export const createUser = async ( | ||
data: Record<'name' | 'email' | 'password', string>, | ||
data: Record<"name" | "email" | "password", string>, | ||
) => { |
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.
This pull request fixes code formatting issues in multiple files and adds a new component called TranslationLanguageSelect. The TranslationLanguageSelect component is a dropdown select menu that allows users to choose a translation language. It is used for selecting the target language for translation.
Summary by CodeRabbit