forked from coracle/flotilla
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>>({})
|
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 deriveChecked = (key: string) => derived(checked, prop(key))
|
||||||
|
|
||||||
export const setChecked = (key: string, ts = now()) =>
|
export const setChecked = (key: string, ts = now()) =>
|
||||||
|
Boolean(console.trace("====== setChecked", key))||
|
||||||
checked.update(state => ({...state, [key]: ts}))
|
checked.update(state => ({...state, [key]: ts}))
|
||||||
|
|
||||||
// Filters for various routes
|
// Filters for various routes
|
||||||
|
|||||||
+1
-5
@@ -597,17 +597,13 @@ export const userRoomsByUrl = withGetter(
|
|||||||
addToMapKey($userRoomsByUrl, url, room)
|
addToMapKey($userRoomsByUrl, url, room)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const url of $userRoomsByUrl.keys()) {
|
|
||||||
addToMapKey($userRoomsByUrl, url, GENERAL)
|
|
||||||
}
|
|
||||||
|
|
||||||
return $userRoomsByUrl
|
return $userRoomsByUrl
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const deriveUserRooms = (url: string) =>
|
export const deriveUserRooms = (url: string) =>
|
||||||
derived(userRoomsByUrl, $userRoomsByUrl =>
|
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) =>
|
export const deriveOtherRooms = (url: string) =>
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
import ChannelName from "@app/components/ChannelName.svelte"
|
import ChannelName from "@app/components/ChannelName.svelte"
|
||||||
import SpaceJoin from "@app/components/SpaceJoin.svelte"
|
import SpaceJoin from "@app/components/SpaceJoin.svelte"
|
||||||
import RelayName from "@app/components/RelayName.svelte"
|
import RelayName from "@app/components/RelayName.svelte"
|
||||||
|
import RoomCreate from "@app/components/RoomCreate.svelte"
|
||||||
import RelayDescription from "@app/components/RelayDescription.svelte"
|
import RelayDescription from "@app/components/RelayDescription.svelte"
|
||||||
import {
|
import {
|
||||||
decodeRelay,
|
decodeRelay,
|
||||||
@@ -33,6 +34,8 @@
|
|||||||
|
|
||||||
const joinSpace = () => pushModal(SpaceJoin, {url})
|
const joinSpace = () => pushModal(SpaceJoin, {url})
|
||||||
|
|
||||||
|
const addRoom = () => pushModal(RoomCreate, {url})
|
||||||
|
|
||||||
let relayAdminEvents: TrustedEvent[] = []
|
let relayAdminEvents: TrustedEvent[] = []
|
||||||
|
|
||||||
$: pubkey = $relay?.profile?.pubkey
|
$: pubkey = $relay?.profile?.pubkey
|
||||||
@@ -113,37 +116,37 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<div class="grid grid-cols-3 gap-2">
|
<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
|
<Icon icon="notes-minimalistic" /> Threads
|
||||||
</Link>
|
</Link>
|
||||||
{#each $userRooms as room (room)}
|
{#each $userRooms as room (room)}
|
||||||
<Link
|
<Link
|
||||||
href={makeRoomPath(url, room)}
|
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)))}
|
{#if channelIsLocked($channelsById.get(makeChannelId(url, room)))}
|
||||||
<Icon icon="lock" size={4} />
|
<Icon icon="lock" size={4} />
|
||||||
{:else}
|
{:else}
|
||||||
<Icon icon="hashtag" />
|
<Icon icon="hashtag" />
|
||||||
{/if}
|
{/if}
|
||||||
<div class="min-w-0 overflow-hidden text-ellipsis">
|
<ChannelName {url} {room} />
|
||||||
<ChannelName {url} {room} />
|
|
||||||
</div>
|
|
||||||
</Link>
|
</Link>
|
||||||
{/each}
|
{/each}
|
||||||
{#each $otherRooms as room (room)}
|
{#each $otherRooms as room (room)}
|
||||||
<Link
|
<Link
|
||||||
href={makeRoomPath(url, room)}
|
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)))}
|
{#if channelIsLocked($channelsById.get(makeChannelId(url, room)))}
|
||||||
<Icon icon="lock" size={4} />
|
<Icon icon="lock" size={4} />
|
||||||
{:else}
|
{:else}
|
||||||
<Icon icon="hashtag" />
|
<Icon icon="hashtag" />
|
||||||
{/if}
|
{/if}
|
||||||
<div class="min-w-0 overflow-hidden text-ellipsis">
|
<ChannelName {url} {room} />
|
||||||
<ChannelName {url} {room} />
|
|
||||||
</div>
|
|
||||||
</Link>
|
</Link>
|
||||||
{/each}
|
{/each}
|
||||||
|
<Button on:click={addRoom} class="btn btn-neutral">
|
||||||
|
<Icon icon="add-circle" />
|
||||||
|
Create Room
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
{#if pubkey}
|
{#if pubkey}
|
||||||
<div class="hidden flex-col gap-2" class:!flex={relayAdminEvents.length > 0}>
|
<div class="hidden flex-col gap-2" class:!flex={relayAdminEvents.length > 0}>
|
||||||
|
|||||||
Reference in New Issue
Block a user