From d99a3524fd2649f1a9ce3623333de56a99e06971 Mon Sep 17 00:00:00 2001 From: secondl1ght <85003930+secondl1ght@users.noreply.github.com> Date: Tue, 2 Aug 2022 13:23:59 -0600 Subject: lots of updates, implementing design, refactoring, bug fixes and more --- src/components/404.svelte | 4 +- src/components/About.svelte | 8 +- src/components/AppHeader.svelte | 2 +- src/components/Footer.svelte | 1 - src/components/LandingHero.svelte | 4 +- src/lib/socket.js | 2 +- src/lib/utils.js | 45 ++++- src/routes/[username]/dashboard.svelte | 67 ++++++- src/routes/[username]/index.svelte | 34 +--- src/routes/[username]/receive.svelte | 22 +-- src/routes/[username]/support.svelte | 45 +++++ src/routes/__error.svelte | 8 +- src/routes/__layout.svelte | 8 +- src/routes/community.svelte | 0 src/routes/index.svelte | 2 +- src/routes/invoice/[id].svelte | 318 ++++++++++++++++----------------- src/routes/jobs.svelte | 28 +++ src/routes/support.svelte | 5 - 18 files changed, 375 insertions(+), 228 deletions(-) create mode 100644 src/routes/[username]/support.svelte delete mode 100644 src/routes/community.svelte delete mode 100644 src/routes/support.svelte diff --git a/src/components/404.svelte b/src/components/404.svelte index 503316bb..426f1f96 100644 --- a/src/components/404.svelte +++ b/src/components/404.svelte @@ -5,10 +5,10 @@
- + - +

404

Page not found.

diff --git a/src/components/About.svelte b/src/components/About.svelte index 3731bf9b..84e1761b 100644 --- a/src/components/About.svelte +++ b/src/components/About.svelte @@ -2,10 +2,10 @@ import { Image, Icon } from '$comp'; const aboutAdam = [ - 'Running Bitcoin since 2011', + 'Running bitcoin since 2011', '20+ years web development experience in government and industry', - 'Early Bitcoin Vancouver meetup organizer', - 'Founder of The Bitcoin Co-op and early supporter of Decentral Vancouver', + 'Early bitcoin Vancouver meetup organizer', + 'Founder of The bitcoin Co-op and early supporter of Decentral Vancouver', 'Yogi, permaculturist, anarchist, decentralist', 'Husband, father, brother, son' ]; @@ -21,7 +21,7 @@ as a way to provide local merchants with a convenient way to accept bitcoin payments.

The feature set has grown over the years to accomodate a wide variety of use cases with the goal - of making it as easy as possible for anyone to get started using Bitcoin quickly, cheaply, and securely. + of making it as easy as possible for anyone to get started using bitcoin quickly, cheaply, and securely.

