aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(static)
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-02-27 23:09:19 -0800
committerAdam Soltys <[email protected]>2026-02-27 23:09:19 -0800
commit23a783c13302fbe6b29cb21e226f25b81cd88de6 (patch)
tree3caa3f380328bca802c3d7fa95555cb8499e5d73 /src/routes/(static)
parent6efa1762d7d7583a5cf191474e80252deff0df85 (diff)
downloadcoinos-ui-23a783c13302fbe6b29cb21e226f25b81cd88de6.tar.gz
coinos-ui-23a783c13302fbe6b29cb21e226f25b81cd88de6.zip
splash page update
Diffstat (limited to 'src/routes/(static)')
-rw-r--r--src/routes/(static)/+layout.svelte7
-rw-r--r--src/routes/(static)/login/+page.svelte2
-rw-r--r--src/routes/(static)/map/add/+page.svelte64
-rw-r--r--src/routes/(static)/register/+page.svelte96
-rw-r--r--src/routes/(static)/register/auth/+page.svelte4
5 files changed, 143 insertions, 30 deletions
diff --git a/src/routes/(static)/+layout.svelte b/src/routes/(static)/+layout.svelte
index 9c7f5e5e..b204cd0e 100644
--- a/src/routes/(static)/+layout.svelte
+++ b/src/routes/(static)/+layout.svelte
@@ -4,6 +4,7 @@
import Footer from "$comp/Footer.svelte";
import LandingHeader from "$comp/LandingHeader.svelte";
import { theme as themeStore } from "$lib/store";
+ import { page } from "$app/stores";
let { data, children } = $props();
let user = $derived(data.user);
@@ -11,6 +12,8 @@
$effect(() => {
theme = $themeStore;
});
+
+ let hideFooter = $derived($page.url.pathname.startsWith("/login") || $page.url.pathname.startsWith("/register"));
</script>
<SvelteToast options={{ reversed: true, intro: { y: 192 } }} />
@@ -19,4 +22,6 @@
<main class="container flex px-4 md:px-40 mx-auto min-h-[600px]" data-theme={theme}>
{@render children?.()}
</main>
-<Footer />
+{#if !hideFooter}
+ <Footer />
+{/if}
diff --git a/src/routes/(static)/login/+page.svelte b/src/routes/(static)/login/+page.svelte
index 96a03ef5..7a7b06ed 100644
--- a/src/routes/(static)/login/+page.svelte
+++ b/src/routes/(static)/login/+page.svelte
@@ -30,7 +30,9 @@
password.set(undefined);
pin?.set(undefined);
signer.set(undefined);
+ const installDismissed = localStorage.getItem("installDismissed");
localStorage.clear();
+ if (installDismissed) localStorage.setItem("installDismissed", installDismissed);
sessionStorage.clear();
}, 50);
}
diff --git a/src/routes/(static)/map/add/+page.svelte b/src/routes/(static)/map/add/+page.svelte
new file mode 100644
index 00000000..f2052e28
--- /dev/null
+++ b/src/routes/(static)/map/add/+page.svelte
@@ -0,0 +1,64 @@
+<script lang="ts">
+ import { t } from "$lib/translations";
+</script>
+
+<div class="max-w-2xl mx-auto py-10 mb-20">
+ <h1 class="text-3xl font-bold mb-2">{$t("mapAdd.header")}</h1>
+ <p class="text-secondary text-lg mb-8">
+ {$t("mapAdd.description")}
+ </p>
+
+ <div class="space-y-8">
+ <div class="flex gap-4">
+ <div class="flex-shrink-0 w-10 h-10 rounded-full bg-primary text-white flex items-center justify-center font-bold text-lg">1</div>
+ <div>
+ <h2 class="text-xl font-semibold mb-1">{$t("mapAdd.step1.header")}</h2>
+ <p class="text-secondary">
+ {$t("mapAdd.step1.before")} <a href="https://www.openstreetmap.org" target="_blank" rel="noopener" class="text-base-content underline">
+ {$t("mapAdd.step1.linkText")}</a> {$t("mapAdd.step1.after")}
+ </p>
+ </div>
+ </div>
+
+ <div class="flex gap-4">
+ <div class="flex-shrink-0 w-10 h-10 rounded-full bg-primary text-white flex items-center justify-center font-bold text-lg">2</div>
+ <div>
+ <h2 class="text-xl font-semibold mb-1">{$t("mapAdd.step2.header")}</h2>
+ <p class="text-secondary">
+ {$t("mapAdd.step2.before")} <strong>{$t("mapAdd.step2.edit")}</strong>, {$t("mapAdd.step2.middle")} <strong>{$t("mapAdd.step2.point")}</strong> {$t("mapAdd.step2.after")}
+ </p>
+ </div>
+ </div>
+
+ <div class="flex gap-4">
+ <div class="flex-shrink-0 w-10 h-10 rounded-full bg-primary text-white flex items-center justify-center font-bold text-lg">3</div>
+ <div>
+ <h2 class="text-xl font-semibold mb-1">{$t("mapAdd.step3.header")}</h2>
+ <p class="text-secondary mb-3">
+ {$t("mapAdd.step3.description")}
+ </p>
+ <div class="bg-neutral text-white rounded-lg p-4 font-mono text-sm space-y-2">
+ <div><span class="font-bold">currency:XBT</span> = <span class="font-bold">yes</span></div>
+ <div><span class="font-bold">payment:coinos</span> = <span class="font-bold">yes</span></div>
+ </div>
+ </div>
+ </div>
+
+ <div class="flex gap-4">
+ <div class="flex-shrink-0 w-10 h-10 rounded-full bg-primary text-white flex items-center justify-center font-bold text-lg">4</div>
+ <div>
+ <h2 class="text-xl font-semibold mb-1">{$t("mapAdd.step4.header")}</h2>
+ <p class="text-secondary">
+ {$t("mapAdd.step4.before")} <strong>{$t("mapAdd.step4.save")}</strong> {$t("mapAdd.step4.after")}
+ </p>
+ </div>
+ </div>
+ </div>
+
+ <div class="mt-10 flex justify-center">
+ <a href="/map" class="btn btn-primary !w-auto !rounded-full px-8">
+ <iconify-icon noobserver icon="ph:arrow-left-bold" width="20"></iconify-icon>
+ {$t("mapAdd.backToMap")}
+ </a>
+ </div>
+</div>
diff --git a/src/routes/(static)/register/+page.svelte b/src/routes/(static)/register/+page.svelte
index 3441b95c..8645356a 100644
--- a/src/routes/(static)/register/+page.svelte
+++ b/src/routes/(static)/register/+page.svelte
@@ -1,11 +1,14 @@
<script lang="ts">
import { goto } from "$app/navigation";
import { page } from "$app/stores";
+ import { browser } from "$app/environment";
import punks from "$lib/punks";
import { avatar } from "$lib/store";
import { focus } from "$lib/utils";
import { t } from "$lib/translations";
- import { NumberDictionary, uniqueNamesGenerator, animals } from "unique-names-generator";
+
+
+ let isMobile = $derived(browser && /Android|iPhone|iPad|iPod/i.test(navigator.userAgent));
let { data }: any = $props();
@@ -20,21 +23,12 @@
}
};
- let refresh = async (e: any) => {
- e.preventDefault();
- cleared = false;
-
- username = uniqueNamesGenerator({
- dictionaries: [animals, NumberDictionary.generate({ min: 10, max: 99 })],
- length: 2,
- separator: "",
- });
- };
- let avatarInput: HTMLInputElement = $state() as any;
+ let cameraInput: HTMLInputElement = $state() as any;
+ let galleryInput: HTMLInputElement = $state() as any;
+ let showUploadModal = $state(false);
let decr = () => (index = index <= 0 ? 63 : index - 1);
let incr = () => (index = index >= 63 ? 0 : index + 1);
- let selectAvatar = () => avatarInput.click();
let progress: any;
let handleFile = async ({ target }: { target: HTMLInputElement }) => {
@@ -44,6 +38,7 @@
if (file.size > 10000000) return;
$avatar = { file, type, progress };
+ showUploadModal = false;
var reader = new FileReader();
reader.onload = async (e: any) => {
@@ -55,16 +50,24 @@
let src: string = $derived(`/api/public/${punks[index]}.webp`);
- let continueToAuth = () => {
- let name = (username || "").replace(/\s*/g, "");
+ let error = $state("");
+ let continueToAuth = async () => {
+ let name = (username || "").replace(/\s/g, "").toLowerCase();
if (!name) return;
- goto(`/register/auth?username=${encodeURIComponent(name)}&index=${index}`);
+ error = "";
+ let r = await fetch(`/api/users/${name}`);
+ if (r.ok) {
+ error = `Username ${name} is taken`;
+ } else {
+ goto(`/register/auth?username=${encodeURIComponent(name)}&index=${index}`);
+ }
};
</script>
<div class="mx-auto md:shadow-xl rounded-3xl max-w-xl w-full md:w-[480px] md:p-8 space-y-5 mb-20">
<h1 class="text-2xl font-bold text-center">{$t("login.createAccount")}</h1>
- <input type="file" accept="image/*" class="hidden!" bind:this={avatarInput} onchange={(e: any) => handleFile(e)} />
+ <input type="file" accept="image/*" capture="user" class="hidden!" bind:this={cameraInput} onchange={(e: any) => handleFile(e)} />
+ <input type="file" accept="image/*" class="hidden!" bind:this={galleryInput} onchange={(e: any) => handleFile(e)} />
<div class="relative">
<button
@@ -74,7 +77,7 @@
>
<iconify-icon noobserver icon="ph:caret-left-bold" width="32"></iconify-icon>
</button>
- <button class="block relative w-32 mx-auto" onclick={selectAvatar}>
+ <button class="block relative w-32 mx-auto" onclick={() => isMobile ? (showUploadModal = true) : galleryInput.click()}>
<div
class="w-32 h-32 rounded-full border-4 border-white overflow-hidden flex mx-auto relative"
>
@@ -84,9 +87,8 @@
alt={username}
/>
</div>
- <div class="absolute bg-base-100 rounded-full px-3 py-1 mx-auto -right-6 -bottom-2 z-10 flex items-center gap-1 text-base">
- <iconify-icon noobserver icon="ph:camera-bold" width="24"></iconify-icon>
- Upload
+ <div class="absolute bg-base-100 rounded-full p-2 -right-2 -bottom-2 z-10">
+ <iconify-icon noobserver icon="ph:folder-bold" width="24"></iconify-icon>
</div>
</button>
<button
@@ -98,6 +100,10 @@
</button>
</div>
+ {#if error}
+ <div class="text-red-600 text-center">{error}</div>
+ {/if}
+
<div class="space-y-3">
<label for="username" class="input flex items-center gap-2 w-full pr-0! overflow-hidden">
<input
@@ -109,17 +115,12 @@
bind:value={username}
onfocus={clear}
autocapitalize="none"
- placeholder={$t("login.username")}
+ placeholder="Your username"
onkeydown={(e: KeyboardEvent) => e.key === "Enter" && continueToAuth()}
/>
- <span class="bg-base-300 whitespace-nowrap select-none self-stretch flex items-center px-3">@coinos.io</span>
+ <span class="at-suffix font-bold whitespace-nowrap select-none self-stretch flex items-center px-3">@coinos.io</span>
</label>
- <button type="button" class="btn gap-2" onclick={refresh}>
- <iconify-icon noobserver icon="ph:dice-three-bold" width="32"></iconify-icon>
- Random username
- </button>
-
<button class="btn btn-accent" onclick={continueToAuth}>
Continue
</button>
@@ -135,3 +136,42 @@
</p>
</div>
</div>
+
+{#if showUploadModal}
+ <div
+ class="fixed inset-0 bg-black/50 z-50 flex items-start justify-center pt-32"
+ role="button"
+ tabindex="0"
+ onclick={() => (showUploadModal = false)}
+ onkeydown={(e) => e.key === "Escape" && (showUploadModal = false)}
+ >
+ <!-- svelte-ignore a11y_click_events_have_key_events a11y_no_static_element_interactions -->
+ <div class="bg-base-100 rounded-2xl p-6 w-full max-w-sm space-y-3" role="none" onclick={(e) => e.stopPropagation()}>
+ <h2 class="text-lg font-semibold text-center">Upload photo</h2>
+ {#if isMobile}
+ <button class="btn w-full gap-2" onclick={() => cameraInput.click()}>
+ <iconify-icon noobserver icon="ph:camera-bold" width="24"></iconify-icon>
+ Take photo
+ </button>
+ {/if}
+ <button class="btn w-full gap-2" onclick={() => galleryInput.click()}>
+ <iconify-icon noobserver icon="ph:images-bold" width="24"></iconify-icon>
+ Choose from gallery
+ </button>
+ <button class="btn w-full" onclick={() => (showUploadModal = false)}>
+ Cancel
+ </button>
+ </div>
+ </div>
+{/if}
+
+<style>
+ .at-suffix {
+ background: black;
+ color: white;
+ }
+ :global([data-theme="black"]) .at-suffix {
+ background: rgba(255, 255, 255, 0.2);
+ color: white;
+ }
+</style>
diff --git a/src/routes/(static)/register/auth/+page.svelte b/src/routes/(static)/register/auth/+page.svelte
index ad5d6e54..5809ef4b 100644
--- a/src/routes/(static)/register/auth/+page.svelte
+++ b/src/routes/(static)/register/auth/+page.svelte
@@ -50,7 +50,9 @@
password.set(undefined);
pin.set(undefined);
signer.set(undefined);
+ const installDismissed = localStorage.getItem("installDismissed");
localStorage.clear();
+ if (installDismissed) localStorage.setItem("installDismissed", installDismissed);
sessionStorage.clear();
}, 50);
}
@@ -322,7 +324,7 @@
<div class="w-24 h-24 rounded-full overflow-hidden">
<img {src} class="w-full h-full object-cover" alt={username} />
</div>
- <span class="text-xl font-medium">{username}</span>
+ <span class="text-xl font-bold">{username}</span>
</div>
{#if form?.error || form?.message}