-
Notifications
You must be signed in to change notification settings - Fork 40
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
Notification toast #578
Notification toast #578
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
📝 Walkthrough📝 WalkthroughWalkthroughThe changes involve the Changes
Possibly related issues
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: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
apps/router/src/components/Footer.tsx
(2 hunks)apps/router/src/constants/Version.tsx
(1 hunks)package.json
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- apps/router/src/constants/Version.tsx
🔇 Additional comments (3)
package.json (1)
5-5
: Verify the prebuild script functionality
Let's verify that the script works correctly and the Version.tsx file is properly generated.
✅ Verification successful
Let me gather more information about the Version.tsx file and its usage.
Prebuild script is working as expected
The script successfully:
- Creates Version.tsx in the correct location
- Generates valid TypeScript code with the git commit hash
- Is properly used in Footer component to display and link to the version
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify prebuild script functionality
# Test 1: Check if git command works
echo "Testing git command..."
if ! git rev-parse HEAD &>/dev/null; then
echo "Error: git command failed"
exit 1
fi
# Test 2: Check if target directory exists
TARGET_DIR="./apps/router/src/constants"
echo "Checking directory: $TARGET_DIR"
if [ ! -d "$TARGET_DIR" ]; then
echo "Warning: Target directory does not exist"
fi
# Test 3: Check write permissions
echo "Checking write permissions..."
if [ -d "$TARGET_DIR" ] && ! [ -w "$TARGET_DIR" ]; then
echo "Error: No write permission in target directory"
exit 1
fi
Length of output: 417
Script:
#!/bin/bash
# Check if Version.tsx exists and its content
echo "Checking for Version.tsx..."
fd Version.tsx
echo -e "\nChecking content if file exists..."
if [ -f "./apps/router/src/constants/Version.tsx" ]; then
cat "./apps/router/src/constants/Version.tsx"
fi
echo -e "\nChecking usage of GIT_COMMIT_HASH..."
rg "GIT_COMMIT_HASH" -A 2
Length of output: 1389
apps/router/src/components/Footer.tsx (2)
40-58
: LGTM: Responsive layout implementation
The Flex-based layout with proper breakpoints and spacing looks good.
48-49
:
Add error handling for GIT_COMMIT_HASH
The code assumes GIT_COMMIT_HASH will always be available and valid. Consider adding error handling and fallback display.
package.json
Outdated
@@ -2,6 +2,7 @@ | |||
"private": true, | |||
"scripts": { | |||
"dev": "turbo run dev", | |||
"prebuild": "echo \"export const GIT_COMMIT_HASH = '$(git rev-parse HEAD)'\" > ./apps/router/src/constants/Version.tsx", |
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.
Add error handling and cross-platform support to prebuild script
The prebuild script has potential reliability issues:
- No error handling if git command fails
- Uses platform-specific path separator
- Assumes git is available
- No directory existence check
Apply this diff to make the script more robust:
-"prebuild": "echo \"export const GIT_COMMIT_HASH = '$(git rev-parse HEAD)'\" > ./apps/router/src/constants/Version.tsx",
+"prebuild": "node -e \"const fs=require('fs');const path=require('path');const {execSync}=require('child_process');const dir='./apps/router/src/constants';try{fs.mkdirSync(dir,{recursive:true});const hash=execSync('git rev-parse HEAD').toString().trim();fs.writeFileSync(path.join(dir,'Version.tsx'),`export const GIT_COMMIT_HASH = '${hash}';\\n`);}catch(e){console.error(e);process.exit(1)}\"",
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
"prebuild": "echo \"export const GIT_COMMIT_HASH = '$(git rev-parse HEAD)'\" > ./apps/router/src/constants/Version.tsx", | |
"prebuild": "node -e \"const fs=require('fs');const path=require('path');const {execSync}=require('child_process');const dir='./apps/router/src/constants';try{fs.mkdirSync(dir,{recursive:true});const hash=execSync('git rev-parse HEAD').toString().trim();fs.writeFileSync(path.join(dir,'Version.tsx'),`export const GIT_COMMIT_HASH = '${hash}';\\n`);}catch(e){console.error(e);process.exit(1)}\"", |
import { Flex, useTheme, Link, Box } from '@chakra-ui/react'; | ||
import { GIT_COMMIT_HASH } from '@fedimint/router/src/constants/Version'; |
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.
🛠️ Refactor suggestion
Consider using relative import for Version.tsx
The absolute import path @fedimint/router/src/constants/Version
might cause issues as it references internal package structure. Consider using a relative import path instead.
-import { GIT_COMMIT_HASH } from '@fedimint/router/src/constants/Version';
+import { GIT_COMMIT_HASH } from '../constants/Version';
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
import { Flex, useTheme, Link, Box } from '@chakra-ui/react'; | |
import { GIT_COMMIT_HASH } from '@fedimint/router/src/constants/Version'; | |
import { Flex, useTheme, Link, Box } from '@chakra-ui/react'; | |
import { GIT_COMMIT_HASH } from '../constants/Version'; |
can you separate this out from the git version PR before review? |
35efed8
to
a67630b
Compare
Issue #496
Implementation Summary
Objective: Implement a unified notification system using Chakra UI's toast functionality to ensure a consistent user experience and improve code maintainability.
Key Changes:
Migrated from SharedChakraProvider to direct ChakraProvider to enable toast functionality.
Created a NotificationProvider to centralize and manage all notifications (success, error, warning, info) in a consistent way.
Updated Components:
Features:
Provider Implementation:
Before:
Now:
Summary by CodeRabbit