diff --git a/src/components/AppHeader.svelte b/src/components/AppHeader.svelte index d0123650..7d029a21 100644 --- a/src/components/AppHeader.svelte +++ b/src/components/AppHeader.svelte @@ -8,7 +8,7 @@ export let avatarPosition = 'left-[calc(50vw-48px)]'; const menuButtons = [ - { title: 'Customers', icon: 'customers', goto: 'customers' }, + // { title: 'Customers', icon: 'customers', goto: 'customers' }, { title: 'Dashboard', icon: 'dash', goto: 'dashboard' }, { title: 'Settings', icon: 'settings', goto: 'settings' }, { title: 'Support', icon: 'support', goto: 'support' }, diff --git a/src/components/Footer.svelte b/src/components/Footer.svelte index 0c682179..f1de0173 100644 --- a/src/components/Footer.svelte +++ b/src/components/Footer.svelte @@ -9,7 +9,6 @@ const companyLinks = [ { url: 'mailto:support@coinos.io', title: 'Support' }, - { url: '/community', title: 'Community' }, { url: '/jobs', title: 'Jobs' } ]; diff --git a/src/components/LandingHero.svelte b/src/components/LandingHero.svelte index 93bea8c2..750f5626 100644 --- a/src/components/LandingHero.svelte +++ b/src/components/LandingHero.svelte @@ -12,12 +12,12 @@ The easiest - way to accept Bitcoin in your store. + way to accept bitcoin in your store.

- Grow your customer base and revenue by accepting Bitcoin with an easy-to-use and managed Point + Grow your customer base and revenue by accepting bitcoin with an easy-to-use and managed Point of Sale. No software or hardware required.

{#if !$user} diff --git a/src/lib/socket.js b/src/lib/socket.js index 66091d76..53adfe7c 100644 --- a/src/lib/socket.js +++ b/src/lib/socket.js @@ -25,7 +25,7 @@ export const messages = (data) => ({ login() { user.set(data); - preferredCurrency.set(data.currency); + preferredCurrency.set('USD'); } }); diff --git a/src/lib/utils.js b/src/lib/utils.js index db8a490a..6b728152 100644 --- a/src/lib/utils.js +++ b/src/lib/utils.js @@ -1,4 +1,5 @@ import { browser } from '$app/env'; +import { toast } from '@zerodevx/svelte-toast'; export function scroll(section) { section.scrollIntoView({ behavior: 'smooth' }); @@ -26,6 +27,7 @@ export const post = (url, body) => export const copy = (text) => { navigator.clipboard.writeText(text); + success('Copied!'); }; export function reverseFormat(val, locale) { @@ -37,4 +39,45 @@ export function reverseFormat(val, locale) { return Number.isNaN(reversedVal) ? 0 : +reversedVal; } -export let protectedRoutes = [/receive/, /customers/, /dashboard/, /settings/, /transactions/]; +export let protectedRoutes = [ + /receive/, + /customers/, + /dashboard/, + /settings/, + /transactions/, + /support/ +]; + +export const success = (m) => { + toast.pop(); + toast.push(m, { + theme: { + '--toastBarBackground': '#16A34A' + } + }); +}; + +export const warning = (m) => { + toast.pop(); + toast.push(m, { + theme: { + '--toastBarBackground': '#FFCE22' + } + }); +}; +export const failure = (m) => { + toast.pop(); + toast.push(m, { + theme: { + '--toastBarBackground': '#E93535' + } + }); +}; +export const info = (m) => { + toast.pop(); + toast.push(m, { + theme: { + '--toastBarBackground': '#1C69FF' + } + }); +}; diff --git a/src/routes/[username]/dashboard.svelte b/src/routes/[username]/dashboard.svelte index 1935b156..4c0e4cfc 100644 --- a/src/routes/[username]/dashboard.svelte +++ b/src/routes/[username]/dashboard.svelte @@ -1,5 +1,70 @@ - +{#if $user} + + +
+

{$user.username}

+ Address goes here +
+ +
+
+

Dashboard

+ + Bitcoin Price: {$rate ? btcPrice : 'fetching rate...'} + {$preferredCurrency} + + + Data from Binance. + + +

+ ACCOUNT BALANCE +

+ + {$rate ? accountBalanceFiat : 'fetching rate...'} + + {accountBalanceBtc} BTC ({accountBalanceSats} SATS) + + + +

+ You will be charged a 1% withdrawal fee ({$rate ? feeAmount : 'fetching rate...'}) on your balance. +

+
+
+{/if} diff --git a/src/routes/[username]/index.svelte b/src/routes/[username]/index.svelte index 6002efdc..41d60849 100644 --- a/src/routes/[username]/index.svelte +++ b/src/routes/[username]/index.svelte @@ -1,5 +1,4 @@ {#if username} @@ -57,33 +44,30 @@

Address goes here

- + -->
-
-
+ class="w-[292px] md:w-[342px] h-[342px] border border-lightgrey rounded-3xl flex p-5 justify-center items-center relative" + /> -

Scan to pay with Bitcoin

+

Scan to pay with bitcoin

{lightningAddress} -
diff --git a/src/routes/[username]/receive.svelte b/src/routes/[username]/receive.svelte index 50fddbed..f0fa0fbd 100644 --- a/src/routes/[username]/receive.svelte +++ b/src/routes/[username]/receive.svelte @@ -3,13 +3,12 @@ import { AppHeader, Icon } from '$comp'; import { goto } from '$app/navigation'; import { invoiceAmount, invoiceAmountFiat, rate, user } from '$lib/store'; - import { post } from '$lib/utils'; + import { post, warning } from '$lib/utils'; import { page } from '$app/stores'; let useFiat = true; let amountFiat = 0; let amountSats = 0; - let message = ''; $: amount = useFiat ? Math.round(amountFiat / ($rate / 100000000)) : amountSats; @@ -33,9 +32,6 @@ const numPad = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '.', '0', '<']; const handleInput = (value) => { - if (message) { - message = ''; - } if (useFiat) { if (amountFiat === 0 && value !== '.' && value !== '<' && value !== '0') { amountFiat = value; @@ -54,7 +50,7 @@ } } } else if (value !== '.' && value !== '<' && parseInt(amountFiat + value) > $rate) { - message = 'Please enter an amount less than 1 bitcoin.'; + warning('Please enter an amount less than 1 bitcoin.'); } else if (amountFiat !== 0 && amountFiat.match(/\.../)) { return; } else { @@ -74,7 +70,7 @@ } } } else if (value !== '<' && parseInt(amountSats + value) > 100000000) { - message = 'Please enter an amount less than 1 bitcoin.'; + warning('Please enter an amount less than 1 bitcoin.'); } else { amountSats = amountSats + value; } @@ -118,16 +114,6 @@ >
- - {#if message} -
- -

{message}

-
- {/if} -
{#each numPad as value} @@ -172,10 +158,12 @@ on:click={submit} disabled={$invoiceAmount === 0}> Show QR +
{:else} diff --git a/src/routes/[username]/support.svelte b/src/routes/[username]/support.svelte new file mode 100644 index 00000000..7dd254c1 --- /dev/null +++ b/src/routes/[username]/support.svelte @@ -0,0 +1,45 @@ + + +{#if $user} + + +
+

Support

+ +
+
+ + +
+ +
+ + +
+ +
+ +