-
Notifications
You must be signed in to change notification settings - Fork 3.3k
fix(landing): ui #2979
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
Merged
Merged
fix(landing): ui #2979
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 39 additions & 12 deletions
51
apps/sim/app/(landing)/components/hero/components/landing-canvas/landing-block/tag.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,25 +1,52 @@ | ||||||||||||||||||||
| import React from 'react' | ||||||||||||||||||||
|
|
||||||||||||||||||||
| /** | ||||||||||||||||||||
| * Properties for a tag component | ||||||||||||||||||||
| * Properties for a subblock row component | ||||||||||||||||||||
| * Matches the SubBlockRow pattern from workflow-block.tsx | ||||||||||||||||||||
| */ | ||||||||||||||||||||
| export interface TagProps { | ||||||||||||||||||||
| /** Icon element to display in the tag */ | ||||||||||||||||||||
| icon: React.ReactNode | ||||||||||||||||||||
| /** Text label for the tag */ | ||||||||||||||||||||
| export interface SubBlockRowProps { | ||||||||||||||||||||
| /** Icon element to display (optional, for visual context) */ | ||||||||||||||||||||
| icon?: React.ReactNode | ||||||||||||||||||||
| /** Text label for the row title */ | ||||||||||||||||||||
| label: string | ||||||||||||||||||||
| /** Optional value to display on the right side */ | ||||||||||||||||||||
| value?: string | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| /** | ||||||||||||||||||||
| * Tag component for displaying labeled icons in a compact format | ||||||||||||||||||||
| * @param props - Tag properties including icon and label | ||||||||||||||||||||
| * @returns A styled tag component | ||||||||||||||||||||
| * Kept for backwards compatibility | ||||||||||||||||||||
| */ | ||||||||||||||||||||
| export const Tag = React.memo(function Tag({ icon, label }: TagProps) { | ||||||||||||||||||||
| export type TagProps = SubBlockRowProps | ||||||||||||||||||||
|
|
||||||||||||||||||||
| /** | ||||||||||||||||||||
| * SubBlockRow component matching the workflow block's subblock row style | ||||||||||||||||||||
| * @param props - Row properties including label and optional value | ||||||||||||||||||||
| * @returns A styled row component | ||||||||||||||||||||
| */ | ||||||||||||||||||||
| export const SubBlockRow = React.memo(function SubBlockRow({ label, value }: SubBlockRowProps) { | ||||||||||||||||||||
| // Split label by colon to separate title and value if present | ||||||||||||||||||||
| const [title, displayValue] = label.includes(':') | ||||||||||||||||||||
| ? label.split(':').map((s) => s.trim()) | ||||||||||||||||||||
| : [label, value] | ||||||||||||||||||||
|
Comment on lines
+26
to
+30
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic: simplified label splitting logic loses flexibility The current implementation always splits on the first colon, which means labels like
Suggested change
Prompt To Fix With AIThis is a comment left during a code review.
Path: apps/sim/app/(landing)/components/hero/components/landing-canvas/landing-block/tag.tsx
Line: 26:30
Comment:
**logic:** simplified label splitting logic loses flexibility
The current implementation always splits on the first colon, which means labels like `"Time: 09:00AM: Daily"` would split incorrectly. Consider using `split(':', 2)` pattern or limit to first occurrence only.
```suggestion
const colonIndex = label.indexOf(':')
const [title, displayValue] = colonIndex !== -1
? [label.slice(0, colonIndex).trim(), label.slice(colonIndex + 1).trim()]
: [label, value]
```
How can I resolve this? If you propose a fix, please make it concise. |
||||||||||||||||||||
|
|
||||||||||||||||||||
| return ( | ||||||||||||||||||||
| <div className='flex w-fit items-center gap-1 rounded-[8px] border border-gray-300 bg-white px-2 py-0.5'> | ||||||||||||||||||||
| <div className='h-3 w-3 text-muted-foreground'>{icon}</div> | ||||||||||||||||||||
| <p className='text-muted-foreground text-xs leading-normal'>{label}</p> | ||||||||||||||||||||
| <div className='flex items-center gap-[8px]'> | ||||||||||||||||||||
| <span className='min-w-0 truncate text-[#888888] text-[14px] capitalize' title={title}> | ||||||||||||||||||||
| {title} | ||||||||||||||||||||
| </span> | ||||||||||||||||||||
| {displayValue && ( | ||||||||||||||||||||
| <span | ||||||||||||||||||||
| className='flex-1 truncate text-right text-[#171717] text-[14px]' | ||||||||||||||||||||
| title={displayValue} | ||||||||||||||||||||
| > | ||||||||||||||||||||
| {displayValue} | ||||||||||||||||||||
| </span> | ||||||||||||||||||||
| )} | ||||||||||||||||||||
| </div> | ||||||||||||||||||||
| ) | ||||||||||||||||||||
| }) | ||||||||||||||||||||
|
|
||||||||||||||||||||
| /** | ||||||||||||||||||||
| * Tag component - alias for SubBlockRow for backwards compatibility | ||||||||||||||||||||
| */ | ||||||||||||||||||||
| export const Tag = SubBlockRow | ||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
style:
iconprop declared in interface but not used in component - destructure it if intended for display or remove from interfacePrompt To Fix With AI