Populate feeds with default accounts

This commit is contained in:
Jon Staab
2024-10-11 15:29:54 -07:00
parent e21063f247
commit f5461d551e
6 changed files with 30 additions and 17 deletions
+2 -3
View File
@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import {goto} from "$app/navigation" import {goto} from "$app/navigation"
import {pubkey} from '@welshman/app'
import Field from "@lib/components/Field.svelte" import Field from "@lib/components/Field.svelte"
import Button from "@lib/components/Button.svelte" import Button from "@lib/components/Button.svelte"
import Icon from "@lib/components/Icon.svelte" import Icon from "@lib/components/Icon.svelte"
@@ -10,9 +11,7 @@
const back = () => history.back() const back = () => history.back()
const onSubmit = async () => { const onSubmit = () => goto(makeChatPath([...pubkeys, $pubkey!]))
goto(makeChatPath(pubkeys))
}
let pubkeys: string[] = [] let pubkeys: string[] = []
</script> </script>
+2 -2
View File
@@ -17,9 +17,9 @@ export const pushModal = (
) => { ) => {
const id = randomId() const id = randomId()
// TODO: fix memory leak here by listening to history somehow
modals.set(id, {component, props, options}) modals.set(id, {component, props, options})
goto("#" + id)
setTimeout(() => goto("#" + id))
return id return id
} }
+5 -3
View File
@@ -1,15 +1,17 @@
<script lang="ts"> <script lang="ts">
import cx from "classnames" import {goto} from '$app/navigation'
export let href export let href
export let external = false export let external = false
const go = () => goto(href)
</script> </script>
<a <a
{href} {href}
{...$$props} {...$$props}
on:click|stopPropagation class="cursor-pointer {$$props.class}"
class={cx($$props.class, "cursor-pointer")} on:click|preventDefault|stopPropagation={go}
rel={external ? "noopener noreferer" : ""} rel={external ? "noopener noreferer" : ""}
target={external ? "_blank" : ""}> target={external ? "_blank" : ""}>
<slot /> <slot />
+5 -6
View File
@@ -113,15 +113,14 @@
{/if} {/if}
</div> </div>
<div slot="action"> <div slot="action">
{#if $missingInboxes.length > 0} {#if remove($pubkey, $missingInboxes).length > 0}
{@const plural = $missingInboxes.length > 0} {@const count = remove($pubkey, $missingInboxes).length}
{@const label = count > 0 ? 'inboxes are' : 'inbox is'}
<div <div
class="row-2 badge badge-error badge-lg tooltip tooltip-left cursor-pointer" class="row-2 badge badge-error badge-lg tooltip tooltip-left cursor-pointer"
data-tip="{$missingInboxes.length} {plural data-tip="{count} {label} not configured.">
? 'inboxes are'
: 'inbox is'} not configured.">
<Icon icon="danger" /> <Icon icon="danger" />
{$missingInboxes.length} {count}
</div> </div>
{/if} {/if}
</div> </div>
+10
View File
@@ -13,6 +13,8 @@
import type {TrustedEvent} from "@welshman/util" import type {TrustedEvent} from "@welshman/util"
import {deriveEvents} from "@welshman/store" import {deriveEvents} from "@welshman/store"
import {repository, userFollows, load} from "@welshman/app" import {repository, userFollows, load} from "@welshman/app"
import Link from "@lib/components/Link.svelte"
import Icon from "@lib/components/Icon.svelte"
import Spinner from "@lib/components/Spinner.svelte" import Spinner from "@lib/components/Spinner.svelte"
import NoteCard from "@app/components/NoteCard.svelte" import NoteCard from "@app/components/NoteCard.svelte"
import Content from "@app/components/Content.svelte" import Content from "@app/components/Content.svelte"
@@ -85,6 +87,14 @@
<Content {event} /> <Content {event} />
</div> </div>
</NoteCard> </NoteCard>
{:else}
<div class="py-20 max-w-sm col-4 items-center m-auto text-center">
<p>No activity found! Try following a few more people.</p>
<Link class="btn btn-primary" href="/home/people">
<Icon icon="user-heart" />
Browse Profiles
</Link>
</div>
{/each} {/each}
</div> </div>
{/await} {/await}
+6 -3
View File
@@ -1,14 +1,17 @@
<script lang="ts"> <script lang="ts">
import {onMount} from "svelte" import {onMount} from "svelte"
import {createScroller} from "@lib/html" import {createScroller} from "@lib/html"
import Icon from "@lib/components/Icon.svelte" import {uniq, shuffle} from "@welshman/lib"
import {shuffle} from "@welshman/lib"
import {getPubkeyTagValues, getListTags} from "@welshman/util" import {getPubkeyTagValues, getListTags} from "@welshman/util"
import {profileSearch, userFollows} from "@welshman/app" import {profileSearch, userFollows} from "@welshman/app"
import Icon from "@lib/components/Icon.svelte"
import PageHeader from "@lib/components/PageHeader.svelte" import PageHeader from "@lib/components/PageHeader.svelte"
import PeopleItem from "@app/components/PeopleItem.svelte" import PeopleItem from "@app/components/PeopleItem.svelte"
const defaultPubkeys = shuffle(getPubkeyTagValues(getListTags($userFollows))) const defaultPubkeys = uniq([
...shuffle(getPubkeyTagValues(getListTags($userFollows))),
...import.meta.env.VITE_DEFAULT_PUBKEYS.split(','),
])
let term = "" let term = ""
let limit = 10 let limit = 10