-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c3ca931
commit b2ad7ba
Showing
4 changed files
with
95 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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 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 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,72 @@ | ||
<script lang="ts"> | ||
import { _ } from "svelte-i18n"; | ||
import Dropdown, { closeDropdown } from "@/common/Dropdown2.svelte"; | ||
import SidebarItem from "../sidebar/SidebarItem.svelte"; | ||
import type { User } from "@/api/types"; | ||
import { | ||
ChevronDown16, | ||
Gear16, | ||
Paperclip16, | ||
SignOut16, | ||
} from "svelte-octicons"; | ||
import Menu from "@/common/Menu.svelte"; | ||
import { | ||
DC_BASE, | ||
DC_LOGIN, | ||
SQUARELET_BASE, | ||
SQUARELET_SIGNUP, | ||
DC_LOGOUT, | ||
} from "@/config/config.js"; | ||
export const SQUARELET_URL = SQUARELET_BASE; | ||
export const SIGN_IN_URL = DC_BASE + DC_LOGIN; | ||
export const SIGN_UP_URL = | ||
SQUARELET_BASE + | ||
SQUARELET_SIGNUP + | ||
encodeURIComponent(window.location.href); | ||
export const SIGN_OUT_URL = DC_BASE + DC_LOGOUT; | ||
export let user: User; | ||
const dropdownId = "user-menu"; | ||
function close() { | ||
closeDropdown(dropdownId); | ||
} | ||
</script> | ||
|
||
<Dropdown id={dropdownId} position="right"> | ||
<SidebarItem slot="title"> | ||
<img src={user.avatar_url} alt="Avatar" class="avatar" /> | ||
{user.name} | ||
<div class="dropdownArrow"><ChevronDown16 /></div> | ||
</SidebarItem> | ||
<Menu> | ||
<SidebarItem href={SQUARELET_URL} target="_blank" on:click={close}> | ||
<Gear16 /> | ||
{$_("authSection.user.acctSettings")} | ||
</SidebarItem> | ||
<!-- TODO mailkey page --> | ||
<SidebarItem hover on:click={close}> | ||
<Paperclip16 /> | ||
{$_("authSection.user.uploadEmail")} | ||
</SidebarItem> | ||
<SidebarItem href={SIGN_OUT_URL} on:click={close}> | ||
<SignOut16 /> | ||
{$_("authSection.user.signOut")} | ||
</SidebarItem> | ||
</Menu> | ||
</Dropdown> | ||
|
||
<style> | ||
.avatar { | ||
height: 1.5rem; | ||
width: 1.5rem; | ||
border-radius: 0.75rem; | ||
} | ||
.dropdownArrow { | ||
display: flex; | ||
align-items: center; | ||
} | ||
</style> |
This file contains 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