Skip to content

Commit

Permalink
draft hub portal
Browse files Browse the repository at this point in the history
  • Loading branch information
clbrge committed Oct 30, 2023
1 parent 989dad3 commit cd8c0ca
Show file tree
Hide file tree
Showing 12 changed files with 426 additions and 0 deletions.
75 changes: 75 additions & 0 deletions src/components/Notifications.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<script>
import notifier from '$stores/notifier'
//import settings from '$stores/settings'
export let show = true // $settings.notify
const handleDismiss = (message) => {
notifier.dismiss(message)
// guard to close popup when there are no more messages
if ($notifier.length === 0) {
//show = false
}
}
const toggle = () => {
// don't show popup when no messages
if ($notifier.length === 0) {
show = false
} else {
show = !show
}
}
const clearAll = () => {
notifier.clear()
}
// TODO auto disappear notify
</script>

<ul class="notifications">
{#each $notifier as message}
<li>
<div class="notification is-warning">
<button class="delete" on:click={() => handleDismiss(message)} />
<p>{message.title}</p>
{#if message.htmlDeck}
<p>{@html message.htmlDeck}</p>
{:else}
<p>{message.deck}</p>
{/if}
</div>
</li>
{/each}
</ul>

{#if false && $notifier.length > 1}
<button class="" on:click={clearAll}>Clear all</button>
{/if}

<style lang="scss">
.notifications {
padding: 0;
margin: 0;
list-style-type: none;
position: fixed;
z-index: 10000;
left: 0.5em;
top: 0.5em;
li {
width: 320px;
margin-bottom: 0.5em;
p {
margin: 0;
margin-bottom: 0.2em;
overflow: hidden;
a {
color: inherit;
}
}
}
}
</style>
15 changes: 15 additions & 0 deletions src/icons/ethereum.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/icons/optimism.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions src/icons/strings.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@

export const ethereum = `<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="100%" height="100%" version="1.1" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" image-rendering="optimizeQuality" fill-rule="evenodd" clip-rule="evenodd" viewBox="0 0 784.37 1277.39" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xodm="http://www.corel.com/coreldraw/odm/2003">
<g id="Layer_x0020_1">
<metadata id="CorelCorpID_0Corel-Layer"/>
<g id="_1421394342400">
<g>
<polygon fill="#343434" fill-rule="nonzero" points="392.07,0 383.5,29.11 383.5,873.74 392.07,882.29 784.13,650.54 "/>
<polygon fill="#8C8C8C" fill-rule="nonzero" points="392.07,0 -0,650.54 392.07,882.29 392.07,472.33 "/>
<polygon fill="#3C3C3B" fill-rule="nonzero" points="392.07,956.52 387.24,962.41 387.24,1263.28 392.07,1277.38 784.37,724.89 "/>
<polygon fill="#8C8C8C" fill-rule="nonzero" points="392.07,1277.38 392.07,956.52 -0,724.89 "/>
<polygon fill="#141414" fill-rule="nonzero" points="392.07,882.29 784.13,650.54 392.07,472.33 "/>
<polygon fill="#393939" fill-rule="nonzero" points="0,650.54 392.07,882.29 392.07,472.33 "/>
</g>
</g>
</g>
</svg>`

export const optimism = `<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 500 500" style="enable-background:new 0 0 500 500;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FF0420;}
.st1{fill:#FFFFFF;}
</style>
<circle class="st0" cx="250" cy="250" r="250"/>
<path class="st1" d="M177.1,316.4c-14.9,0-27.1-3.5-36.6-10.5c-9.4-7.1-14.1-17.3-14.1-30.4c0-2.8,0.3-6.1,0.9-10.1 c1.6-9,3.9-19.8,6.9-32.5c8.5-34.4,30.5-51.6,65.9-51.6c9.6,0,18.3,1.6,25.9,4.9c7.6,3.1,13.6,7.9,18,14.3 c4.4,6.3,6.6,13.8,6.6,22.5c0,2.6-0.3,5.9-0.9,9.9c-1.9,11.1-4.1,22-6.8,32.5c-4.4,17.1-11.9,30-22.7,38.5 C209.5,312.3,195.1,316.4,177.1,316.4z M179.8,289.4c7,0,12.9-2.1,17.8-6.2c5-4.1,8.6-10.4,10.7-19c2.9-11.8,5.1-22,6.6-30.8 c0.5-2.6,0.8-5.3,0.8-8.1c0-11.4-5.9-17.1-17.8-17.1c-7,0-13,2.1-18,6.2c-4.9,4.1-8.4,10.4-10.5,19c-2.3,8.4-4.5,18.6-6.8,30.8 c-0.5,2.5-0.8,5.1-0.8,7.9C161.7,283.7,167.8,289.4,179.8,289.4z"/>
<path class="st1" d="M259.3,314.6c-1.4,0-2.4-0.4-3.2-1.3c-0.6-1-0.8-2.1-0.6-3.4l25.9-122c0.2-1.4,0.9-2.5,2.1-3.4 c1.1-0.9,2.3-1.3,3.6-1.3H337c13.9,0,25,2.9,33.4,8.6c8.5,5.8,12.8,14.1,12.8,25c0,3.1-0.4,6.4-1.1,9.8c-3.1,14.4-9.4,25-19,31.9 c-9.4,6.9-22.3,10.3-38.7,10.3h-25.3l-8.6,41.1c-0.3,1.4-0.9,2.5-2.1,3.4c-1.1,0.9-2.3,1.3-3.6,1.3H259.3z M325.7,242.9 c5.3,0,9.8-1.4,13.7-4.3c4-2.9,6.6-7,7.9-12.4c0.4-2.1,0.6-4,0.6-5.6c0-3.6-1.1-6.4-3.2-8.3c-2.1-2-5.8-3-10.9-3h-22.5l-7.1,33.6 H325.7z"/>
</svg>`


export const metisBlack = `<svg xml:space="preserve" style="enable-background:new 0 0 1080 1080" version="1.0" viewBox="0 0 1080 1080" xmlns="http://www.w3.org/2000/svg">
<path d="M824.3 429.4C821.1 271 689 145.5 530.1 151 375 156.3 252.3 286.2 255.7 441.4c2.5 114.7 72.5 212 171.3 254.9 14-17.8 25.7-49.8 31.5-67.7 5.8-14.6 12-28.8 18.4-42.6 28.9 10.1 67.6.5 88.8-22.5l.8-.9h-.1c-25.7-11.2-61.1-5.4-84.4 12.7 8-16.5 16.4-32.4 25.2-47.7 28.4 11.4 67.5 3.6 89.7-18.4l.9-.9h-.1c-24.8-12.2-59.7-8.4-83.8 7.9 8.8-14.6 17.9-28.7 27.5-42.1 29.4 9.1 68.1-2.1 88.4-26.3l.8-1h-.1c-24-9.2-55.4-3.8-77.8 11.8.8-1.1 1.6-2.1 2.4-3.2 5.7-7.5 11.6-14.7 17.5-21.8 34.7-9.9 65.7-45.2 70.6-81.8l.2-1.5h-.1c-35.9 7.2-69.2 42.5-75.8 79.9-5.7 6.8-11.3 13.7-16.8 20.9 9-24.4 7.4-53.9-5.7-74.3l-.1-.1-.8 1c-19.8 25-22.9 65.7-7.6 92.7-9 12.7-17.7 26-26.1 39.8 5.3-27.6-3.6-59.7-23-77.8l-.1-.1-.5 1.1c-12.8 28.8-5.9 68.6 15.2 91-8.3 14.5-16.3 29.5-23.9 45 4.6-28.7-5.7-62-26.3-80l-.1-.1-.5 1.2c-11.7 30.3-2.7 71.2 20 93.1-4.9 10.6-9.7 21.5-14.3 32.5-1.1-1.1-2.5-2-4.2-2.5-5.9-1.7-14.1-4.8-23.1-10.2-6-3.6-12.3-6.5-18.9-8.6-25.6-8.4-21.9-20.8-35.3-45.5-.9-1.6-11.5-12.7-13.7-14.7-.6-.5-7.3-4.4-10.8-11.7-3.1-6.6-4.9-12.8-5.6-18.8-.9-8.1-4.2-13.4-12.1-16.1-37.7-13.1-20.9-62-19.5-68.6 1.1-5.6-3.7-17.7-5.5-24.3-.2-.8-.4-1.8-.6-3-2.7-13.1 3.4-24.3 7.9-28.8 4.5-4.6 20.2-11.9 23.5-16.2 3.2-4.2 5.8-9 9.1-13.1 4.4-5.5 17.9-16.2 36-25.9 11-5.9 12.9-21.2 17.1-26 7.2-8.1 18-8.1 26.1-15.3 4.1-3.7 10-5.5 13.7-9.4 18.7-19.2 43.8-26.9 68.6-31.6 16.7-3.1 35.3 1.7 52.8 4.7 2.6.4 5 1.1 7.4 1.7 39.2 1.3 86.4 9.5 103.4 26.1 10.6 10.4 15.8 21.7 18.4 29.5 2.8 8.7 6.7 17 11.5 24.8l10.5 17.1c6.6 10.8 8.8 23.8 6 36.1-1.6 7-2.5 14.4-.4 18.5 3.3 6.4 13.3 16.8 19.4 22.8 2.9 2.9 6.1 5.4 9.6 7.6 8.1 5.1 23.4 14.9 23.4 15.7 0 1.1 1.3 6-5.5 11.9s-19.5 15.2-19.5 15.2.7 4.3 2.5 7.7c1.8 3.4 6.2 8.5 4.9 13.1-1.3 4.6-10.7 8.3-8.1 13.4 2.7 5.1 9.3 6.7 7.4 11.3-1.9 4.6-11.2 12.6-10.3 16 .9 3.4 8.5 35.1-8.9 40.7-13.1 4.2-49.1 6.5-66.1 7.4-7.3.4-13.9 4.5-17.4 10.9-2.6 4.8-5.2 11.4-6.5 20.3-3.3 22.5-25.5 74-25.5 74s-.7 1.3-1.7 3.5c-1.9 4.7-4.7 12-4.3 14.9.3 1.9 2.9 5.7 6.7 10.2 3 3.6 8 5 12.5 3.5 114.2-38.9 195.1-148.1 192.5-275z" style="fill:#00dacc"/>
<path d="M140 804.3h29.2l32.4 52.1 32.4-52.1h29.2v123.1h-26.9V847l-34.7 52.6h-.7l-34.3-52.1v79.9H140V804.3zm219.5 0h92.9v24.1h-66v25h58v24.1h-58v25.9h66.8v24.1h-93.8V804.3zm213.4 25h-37.5v-25h102v25H600v98.2h-27.1v-98.2zm153.4-25h27.1v123.1h-27.1V804.3zm116.3 105.2 16-19.2c11.3 9.1 22.7 15 36.8 15 11.3 0 17.8-4.4 17.8-11.6v-.4c0-6.9-4.2-10.6-24.8-15.7-25-6.2-40.8-13.4-40.8-37.6v-.4c0-22.3 17.8-37.1 43.1-37.1 18.1 0 33.1 5.6 45.7 15.7l-14.1 20.4c-11.1-7.6-21.5-12.1-32-12.1-10.6 0-15.8 4.6-15.8 10.7v.4c0 8.3 5.3 10.6 26.6 16.2 25 6.7 39 15.5 39 36.9v.4c0 24.4-18.6 38.2-45.2 38.2-18.9-.1-37.6-6.5-52.3-19.8z" class="2022_H-Brand_Stacked_BlackGreen_svg__st2"/>
Expand Down
2 changes: 2 additions & 0 deletions src/icons/tabler-icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { IconLogout } from '@tabler/icons-svelte'
import { IconConfetti } from '@tabler/icons-svelte'
import { IconTools } from '@tabler/icons-svelte'
import { IconList } from '@tabler/icons-svelte'
import { IconCompass } from '@tabler/icons-svelte'
import { IconEdit } from '@tabler/icons-svelte'
import { IconTrash } from '@tabler/icons-svelte'
import { IconEyeOff } from '@tabler/icons-svelte'
Expand Down Expand Up @@ -53,6 +54,7 @@ export {
IconConfetti,
IconTools,
IconList,
IconCompass,
IconEdit,
IconTrash,
IconEyeOff,
Expand Down
26 changes: 26 additions & 0 deletions src/lib/notifier.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { writable } from 'svelte/store'
import { nanoid } from 'nanoid'

const createStore = () => {
const { subscribe, set, update } = writable([])

const dismiss = (message) =>
update((messages) => messages.filter((m) => m.id !== message.id))

const add = (message) => {
message.id = message.id || nanoid()
message.timestamp = message.timestamp || new Date().getTime()
update((messages) => [message, ...messages])
}

return {
subscribe,
add,
dismiss,
clear: () => set([])
}
}

const notifier = createStore()

export default notifier
6 changes: 6 additions & 0 deletions src/routes/(app)/BreadcrumbNav.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@
><Icon name="Book" class="mr-1" />Tickets book</a>
</div>
{/if}
{#if !/^\/hub/.test($page.url.pathname)}
<div class="level-item">
<a class="button is-text is-small" href="/hub"
><Icon name="Compass" class="mr-1" />Events hub</a>
</div>
{/if}
{#each $chainContext.pluginRoutes as entry}
{#if !activePlugin(entry.path)}
<div class="level-item">
Expand Down
120 changes: 120 additions & 0 deletions src/routes/(app)/hub/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<script>
import { connected, signerAddress, chainData } from 'ethers-svelte'
import { Jazzicon } from 'ethers-svelte/components'
import { keyDownA11y, formatAddress } from '$lib/utils'
import blockchain from '$lib/blockchain.js'
import AppContext from '$components/AppContext.svelte'
import Icon from '$components/Icon.svelte'
import AppMenuPopover from '$components/design/AppMenuPopover.svelte'
import BreadcrumbNav from '../BreadcrumbNav.svelte'
let popparent
</script>

<AppContext>
<nav class="navbar" aria-label="main navigation">
<div class="navbar-brand">
<a class="navbar-item is-black" alt="Rouge Ticket" href="/book">
<span class="mx-2 is-hidden-mobile"
><img alt="Rouge Ticket logo" src="/rouge-ticket-black.svg" /></span>
<span class="mx-2 icon is-large is-hidden-tablet"
><img alt="Rouge Ticket logo" src="/logo.svg" /></span>
</a>
</div>

{#if $connected}
<div
bind:this={popparent}
class="navbar-brand is-justify-content-center is-hidden-tablet">
<AppMenuPopover let:toggle {popparent}>
<a
href="#apps"
class="navbar-item"
on:click={toggle}
on:keydown={keyDownA11y(toggle)}>
<Icon name="GridDots" />
</a>
</AppMenuPopover>
</div>
{/if}

<div class="navbar-brand is-justify-content-flex-end">
{#if $signerAddress}
<div class="navbar-item pr-0">
<span class="icon-text">
<span class="icon"
><Jazzicon address={$signerAddress} size={24} /></span>
<small class="is-hidden-mobile"
>{formatAddress($signerAddress)}</small>
</span>
</div>
<div class="navbar-item">
<span class="tag is-hidden-touch">{$chainData.name}</span>
<span class="tag is-hidden-desktop">{$chainData.shortName}</span>
</div>
{/if}
</div>
</nav>

<div class="container is-max-desktop">
<div class="container is-fluid">
<BreadcrumbNav class="mt-5 mb-2" />

<div class="box">
<slot />
</div>
</div>
</div>
</AppContext>

<style lang="scss">
@import '../../../scss/_variables.scss';
@import 'bulma/sass/utilities/_all';
:global(body) {
background-color: $grey-standalone;
}
:global(.version a) {
color: #888 !important;
}
.container.is-max-desktop {
@include mobile {
padding-top: 3.5rem;
}
@include tablet {
padding: 4rem;
}
}
.navbar {
background-color: $grey-standalone;
}
nav {
display: flex;
align-items: stretch;
background-color: transparent;
.navbar-brand {
flex: 1;
justify-content: left;
&:last-child {
justify-content: right;
}
a:hover {
color: currentColor;
}
}
}
.navbar-item .is-large img {
max-height: none;
}
</style>
2 changes: 2 additions & 0 deletions src/routes/(app)/hub/+page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const prerender = false
// export const ssr = false
78 changes: 78 additions & 0 deletions src/routes/(app)/hub/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<script>
import {
getChainDataByChainId,
} from 'ethers-svelte'
import {
ethereum,
// metisBlack,
// arbitrum,
arbitrumNova,
optimism
} from '$icons/strings.js'
import { getSupportedChainIds } from '$lib/enums.js'
import registry from '$stores/registry.js'
import Icon from '$components/Icon.svelte'
$: supportedChainIds = getSupportedChainIds($registry.includeTestnets)
const graphics = {
1: { icon: ethereum },
10: { icon: optimism },
42170: { icon: arbitrumNova }
}
</script>

<section class="sectionx">

<div class="level">
<div class="level-left">
<h2 class="title">Choose the chain</h2>
</div>
</div>

<span class="field ml-2 hidden">
<input
id="testnets"
type="checkbox"
name="testnets"
class="switch is-rtl"
bind:checked={$registry.includeTestnets} />
<label class="has-text-grey-light" for="testnets"
>Include testnets?</label>
</span>



<section id="why" class="hero is-medium xis-info">
<div class="hero-body has-text-centered has-big-titles">
<div class="columns is-multiline mt-4">

{#each supportedChainIds as id}
<div class="column is-half">
<a
href="/hub/{getChainDataByChainId(id)?.shortName}">
<div class="box">
<p class="title">{getChainDataByChainId(id)?.name}</p>

<div class="m-auto" style="height: 5em; width: 5em;">

{@html graphics[id].icon}
</div>

</div>
</a>
</div>
{/each}

</div>
</div>
</section>


</section>
Loading

0 comments on commit cd8c0ca

Please sign in to comment.