Skip to content
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

Update layout auth after significant changes in upstream #10

Merged
merged 13 commits into from
Nov 21, 2024

Conversation

ymijsters
Copy link
Collaborator

@ymijsters ymijsters commented Nov 21, 2024

This PR contains a number of changes that I made to the lay-out after the auth design was updated in the upstream. I also re-enabled Husky, which was running into issues before but is working now.

Summary by CodeRabbit

Release Notes

  • New Features

    • Updated branding across the application to reflect "LNCO.ai" instead of "Graasp."
    • Introduced structured shell scripts for pre-commit, post-commit, and pre-push hooks to enhance Git workflow.
  • Bug Fixes

    • Improved localization files for English, French, Arabic, and German to ensure clarity and accuracy in user-facing messages.
  • Chores

    • Updated .gitignore to exclude Vite configuration files.

Copy link

coderabbitai bot commented Nov 21, 2024

Walkthrough

This pull request introduces several changes to the Husky Git hooks, converting them to shell script format for improved structure and functionality. It also updates various components to reflect a branding change from "Graasp" to "LNCO.ai," including modifications to localization files in multiple languages. Additionally, the .gitignore file is updated to ignore specific Vite configuration files. Overall, these changes enhance the project's integration with Husky and align the branding across different components and languages.

Changes

File Change Summary
.husky/commit-msg Added shell script header and sourced Husky script; command for commitlint unchanged.
.husky/post-commit Created new shell script; added shebang and sourced Husky script; retained git status command.
.husky/pre-commit Converted to shell script; added shebang, sourced Husky script, executed yarn prettier:check and yarn lint.
.husky/pre-push Introduced shell script; added shebang, sourced Husky script, executed yarn lint and yarn build.
src/components/BrandingLogo.tsx Updated import for AccentColors, changed displayed text to "LNCO.ai", updated color property.
src/components/LeftContentContainer.tsx Removed LibraryIcon and associated PlatformContent logic, streamlined import statement.
src/components/register/Register.tsx Replaced local logo image with GraaspLogo component from @graasp/ui, adjusted alignment.
src/langs/en.json Updated various UI text strings to reflect branding change to "LNCO.ai".
src/langs/fr.json Modified French UI strings for clarity and branding change to "LNCO.ai".
src/langs/ar.json Changed Arabic strings to replace "Graasp" with "LNCO.ai".
src/langs/de.json Updated German UI string for redirection button to "Gehe zu LNCO.ai".
.gitignore Added entry to ignore Vite configuration files matching pattern +.vite.config.ts.timestamp-*.

Possibly related PRs

  • 6 update layout - update colors, change logos #7: The changes in this PR involve updating logos and colors in the authentication component, which aligns with the branding updates made in the main PR regarding the transition from "Graasp" to "LNCO.ai".

Suggested reviewers

  • juancarlosfarah

Poem

In the meadow where logos bloom,
"Graasp" now fades, making room.
"LNCO.ai" shines bright and clear,
With colors fresh, we spread the cheer.
Commit hooks dance in shell's embrace,
A vibrant change, a brand new face! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between d1765d6 and 76db70c.

