Upgrade react-zen and migrate UI components to its updated APIs
This commit is contained in:
1 parent
f054830292
commit
6ac2b9377c
83 files changed
+1337
-506
No files matched your search
@@ -34,6 +34,14 @@ export function TeamsButton() {
|
||||
return cloudMode ? `${process.env.cloudUrl}${url}` : url;
|
||||
};
|
||||
|
||||
const handleNavigate = (url: string) => {
|
||||
if (cloudMode) {
|
||||
window.location.href = url;
|
||||
} else {
|
||||
router.push(url);
|
||||
}
|
||||
};
|
||||
|
||||
const handleAction = async (key: Key) => {
|
||||
if (key === 'user') {
|
||||
removeItem(LAST_TEAM_CONFIG);
|
||||
@@ -63,18 +71,18 @@ export function TeamsButton() {
|
||||
<ChevronRight />
|
||||
</Icon>
|
||||
</Button>
|
||||
<Popover placement="bottom start">
|
||||
<Popover side="bottom" align="start">
|
||||
<Column minWidth="300px">
|
||||
<Menu selectionMode="single" selectedKeys={selectedKeys} onAction={handleAction}>
|
||||
<Menu selectionMode="single" selectedKeys={selectedKeys}>
|
||||
<MenuSection title={t(labels.myAccount)}>
|
||||
<MenuItem id="user">
|
||||
<MenuItem id="user" onAction={handleAction}>
|
||||
<IconLabel icon={<User />} label={user.username} />
|
||||
</MenuItem>
|
||||
</MenuSection>
|
||||
<MenuSeparator />
|
||||
<MenuSection title={t(labels.teams)}>
|
||||
{user?.teams?.map(({ id, name }) => (
|
||||
<MenuItem key={id} id={id} href={getUrl(`/teams/${id}`)}>
|
||||
<MenuItem key={id} id={id} onAction={() => handleNavigate(getUrl(`/teams/${id}`))}>
|
||||
<IconLabel icon={<Users />}>
|
||||
<Text wrap="nowrap">{name}</Text>
|
||||
</IconLabel>
|
||||
|
||||
Reference in new issue
Block a user