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

feat(lang-section): option to show language name and description on a single line #2246

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

encarbassotnopot
Copy link

@encarbassotnopot encarbassotnopot commented Mar 21, 2025

taking a first stab at closing #2245

Summary by CodeRabbit

  • New Features
    • Enhanced the display of language items by enabling a horizontal layout with improved spacing when the single-line option is activated.
    • Added a new toggle in the language settings dialog, allowing users to easily switch between single-line and default layouts.
    • Updated the language configuration to support the new single-line display option for a more flexible presentation.

…cription in a single line. updated templates accordingly
Copy link

coderabbitai bot commented Mar 21, 2025

📝 Walkthrough

Walkthrough

This update adds conditional styling to the Languages component across multiple templates. The components now apply the CSS classes "flex flex-row items-center space-x-2" when the singleLine flag is true, otherwise default styling is used. Additionally, a new switch form field was added to the LanguagesDialog for toggling the single-line display, and the language schema was updated to include a new boolean property singleLine with a default value of false.

Changes

File(s) Change Summary
apps/artboard/src/templates/*.tsx (azurill, bronzor, chikorita, ditto, gengar, glalie, kakuna, leafish, nosepass, onyx, pikachu, rhyhorn) Updated Languages component to conditionally assign CSS classes based on the item.singleLine property. Some files now use the cn utility to merge classes.
apps/client/src/.../dialogs/languages.tsx Added a new toggle switch form field (singleLine) in the LanguagesDialog component, integrated with the form state using the UI Switch component.
libs/schema/src/sections/language.ts Added a new boolean property singleLine (default false) to the language schema and updated the defaultLanguage object accordingly.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Switch
  participant LanguagesDialog
  participant FormState

  User->>Switch: Toggle "singleLine" option
  Switch->>LanguagesDialog: onCheckedChange(newValue)
  LanguagesDialog->>FormState: update("singleLine", newValue)
  FormState-->>LanguagesDialog: State Updated
Loading
sequenceDiagram
  participant Template
  participant LanguageItem

  Template->>LanguageItem: Evaluate singleLine property
  alt singleLine true
      LanguageItem->>Template: Render with flex layout classes
  else singleLine false
      LanguageItem->>Template: Render with default styling
  end
Loading

Poem

I'm a bunny coding through the night,
Hopping on changes with pure delight.
Flex classes appear when singleLine is true,
And toggles in dialogs bring magic anew.
In a world of code, I nibble the sweet change,
With whiskers twitching for UI that's arranged! 🐰✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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 generate docstrings to generate docstrings for this 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: 0

🧹 Nitpick comments (2)
apps/client/src/pages/builder/sidebars/left/dialogs/languages.tsx (1)

90-107: Well-implemented form field for single line toggle.

The FormField implementation is clear and follows the existing patterns in the form. The label accurately describes the feature's purpose.

Consider simplifying the onChange handler:

 onCheckedChange={(checked) => {
-  field.onChange((field.value = checked));
+  field.onChange(checked);
 }}

This is more in line with React Hook Form's typical patterns and avoids the side effect of assigning to field.value within the onChange call.

apps/artboard/src/templates/bronzor.tsx (1)

431-436: Consider potential CSS class conflict in single-line mode

Your implementation correctly uses the cn utility to combine classes, but there may be a conflict between space-y-0.5 (vertical spacing) and the single-line mode classes that include space-x-2 (horizontal spacing). When singleLine is true, you might want to conditionally exclude the vertical spacing class.

<div
  className={cn(
-   "space-y-0.5",
+   item.singleLine ? "" : "space-y-0.5",
    item.singleLine ? "flex flex-row items-center space-x-2" : "",
  )}
>
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cd21860 and 6a5282f.

📒 Files selected for processing (14)
  • apps/artboard/src/templates/azurill.tsx (1 hunks)
  • apps/artboard/src/templates/bronzor.tsx (1 hunks)
  • apps/artboard/src/templates/chikorita.tsx (1 hunks)
  • apps/artboard/src/templates/ditto.tsx (1 hunks)
  • apps/artboard/src/templates/gengar.tsx (1 hunks)
  • apps/artboard/src/templates/glalie.tsx (1 hunks)
  • apps/artboard/src/templates/kakuna.tsx (1 hunks)
  • apps/artboard/src/templates/leafish.tsx (1 hunks)
  • apps/artboard/src/templates/nosepass.tsx (1 hunks)
  • apps/artboard/src/templates/onyx.tsx (1 hunks)
  • apps/artboard/src/templates/pikachu.tsx (1 hunks)
  • apps/artboard/src/templates/rhyhorn.tsx (1 hunks)
  • apps/client/src/pages/builder/sidebars/left/dialogs/languages.tsx (2 hunks)
  • libs/schema/src/sections/language.ts (2 hunks)
🔇 Additional comments (14)
apps/artboard/src/templates/nosepass.tsx (1)

441-441: Conditional layout for single-line language display implemented correctly.

The implementation adds a conditional CSS class that changes the layout to a horizontal flex container when the singleLine flag is true, creating a space-efficient display format for language entries.

apps/artboard/src/templates/onyx.tsx (1)

430-435: Good use of the cn utility for conditional class combining.

The implementation properly maintains the base spacing class (space-y-0.5) while conditionally adding the flex layout classes when singleLine is true. Using the cn utility function is the right approach for combining multiple class conditions.

apps/artboard/src/templates/rhyhorn.tsx (1)

430-435: Consistent implementation of conditional layout classes.

This implementation follows the same pattern as the Onyx template, maintaining consistency in how the feature is implemented across similar templates. The base spacing is preserved with space-y-0.5 while adding flex layout when needed.

apps/artboard/src/templates/pikachu.tsx (1)

464-464: Simple and clean conditional layout implementation.

The implementation correctly adds the necessary flex layout classes when singleLine is true, matching the implementation style used in other templates like Nosepass.

libs/schema/src/sections/language.ts (2)

10-10: Good addition of singleLine property to the schema.

The new property uses z.coerce.boolean().default(false) which appropriately coerces values to boolean type and sets a sensible default.


22-22: Correctly initialized default property value.

The default value is properly added to the defaultLanguage object, maintaining consistency with the schema definition.

apps/artboard/src/templates/gengar.tsx (1)

436-436: Clean implementation of conditional styling for single line display.

The conditional class application using item.singleLine ? "flex flex-row items-center space-x-2" : "" is a good approach. When enabled, it creates a horizontal flex layout with appropriate spacing between elements.

apps/artboard/src/templates/kakuna.tsx (1)

396-396: Consistent implementation of single line styling.

This implementation matches the pattern used in other templates, maintaining consistency throughout the application.

apps/client/src/pages/builder/sidebars/left/dialogs/languages.tsx (1)

12-12: Correctly imported Switch component.

The Switch component is properly imported from the UI library.

apps/artboard/src/templates/leafish.tsx (1)

391-391: Clean implementation of the single-line option

The conditional class assignment is a clean approach to implementing the single-line display option for language items. This will allow users to choose between vertical stacking (default) or horizontal layout with proper spacing.

apps/artboard/src/templates/ditto.tsx (1)

458-458: Clean implementation of the single-line option

The conditional class assignment is an elegant solution for implementing the single-line display feature. It provides a consistent user experience across different resume templates.

apps/artboard/src/templates/azurill.tsx (1)

420-422: Good adaptation for the centered layout template

This implementation correctly adds the justify-center class, which is appropriate for the centered design of this template. The horizontal alignment matches the existing design patterns in the Azurill template.

apps/artboard/src/templates/glalie.tsx (1)

446-451: LGTM - Clean implementation of conditional layout.

The addition of conditional styling using the cn utility allows for flexible display of language items. When item.singleLine is true, the language name and description will display horizontally with appropriate spacing, otherwise they'll maintain the original vertical stacking.

apps/artboard/src/templates/chikorita.tsx (1)

431-436: LGTM - Consistent implementation across templates.

The change applies the same conditional styling pattern as in other templates, ensuring a uniform user experience. The implementation is clean and maintains backward compatibility while adding the new single-line display option.

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.

1 participant