Skip to content

Commit

Permalink
Add burger menu to the header (#401)
Browse files Browse the repository at this point in the history
* Add burger menu to the header

* Update src/components/app-bar/AppBar.svelte

Co-authored-by: Tom Adler <[email protected]>

* Update src/components/app-bar/BurgerMenu.svelte

Co-authored-by: Tom Adler <[email protected]>

* Update src/components/app-bar/BurgerMenu.svelte

Co-authored-by: Tom Adler <[email protected]>

* Address PR suggestions

* Minor change

* Update src/components/app-bar/BurgerMenu.svelte

Co-authored-by: Tom Adler <[email protected]>

* Update src/components/app-bar/BurgerMenu.svelte

Co-authored-by: Tom Adler <[email protected]>

* Address PR comments

---------

Co-authored-by: BlertaGalani <[email protected]>
Co-authored-by: Tom Adler <[email protected]>
  • Loading branch information
3 people authored Jan 8, 2025
1 parent 960c795 commit 58ed6ab
Show file tree
Hide file tree
Showing 9 changed files with 122 additions and 54 deletions.
2 changes: 1 addition & 1 deletion src/components/Footer/Footer.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import LogoBountyManagerDesktop from '../svg/header-footer-logos/LogoBountyManagerDesktop.svg';
import LogoBountyManagerDesktop from './LogoBountyManagerFooter.svg';
import LogoTelegram from './LogoTelegram.svg';
import LogoEmail from './LogoEmail.svg';
import LogoPolkadot from './LogoPolkadot.svg';
Expand Down
Binary file not shown.
24 changes: 24 additions & 0 deletions src/components/Typography/Typography.css
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,27 @@
font-family: 'Overpass', sans-serif;
font-optical-sizing: auto;
}

/* https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,[email protected],100..700,0..1,-50..200&icon_names=add,close,logout,menu */

@font-face {
font-family: 'Material Symbols Rounded';
font-style: normal;
font-weight: 100 700;
src: url(MaterialSymbolsRounded.woff2) format('woff2');
}

.material-symbols-rounded {
font-family: 'Material Symbols Rounded';
font-weight: normal;
font-style: normal;
font-size: 24px;
line-height: 1;
letter-spacing: normal;
text-transform: none;
white-space: nowrap;
word-wrap: normal;
direction: ltr;
-webkit-font-feature-settings: 'liga';
-webkit-font-smoothing: antialiased;
}
40 changes: 11 additions & 29 deletions src/components/app-bar/AppBar.svelte
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
<script lang="ts">
import { onMount } from 'svelte';
import {
activeAccount,
activeAccountBounties,
polkadotSigner,
walletConnect
} from '../../stores';
import { activeAccount, polkadotSigner } from '../../stores';
import { truncateString } from '../../utils/common';
import PolkadotIcon from '../common/PolkadotIcon.svelte';
import LogoBountyManagerDesktop from '../svg/header-footer-logos/LogoBountyManagerDesktop.svg';
import LogoBountyManagerMobile from '../svg/header-footer-logos/LogoBountyManagerMobile.svg';
import LogoBountyManagerHeader from './LogoBountyManagerHeader.svg';
import LoginDialog from './LoginDialog.svelte';
import { setActiveAccountBounties } from '../../utils/bounties';
import { getAccounts } from './getAccounts';
import { type AccountInfo } from '../../types/account';
import BurgerMenu from './BurgerMenu.svelte';
let loginDialogOpen = false;
Expand Down Expand Up @@ -43,44 +38,31 @@
polkadotSigner.set(account.polkadotSigner);
setActiveAccountBounties();
});
async function logOut() {
activeAccount.set(undefined);
sessionStorage.clear();
activeAccountBounties.set([]);
await $walletConnect?.disconnect();
}
</script>

<header
class="relative flex items-center justify-between h-20 bg-primary px-4 sm:px-12 overflow-clip"
>
<div class="md:absolute md:left-1/2 md:transform md:-translate-x-1/2 pt-2">
<a href="/curator-actions" class="hidden md:inline-flex">
<img width="307" height="62" src={LogoBountyManagerDesktop} alt="Logo" />
</a>
<a href="/curator-actions" class="md:hidden">
<img width="71" height="54" src={LogoBountyManagerMobile} alt="Logo" />
<header class="relative flex items-center justify-between min-h-20 bg-primary px-4 sm:px-12">
<div>
<a href="/curator-actions">
<img width="71" height="54" src={LogoBountyManagerHeader} alt="Logo Bounty Manager" />
</a>
</div>

