Skip to content

Add image for clients with missing or unknown platform #30

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

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

Conversation

stintel
Copy link
Collaborator

@stintel stintel commented May 17, 2025

When running the UI in dev mode, having a client with missing or unknown platform causes an error. Add a fallback image to fix this.

Copy link
Contributor

@ciaranj ciaranj left a comment

Choose a reason for hiding this comment

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

Initially this looked out to me, although src={ClientImages[client.platform] ?? UnknownImage} and alt={client.platform || "Unknown device"} are subtly different. An invalid (from the perspective of the ClientImages constant) client.platform value will return the 'UnknownImage' image, but display the value of the client.platform variable. Only an undefined/null client.platform will display the 'Unknown Device' label. Was this your intent @stintel ?

edit: Which on further analysis checked the type of client.platform, looks non-nullable, so I don't think it's ever possible for 'unknown Device' to be shown.

@stintel
Copy link
Collaborator Author

stintel commented May 19, 2025

My intent was to fix the error. Probably didn't think hard enough about the implication of the alt change. Have any suggestions to make/keep things consistent?

@ciaranj
Copy link
Contributor

ciaranj commented May 19, 2025

My intent was to fix the error. Probably didn't think hard enough about the implication of the alt change. Have any suggestions to make/keep things consistent?

I guess something like: ClientImages[client.platform] ? client.platform : "Unknown device" would give you a consistent logic.

@stintel stintel force-pushed the feature/unknown_platform_image branch from a57ea60 to 7ec6658 Compare May 30, 2025 14:25
When running the UI in dev mode, having a client with missing or unknown
platform causes an error. Add a fallback image to fix this.
@stintel stintel force-pushed the feature/unknown_platform_image branch from 7ec6658 to 99f37f0 Compare May 30, 2025 14:29
@stintel stintel requested a review from ciaranj May 30, 2025 14:30
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