UI tweaks, fix some calendar stuff
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {page} from "$app/stores"
|
import {page} from "$app/stores"
|
||||||
import {goto} from "$app/navigation"
|
import {goto} from "$app/navigation"
|
||||||
|
import {displayRelayUrl} from '@welshman/util'
|
||||||
import Icon from "@lib/components/Icon.svelte"
|
import Icon from "@lib/components/Icon.svelte"
|
||||||
import Link from "@lib/components/Link.svelte"
|
import Link from "@lib/components/Link.svelte"
|
||||||
import Button from "@lib/components/Button.svelte"
|
import Button from "@lib/components/Button.svelte"
|
||||||
@@ -27,6 +28,8 @@
|
|||||||
let space = $page.params?.nrelay ? decodeNRelay($page.params?.nrelay) : undefined
|
let space = $page.params?.nrelay ? decodeNRelay($page.params?.nrelay) : undefined
|
||||||
let showSettings = false
|
let showSettings = false
|
||||||
|
|
||||||
|
const assertNotNil = <T>(x: T) => x!
|
||||||
|
|
||||||
const resetSpace = () => {
|
const resetSpace = () => {
|
||||||
space = ""
|
space = ""
|
||||||
}
|
}
|
||||||
@@ -60,10 +63,9 @@
|
|||||||
|
|
||||||
<div class="column menu gap-2">
|
<div class="column menu gap-2">
|
||||||
{#if showSettings}
|
{#if showSettings}
|
||||||
<Button on:click={closeSettings} class="mb-4 flex items-center gap-2 text-lg">
|
<p class="mb-4 text-2xl text-center">
|
||||||
<Icon icon="alt-arrow-left" size={7} />
|
Settings for <span class="text-primary">{displayRelayUrl(assertNotNil(space))}</span>
|
||||||
Go Back
|
</p>
|
||||||
</Button>
|
|
||||||
{#if getMembershipUrls($userMembership).includes(space || "")}
|
{#if getMembershipUrls($userMembership).includes(space || "")}
|
||||||
<Button on:click={leaveSpace} class="btn btn-error">
|
<Button on:click={leaveSpace} class="btn btn-error">
|
||||||
<Icon icon="exit" />
|
<Icon icon="exit" />
|
||||||
@@ -75,11 +77,14 @@
|
|||||||
Join Space
|
Join Space
|
||||||
</Button>
|
</Button>
|
||||||
{/if}
|
{/if}
|
||||||
{:else if space}
|
<Button on:click={closeSettings} class="mt-4 flex items-center gap-2 text-lg">
|
||||||
<Button on:click={resetSpace} class="mb-4 flex items-center gap-2 text-lg">
|
|
||||||
<Icon icon="alt-arrow-left" size={7} />
|
<Icon icon="alt-arrow-left" size={7} />
|
||||||
Back to Spaces
|
Go Back
|
||||||
</Button>
|
</Button>
|
||||||
|
{:else if space}
|
||||||
|
<p class="mb-4 text-2xl text-center">
|
||||||
|
Actions for <span class="text-primary">{displayRelayUrl(space)}</span>
|
||||||
|
</p>
|
||||||
<div class="grid grid-cols-3 gap-2">
|
<div class="grid grid-cols-3 gap-2">
|
||||||
<Link href={makeSpacePath(space)} class="btn btn-neutral">
|
<Link href={makeSpacePath(space)} class="btn btn-neutral">
|
||||||
<Icon icon="chat-round" /> Chat
|
<Icon icon="chat-round" /> Chat
|
||||||
@@ -112,6 +117,10 @@
|
|||||||
<Icon icon="settings" /> Space Settings
|
<Icon icon="settings" /> Space Settings
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
<Button on:click={resetSpace} class="mt-4 flex items-center gap-2 text-lg">
|
||||||
|
<Icon icon="alt-arrow-left" size={7} />
|
||||||
|
Back to Spaces
|
||||||
|
</Button>
|
||||||
{:else}
|
{:else}
|
||||||
{#each getMembershipUrls($userMembership) as url (url)}
|
{#each getMembershipUrls($userMembership) as url (url)}
|
||||||
<Button on:click={() => setSpace(url)}>
|
<Button on:click={() => setSpace(url)}>
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Button class="card2 bg-alt shadow-xl" on:click={onClick}>
|
<Button class="card2 bg-alt shadow-xl flex flex-col" on:click={onClick}>
|
||||||
<Profile {pubkey} />
|
<Profile {pubkey} />
|
||||||
<ProfileInfo {pubkey} />
|
<ProfileInfo {pubkey} />
|
||||||
{#if roots.length > 0}
|
{#if roots.length > 0}
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
{@const nevent = nip19.neventEncode({id: event.id, relays})}
|
{@const nevent = nip19.neventEncode({id: event.id, relays})}
|
||||||
{@const following = getPubkeyTagValues(getListTags($userFollows)).includes(pubkey)}
|
{@const following = getPubkeyTagValues(getListTags($userFollows)).includes(pubkey)}
|
||||||
<div class="divider" />
|
<div class="divider" />
|
||||||
<button type="button" class="chat chat-start cursor-default" on:click|stopPropagation>
|
<button type="button" class="chat chat-start cursor-default flex" on:click|stopPropagation>
|
||||||
<div class="bg-alt col-4 chat-bubble text-left">
|
<div class="bg-alt col-4 chat-bubble text-left">
|
||||||
<Content showEntire hideMedia={!following} {event} />
|
<Content showEntire hideMedia={!following} {event} />
|
||||||
<Link external href={entityLink(nevent)} class="row-2 group justify-end whitespace-nowrap">
|
<Link external href={entityLink(nevent)} class="row-2 group justify-end whitespace-nowrap">
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {nip19} from "nostr-tools"
|
|
||||||
import {ctx} from "@welshman/lib"
|
import {ctx} from "@welshman/lib"
|
||||||
import {repository} from "@welshman/app"
|
import {repository} from "@welshman/app"
|
||||||
import {getReplyFilters} from "@welshman/util"
|
import {getReplyFilters} from "@welshman/util"
|
||||||
@@ -11,10 +10,6 @@
|
|||||||
import {entityLink} from "@app/state"
|
import {entityLink} from "@app/state"
|
||||||
|
|
||||||
export let event
|
export let event
|
||||||
|
|
||||||
const replies = deriveEvents(repository, {filters: getReplyFilters([event], {})})
|
|
||||||
const relays = ctx.app.router.Event(event).getUrls()
|
|
||||||
const nevent = nip19.neventEncode({...event, relays})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex flex-col items-end">
|
<div class="flex flex-col items-end">
|
||||||
@@ -23,10 +18,4 @@
|
|||||||
<Content {event} />
|
<Content {event} />
|
||||||
</div>
|
</div>
|
||||||
</NoteCard>
|
</NoteCard>
|
||||||
<Link
|
|
||||||
href={entityLink(nevent)}
|
|
||||||
class="btn btn-neutral z-feature -mt-6 mr-4 flex items-center gap-2 rounded-full">
|
|
||||||
<Icon icon="chat-round" />
|
|
||||||
<span>{$replies.length}</span>
|
|
||||||
</Link>
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
<div class="scroll-container max-h-screen flex-grow overflow-auto bg-base-200 pb-14 sm:pb-0">
|
<div class="scroll-container max-h-screen flex-grow overflow-auto bg-base-200 pb-14 md:pb-0">
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,11 +5,16 @@
|
|||||||
import {pubkey, subscribe} from "@welshman/app"
|
import {pubkey, subscribe} from "@welshman/app"
|
||||||
import {fly} from "@lib/transition"
|
import {fly} from "@lib/transition"
|
||||||
import Icon from "@lib/components/Icon.svelte"
|
import Icon from "@lib/components/Icon.svelte"
|
||||||
|
import Button from "@lib/components/Button.svelte"
|
||||||
import ChatItem from "@app/components/ChatItem.svelte"
|
import ChatItem from "@app/components/ChatItem.svelte"
|
||||||
|
import ChatStart from "@app/components/ChatStart.svelte"
|
||||||
import {chatSearch, pullConservatively} from "@app/state"
|
import {chatSearch, pullConservatively} from "@app/state"
|
||||||
|
import {pushModal} from "@app/modal"
|
||||||
|
|
||||||
let term = ""
|
let term = ""
|
||||||
|
|
||||||
|
const startChat = () => pushModal(ChatStart)
|
||||||
|
|
||||||
$: chats = $chatSearch.searchOptions(term).filter(c => c.pubkeys.length > 1)
|
$: chats = $chatSearch.searchOptions(term).filter(c => c.pubkeys.length > 1)
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
@@ -26,13 +31,26 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="content column gap-2">
|
<div class="content column gap-2">
|
||||||
<label class="input input-bordered mb-2 flex items-center gap-2" in:fly={{delay: 250}}>
|
<div class="row-2 min-w-0 items-center">
|
||||||
<Icon icon="magnifer" />
|
<label class="input input-bordered flex flex-grow items-center gap-2" in:fly={{delay: 250}}>
|
||||||
<input bind:value={term} class="grow" type="text" placeholder="Search for conversations..." />
|
<Icon icon="magnifer" />
|
||||||
</label>
|
<input bind:value={term} class="grow" type="text" placeholder="Search for conversations..." />
|
||||||
|
</label>
|
||||||
|
<Button class="btn btn-primary" on:click={startChat}>
|
||||||
|
<Icon icon="add-circle" />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
<div class="column gap-2 overflow-auto">
|
<div class="column gap-2 overflow-auto">
|
||||||
{#each chats as { id, pubkeys, messages } (id)}
|
{#each chats as { id, pubkeys, messages } (id)}
|
||||||
<ChatItem {id} {pubkeys} {messages} />
|
<ChatItem {id} {pubkeys} {messages} />
|
||||||
|
{:else}
|
||||||
|
<div class="py-20 max-w-sm col-4 items-center m-auto text-center">
|
||||||
|
<p>No chats found! Try starting one up.</p>
|
||||||
|
<Button class="btn btn-primary" on:click={startChat}>
|
||||||
|
<Icon icon="add-circle" />
|
||||||
|
Start a Chat
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {onMount} from "svelte"
|
import {onMount} from "svelte"
|
||||||
import {page} from "$app/stores"
|
import {page} from "$app/stores"
|
||||||
import {sortBy, last, ago} from "@welshman/lib"
|
import {sortBy, tryCatch, last, ago} from "@welshman/lib"
|
||||||
import type {TrustedEvent} from "@welshman/util"
|
import type {TrustedEvent} from "@welshman/util"
|
||||||
import {EVENT_DATE, EVENT_TIME} from "@welshman/util"
|
import {EVENT_DATE, EVENT_TIME} from "@welshman/util"
|
||||||
import {subscribe, formatTimestampAsDate} from "@welshman/app"
|
import {subscribe, formatTimestampAsDate} from "@welshman/app"
|
||||||
@@ -21,9 +21,13 @@
|
|||||||
|
|
||||||
const createEvent = () => pushModal(EventCreate, {url})
|
const createEvent = () => pushModal(EventCreate, {url})
|
||||||
|
|
||||||
const getStart = (event: TrustedEvent) =>
|
const getEnd = (event: TrustedEvent) =>
|
||||||
parseInt(event.tags.find(t => t[0] === "start")?.[1] || "0")
|
parseInt(event.tags.find(t => t[0] === "end")?.[1] || "")
|
||||||
|
|
||||||
|
const getStart = (event: TrustedEvent) =>
|
||||||
|
parseInt(event.tags.find(t => t[0] === "start")?.[1] || "")
|
||||||
|
|
||||||
|
let limit = 5
|
||||||
let loading = true
|
let loading = true
|
||||||
|
|
||||||
type Item = {
|
type Item = {
|
||||||
@@ -31,14 +35,19 @@
|
|||||||
dateDisplay?: string
|
dateDisplay?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
$: items = sortBy(getStart, $events).reduce<Item[]>((r, event) => {
|
$: items = sortBy(e => -getStart(e), $events).reduce<Item[]>((r, event) => {
|
||||||
|
const end = getEnd(event)
|
||||||
|
const start = getStart(event)
|
||||||
|
|
||||||
|
if (isNaN(start) || isNaN(end)) return r
|
||||||
|
|
||||||
const prevDateDisplay =
|
const prevDateDisplay =
|
||||||
r.length > 0 ? formatTimestampAsDate(getStart(last(r).event)) : undefined
|
r.length > 0 ? formatTimestampAsDate(getStart(last(r).event)) : undefined
|
||||||
const newDateDisplay = formatTimestampAsDate(getStart(event))
|
const newDateDisplay = formatTimestampAsDate(start)
|
||||||
const dateDisplay = prevDateDisplay === newDateDisplay ? undefined : newDateDisplay
|
const dateDisplay = prevDateDisplay === newDateDisplay ? undefined : newDateDisplay
|
||||||
|
|
||||||
return [...r, {event, dateDisplay}]
|
return [...r, {event, dateDisplay}]
|
||||||
}, [])
|
}, []).slice(0, limit)
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
const sub = subscribe({filters: [{kinds, since: ago(30)}]})
|
const sub = subscribe({filters: [{kinds, since: ago(30)}]})
|
||||||
@@ -78,7 +87,7 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<Button
|
<Button
|
||||||
class="tooltip tooltip-left fixed bottom-16 right-2 z-feature p-1 sm:bottom-4 sm:right-4"
|
class="tooltip tooltip-left fixed bottom-16 right-2 z-feature p-1 md:bottom-4 md:right-4"
|
||||||
data-tip="Create an Event"
|
data-tip="Create an Event"
|
||||||
on:click={createEvent}>
|
on:click={createEvent}>
|
||||||
<div class="btn btn-circle btn-primary flex h-12 w-12 items-center justify-center">
|
<div class="btn btn-circle btn-primary flex h-12 w-12 items-center justify-center">
|
||||||
|
|||||||
@@ -69,7 +69,7 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<Button
|
<Button
|
||||||
class="tooltip tooltip-left fixed bottom-16 right-2 z-feature p-1 sm:bottom-4 sm:right-4"
|
class="tooltip tooltip-left fixed bottom-16 right-2 z-feature p-1 md:bottom-4 md:right-4"
|
||||||
data-tip="Create an Event"
|
data-tip="Create an Event"
|
||||||
on:click={createThread}>
|
on:click={createThread}>
|
||||||
<div class="btn btn-circle btn-primary flex h-12 w-12 items-center justify-center">
|
<div class="btn btn-circle btn-primary flex h-12 w-12 items-center justify-center">
|
||||||
|
|||||||
Reference in New Issue
Block a user