📒 Files selected for processing (1)
  • .gitignore (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .gitignore

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Outside diff range and nitpick comments (1)
.husky/pre-commit (1)

4-4: Consider separating prettier and lint checks

Currently, the lint check only runs if prettier check passes. Consider running them independently to see all issues at once:

-yarn prettier:check && yarn lint
+yarn prettier:check
+yarn lint
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 4746545 and f71b2ff.

📒 Files selected for processing (9)
  • .husky/commit-msg (1 hunks)
  • .husky/post-commit (1 hunks)
  • .husky/pre-commit (1 hunks)
  • .husky/pre-push (1 hunks)
  • src/components/BrandingLogo.tsx (2 hunks)
  • src/components/LeftContentContainer.tsx (1 hunks)
  • src/components/register/Register.tsx (2 hunks)
  • src/langs/en.json (2 hunks)
  • src/langs/fr.json (2 hunks)
✅ Files skipped from review due to trivial changes (3)
  • .husky/commit-msg
  • .husky/post-commit
  • src/components/register/Register.tsx
🔇 Additional comments (9)
.husky/pre-commit (2)

1-2: Verify script permissions

The shell script requires executable permissions to function properly.

✅ Verification successful

Pre-commit hook has correct executable permissions (755)

The pre-commit hook has the correct executable permissions (-rwxr-xr-x), allowing it to be executed by Git during the commit process.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the pre-commit hook has executable permissions
# Expected: File should have executable bit set (755 or similar)

ls -l .husky/pre-commit

Length of output: 90


1-4: Verify Husky installation and configuration

The script looks correct, but let's verify the complete Husky setup.

✅ Verification successful

Husky setup is properly configured and functional

The pre-commit hook and overall Husky setup is correctly configured:

  • All required dependencies (husky, prettier, eslint) are properly installed
  • Necessary scripts (lint, prettier:check) are defined in package.json
  • Configuration files (.prettierrc, .eslintrc) exist
  • All git hooks have correct structure with proper shebang and husky source
  • The pre-commit hook correctly runs prettier and lint checks
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify Husky installation and configuration
# Expected: 
# - package.json should have Husky configuration
# - Git hooks should be properly installed
# - Other hook files should exist with similar structure

# Check Husky in package.json
echo "Checking package.json for Husky configuration:"
cat package.json | jq '.husky'

# List all Husky hooks
echo -e "\nListing all Husky hooks:"
ls -la .husky/

# Check content structure of other hooks
echo -e "\nChecking other hooks for consistent structure:"
for hook in .husky/*; do
  if [ -f "$hook" ] && [ "$hook" != ".husky/_" ]; then
    echo -e "\n=== $hook ==="
    head -n 3 "$hook"  # Show first 3 lines to verify shebang and husky source
  fi
done

Length of output: 1674


Script:

#!/bin/bash
# Let's verify if the required dependencies are properly configured in package.json
echo "Checking package.json for Husky and related dev dependencies:"
cat package.json | jq '.devDependencies | {husky, prettier, eslint}'

# Check if the lint and prettier scripts are defined
echo -e "\nChecking package.json for lint and prettier scripts:"
cat package.json | jq '.scripts | {lint, "prettier:check"}'

# Verify the existence of prettier and eslint config files
echo -e "\nChecking for config files:"
ls -la .prettierrc* .eslintrc* 2>/dev/null || echo "No config files found"

Length of output: 771

src/components/BrandingLogo.tsx (2)

1-1: LGTM on the AccentColors import

The addition of AccentColors from @graasp/ui is appropriate for the new color scheme.


12-12: Verify color scheme alignment

The change from primary to AccentColors.builder represents a significant styling update. Please ensure this aligns with the design system's color guidelines.

Let's check for consistent usage of this color scheme:

✅ Verification successful

Color scheme usage is consistent with design system

The usage of AccentColors.builder is consistent with the design system as evidenced by:

  • It's imported from the official @graasp/ui design system package
  • It's used consistently across components for builder-related UI elements
  • The same pattern is followed for other platform sections (player, analytics) using their respective accent colors
  • The component maintains visual hierarchy with the primary theme color still used for the logo fill
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other usages of AccentColors.builder to verify consistency
rg "AccentColors\.builder"

# Look for any color-related documentation
fd -g "**/COLORS.md" -g "**/THEME.md" -g "**/STYLING.md"

Length of output: 424


Script:

#!/bin/bash
# Let's check the AccentColors enum/constant definition and its usage context
ast-grep --pattern 'export $_ AccentColors'

# Let's also check for any theme or color-related constants/types
rg -i "theme|color" --type=typescript -g "!*.test.*" -g "!*.spec.*" -A 3

Length of output: 155


Script:

#!/bin/bash
# Let's check for the AccentColors definition and color-related constants
rg -t ts -t tsx "export.*AccentColors"

# Let's also look for any theme or styling configuration files
fd -e ts -e tsx -e js -e jsx . | rg -i "theme|color|style"

# Check the specific files where AccentColors.builder is used for more context
rg -A 5 -B 5 "AccentColors\.builder"

Length of output: 1871


Script:

#!/bin/bash
# Let's check the content of the styles file we found
cat src/components/styles.ts

# And check for any theme configuration
cat src/components/common/StyledTextField.tsx

# Let's also check if there are any other color-related imports in these files
rg -B 2 "AccentColors" src/components/LeftContentContainer.tsx src/components/BrandingLogo.tsx

Length of output: 1967

src/components/LeftContentContainer.tsx (3)

1-1: LGTM! Import statement properly updated

The consolidated import statement correctly reflects the removal of LibraryIcon while maintaining necessary imports.


Line range hint 52-69: LGTM! Platform sections maintain consistent structure

The remaining platform sections (Builder, Player, Analytics) maintain a clean and consistent layout after the removal of the Library section.


Line range hint 52-69: Verify cleanup of Library-related resources

While the Library section has been cleanly removed from this component, we should verify that all related resources have been properly cleaned up.

src/langs/en.json (1)

58-59: LGTM: Analytics text change is clear and focused

The simplified message better emphasizes the key functionality of data export, which aligns well with the research-oriented focus.

src/langs/fr.json (1)

53-53: LGTM! Note the shift in messaging context.

The updated text changes the focus from student engagement to reaching subjects through experiments, which aligns with the broader context shift in the application.

.husky/pre-push Outdated Show resolved Hide resolved
src/components/BrandingLogo.tsx Show resolved Hide resolved
src/langs/en.json Show resolved Hide resolved
@@ -89,5 +89,5 @@
"INVALID_TOKEN_PROVIDED_DESCRIPTION": "No token was provided or the provided token is expired. Click the button below to generate a request to reset your password.",
"REDIRECTION_TITLE": "Welcome back, {{name}}",
"REDIRECTION_DESCRIPTION": "You are logged in.",
"REDIRECTION_BUTTON": "Go to Graasp"
"REDIRECTION_BUTTON": "Go to LNCO.ai"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Branding inconsistencies found in German translation and package metadata

Several instances still reference "Graasp" and need to be updated to "LNCO.ai":

  • src/langs/de.json: "REDIRECTION_BUTTON" still shows "Gehe zu Graasp"
  • src/langs/ar.json: Two strings still contain "Graasp" references
  • Package metadata files still use Graasp branding:
    • package.json: package name, author, and dependencies
    • public/manifest.json: app name and short name
    • renovate.json: configuration reference

The LNCO.ai branding is consistently capitalized as "LNCO.ai" in all translated strings where it has been updated.

🔗 Analysis chain

Verify complete rebranding from Graasp to LNCO.ai

While this button text has been updated, we should ensure all Graasp references have been updated to LNCO.ai for consistency.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining "Graasp" references that might need updating
rg -i "graasp" --type json

# Also check for consistency in LNCO.ai capitalization
rg -i "lnco" --type json

Length of output: 3303

@@ -85,5 +85,5 @@
"INVALID_TOKEN_PROVIDED_DESCRIPTION": "Aucun jeton n'a été fourni ou le jeton fourni a expiré. Cliquez sur le bouton ci-dessous pour générer une demande de réinitialisation de votre mot de passe.",
"REDIRECTION_TITLE": "Bienvenue, {{name}}",
"REDIRECTION_DESCRIPTION": "Vous êtes connecté.",
"REDIRECTION_BUTTON": "Aller à Graasp"
"REDIRECTION_BUTTON": "Aller à LNCO.ai"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Branding update requires attention: Multiple "Graasp" references need to be updated

The branding change from "Graasp" to "LNCO.ai" is incomplete. Several files still contain references to "Graasp" that need to be updated:

  • Configuration files still use "Graasp" in environment variables and package names
  • UI components are still importing and using GraaspLogo component
  • Translation files contain mixed branding ("Graasp" in Arabic translations while "LNCO.ai" in others)
  • Test files and fixtures contain "Graasp" references
  • Mobile app links and manifest still use "Graasp" branding

Please update all these references to maintain consistent branding across the codebase.

🔗 Analysis chain

Verify branding consistency across the codebase.

The branding update from "Graasp" to "LNCO.ai" is correct. Let's verify the consistency of this branding change across all files.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining references to "Graasp" that might need updating

# Search for "Graasp" in all files
echo "Searching for remaining 'Graasp' references:"
rg -i "graasp" --type json --type typescript --type javascript --type tsx

# Search for inconsistent "LNCO.ai" capitalization
echo -e "\nChecking for inconsistent 'LNCO.ai' capitalization:"
rg -i "lnco\.ai" --type json --type typescript --type javascript --type tsx

Length of output: 451


Script:

#!/bin/bash
# Let's try with simpler commands without file type restrictions
# Search for any remaining references to "Graasp"
echo "Searching for remaining 'Graasp' references:"
rg -i "graasp"

# Search for all variations of LNCO.ai
echo -e "\nChecking for 'LNCO.ai' variations:"
rg -i "lnco\.ai"

Length of output: 67251


Script:

#!/bin/bash
# Let's check for any remaining references to "Graasp" in the UI components and translations
# that might need to be updated to "LNCO.ai"

# Search for "Graasp" in UI components and translation files
echo "Searching for 'Graasp' in UI components and translations:"
fd -e tsx -e ts -e json | xargs rg -i "graasp" -l

# Check for inconsistent capitalization of "LNCO.ai" in UI components and translations
echo -e "\nChecking for inconsistent capitalization of 'LNCO.ai':"
fd -e tsx -e ts -e json | xargs rg -i "lnco\.ai" -A 1 -B 1

Length of output: 7726

Copy link
Member

@juancarlosfarah juancarlosfarah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just some very minor changes.

.husky/commit-msg Outdated Show resolved Hide resolved
@ymijsters
Copy link
Collaborator Author

Note that the single test that is failing passes locally and works already deployed, not sure why it fails here.

Copy link

@coderabbitai coderabbitai bot left a 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

🧹 Outside diff range and nitpick comments (2)
vite.config.ts.timestamp-1732185774164-b07524006208d.mjs (2)

14-15: Enhance port configuration robustness

The port configuration could be more robust by:

  1. Adding a fallback port if parsing fails
  2. Validating the port range

Consider this enhancement:

-      port: parseInt(process.env.VITE_PORT || "3001", 10),
+      port: (() => {
+        const port = parseInt(process.env.VITE_PORT || "3001", 10);
+        return isNaN(port) || port < 1024 || port > 65535 ? 3001 : port;
+      })(),

40-43: Enhance ESLint configuration

The current ESLint configuration could be more comprehensive to catch common issues.

Consider enhancing the ESLint configuration:

         checker({
           typescript: true,
-          eslint: { lintCommand: 'eslint "./**/*.{ts,tsx}"' }
+          eslint: {
+            lintCommand: 'eslint "./**/*.{ts,tsx}" --max-warnings=0',
+            dev: {
+              logLevel: ['error']
+            }
+          }
         })
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between f71b2ff and aa41499.

📒 Files selected for processing (5)
  • .husky/commit-msg (1 hunks)
  • .husky/post-commit (1 hunks)
  • .husky/pre-commit (1 hunks)
  • .husky/pre-push (1 hunks)
  • vite.config.ts.timestamp-1732185774164-b07524006208d.mjs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • .husky/commit-msg
  • .husky/post-commit
  • .husky/pre-commit
  • .husky/pre-push
🔇 Additional comments (2)
vite.config.ts.timestamp-1732185774164-b07524006208d.mjs (2)

54-57: LGTM: Export statement is well-structured

The export statement follows the standard pattern and is correctly implemented.


1-57: Verify Husky integration compatibility

Since the PR mentions Husky re-enablement, let's verify that this Vite configuration supports the Husky integration.

✅ Verification successful

Let me gather more information about the Husky hooks content to better understand their configuration.


Vite configuration is compatible with Husky integration

The Vite configuration aligns perfectly with the Husky integration:

  • Husky is properly configured with all necessary hooks (commit-msg, post-commit, pre-commit, pre-push)
  • The pre-push hook runs yarn build which uses the Vite configuration correctly
  • The pre-commit hook runs linting which is supported by the Vite checker plugin in dev mode
  • All required scripts referenced in the hooks are properly defined in package.json
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check Husky configuration and related scripts

# Check if Husky is properly configured in package.json
echo "Checking package.json for Husky configuration..."
cat package.json | jq '.scripts | select(contains({prepare: "husky install"}))'

# Check if Husky hooks are present and executable
echo "Checking Husky hooks..."
ls -la .husky/* 2>/dev/null || echo "No Husky hooks found"

# Check if the hooks reference any commands configured in this file
echo "Checking hooks for Vite-related commands..."
grep -r "vite" .husky/ 2>/dev/null || echo "No Vite commands found in hooks"

Length of output: 777


Script:

#!/bin/bash
# Check the content of Husky hooks
echo "Content of commit-msg hook:"
cat .husky/commit-msg

echo -e "\nContent of post-commit hook:"
cat .husky/post-commit

echo -e "\nContent of pre-commit hook:"
cat .husky/pre-commit

echo -e "\nContent of pre-push hook:"
cat .husky/pre-push

# Check package.json scripts that might be referenced by these hooks
echo -e "\nPackage.json scripts:"
cat package.json | jq '.scripts'

Length of output: 1691

vite.config.ts.timestamp-1732185774164-b07524006208d.mjs Outdated Show resolved Hide resolved
vite.config.ts.timestamp-1732185774164-b07524006208d.mjs Outdated Show resolved Hide resolved
Copy link
Member

@juancarlosfarah juancarlosfarah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question about a file that seems to have paths from your computer.

PS. Make sure you always squash and merge precisely to get rid of "middle" commits.

@@ -0,0 +1,58 @@
// vite.config.ts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this file need to be committed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, it was generated running the tests locally, removed it in a new commit now.

Copy link
Member

@juancarlosfarah juancarlosfarah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check online whether these sorts of files should be added to the gitignore? If so, add them, please to avoid future issues.

@ymijsters
Copy link
Collaborator Author

Can you check online whether these sorts of files should be added to the gitignore? If so, add them, please to avoid future issues.

These files should be automatically deleted when running tests, but it appears something went wrong. I added it to the gitignore in the latest commit.

Copy link
Member

@juancarlosfarah juancarlosfarah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember to squash and merge!

@ymijsters ymijsters merged commit a01b85a into main Nov 21, 2024
1 of 2 checks passed
@ymijsters ymijsters deleted the 2-update-layout-after-rebase branch November 21, 2024 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants