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

add AppCard component #784

Merged
merged 19 commits into from
Nov 30, 2023
Merged

Conversation

KhudaDad414
Copy link
Member

@KhudaDad414 KhudaDad414 commented Sep 6, 2023

Description

  • Added AppCard component.
  • Change the dark background colour of the design system.
  • Modified ProtocolBadge so it exports Protocol type.

Related issue(s)
fixes #749

@changeset-bot
Copy link

changeset-bot bot commented Sep 6, 2023

🦋 Changeset detected

Latest commit: 7bf7d7e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@asyncapi/studio-ui Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link

netlify bot commented Sep 6, 2023

Deploy Preview for modest-rosalind-098b67 ready!

Name Link
🔨 Latest commit 7bf7d7e
🔍 Latest deploy log https://app.netlify.com/sites/modest-rosalind-098b67/deploys/656865d5c0cf8e00087e4c32
😎 Deploy Preview https://deploy-preview-784--modest-rosalind-098b67.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@netlify
Copy link

netlify bot commented Sep 6, 2023

Deploy Preview for asyncapi-studio-design-system ready!

Name Link
🔨 Latest commit 7bf7d7e
🔍 Latest deploy log https://app.netlify.com/sites/asyncapi-studio-design-system/deploys/656865d5594223000834aef2
😎 Deploy Preview https://deploy-preview-784--asyncapi-studio-design-system.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@fmvilas fmvilas left a comment

Choose a reason for hiding this comment

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

Lovely! Looks like in the design 🚀

Just left some comments.

packages/ui/components/AppCard.tsx Outdated Show resolved Hide resolved
packages/ui/tailwind.config.js Outdated Show resolved Hide resolved
@KhudaDad414 KhudaDad414 requested a review from fmvilas October 5, 2023 15:27
@KhudaDad414
Copy link
Member Author

@fmvilas another round of review 🙇

@fmvilas
Copy link
Member

fmvilas commented Oct 10, 2023

Badges separation between client and server, and the protocols are not the same. Please make it the same 🙏

Captura de pantalla 2023-10-10 a las 13 00 51

@KhudaDad414
Copy link
Member Author

@fmvilas done. but left the space between client/server badge and protocol badges to keep them separated.

Amzani
Amzani previously approved these changes Oct 16, 2023
Copy link
Collaborator

@Amzani Amzani left a comment

Choose a reason for hiding this comment

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

LGTM

@Amzani
Copy link
Collaborator

Amzani commented Oct 24, 2023

/au

@KhudaDad414 KhudaDad414 requested a review from Amzani November 2, 2023 15:47
Copy link
Member

@princerajpoot20 princerajpoot20 left a comment

Choose a reason for hiding this comment

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

Great work @KhudaDad414! 🚀 Just a few suggestions to consider.

packages/ui/components/AppCard.tsx Show resolved Hide resolved
packages/ui/components/AppCard.tsx Outdated Show resolved Hide resolved
packages/ui/components/AppCard.tsx Outdated Show resolved Hide resolved
{isServer && <ServiceInfoBadge info='server'/>}
</div>
}
{badges.map((badge, index) => (<ServiceInfoBadge info={badge} key={index} />))}
Copy link
Member

@princerajpoot20 princerajpoot20 Nov 22, 2023

Choose a reason for hiding this comment

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

Suggested change
{badges.map((badge, index) => (<ServiceInfoBadge info={badge} key={index} />))}
{Array.from(new Set(badges))
.filter(badge => validBadges.includes(badge))
.map((badge, index) => (<ServiceInfoBadge info={badge} key={`${badge}-${index}`} />))}
  • I noticed that invalid badges leave a blank space (reserved for that invalid badge).
    What do you think about adding a check for this also? If a badge is not valid, we could simply ignore it instead of reserving blank space.

For this, we need to add an export of the list of valid badges from ServiceInfoBadge

export const validBadges: Info[] = ['http', 'kafka', 'websocket', 'amqp', 'mqtt', 'googlepubsub', 'ibmmq', 'nats', 'pulsar', 'redis', 'sns', 'sqs', 'solace', 'stomp', 'client', 'server'];

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 are already marking it's type as Info[] so it will give error in Typescript. so I am more in favour of letting typescript give the error.

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I didn't get this, could you please explain that further.

Copy link
Member Author

Choose a reason for hiding this comment

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

@princerajpoot20 I mean Typescript doesn't allow invalid badges:

Screenshot 2023-11-29 at 16 33 31

Copy link
Member

Choose a reason for hiding this comment

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

@KhudaDad414 Okay, got it. Makes sense. 👍

{isServer && <ServiceInfoBadge info='server'/>}
</div>
}
{Array.from(new Set(badges)).map((badge, index) => (<ServiceInfoBadge info={badge} key={badge + index} aria-label={`Badge for ${badge}`} />))}
Copy link
Member

Choose a reason for hiding this comment

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

I would extract this to a variable so it's easier to understand. Above the return on line 14, I would add this:

const dedupedListOfBadges = Array.from(new Set(badges)).map((badge, index) => (<ServiceInfoBadge info={badge} key={badge + index} aria-label={`Badge for ${badge}`} />))

And then in this line I would just add {dedupedListOfBadges}. The code would be much more readable IMHO.

Copy link
Member

Choose a reason for hiding this comment

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

Also, for the aria-label, this is what a screen reader would say so imagine having 4 or 5 badges. The screen reader would say: "Badge for client, Badge for server, Badge for websocket, Badge for HTTP, Badge for kafka" 😅 Badge badge badge 😂

I suggest that we improve the root element aria-label with a better explanation and would mark all these badges with aria-hidden={true}. This way we can create a meaningful sentence like "This application is both a server and a client. It uses the WebSocket, HTTP, and Kafka protocols".

Suggested change
{Array.from(new Set(badges)).map((badge, index) => (<ServiceInfoBadge info={badge} key={badge + index} aria-label={`Badge for ${badge}`} />))}
{Array.from(new Set(badges)).map((badge, index) => (<ServiceInfoBadge info={badge} key={badge + index} aria-hidden={true} />))}

Then on line 17, we change it to:

aria-label={ariaLabel}

Where ariaLabel is something like "{name}. This application is active/inactive, and it's both a server and a client. It uses the WebSocket, HTTP, and Kafka protocols."

Note we're missing the description though. I'm not sure if a screen reader would read the paragraph below because it's not focusable. We should add https://storybook.js.org/addons/addon-screen-reader to Storybook so we can properly test what our users will experience using a screen reader.

Copy link
Member

Choose a reason for hiding this comment

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

I would extract this to a variable so it's easier to understand.

Agreed, extracting the badges list makes the code cleaner.

Also, for the aria-label, this is what a screen reader would say so imagine having 4 or 5 badges. The screen reader would say: "Badge for client, Badge for server, Badge for websocket, Badge for HTTP, Badge for kafka"

I see your point, and I agree. Right now, it is not a fit for 4-5 badges.

I suggest that we improve the root element aria-label with a better explanation and would mark all these badges with aria-hidden={true}. This way we can create a meaningful sentence like "This application is both a server and a client. It uses the WebSocket, HTTP, and Kafka protocols".
We should add https://storybook.js.org/addons/addon-screen-reader to Storybook so we can properly test what our users will experience using a screen reader.

Sounds perfect.

packages/ui/components/AppCard.tsx Outdated Show resolved Hide resolved
@KhudaDad414 KhudaDad414 requested a review from fmvilas November 30, 2023 10:37
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Member

@fmvilas fmvilas left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@KhudaDad414
Copy link
Member Author

/rtm

@asyncapi-bot asyncapi-bot merged commit 37bdfa0 into asyncapi:master Nov 30, 2023
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Visual Designer: Card component
5 participants