-
-
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
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
📝 WalkthroughWalkthroughThis pull request introduces changes across multiple localization files and website components, focusing on removing a specific financial figure ("USD 300,000+") from website selection JSON files and refactoring import paths. The modifications also include a new currency-based redirection mechanism and updates to the recipient selection page's structure, enhancing the website's localization and navigation capabilities. Changes
Sequence DiagramsequenceDiagram
participant User
participant CurrencyRedirect
participant Page
User->>CurrencyRedirect: Access page
CurrencyRedirect->>Page: Check current currency
alt Currency mismatch
CurrencyRedirect->>User: Redirect to correct currency page
else Currency matches
Page->>User: Render recipient selection content
end
Possibly Related PRs
Suggested Labels
Suggested Reviewers
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 d91390d): https://si-admin-staging--pr1001-pranav-number-from-t-4mdo90t9.web.app (expires Wed, 15 Jan 2025 15:08:43 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
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
Summary by CodeRabbit
Localization
Code Structure
New Features
Page Updates