From 907366bc11171ac5c121e9b2ccd9c0d38e634164 Mon Sep 17 00:00:00 2001 From: Murillo Pinheiro de Oliveira Date: Wed, 28 Feb 2024 12:42:46 -0300 Subject: update: ui --- src/components/Numpad.svelte | 8 +- src/lib/shadcn/components/ui/button/button.svelte | 21 +++++ src/lib/shadcn/components/ui/button/index.js | 32 +++++++ src/lib/shadcn/components/ui/sheet/index.js | 99 ++++++++++++++++++++++ .../components/ui/sheet/sheet-content.svelte | 34 ++++++++ .../components/ui/sheet/sheet-description.svelte | 10 +++ .../shadcn/components/ui/sheet/sheet-footer.svelte | 12 +++ .../shadcn/components/ui/sheet/sheet-header.svelte | 9 ++ .../components/ui/sheet/sheet-overlay.svelte | 18 ++++ .../shadcn/components/ui/sheet/sheet-portal.svelte | 10 +++ .../shadcn/components/ui/sheet/sheet-title.svelte | 13 +++ src/locales/en.json | 2 +- .../[username]/payments/[...page]/+page.svelte | 30 +++---- .../[username]/settings/[...tab]/+page.svelte | 2 +- src/routes/(app)/payment/[id]/+page.svelte | 4 +- src/routes/(app)/send/[...text]/+page.svelte | 6 +- src/routes/(app)/support/+page.svelte | 4 +- src/routes/+page.svelte | 64 ++++++++++---- src/swapee/css/style.css | 1 - 19 files changed, 332 insertions(+), 47 deletions(-) create mode 100644 src/lib/shadcn/components/ui/button/button.svelte create mode 100644 src/lib/shadcn/components/ui/button/index.js create mode 100644 src/lib/shadcn/components/ui/sheet/index.js create mode 100644 src/lib/shadcn/components/ui/sheet/sheet-content.svelte create mode 100644 src/lib/shadcn/components/ui/sheet/sheet-description.svelte create mode 100644 src/lib/shadcn/components/ui/sheet/sheet-footer.svelte create mode 100644 src/lib/shadcn/components/ui/sheet/sheet-header.svelte create mode 100644 src/lib/shadcn/components/ui/sheet/sheet-overlay.svelte create mode 100644 src/lib/shadcn/components/ui/sheet/sheet-portal.svelte create mode 100644 src/lib/shadcn/components/ui/sheet/sheet-title.svelte (limited to 'src') diff --git a/src/components/Numpad.svelte b/src/components/Numpad.svelte index 5690609c..aa109f7e 100644 --- a/src/components/Numpad.svelte +++ b/src/components/Numpad.svelte @@ -183,7 +183,7 @@
-
+
{fiat ? symbol : "⚡️"}
@@ -223,7 +223,7 @@ {#if value === arrow} {/if} diff --git a/src/lib/shadcn/components/ui/button/button.svelte b/src/lib/shadcn/components/ui/button/button.svelte new file mode 100644 index 00000000..775b9f09 --- /dev/null +++ b/src/lib/shadcn/components/ui/button/button.svelte @@ -0,0 +1,21 @@ + + + + + diff --git a/src/lib/shadcn/components/ui/button/index.js b/src/lib/shadcn/components/ui/button/index.js new file mode 100644 index 00000000..96d93665 --- /dev/null +++ b/src/lib/shadcn/components/ui/button/index.js @@ -0,0 +1,32 @@ +import Root from "./button.svelte"; +import { tv } from "tailwind-variants"; +const buttonVariants = tv({ + base: "inline-flex items-center justify-center rounded-md text-sm font-medium whitespace-nowrap ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", + variants: { + variant: { + default: "bg-primary text-primary-foreground hover:bg-primary/90", + destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90", + outline: + "border border-input bg-background hover:bg-accent hover:text-accent-foreground", + secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80", + ghost: "hover:bg-accent hover:text-accent-foreground", + link: "text-primary underline-offset-4 hover:underline", + }, + size: { + default: "h-10 px-4 py-2", + sm: "h-9 rounded-md px-3", + lg: "h-11 rounded-md px-8", + icon: "h-10 w-10", + }, + }, + defaultVariants: { + variant: "default", + size: "default", + }, +}); +export { + Root, + // + Root as Button, + buttonVariants, +}; diff --git a/src/lib/shadcn/components/ui/sheet/index.js b/src/lib/shadcn/components/ui/sheet/index.js new file mode 100644 index 00000000..c892767c --- /dev/null +++ b/src/lib/shadcn/components/ui/sheet/index.js @@ -0,0 +1,99 @@ +import { Dialog as SheetPrimitive } from "bits-ui"; +import { tv } from "tailwind-variants"; +import Portal from "./sheet-portal.svelte"; +import Overlay from "./sheet-overlay.svelte"; +import Content from "./sheet-content.svelte"; +import Header from "./sheet-header.svelte"; +import Footer from "./sheet-footer.svelte"; +import Title from "./sheet-title.svelte"; +import Description from "./sheet-description.svelte"; +const Root = SheetPrimitive.Root; +const Close = SheetPrimitive.Close; +const Trigger = SheetPrimitive.Trigger; +export { + Root, + Close, + Trigger, + Portal, + Overlay, + Content, + Header, + Footer, + Title, + Description, + // + Root as Sheet, + Close as SheetClose, + Trigger as SheetTrigger, + Portal as SheetPortal, + Overlay as SheetOverlay, + Content as SheetContent, + Header as SheetHeader, + Footer as SheetFooter, + Title as SheetTitle, + Description as SheetDescription, +}; +export const sheetVariants = tv({ + base: "fixed z-50 gap-4 bg-background p-6 shadow-lg", + variants: { + side: { + top: "inset-x-0 top-0 border-b", + bottom: "inset-x-0 bottom-0 border-t", + left: "inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm", + right: "inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm", + }, + }, + defaultVariants: { + side: "right", + }, +}); +export const sheetTransitions = { + top: { + in: { + y: "-100%", + duration: 500, + opacity: 1, + }, + out: { + y: "-100%", + duration: 300, + opacity: 1, + }, + }, + bottom: { + in: { + y: "100%", + duration: 500, + opacity: 1, + }, + out: { + y: "100%", + duration: 300, + opacity: 1, + }, + }, + left: { + in: { + x: "-100%", + duration: 500, + opacity: 1, + }, + out: { + x: "-100%", + duration: 300, + opacity: 1, + }, + }, + right: { + in: { + x: "100%", + duration: 500, + opacity: 1, + }, + out: { + x: "100%", + duration: 300, + opacity: 1, + }, + }, +}; diff --git a/src/lib/shadcn/components/ui/sheet/sheet-content.svelte b/src/lib/shadcn/components/ui/sheet/sheet-content.svelte new file mode 100644 index 00000000..8e7a0ffd --- /dev/null +++ b/src/lib/shadcn/components/ui/sheet/sheet-content.svelte @@ -0,0 +1,34 @@ + + + + + + + + + Close + + + diff --git a/src/lib/shadcn/components/ui/sheet/sheet-description.svelte b/src/lib/shadcn/components/ui/sheet/sheet-description.svelte new file mode 100644 index 00000000..9f75b9f4 --- /dev/null +++ b/src/lib/shadcn/components/ui/sheet/sheet-description.svelte @@ -0,0 +1,10 @@ + + + + + diff --git a/src/lib/shadcn/components/ui/sheet/sheet-footer.svelte b/src/lib/shadcn/components/ui/sheet/sheet-footer.svelte new file mode 100644 index 00000000..3a958ac9 --- /dev/null +++ b/src/lib/shadcn/components/ui/sheet/sheet-footer.svelte @@ -0,0 +1,12 @@ + + +
+ +
diff --git a/src/lib/shadcn/components/ui/sheet/sheet-header.svelte b/src/lib/shadcn/components/ui/sheet/sheet-header.svelte new file mode 100644 index 00000000..c6c098a4 --- /dev/null +++ b/src/lib/shadcn/components/ui/sheet/sheet-header.svelte @@ -0,0 +1,9 @@ + + +
+ +
diff --git a/src/lib/shadcn/components/ui/sheet/sheet-overlay.svelte b/src/lib/shadcn/components/ui/sheet/sheet-overlay.svelte new file mode 100644 index 00000000..8f308ce9 --- /dev/null +++ b/src/lib/shadcn/components/ui/sheet/sheet-overlay.svelte @@ -0,0 +1,18 @@ + + + diff --git a/src/lib/shadcn/components/ui/sheet/sheet-portal.svelte b/src/lib/shadcn/components/ui/sheet/sheet-portal.svelte new file mode 100644 index 00000000..c7384693 --- /dev/null +++ b/src/lib/shadcn/components/ui/sheet/sheet-portal.svelte @@ -0,0 +1,10 @@ + + + + + diff --git a/src/lib/shadcn/components/ui/sheet/sheet-title.svelte b/src/lib/shadcn/components/ui/sheet/sheet-title.svelte new file mode 100644 index 00000000..1a285c75 --- /dev/null +++ b/src/lib/shadcn/components/ui/sheet/sheet-title.svelte @@ -0,0 +1,13 @@ + + + + + diff --git a/src/locales/en.json b/src/locales/en.json index 1afa0f22..292c669a 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -199,7 +199,7 @@ "scan": "Scan", "paste": "Paste", "next": "Next", - "placeholder": "Paste a bitcoin address, lightning invoice or coinos username" + "placeholder": "Paste a bitcoin address, lightning invoice or Swapee username" }, "settings": { "notifications": "Payment notifications", diff --git a/src/routes/(app)/[username]/payments/[...page]/+page.svelte b/src/routes/(app)/[username]/payments/[...page]/+page.svelte index 75a0e3d0..b6e5ae49 100644 --- a/src/routes/(app)/[username]/payments/[...page]/+page.svelte +++ b/src/routes/(app)/[username]/payments/[...page]/+page.svelte @@ -122,12 +122,12 @@
-

+

{$t("payments.header")}

-
+
-
+
{sat(Math.abs(p.amount) + (p.tip || 0))}
@@ -184,7 +184,7 @@
{#if p.type === types.pot} -
+
Pot
@@ -197,7 +197,7 @@
-
+
{p.with.username}
@@ -207,9 +207,9 @@ class="w-24 border-4 border-transparent mr-1" alt="Bitcoin" /> -
{p.memo}
+
{p.memo}
{:else} -
+
{#if p.type === types.lightning}
⚡️
{:else if p.type === types.bitcoin} @@ -241,7 +241,7 @@ {/if}
-
+
{format(new Date(p.created), "h:mm aaa")}
@@ -252,14 +252,14 @@
{:else} -

{$t("payments.empty")}

+

{$t("payments.empty")}

{/each}
- {$t("payments.total")} - {$t("payments.presentValue")} - {$t("payments.gainLoss")} + {$t("payments.total")} + {$t("payments.presentValue")} + {$t("payments.gainLoss")} {#each Object.keys(totals) as c} {@const total = totals[c]["fiat"]} @@ -274,10 +274,10 @@
diff --git a/src/routes/(app)/[username]/settings/[...tab]/+page.svelte b/src/routes/(app)/[username]/settings/[...tab]/+page.svelte index e0514320..26c2830a 100644 --- a/src/routes/(app)/[username]/settings/[...tab]/+page.svelte +++ b/src/routes/(app)/[username]/settings/[...tab]/+page.svelte @@ -194,7 +194,7 @@
-

+

{$t("user.settings.header")}

diff --git a/src/routes/(app)/payment/[id]/+page.svelte b/src/routes/(app)/payment/[id]/+page.svelte index dbaea042..7c8c78e0 100644 --- a/src/routes/(app)/payment/[id]/+page.svelte +++ b/src/routes/(app)/payment/[id]/+page.svelte @@ -70,8 +70,8 @@
-

- {$t(amount < 0 ? "payments.sent" : "payments.received")} +

+ {$t(amount < 0 ? "payments.sent" : "payments.received")}

{#if p.with} diff --git a/src/routes/(app)/send/[...text]/+page.svelte b/src/routes/(app)/send/[...text]/+page.svelte index d7b069b5..96df35ad 100644 --- a/src/routes/(app)/send/[...text]/+page.svelte +++ b/src/routes/(app)/send/[...text]/+page.svelte @@ -32,8 +32,8 @@ -
-

+
+

{$t("payments.send")}

@@ -52,7 +52,7 @@