Login with Google — client UI (#4028)#4279
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
WalkthroughAdds Google login support to the frontend. A new ChangesGoogle Login Feature
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/core/ApiSchemas.ts (1)
69-69: 💤 Low valueConsider using
z.email()for email validation.Zod 4 provides a standalone
z.email()schema for validating email format. While the currentz.string()matches the pattern used inDiscordUserSchema, usingz.email()would add client-side validation and make the schema more explicit.✨ Optional enhancement
export const GoogleUserSchema = z.object({ - email: z.string(), + email: z.email(), });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/core/ApiSchemas.ts` at line 69, Replace the `email: z.string()` field definition with `z.email()` to leverage Zod 4's built-in email validation schema. This change adds explicit email format validation at the schema level, making the validation requirements clearer and improving client-side validation capabilities.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/core/ApiSchemas.ts`:
- Around line 68-71: The GoogleUserSchema and its corresponding GoogleUser type
inference are missing test coverage. Create test cases that validate the schema
correctly enforces the email field as a required string and verify that the type
inference for GoogleUser is properly derived from GoogleUserSchema. Include
tests for both valid inputs (valid email strings) and invalid inputs (empty
strings, non-string values) to ensure the schema validation works as expected.
---
Nitpick comments:
In `@src/core/ApiSchemas.ts`:
- Line 69: Replace the `email: z.string()` field definition with `z.email()` to
leverage Zod 4's built-in email validation schema. This change adds explicit
email format validation at the schema level, making the validation requirements
clearer and improving client-side validation capabilities.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2a5bab8b-f1f1-4a90-bf42-0261bd6c9307
📒 Files selected for processing (4)
resources/lang/en.jsonsrc/client/AccountModal.tssrc/client/Auth.tssrc/core/ApiSchemas.ts
| export const GoogleUserSchema = z.object({ | ||
| email: z.string(), | ||
| }); | ||
| export type GoogleUser = z.infer<typeof GoogleUserSchema>; |
There was a problem hiding this comment.
Missing tests for src/core/ changes.
According to coding guidelines, all changes to src/core/ must include tests. This new schema should have test coverage to validate the email field and type inference.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/core/ApiSchemas.ts` around lines 68 - 71, The GoogleUserSchema and its
corresponding GoogleUser type inference are missing test coverage. Create test
cases that validate the schema correctly enforces the email field as a required
string and verify that the type inference for GoogleUser is properly derived
from GoogleUserSchema. Include tests for both valid inputs (valid email strings)
and invalid inputs (empty strings, non-string values) to ensure the schema
validation works as expected.
Source: Coding guidelines
c341c43 to
4d91a57
Compare
Resolves #4028 (client half — backend is openfrontio/infra#368, which must be deployed first).
Description:
Adds "Login with Google" to the client, alongside the existing Discord login. Companion to the backend PR (openfrontio/infra#368).
Auth.ts—googleLogin()(full-page redirect to/auth/login/google?redirect_uri=…, mirrorsdiscordLogin()).ApiSchemas.ts—GoogleUserSchema+ optionaluser.googleonUserMeResponseSchema.AccountModal.ts— a "Login with Google" button (Google brand guidelines: white surface, dark text, the multicolor "G" mark) in the login options, and the logged-in view now renders a Google-authenticated user's email (also addedgoogletoisLinkedAccount()).en.json—main.login_google.resources/images/GoogleLogo.svg— the Google "G" mark.Please complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
jish