diff --git a/src/app/components/ChatStart.svelte b/src/app/components/ChatStart.svelte new file mode 100644 index 00000000..dd2d99ee --- /dev/null +++ b/src/app/components/ChatStart.svelte @@ -0,0 +1,41 @@ + + +
+

Start a Chat

+

+ Create an encrypted chat room for private conversations. +

+ +

Members

+
+ +
+
+
+ + +
+
diff --git a/src/app/components/ProfileMultiSelect.svelte b/src/app/components/ProfileMultiSelect.svelte new file mode 100644 index 00000000..4db08796 --- /dev/null +++ b/src/app/components/ProfileMultiSelect.svelte @@ -0,0 +1,88 @@ + + +
+
+ {#each value as pubkey (pubkey)} +
+ + + + +
+ {/each} +
+ + input.getBoundingClientRect(), + }} + /> +
diff --git a/src/app/routes.ts b/src/app/routes.ts index e6d70bd5..0067830d 100644 --- a/src/app/routes.ts +++ b/src/app/routes.ts @@ -1,6 +1,6 @@ import {nip19} from "nostr-tools" import type {Page} from "@sveltejs/kit" -import {userMembership, decodeNRelay} from "@app/state" +import {userMembership, makeChatId, decodeNRelay} from "@app/state" export const makeSpacePath = (url: string, extra = "") => { let path = `/spaces/${nip19.nrelayEncode(url)}` @@ -12,6 +12,8 @@ export const makeSpacePath = (url: string, extra = "") => { return path } +export const makeChatPath = (pubkeys: string[]) => `/home/${makeChatId(pubkeys)}` + export const getPrimaryNavItem = ($page: Page) => $page.route?.id?.split("/")[1] export const getPrimaryNavItemIndex = ($page: Page) => { diff --git a/src/app/state.ts b/src/app/state.ts index a3e583df..b0322f5e 100644 --- a/src/app/state.ts +++ b/src/app/state.ts @@ -223,7 +223,7 @@ export const { }, }) -// Encrypted Chats +// Chats export const chatMessages = deriveEvents(repository, {filters: [{kinds: [DIRECT_MESSAGE]}]}) diff --git a/src/lib/components/ModalBox.svelte b/src/lib/components/ModalBox.svelte index f04592a6..42649767 100644 --- a/src/lib/components/ModalBox.svelte +++ b/src/lib/components/ModalBox.svelte @@ -5,6 +5,6 @@ export let props = {} - {#each $chats as {id, pubkeys}, i (id)} diff --git a/src/routes/settings/+page.svelte b/src/routes/settings/+page.svelte index 89c781ff..49be2627 100644 --- a/src/routes/settings/+page.svelte +++ b/src/routes/settings/+page.svelte @@ -12,33 +12,13 @@ import Button from '@lib/components/Button.svelte' import Suggestions from '@lib/editor/Suggestions.svelte' import SuggestionProfile from '@lib/editor/SuggestionProfile.svelte' - import Name from '@app/components/Name.svelte' + import ProfileMultiSelect from '@app/components/ProfileMultiSelect.svelte' import {entityLink} from '@app/state' import {updateList} from '@app/commands' import {pushToast} from '@app/toast' - let term = "" - let input: Element - let popover: Instance - let instance: SvelteComponent let mutedPubkeys = getListValues("p", $userMutes) - const addMute = (pubkey: string) => { - term = "" - popover.hide() - mutedPubkeys = uniq(append(pubkey, mutedPubkeys)) - } - - const removeMute = (pubkey: string) => { - mutedPubkeys = remove(pubkey, mutedPubkeys) - } - - const onKeyDown = (e: Event) => { - if (instance.onKeyDown(e)) { - e.preventDefault() - } - } - const reset = () => { mutedPubkeys = getListValues("p", $userMutes) } @@ -48,56 +28,14 @@ pushToast({message: "Your settings have been saved!"}) } - - $: { - if (term) { - popover?.show() - } else { - popover?.hide() - } - }

Muted Accounts

-
-
- {#each mutedPubkeys as pubkey (pubkey)} -
- - - - -
- {/each} -
- - input.getBoundingClientRect(), - }} - /> +
+