<div class="ml-auto">
<div>
{#if !$activeAccount}
<button class=" text-white" on:click={showLoginDialog}>Connect Wallet</button>

<w3m-button></w3m-button>
{:else}
<div class="flex items-center space-x-3">
<!-- User Address -->
<div class="flex items-center align-top space-x-3">
<div class=" flex gap-2 items-center text-white">
<div class="w-6 h-6">
<PolkadotIcon address={$activeAccount.address} />
</div>
{$activeAccount.name || 'Account'}
<span class="text-darkgray text-sm">[{truncateString($activeAccount.address, 4)}]</span>
</div>
<button on:click={() => logOut()} class="mt-2">
<span class="material-symbols-outlined text-white text-2xl">logout</span>
</button>
<BurgerMenu />
</div>
{/if}
</div>
Expand Down
85 changes: 85 additions & 0 deletions src/components/app-bar/BurgerMenu.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<script lang="ts">
import {
activeAccount,
activeAccountBounties,
walletConnect as wcConnection
} from '../../stores';
import { onMount } from 'svelte';
let open = false;
let container: HTMLDivElement | null = null;
$: {
if (open) {
window.addEventListener('click', closeMenuOnOutsideClick);
} else {
window.removeEventListener('click', closeMenuOnOutsideClick);
}
}
async function logOut() {
activeAccount.set(undefined);
sessionStorage.clear();
activeAccountBounties.set([]);
if ($wcConnection) {
await $wcConnection.disconnect();
}
open = false;
}
function closeMenuOnOutsideClick(event: MouseEvent) {
if (!container?.contains(event.target as Node)) {
open = false;
}
}
onMount(() => {
return () => {
window.removeEventListener('click', closeMenuOnOutsideClick);
};
});
</script>

<div bind:this={container} class="relative">
<!-- Burger Menu Icon -->
<button
on:click={() => {
open = !open;
}}
>
<span class="material-symbols-rounded text-white"> menu </span>
</button>

<!-- Menu Overlay -->
{#if open}
<div
class="absolute top-0 right-0 flex flex-col items-start bg-backgroundContent border shadow-lg p-2.5 rounded-md w-[210px]"
>
<button
on:click={() => {
open = false;
}}
class="self-end mr-2.5 mb-1"
>
<span class="material-symbols-rounded text-accent"> close </span>
</button>
<a
on:click={() => {
open = false;
}}
href="/bounty-setup"
class="bg-accent text-white p-2.5 mb-2 rounded-md w-[189px] flex justify-between items-center"
>
<span class="mt-1">Create new bounty</span>
<span class="material-symbols-rounded"> add </span>
</a>
<button
on:click={logOut}
class="text-primary p-2.5 rounded-md w-[189px] flex justify-between items-center"
>
<span class="mt-1">Log out</span>
<span class="material-symbols-rounded"> logout </span>
</button>
</div>
{/if}
</div>
23 changes: 0 additions & 23 deletions src/components/curator-actions/CuratorActions.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,6 @@
data-pagination-scroll="parent-bounty-list"
>
<div class="w-full rounded-md px-3 py-6 sm:px-12 sm:pt-2 sm:pb-2">
<div class="actions-container flex justify-between lg:px-8 lg:py-6 items-center rounded-md">
<div class="hidden space-x-5 items-center lg:inline-flex">
<h2 class="title mt-1 text-3xl text-white">Create new bounty here</h2>
<span class="material-symbols-outlined text-white text-xl"> arrow_forward_ios </span>
</div>
<a
href="/bounty-setup"
class="link-button border-accent bg-accent rounded-md w-full h-12 lg:max-w-64 text-white font-bold self-center"
>
NEW BOUNTY
</a>
</div>

<div class="min-h-[70vh]">
{#if !$activeAccount}
<div class="text-white flex justify-center mt-20">
Expand Down Expand Up @@ -107,13 +94,3 @@
</div>
</div>
</div>

<style>
.actions-container {
background-color: #836fac40;
}
.title {
font-weight: 300;
}
</style>
2 changes: 1 addition & 1 deletion src/routes/bounty-setup/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<div class="container setup-container max-w-screen-lg rounded-md p-4 space-y-5">
<h2 class="font-bold text-lg sm:text-2xl text-white text-start">Bounty Setup</h2>
<div class="border border-accent rounded-md overflow-clip">
<div class="flex relative h-16 sm:h-20 px-2 md:px-8 bg-primary rounded-md">
<div class="flex h-16 sm:h-20 px-2 md:px-8 bg-primary rounded-md">
<div class="w-1/3 md:w-1/6">
<BountySetupTab href="/bounty-setup">Creation</BountySetupTab>
</div>
Expand Down

0 comments on commit 58ed6ab

Please sign in to comment.