Skip to content
This repository has been archived by the owner on Feb 25, 2024. It is now read-only.

Use loggedInUserData for Avatar props #149

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

Andarist
Copy link
Member

@Andarist Andarist commented Aug 4, 2021

It's a follow up to #110 (comment)

@vercel
Copy link

vercel bot commented Aug 4, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/statelyai/xstate-viz/DtUvrUdXSdAGfsUmxEFMANVsQRdg
✅ Preview: https://xstate-viz-git-andarist-use-logged-in-user-data-statelyai.vercel.app

src/Login.tsx Outdated
session?.user?.user_metadata?.full_name ||
session?.user?.user_metadata?.user_name
}
src={loggedInUserData!.avatarUrl || undefined}
Copy link
Member

Choose a reason for hiding this comment

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

When is it possible that this can be undefined?

Copy link
Member Author

Choose a reason for hiding this comment

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

If we assume that we only support GitHub-authorized users - then never. I think GitHub always provides an avatar for us - even if it's a default one. I've actually created a fresh user the other day for testing purposes and the avatar was in its data right from the beginning.

If we don't make that assumption though... this could happen. It's more a future-proof thing rather than a necessity for the current state of things.

Comment on lines +49 to +50
src={loggedInUserData.avatarUrl || undefined}
name={loggedInUserData.displayName || undefined}
Copy link
Member Author

Choose a reason for hiding this comment

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

I've checked the implementation of Avatar.

  1. src is not required - "initials" are rendered if you don't provide src
  2. initials require name though - if it's not provided a default icon is used instead

I would actually probably prefer using a fallback icon at all times, wdyt?

Copy link
Member

Choose a reason for hiding this comment

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

Fallback icon is fine 👍

@mattpocock
Copy link
Contributor

@Andarist Anything preventing this being merged? Other than the conflicts

@mattpocock mattpocock changed the base branch from main to dev September 1, 2021 08:46
@changeset-bot
Copy link

changeset-bot bot commented Sep 1, 2021

⚠️ No Changeset found

Latest commit: fc254bd

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@mattpocock
Copy link
Contributor

Merged conflicts, should be fine to go in

@Andarist
Copy link
Member Author

Andarist commented Sep 1, 2021

@mattpocock I'll handle this soon-ish. It's just so low priority that it got pushed down on my priority list - since I still want to do some minor changes here

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants