Show all members button on chat

This commit is contained in:
Jon Staab
2024-10-11 16:18:05 -07:00
parent aad1ad5f7c
commit 1be288dcd9
5 changed files with 33 additions and 9 deletions
+3 -3
View File
@@ -7,7 +7,7 @@
import {pubkey, inboxRelaySelectionsByPubkey, loadInboxRelaySelections} from "@welshman/app" import {pubkey, inboxRelaySelectionsByPubkey, loadInboxRelaySelections} from "@welshman/app"
import Link from "@lib/components/Link.svelte" import Link from "@lib/components/Link.svelte"
import Icon from "@lib/components/Icon.svelte" import Icon from "@lib/components/Icon.svelte"
import Name from "@app/components/Name.svelte" import ProfileName from "@app/components/ProfileName.svelte"
import ProfileCircle from "@app/components/ProfileCircle.svelte" import ProfileCircle from "@app/components/ProfileCircle.svelte"
import ProfileCircles from "@app/components/ProfileCircles.svelte" import ProfileCircles from "@app/components/ProfileCircles.svelte"
@@ -35,11 +35,11 @@
<div class="flex min-w-0 items-center gap-2"> <div class="flex min-w-0 items-center gap-2">
{#if others.length === 1} {#if others.length === 1}
<ProfileCircle pubkey={others[0]} size={5} /> <ProfileCircle pubkey={others[0]} size={5} />
<Name pubkey={others[0]} /> <ProfileName pubkey={others[0]} />
{:else} {:else}
<ProfileCircles pubkeys={others} size={5} /> <ProfileCircles pubkeys={others} size={5} />
<p class="overflow-hidden text-ellipsis whitespace-nowrap"> <p class="overflow-hidden text-ellipsis whitespace-nowrap">
<Name pubkey={others[0]} /> <ProfileName pubkey={others[0]} />
and {others.length - 1} and {others.length - 1}
{others.length > 2 ? "others" : "other"} {others.length > 2 ? "others" : "other"}
</p> </p>
+11
View File
@@ -0,0 +1,11 @@
<script lang="ts">
import Profile from "@app/components/Profile.svelte"
export let pubkeys
</script>
<div class="row-2">
{#each pubkeys as pubkey (pubkey)}
<Profile {pubkey} />
{/each}
</div>
+2 -2
View File
@@ -8,7 +8,7 @@
import Button from "@lib/components/Button.svelte" import Button from "@lib/components/Button.svelte"
import Suggestions from "@lib/editor/Suggestions.svelte" import Suggestions from "@lib/editor/Suggestions.svelte"
import SuggestionProfile from "@lib/editor/SuggestionProfile.svelte" import SuggestionProfile from "@lib/editor/SuggestionProfile.svelte"
import Name from "@app/components/Name.svelte" import ProfileName from "@app/components/ProfileName.svelte"
import ProfileDetail from "@app/components/ProfileDetail.svelte" import ProfileDetail from "@app/components/ProfileDetail.svelte"
import {pushDrawer} from "@app/modal" import {pushDrawer} from "@app/modal"
@@ -54,7 +54,7 @@
<Icon icon="close-circle" size={4} class="-ml-1 mt-px" /> <Icon icon="close-circle" size={4} class="-ml-1 mt-px" />
</Button> </Button>
<Button on:click={() => onClick(pubkey)}> <Button on:click={() => onClick(pubkey)}>
<Name {pubkey} /> <ProfileName {pubkey} />
</Button> </Button>
</div> </div>
{/each} {/each}
+17 -4
View File
@@ -27,12 +27,16 @@
import Spinner from "@lib/components/Spinner.svelte" import Spinner from "@lib/components/Spinner.svelte"
import PageBar from "@lib/components/PageBar.svelte" import PageBar from "@lib/components/PageBar.svelte"
import Divider from "@lib/components/Divider.svelte" import Divider from "@lib/components/Divider.svelte"
import Name from "@app/components/Name.svelte" import Button from "@lib/components/Button.svelte"
import ProfileName from "@app/components/ProfileName.svelte"
import ProfileCircle from "@app/components/ProfileCircle.svelte" import ProfileCircle from "@app/components/ProfileCircle.svelte"
import ProfileCircles from "@app/components/ProfileCircles.svelte" import ProfileCircles from "@app/components/ProfileCircles.svelte"
import ProfileDetail from "@app/components/ProfileDetail.svelte"
import ProfileList from "@app/components/ProfileList.svelte"
import ChatMessage from "@app/components/ChatMessage.svelte" import ChatMessage from "@app/components/ChatMessage.svelte"
import ChatCompose from "@app/components/ChannelCompose.svelte" import ChatCompose from "@app/components/ChannelCompose.svelte"
import {deriveChat, splitChatId} from "@app/state" import {deriveChat, splitChatId} from "@app/state"
import {pushModal} from "@app/modal"
import {sendWrapped} from "@app/commands" import {sendWrapped} from "@app/commands"
const id = $page.params.chat === "notes" ? $pubkey! : $page.params.chat const id = $page.params.chat === "notes" ? $pubkey! : $page.params.chat
@@ -47,6 +51,8 @@
const assertNotNil = <T,>(x: T | undefined) => x! const assertNotNil = <T,>(x: T | undefined) => x!
const showMembers = () => pushModal(ProfileList, {pubkeys: others})
const onSubmit = async ({content, ...params}: EventContent) => { const onSubmit = async ({content, ...params}: EventContent) => {
const tags = [...params.tags, ...remove($pubkey!, pubkeys).map(tagPubkey)] const tags = [...params.tags, ...remove($pubkey!, pubkeys).map(tagPubkey)]
const template = createEvent(DIRECT_MESSAGE, {content, tags}) const template = createEvent(DIRECT_MESSAGE, {content, tags})
@@ -101,14 +107,21 @@
<PageBar> <PageBar>
<div slot="title" class="row-2"> <div slot="title" class="row-2">
{#if others.length === 1} {#if others.length === 1}
<ProfileCircle pubkey={others[0]} size={5} /> {@const pubkey = others[0]}
<Name pubkey={others[0]} /> {@const showProfile = () => pushModal(ProfileDetail, {pubkey})}
<Button on:click={showProfile}>
<ProfileCircle {pubkey} size={5} />
<ProfileName {pubkey} />
</Button>
{:else} {:else}
<ProfileCircles pubkeys={others} size={5} /> <ProfileCircles pubkeys={others} size={5} />
<p class="overflow-hidden text-ellipsis whitespace-nowrap"> <p class="overflow-hidden text-ellipsis whitespace-nowrap">
<Name pubkey={others[0]} /> <ProfileName pubkey={others[0]} />
and {others.length - 1} and {others.length - 1}
{others.length > 2 ? "others" : "other"} {others.length > 2 ? "others" : "other"}
<Button on:click={showMembers} class="btn btn-link">
Show all members
</Button>
</p> </p>
{/if} {/if}
</div> </div>