Finish space create form

This commit is contained in:
Jon Staab
2024-08-08 16:32:46 -07:00
parent 6c2e5d6e07
commit 028ff71e8f
18 changed files with 258 additions and 17 deletions
+29
View File
@@ -0,0 +1,29 @@
<script lang="ts">
import Link from '@lib/components/Link.svelte'
import Icon from '@lib/components/Icon.svelte'
import {clip} from '@app/toast'
</script>
<div class="column gap-4">
<h1 class="heading">What is a relay?</h1>
<p>
Flotilla hosts spaces on the <Link external href="https://nostr.com/">Nostr protocol</Link>.
Nostr uses "relays" to host data, which are special-purpose servers that speak nostr's language.
This means that anyone can host their own data, making the web more decentralized and resilient.
</p>
<p>
Only some relays support spaces. You can find a list of suggested relays below,
or you can <Link external href="https://coracle.tools">host your own</Link>.
If you do decide to join someone else's, make sure to follow their directions for registering
as a user.
</p>
<div class="card flex-row justify-between">
relay.whatever.com
<button on:click={() => clip('relay.whatever.com')}>
<Icon icon="copy" />
</button>
</div>
<button class="btn btn-primary" on:click={() => history.back()}>
Got it
</button>
</div>
+34 -4
View File
@@ -1,25 +1,55 @@
<script lang="ts">
import InputProfilePicture from '@lib/components/InputProfilePicture.svelte'
import Field from '@lib/components/Field.svelte'
import Icon from '@lib/components/Icon.svelte'
import InfoNip29 from '@app/components/InfoNip29.svelte'
import {pushModal} from '@app/modal'
const back = () => history.back()
const next = () => pushModal()
const showNip29Info = () => pushModal(InfoNip29)
let file: File
let name = ""
let relay = ""
</script>
<div class="column gap-4">
<h1 class="heading">Customize your Space</h1>
<p class="text-center">
Give people a few details to go. You can always change this later.
Give people a few details to go on. You can always change this later.
</p>
<div class="flex justify-center py-2">
<InputProfilePicture bind:file />
</div>
<Field>
<p slot="label">Give your space a name:</p>
<input slot="input" type="text" class="input input-bordered w-full max-w-xs" />
<p slot="label">Space Name</p>
<label class="input input-bordered w-full flex items-center gap-2" slot="input">
<Icon icon="fire-minimalistic" />
<input bind:value={name} class="grow" type="text" />
</label>
</Field>
<Field>
<p slot="label">Relay</p>
<label class="input input-bordered w-full flex items-center gap-2" slot="input">
<Icon icon="remote-controller-minimalistic" />
<input bind:value={relay} class="grow" type="text" />
</label>
<p slot="info">
This should be a NIP-29 compatible nostr relay where you'd like to host your space.
<button class="text-primary underline cursor-pointer" on:click={showNip29Info}>
More information
</button>
</p>
</Field>
<div class="flex flex-row justify-between items-center gap-4">
<button class="btn btn-link" on:click={back}>
<Icon icon="alt-arrow-left" />
Go back
</button>
<button class="btn btn-primary" on:click={back}>
<button class="btn btn-primary" on:click={next}>
Next
<Icon icon="alt-arrow-right" class="!bg-base-300" />
</button>
+14
View File
@@ -0,0 +1,14 @@
<script lang="ts">
import {fly} from "@lib/transition"
import {toast} from "@app/toast"
</script>
{#if $toast}
{#key $toast.id}
<div transition:fly class="toast z-toast">
<div role="alert" class="alert flex justify-center">
{$toast.message}
</div>
</div>
{/key}
{/if}
+7 -1
View File
@@ -1,5 +1,6 @@
import {writable} from "svelte/store"
import {randomId} from "@welshman/lib"
import {copyToClipboard} from '@lib/html'
export type Toast = {
id: string
@@ -15,7 +16,7 @@ export const toast = writable<Toast | null>(null)
export const pushToast = (
{message = "", id = randomId()}: Partial<Toast>,
options: ToastOptions,
options: ToastOptions = {},
) => {
toast.set({id, message, options})
@@ -25,3 +26,8 @@ export const pushToast = (
}
export const popToast = (id: string) => toast.update($t => ($t?.id === id ? null : $t))
export const clip = (value: string) => {
copyToClipboard(value)
pushToast({message: "Copied to clipboard!"})
}