Skip to content
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

Adds a link to your profile + fixes a photo bug #59

Merged
merged 1 commit into from
Aug 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/global/header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,19 @@ function createUserMenuButton (label: string, onClick: EventListenerOrEventListe
return button
}

function createUserMenuLink (label: string, href: string): HTMLElement {
const link = document.createElement("a")
link.classList.add("header-user-menu__link")
link.href = href
link.innerText = label
return link
}

async function createUserMenu (store: IndexedFormula, user: NamedNode): Promise<HTMLElement> {
const outliner = panes.getOutliner(document)

const loggedInMenuList = document.createElement("ul")
loggedInMenuList.appendChild(createUserMenuItem(createUserMenuLink("Show your profile", user.uri)))
const menuItems = await getMenuItems(outliner)
menuItems.forEach(item => {
loggedInMenuList.appendChild(createUserMenuItem(createUserMenuButton(item.label, () => openDashboardPane(outliner, item.tabName || item.paneName))))
Expand Down
4 changes: 3 additions & 1 deletion src/styles/header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ $icon-size: 60px;
$image-margin: 5px;
$image-size: $icon-size - $image-margin * 2;
border-radius: 50%;
background-position: center;
background-repeat: no-repeat;
background-size: $image-size;
background-size: cover;
margin: $image-margin;
height: $image-size;
width: $image-size;
Expand All @@ -87,6 +88,7 @@ $icon-size: 60px;
&__trigger {
background: none;
border: 0;
cursor: pointer;
width: $icon-size;
height: $icon-size;
img {
Expand Down