Skip to content

Commit

Permalink
chore: strip ui elements
Browse files Browse the repository at this point in the history
  • Loading branch information
neurosnap committed Nov 9, 2022
1 parent ebb9d95 commit ebf6389
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 134 deletions.
22 changes: 0 additions & 22 deletions src/ui/shared/app-context-menu.tsx

This file was deleted.

11 changes: 0 additions & 11 deletions src/ui/shared/checkbox.tsx

This file was deleted.

22 changes: 0 additions & 22 deletions src/ui/shared/database-context-menu.tsx

This file was deleted.

31 changes: 0 additions & 31 deletions src/ui/shared/help-link.tsx

This file was deleted.

4 changes: 0 additions & 4 deletions src/ui/shared/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export * from "./external-link";
export * from "./banner";
export * from "./form-group";
export * from "./banner-messages";
export * from "./help-link";
export * from "./tokens";
export * from "./menu-button";
export * from "./detail-page-section";
Expand All @@ -22,11 +21,8 @@ export * from "./alert";
export * from "./aptible-logo";
export * from "./application-sidebar";
export * from "./settings-sidebar";
export * from "./app-context-menu";
export * from "./database-context-menu";
export * from "./endpoints-overview";
export * from "./progress";
export * from "./logout-button";
export * from "./logged-in-banner";
export * from "./app";
export * from "./db";
Expand Down
22 changes: 0 additions & 22 deletions src/ui/shared/logout-button.tsx

This file was deleted.

38 changes: 16 additions & 22 deletions src/ui/shared/user-menu.tsx
Original file line number Diff line number Diff line change
@@ -1,38 +1,32 @@
import { useNavigate } from "react-router";

import { logoutUrl, securitySettingsUrl, sshSettingsUrl } from "@app/routes";

import { useCurrentUser } from "../hooks";

import { tokens } from "./tokens";
import { Menu, MenuButton, MenuList, MenuItem } from "./menu-button";
import { Link } from "react-router-dom";

export const UserMenu = () => {
const { user, isLoading } = useCurrentUser();
const navigate = useNavigate();

if (isLoading || !user) {
return <>Loading...</>;
}

return (
<Menu>
<MenuButton>
<div className="flex-1">{user.name}</div>
</MenuButton>
<MenuList>
<div className="px-4 py-2">
<p className={tokens.type["small semibold darker"]}>{user.name}</p>
<p className={tokens.type["small lighter"]}>{user.email}</p>
</div>
<MenuItem onSelect={() => navigate(sshSettingsUrl())}>
SSH Keys
</MenuItem>
<MenuItem onSelect={() => navigate(securitySettingsUrl())}>
Security Settings
</MenuItem>
<MenuItem onSelect={() => navigate(logoutUrl())}>Logout</MenuItem>
</MenuList>
</Menu>
<div>
<div className="px-4 py-2">
<p className={tokens.type["small semibold darker"]}>{user.name}</p>
<p className={tokens.type["small lighter"]}>{user.email}</p>
</div>
<div>
<Link to={sshSettingsUrl()}>SSH Keys</Link>
</div>
<div>
<Link to={securitySettingsUrl()}>Security Settings</Link>
</div>
<div>
<Link to={logoutUrl()}>Logout</Link>
</div>
</div>
);
};

0 comments on commit ebf6389

Please sign in to comment.