-
Notifications
You must be signed in to change notification settings - Fork 939
feat: add list of user's groups to Accounts page #10522
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
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
00d819f
chore: add query for a user's groups
Parkreiner 1d646eb
chore: integrate user groups into UI
Parkreiner 024879d
refactor: split UI card into separate component
Parkreiner 102b1e0
chore: enforce alt text for AvatarCard
Parkreiner e8c713c
chore: add proper alt text support for Avatar
Parkreiner 22e9573
fix: update props for Avatar call sites
Parkreiner acf2500
finish AccountPage changes
Parkreiner f4b9a63
wip: commit progress on AvatarCard
Parkreiner 426260d
fix: add better UI error handling
Parkreiner fecf41e
fix: update theme setup for AvatarCard
Parkreiner 831d110
fix: update styling for AccountPage
Parkreiner 69fab82
fix: make error message conditional
Parkreiner f7cffd1
chore: update styling for AvatarCard
Parkreiner 2e43d5f
chore: finish AvatarCard
Parkreiner 7c322fa
fix: add maxWidth support to AvatarCard
Parkreiner b92c5f7
chore: update how no max width is defined
Parkreiner d5b5323
chore: add AvatarCard stories
Parkreiner 43ae56b
fix: remove incorrect semantics for AvatarCard
Parkreiner ba57fff
docs: add comment about flexbox behavior
Parkreiner 387c033
docs: add clarifying text about prop
Parkreiner 7dcddbf
fix: fix grammar for singular groups
Parkreiner 68ae492
refactor: split off AccountUserGroups and add story
Parkreiner d56a9cc
fix: differentiate mock groups more
Parkreiner 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { type Meta, type StoryObj } from "@storybook/react"; | ||
import { AvatarCard } from "./AvatarCard"; | ||
|
||
const meta: Meta<typeof AvatarCard> = { | ||
title: "components/AvatarCard", | ||
component: AvatarCard, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof AvatarCard>; | ||
|
||
export const WithImage: Story = { | ||
args: { | ||
header: "Coder", | ||
imgUrl: "https://avatars.githubusercontent.com/u/95932066?s=200&v=4", | ||
altText: "Coder", | ||
subtitle: "56 members", | ||
}, | ||
}; | ||
|
||
export const WithoutImage: Story = { | ||
args: { | ||
header: "Patrick Star", | ||
subtitle: "Friends with 723 people", | ||
}, | ||
}; | ||
|
||
export const WithoutSubtitleOrImage: Story = { | ||
args: { | ||
header: "Sandy Cheeks", | ||
}, | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import { type ReactNode } from "react"; | ||
import { Avatar } from "components/Avatar/Avatar"; | ||
import { type CSSObject, useTheme } from "@emotion/react"; | ||
import { colors } from "theme/colors"; | ||
|
||
type AvatarCardProps = { | ||
header: string; | ||
imgUrl: string; | ||
altText: string; | ||
|
||
subtitle?: ReactNode; | ||
maxWidth?: number | "none"; | ||
}; | ||
|
||
export function AvatarCard({ | ||
header, | ||
imgUrl, | ||
altText, | ||
subtitle, | ||
maxWidth = "none", | ||
}: AvatarCardProps) { | ||
const theme = useTheme(); | ||
|
||
return ( | ||
<div | ||
css={{ | ||
maxWidth: maxWidth === "none" ? undefined : `${maxWidth}px`, | ||
display: "flex", | ||
flexFlow: "row nowrap", | ||
alignItems: "center", | ||
border: `1px solid ${theme.palette.divider}`, | ||
gap: "16px", | ||
padding: "16px", | ||
borderRadius: "8px", | ||
cursor: "default", | ||
}} | ||
> | ||
{/** | ||
* minWidth is necessary to ensure that the text truncation works properly | ||
* with flex containers that don't have fixed width | ||
* | ||
* @see {@link https://css-tricks.com/flexbox-truncated-text/} | ||
*/} | ||
<div css={{ marginRight: "auto", minWidth: 0 }}> | ||
<h3 | ||
// Lets users hover over truncated text to see whole thing | ||
title={header} | ||
css={[ | ||
theme.typography.body1 as CSSObject, | ||
{ | ||
lineHeight: 1.4, | ||
margin: 0, | ||
overflow: "hidden", | ||
whiteSpace: "nowrap", | ||
textOverflow: "ellipsis", | ||
}, | ||
]} | ||
> | ||
{header} | ||
</h3> | ||
|
||
{subtitle && ( | ||
<div | ||
css={[ | ||
theme.typography.body2 as CSSObject, | ||
{ color: theme.palette.text.secondary }, | ||
]} | ||
> | ||
{subtitle} | ||
</div> | ||
)} | ||
</div> | ||
|
||
<Avatar | ||
src={imgUrl} | ||
alt={altText} | ||
size="md" | ||
css={{ backgroundColor: colors.gray[7] }} | ||
> | ||
{header} | ||
</Avatar> | ||
</div> | ||
); | ||
} |
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
49 changes: 32 additions & 17 deletions
49
site/src/pages/UserSettingsPage/AccountPage/AccountPage.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
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.
Uh oh!
There was an error while loading. Please reload this page.