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: new flag info box #9308

Merged
merged 9 commits into from
Feb 18, 2025
Merged

feat: new flag info box #9308

merged 9 commits into from
Feb 18, 2025

Conversation

Tymek
Copy link
Member

@Tymek Tymek commented Feb 13, 2025

  • updated spacing of elements
  • modified header and "flag type"
  • added "collaborators"
  • refactored tags

New design:
image

What's not done yet:

  • dropdown for environments visibility

Copy link

vercel bot commented Feb 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 18, 2025 9:13am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Visit Preview Feb 18, 2025 9:13am

Copy link
Contributor

github-actions bot commented Feb 13, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Files

Copy link
Contributor

@thomasheartman thomasheartman left a comment

Choose a reason for hiding this comment

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

Nice one! Got a couple questions and comments throughout but nothing blocking, so I'm gonna give this a ✅ and you can address them either now or later (or never if you disagree).

Regarding the screenies in the PR description: are the tags supposed to wrap like they do in the final, light screeshot? It looks a little weird to me that they're suddenly left-aligned. I don't expect we have sketches for that, so we should probably check in with UX.

Comment on lines +149 to +157
) : null}
{hasParentDependency && !feature.dependencies[0]?.enabled ? (
<StyledMetaDataItem>
<StyledMetaDataItemLabel>
Dependency value:
</StyledMetaDataItemLabel>
<span>disabled</span>
</StyledMetaDataItem>
) : null}
Copy link
Contributor

Choose a reason for hiding this comment

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

Not very important, but can we use && instead of ternaries in this file to get rid of all the : null? It's kinda distracting when there's this many of them, I think.

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't have reliable way of catching issues related to && operator. https://docs.getunleash.io/contributing/ADRs/front-end/jsx-conditionals#pitfalls-of--operator

</StyledMetaDataItemLabel>
<StyledMetaDataItemText data-loading>
{project}
{capitalizeFirst(type || '')} flag
Copy link
Contributor

Choose a reason for hiding this comment

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

This can also be done by CSS ::first-letter: { text-transform: uppercase } which will also capitalize "flag" if there is no type 💁🏼 Not important, but this feels more like a CSS thing to me 🤷🏼

Copy link
Member Author

@Tymek Tymek Feb 18, 2025

Choose a reason for hiding this comment

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

I'm using what we already have, plus I did not have good time debugging and finding what's causing changes when using :: pseudo-classes in the past.

<StyledMetaDataItem data-loading>
<StyledMetaDataItemText>
{description}
</StyledMetaDataItemText>
</StyledMetaDataItem>
}
/>
) : null}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same question regarding ternaries vs double ampersands. Wouldn't && be easier? But did we say not to use double ampersands?

@@ -99,80 +96,77 @@ export const TagRow = ({ feature }: IFeatureOverviewSidePanelTagsProps) => {
}
};

const addTagButton = (
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be a function component and rendered as <AddTagButton/> instead?

I thought of the "Never call function component functions directly" react docs, but this is a variable, so I'm not sure whether it applies here or not 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

This doesn't apply for things rendered into a variable. But thanks for pointing it out. I refactored it to a separate component

Comment on lines 116 to 122
<StyledMetaDataItem>
<StyledLabel>Tags:</StyledLabel>
<StyledTagContainer>{addTagButton}</StyledTagContainer>
</StyledMetaDataItem>
) : (
<StyledTagRow>
<StyledLabel>Tags:</StyledLabel>
Copy link
Contributor

Choose a reason for hiding this comment

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

Small point, but is there a reason why you swap out the metadata item container here?

In fact, I'd expect these two branches to be exactly the same: Container -> Label + Tag Container -> Tags + Button. So if the list of tags is empty, then tags.map gives you no components back and it'll still work.

Does that check out?

Copy link
Member Author

Choose a reason for hiding this comment

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

It didn't align tags properly, because we have 2 cases here: if tags fit in one line, keep it this way (aligned to the right), but if it doesn't fit - align to the left in starting from next line.
I'll spend 5min checking if I can make it work.

…tureOverviewMetaData/TagRow.tsx

Co-authored-by: Thomas Heartman <[email protected]>
@Tymek Tymek merged commit 2ede2a6 into main Feb 18, 2025
12 checks passed
@Tymek Tymek deleted the 1-3361 branch February 18, 2025 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants