-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
Website: Display contributions dynamically on selections page (instead of hardcoding in shared/locales) #1001
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
📝 WalkthroughWalkthroughThis pull request involves modifications across multiple files in the website's localization and component structure. The changes primarily focus on removing a specific monetary value ("USD 300,000+") from localization JSON files in multiple languages, updating import paths to be more concise, and refactoring the recipient selection page to handle currency-based routing dynamically. Changes
Sequence DiagramsequenceDiagram
participant User
participant Page
participant CurrencyRedirect
participant Components
User->>Page: Access Page
Page->>CurrencyRedirect: Determine Currency
CurrencyRedirect-->>Page: Redirect URL
Page->>Components: Render with Currency Context
Possibly related PRs
Suggested labels
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (3)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Visit the preview URL for this PR (updated for commit c8b979c): https://si-admin-staging--pr1001-pranav-number-from-t-4mdo90t9.web.app (expires Mon, 20 Jan 2025 16:52:39 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: b7b0969384059dce6ea8fad1ee1d1737e54e6676 |
@CodeRabbit review |
✅ Actions performedReview triggered.
|
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.
Actionable comments posted: 3
🧹 Nitpick comments (3)
website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(sections)/resources.tsx (1)
57-60
: UseLink
component for internal navigationFor internal links, it's recommended to use the
Link
component fromnext/link
instead of ana
tag. This improves performance and enables client-side transitions.Apply this diff to update the code:
+import Link from 'next/link'; <Button variant="link"> - <a href="../finances" target="_blank" rel="noopener noreferrer"> + <Link href="../finances"> <Typography as="span" className="text-xl sm:text-2xl"> {currency.toUpperCase()} {roundAmount(totalContributionsAmount)}{' '} {translator.t('section-2.amount-context')} </Typography> + </Link> - </a> </Button>website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/page.tsx (1)
18-18
: Consider using design tokens for margin valuesThe arbitrary negative margins (-mt-24, -mt-36) could cause layout inconsistencies. Consider using design system tokens or CSS variables.
website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(sections)/state.ts (1)
Line range hint
28-40
: Enhance error handling specificityThe catch block currently logs all errors generically. Consider handling specific error types (e.g., file not found, parse errors) differently.
} catch (e) { - console.error(e); + if (e instanceof SyntaxError) { + console.error('Failed to parse draw file:', e); + } else if ((e as NodeJS.ErrnoException).code === 'ENOENT') { + console.error('Draw file not found:', e); + } else { + console.error('Unexpected error loading draws:', e); + } return []; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(assets)/globe.svg
is excluded by!**/*.svg
website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(assets)/transparency.svg
is excluded by!**/*.svg
📒 Files selected for processing (12)
shared/locales/de/website-selection.json
(0 hunks)shared/locales/en/website-selection.json
(0 hunks)shared/locales/fr/website-selection.json
(0 hunks)shared/locales/it/website-selection.json
(0 hunks)website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(components)/draw-card.tsx
(1 hunks)website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(sections)/hero-section.tsx
(1 hunks)website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(sections)/past-rounds.tsx
(1 hunks)website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(sections)/resources.tsx
(2 hunks)website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(sections)/state.ts
(1 hunks)website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/currency-redirect.tsx
(1 hunks)website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/page.tsx
(1 hunks)website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/page.tsx
(1 hunks)
💤 Files with no reviewable changes (4)
- shared/locales/de/website-selection.json
- shared/locales/fr/website-selection.json
- shared/locales/it/website-selection.json
- shared/locales/en/website-selection.json
✅ Files skipped from review due to trivial changes (1)
- website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(sections)/past-rounds.tsx
🔇 Additional comments (3)
website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/page.tsx (1)
19-24
: LGTM! Props handling looks goodProps are correctly typed and passed down to child components. The currency transformation to uppercase is handled appropriately.
website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(sections)/hero-section.tsx (1)
7-7
: LGTM! Import path simplification looks goodThe relative import path is correctly simplified and maintains code clarity.
website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(components)/draw-card.tsx (1)
7-7
: LGTM! Import path and security best practices look goodThe relative import path is correctly simplified, and external links properly implement security best practices with appropriate attributes.
website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/page.tsx
Show resolved
Hide resolved
.../[lang]/[region]/(website)/transparency/recipient-selection/[currency]/currency-redirect.tsx
Outdated
Show resolved
Hide resolved
@@ -1,7 +1,7 @@ | |||
import { readFileSync } from 'fs'; | |||
import * as fs from 'fs/promises'; | |||
|
|||
const DRAWS_PATH = '../recipients_selection/draws'; | |||
const DRAWS_PATH = process.cwd() + '/../recipients_selection/draws'; |
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.
Avoid using process.cwd() for file paths
Using process.cwd() can be unreliable in production as the working directory might change. Consider using path.resolve(__dirname, ...) instead.
-const DRAWS_PATH = process.cwd() + '/../recipients_selection/draws';
+import path from 'path';
+const DRAWS_PATH = path.resolve(__dirname, '../../../recipients_selection/draws');
Committable suggestion skipped: line range outside the PR's diff.
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.
Nice! @mkue
.../[lang]/[region]/(website)/transparency/recipient-selection/[currency]/currency-redirect.tsx
Outdated
Show resolved
Hide resolved
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.
nice! 👌
Summary by CodeRabbit
Localization
Code Structure
Functionality