mirror of
https://github.com/coracle-social/flotilla.git
synced 2025-12-10 19:07:06 +00:00
Small tweaks to room menu
This commit is contained in:
@@ -12,11 +12,12 @@ import {LEGACY_THREAD, deriveEventsForUrl, getMembershipUrls, userMembership} fr
|
||||
|
||||
export const checked = writable<Record<string, number>>({})
|
||||
|
||||
checked.subscribe(v => console.trace("======", v))
|
||||
checked.subscribe(v => console.log("====== checked", v))
|
||||
|
||||
export const deriveChecked = (key: string) => derived(checked, prop(key))
|
||||
|
||||
export const setChecked = (key: string, ts = now()) =>
|
||||
Boolean(console.trace("====== setChecked", key))||
|
||||
checked.update(state => ({...state, [key]: ts}))
|
||||
|
||||
// Filters for various routes
|
||||
|
||||
@@ -597,17 +597,13 @@ export const userRoomsByUrl = withGetter(
|
||||
addToMapKey($userRoomsByUrl, url, room)
|
||||
}
|
||||
|
||||
for (const url of $userRoomsByUrl.keys()) {
|
||||
addToMapKey($userRoomsByUrl, url, GENERAL)
|
||||
}
|
||||
|
||||
return $userRoomsByUrl
|
||||
}),
|
||||
)
|
||||
|
||||
export const deriveUserRooms = (url: string) =>
|
||||
derived(userRoomsByUrl, $userRoomsByUrl =>
|
||||
sortBy(roomComparator(url), Array.from($userRoomsByUrl.get(url) || [])),
|
||||
sortBy(roomComparator(url), uniq(Array.from($userRoomsByUrl.get(url) || []).concat(GENERAL))),
|
||||
)
|
||||
|
||||
export const deriveOtherRooms = (url: string) =>
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
import ChannelName from "@app/components/ChannelName.svelte"
|
||||
import SpaceJoin from "@app/components/SpaceJoin.svelte"
|
||||
import RelayName from "@app/components/RelayName.svelte"
|
||||
import RoomCreate from "@app/components/RoomCreate.svelte"
|
||||
import RelayDescription from "@app/components/RelayDescription.svelte"
|
||||
import {
|
||||
decodeRelay,
|
||||
@@ -33,6 +34,8 @@
|
||||
|
||||
const joinSpace = () => pushModal(SpaceJoin, {url})
|
||||
|
||||
const addRoom = () => pushModal(RoomCreate, {url})
|
||||
|
||||
let relayAdminEvents: TrustedEvent[] = []
|
||||
|
||||
$: pubkey = $relay?.profile?.pubkey
|
||||
@@ -113,37 +116,37 @@
|
||||
{/if}
|
||||
</div>
|
||||
<div class="grid grid-cols-3 gap-2">
|
||||
<Link href={makeSpacePath(url, "threads")} class="btn btn-primary justify-start border-none">
|
||||
<Link href={makeSpacePath(url, "threads")} class="btn btn-primary">
|
||||
<Icon icon="notes-minimalistic" /> Threads
|
||||
</Link>
|
||||
{#each $userRooms as room (room)}
|
||||
<Link
|
||||
href={makeRoomPath(url, room)}
|
||||
class="btn btn-neutral flex-nowrap justify-start whitespace-nowrap border-none">
|
||||
class="btn btn-neutral">
|
||||
{#if channelIsLocked($channelsById.get(makeChannelId(url, room)))}
|
||||
<Icon icon="lock" size={4} />
|
||||
{:else}
|
||||
<Icon icon="hashtag" />
|
||||
{/if}
|
||||
<div class="min-w-0 overflow-hidden text-ellipsis">
|
||||
<ChannelName {url} {room} />
|
||||
</div>
|
||||
<ChannelName {url} {room} />
|
||||
</Link>
|
||||
{/each}
|
||||
{#each $otherRooms as room (room)}
|
||||
<Link
|
||||
href={makeRoomPath(url, room)}
|
||||
class="bg-alt btn btn-neutral flex-nowrap justify-start whitespace-nowrap border-none">
|
||||
class="btn btn-neutral">
|
||||
{#if channelIsLocked($channelsById.get(makeChannelId(url, room)))}
|
||||
<Icon icon="lock" size={4} />
|
||||
{:else}
|
||||
<Icon icon="hashtag" />
|
||||
{/if}
|
||||
<div class="min-w-0 overflow-hidden text-ellipsis">
|
||||
<ChannelName {url} {room} />
|
||||
</div>
|
||||
<ChannelName {url} {room} />
|
||||
</Link>
|
||||
{/each}
|
||||
<Button on:click={addRoom} class="btn btn-neutral">
|
||||
<Icon icon="add-circle" />
|
||||
Create Room
|
||||
</Button>
|
||||
</div>
|
||||
{#if pubkey}
|
||||
<div class="hidden flex-col gap-2" class:!flex={relayAdminEvents.length > 0}>
|
||||
|
||||
Reference in New Issue
Block a user