mirror of
https://github.com/coracle-social/flotilla.git
synced 2025-12-10 10:57:04 +00:00
Remove general room
This commit is contained in:
@@ -14,13 +14,7 @@
|
|||||||
import ModalFooter from "@lib/components/ModalFooter.svelte"
|
import ModalFooter from "@lib/components/ModalFooter.svelte"
|
||||||
import InfoBunker from "@app/components/InfoBunker.svelte"
|
import InfoBunker from "@app/components/InfoBunker.svelte"
|
||||||
import BunkerConnect, {BunkerConnectController} from "@app/components/BunkerConnect.svelte"
|
import BunkerConnect, {BunkerConnectController} from "@app/components/BunkerConnect.svelte"
|
||||||
import {
|
import {alerts, getMembershipUrls, getMembershipRoomsByUrl, userMembership} from "@app/state"
|
||||||
GENERAL,
|
|
||||||
alerts,
|
|
||||||
getMembershipUrls,
|
|
||||||
getMembershipRoomsByUrl,
|
|
||||||
userMembership,
|
|
||||||
} from "@app/state"
|
|
||||||
import {loadAlertStatuses} from "@app/requests"
|
import {loadAlertStatuses} from "@app/requests"
|
||||||
import {publishAlert} from "@app/commands"
|
import {publishAlert} from "@app/commands"
|
||||||
import {pushToast} from "@app/toast"
|
import {pushToast} from "@app/toast"
|
||||||
@@ -107,7 +101,7 @@
|
|||||||
display.push("chat")
|
display.push("chat")
|
||||||
filters.push({
|
filters.push({
|
||||||
kinds: [MESSAGE],
|
kinds: [MESSAGE],
|
||||||
"#h": [GENERAL, ...getMembershipRoomsByUrl(relay, $userMembership)],
|
"#h": getMembershipRoomsByUrl(relay, $userMembership),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
import ModalFooter from "@lib/components/ModalFooter.svelte"
|
import ModalFooter from "@lib/components/ModalFooter.svelte"
|
||||||
import DateTimeInput from "@lib/components/DateTimeInput.svelte"
|
import DateTimeInput from "@lib/components/DateTimeInput.svelte"
|
||||||
import EditorContent from "@app/editor/EditorContent.svelte"
|
import EditorContent from "@app/editor/EditorContent.svelte"
|
||||||
import {PROTECTED, GENERAL, tagRoom} from "@app/state"
|
import {PROTECTED} from "@app/state"
|
||||||
import {makeEditor} from "@app/editor"
|
import {makeEditor} from "@app/editor"
|
||||||
import {pushToast} from "@app/toast"
|
import {pushToast} from "@app/toast"
|
||||||
|
|
||||||
@@ -73,7 +73,6 @@
|
|||||||
["end", end.toString()],
|
["end", end.toString()],
|
||||||
...daysBetween(start, end).map(D => ["D", D.toString()]),
|
...daysBetween(start, end).map(D => ["D", D.toString()]),
|
||||||
...ed.storage.nostr.getEditorTags(),
|
...ed.storage.nostr.getEditorTags(),
|
||||||
tagRoom(GENERAL, url),
|
|
||||||
PROTECTED,
|
PROTECTED,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {GENERAL, channelsById, makeChannelId} from "@app/state"
|
import {channelsById, makeChannelId} from "@app/state"
|
||||||
|
|
||||||
const {url, room} = $props()
|
const {url, room} = $props()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if room === GENERAL}
|
{$channelsById.get(makeChannelId(url, room))?.name || room}
|
||||||
general
|
|
||||||
{:else}
|
|
||||||
{$channelsById.get(makeChannelId(url, room))?.name || room}
|
|
||||||
{/if}
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
import ModalFooter from "@lib/components/ModalFooter.svelte"
|
import ModalFooter from "@lib/components/ModalFooter.svelte"
|
||||||
import EditorContent from "@app/editor/EditorContent.svelte"
|
import EditorContent from "@app/editor/EditorContent.svelte"
|
||||||
import {publishComment} from "@app/commands"
|
import {publishComment} from "@app/commands"
|
||||||
import {tagRoom, GENERAL, PROTECTED} from "@app/state"
|
import {PROTECTED} from "@app/state"
|
||||||
import {makeEditor} from "@app/editor"
|
import {makeEditor} from "@app/editor"
|
||||||
import {pushToast} from "@app/toast"
|
import {pushToast} from "@app/toast"
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
const ed = await editor
|
const ed = await editor
|
||||||
const content = ed.getText({blockSeparator: "\n"}).trim()
|
const content = ed.getText({blockSeparator: "\n"}).trim()
|
||||||
const tags = [...ed.storage.nostr.getEditorTags(), tagRoom(GENERAL, url), PROTECTED]
|
const tags = [...ed.storage.nostr.getEditorTags(), PROTECTED]
|
||||||
|
|
||||||
if (!content) {
|
if (!content) {
|
||||||
return pushToast({
|
return pushToast({
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
import ModalFooter from "@lib/components/ModalFooter.svelte"
|
import ModalFooter from "@lib/components/ModalFooter.svelte"
|
||||||
import EditorContent from "@app/editor/EditorContent.svelte"
|
import EditorContent from "@app/editor/EditorContent.svelte"
|
||||||
import {pushToast} from "@app/toast"
|
import {pushToast} from "@app/toast"
|
||||||
import {GENERAL, tagRoom, PROTECTED} from "@app/state"
|
import {PROTECTED} from "@app/state"
|
||||||
import {makeEditor} from "@app/editor"
|
import {makeEditor} from "@app/editor"
|
||||||
|
|
||||||
const {url} = $props()
|
const {url} = $props()
|
||||||
@@ -41,12 +41,7 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const tags = [
|
const tags = [...ed.storage.nostr.getEditorTags(), ["title", title], PROTECTED]
|
||||||
...ed.storage.nostr.getEditorTags(),
|
|
||||||
tagRoom(GENERAL, url),
|
|
||||||
["title", title],
|
|
||||||
PROTECTED,
|
|
||||||
]
|
|
||||||
|
|
||||||
publishThunk({
|
publishThunk({
|
||||||
relays: [url],
|
relays: [url],
|
||||||
|
|||||||
@@ -71,8 +71,6 @@ export const fromCsv = (s: string) => (s || "").split(",").filter(identity)
|
|||||||
|
|
||||||
export const ROOM = "h"
|
export const ROOM = "h"
|
||||||
|
|
||||||
export const GENERAL = "_"
|
|
||||||
|
|
||||||
export const PROTECTED = ["-"]
|
export const PROTECTED = ["-"]
|
||||||
|
|
||||||
export const ALERT = 32830
|
export const ALERT = 32830
|
||||||
@@ -582,13 +580,8 @@ export const channelsByUrl = derived(channelsById, $channelsById => {
|
|||||||
return $channelsByUrl
|
return $channelsByUrl
|
||||||
})
|
})
|
||||||
|
|
||||||
export const displayChannel = (url: string, room: string) => {
|
export const displayChannel = (url: string, room: string) =>
|
||||||
if (room === GENERAL) {
|
channelsById.get().get(makeChannelId(url, room))?.name || room
|
||||||
return "general"
|
|
||||||
}
|
|
||||||
|
|
||||||
return channelsById.get().get(makeChannelId(url, room))?.name || room
|
|
||||||
}
|
|
||||||
|
|
||||||
export const roomComparator = (url: string) => (room: string) =>
|
export const roomComparator = (url: string) => (room: string) =>
|
||||||
displayChannel(url, room).toLowerCase()
|
displayChannel(url, room).toLowerCase()
|
||||||
@@ -633,17 +626,13 @@ export const userRoomsByUrl = withGetter(
|
|||||||
addToMapKey($userRoomsByUrl, normalizeRelayUrl(url), room)
|
addToMapKey($userRoomsByUrl, normalizeRelayUrl(url), room)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const url of getRelayTagValues(tags)) {
|
|
||||||
addToMapKey($userRoomsByUrl, normalizeRelayUrl(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), uniq(Array.from($userRoomsByUrl.get(url) || [GENERAL]))),
|
sortBy(roomComparator(url), uniq(Array.from($userRoomsByUrl.get(url) || []))),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const deriveOtherRooms = (url: string) =>
|
export const deriveOtherRooms = (url: string) =>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type {Snippet} from 'svelte'
|
import type {Snippet} from "svelte"
|
||||||
import {page} from "$app/stores"
|
import {page} from "$app/stores"
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
import {
|
import {
|
||||||
userSettingValues,
|
userSettingValues,
|
||||||
decodeRelay,
|
decodeRelay,
|
||||||
GENERAL,
|
|
||||||
tagRoom,
|
tagRoom,
|
||||||
userRoomsByUrl,
|
userRoomsByUrl,
|
||||||
displayChannel,
|
displayChannel,
|
||||||
@@ -41,7 +40,7 @@
|
|||||||
import {popKey} from "@app/implicit"
|
import {popKey} from "@app/implicit"
|
||||||
import {pushToast} from "@app/toast"
|
import {pushToast} from "@app/toast"
|
||||||
|
|
||||||
const {room = GENERAL} = $page.params
|
const {room} = $page.params
|
||||||
const mounted = now()
|
const mounted = now()
|
||||||
const lastChecked = $checked[$page.url.pathname]
|
const lastChecked = $checked[$page.url.pathname]
|
||||||
const url = decodeRelay($page.params.relay)
|
const url = decodeRelay($page.params.relay)
|
||||||
@@ -252,22 +251,20 @@
|
|||||||
{/snippet}
|
{/snippet}
|
||||||
{#snippet action()}
|
{#snippet action()}
|
||||||
<div class="row-2">
|
<div class="row-2">
|
||||||
{#if room !== GENERAL}
|
{#if $userRoomsByUrl.get(url)?.has(room)}
|
||||||
{#if $userRoomsByUrl.get(url)?.has(room)}
|
<Button class="btn btn-neutral btn-sm" onclick={leaveRoom}>
|
||||||
<Button class="btn btn-neutral btn-sm" onclick={leaveRoom}>
|
<Icon icon="arrows-a-logout-2" />
|
||||||
<Icon icon="arrows-a-logout-2" />
|
Leave Room
|
||||||
Leave Room
|
</Button>
|
||||||
</Button>
|
{:else}
|
||||||
{:else}
|
<Button class="btn btn-neutral btn-sm" disabled={joiningRoom} onclick={joinRoom}>
|
||||||
<Button class="btn btn-neutral btn-sm" disabled={joiningRoom} onclick={joinRoom}>
|
{#if joiningRoom}
|
||||||
{#if joiningRoom}
|
<span class="loading loading-spinner loading-sm"></span>
|
||||||
<span class="loading loading-spinner loading-sm"></span>
|
{:else}
|
||||||
{:else}
|
<Icon icon="login-2" />
|
||||||
<Icon icon="login-2" />
|
{/if}
|
||||||
{/if}
|
Join Room
|
||||||
Join Room
|
</Button>
|
||||||
</Button>
|
|
||||||
{/if}
|
|
||||||
{/if}
|
{/if}
|
||||||
<MenuSpaceButton {url} />
|
<MenuSpaceButton {url} />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
import CalendarEventItem from "@app/components/CalendarEventItem.svelte"
|
import CalendarEventItem from "@app/components/CalendarEventItem.svelte"
|
||||||
import CalendarEventCreate from "@app/components/CalendarEventCreate.svelte"
|
import CalendarEventCreate from "@app/components/CalendarEventCreate.svelte"
|
||||||
import {pushModal} from "@app/modal"
|
import {pushModal} from "@app/modal"
|
||||||
import {GENERAL, getEventsForUrl, decodeRelay} from "@app/state"
|
import {getEventsForUrl, decodeRelay} from "@app/state"
|
||||||
import {makeCalendarFeed} from "@app/requests"
|
import {makeCalendarFeed} from "@app/requests"
|
||||||
import {setChecked} from "@app/notifications"
|
import {setChecked} from "@app/notifications"
|
||||||
|
|
||||||
@@ -92,10 +92,8 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
const feedFilters = [{kinds: [EVENT_TIME], "#h": [GENERAL]}]
|
const feedFilters = [{kinds: [EVENT_TIME]}]
|
||||||
const subscriptionFilters = [
|
const subscriptionFilters = [{kinds: [DELETE, REACTION, EVENT_TIME], since: now()}]
|
||||||
{kinds: [DELETE, REACTION, EVENT_TIME], "#h": [GENERAL], since: now()},
|
|
||||||
]
|
|
||||||
|
|
||||||
;({events, cleanup} = makeCalendarFeed({
|
;({events, cleanup} = makeCalendarFeed({
|
||||||
element: element!,
|
element: element!,
|
||||||
|
|||||||
Reference in New Issue
Block a user