-
Notifications
You must be signed in to change notification settings - Fork 31
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
refactor(types): update type definitions #118
refactor(types): update type definitions #118
Conversation
@suhas-sensei is attempting to deploy a commit to the kindfi Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThis update introduces new type-safe data structures and additional type annotations across various components and type definition files. The home page now defines a Changes
Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
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 (
|
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: 4
🔭 Outside diff range comments (1)
apps/web/lib/stellar/escrow.ts (1)
26-96
: Consider enhancing type safety for Stellar SDK usage.The function could benefit from stronger type safety around Stellar SDK operations.
- Create a type-safe wrapper for
Server
:// apps/web/lib/stellar/types.ts export type StellarNetwork = 'TESTNET' | 'MAINNET'; export interface StellarConfig { networkUrl: string; network: StellarNetwork; } // apps/web/lib/stellar/config.ts export function getStellarConfig(): StellarConfig { const networkUrl = process.env.STELLAR_NETWORK_URL; if (!networkUrl) { throw new Error('STELLAR_NETWORK_URL is not configured'); } return { networkUrl, network: process.env.NODE_ENV === 'production' ? 'MAINNET' : 'TESTNET' }; }
- Use these types in the escrow contract:
-const server = new Server(process.env.STELLAR_NETWORK_URL!) +const config = getStellarConfig(); +const server = new Server(config.networkUrl)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (7)
apps/web/components/pages/home.tsx
(2 hunks)apps/web/components/shared/layout/header/navigation.tsx
(3 hunks)apps/web/lib/stellar/escrow.ts
(1 hunks)apps/web/lib/types/home.types.ts
(1 hunks)apps/web/lib/types/index.ts
(1 hunks)apps/web/lib/types/pages.ts
(1 hunks)apps/web/lib/types/stats.ts
(1 hunks)
🔇 Additional comments (5)
apps/web/lib/types/pages.ts (2)
9-13
: LGTM! Type-safe URL validation using template literals.The
NavigationItem
interface effectively uses template literal types to ensure type-safe URLs, allowing only valid URL patterns.
15-23
: LGTM! Well-documented interface with clear purpose.The
NavigationSection
interface is well-documented with comprehensive JSDoc comments explaining its purpose and properties.apps/web/components/shared/layout/header/navigation.tsx (1)
18-34
: LGTM! Enhanced type safety with explicit array types.The explicit
NavigationItem[]
type annotations forprojects
andresources
arrays improve type safety and make the code more maintainable.Also applies to: 36-53
apps/web/lib/types/index.ts (1)
8-9
: LGTM!The new exports follow the barrel pattern, which is a good practice for organizing and exposing types.
apps/web/lib/stellar/escrow.ts (1)
42-42
: Empty line added for readability.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
Hey @suhas-sensei, could you please address the issue that has appeared after rebasing your branch? Here’s what you need to do:
- Open the terminal and navigate to the web folder.
- Run the following command:
bun run build
- Review the error message that appears and resolve the issue.
- Commit your changes and push them again.
Thank you!
|
sending then |
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: 6
♻️ Duplicate comments (2)
apps/web/components/pages/home.tsx (2)
91-98
: 🛠️ Refactor suggestionUse helper functions consistently for type assertions.
Replace type assertions with the provided helper functions for consistency.
Apply this diff:
-currentAmount: { __brand: 'money', value: 22800 } as unknown as Money, -targetAmount: { __brand: 'money', value: 25000 } as unknown as Money, -investors: 18, -minInvestment: { __brand: 'money', value: 5 } as unknown as Money, -percentageComplete: { - __brand: 'percentage', - value: 90, -} as unknown as Percentage, +currentAmount: createMoney(22800), +targetAmount: createMoney(25000), +investors: 18, +minInvestment: createMoney(5), +percentageComplete: createPercentage(90),
83-231
: 🛠️ Refactor suggestionExtract projects data to a separate file.
The large projects array should be moved to a dedicated data file.
Create a new file
apps/web/data/projects.ts
:import { Money, Percentage, Project } from '~/lib/types' import { createMoney, createPercentage } from '~/lib/types' export const projects: Project[] = [ { id: 'healthy-kids-id', // ... rest of the project data }, // ... other projects ]
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
apps/web/app/auth/callback/route.ts
(1 hunks)apps/web/components/pages/home.tsx
(2 hunks)apps/web/lib/types/project.ts
(1 hunks)
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.
Thank you for addressing the build issues and contributing to our project! Great job!
Pleasure working with you folks, learnt a great lot stuff! |
* refactor(types): update type definitions * refactor(types): update type definitions build fix * refactor(types): update type definitions build fix --------- Co-authored-by: Brandon Fernández <[email protected]>
enhances #14
introduces sharable types
Summary by CodeRabbit
New Features
Documentation