Rename room variables to h

This commit is contained in:
Jon Staab
2025-10-30 15:33:34 -07:00
parent 478721d349
commit dbaa0f5d49
28 changed files with 158 additions and 158 deletions
@@ -25,7 +25,7 @@
const {url, event, showRoom, showActivity}: Props = $props()
const room = getTagValue("h", event.tags)
const h = getTagValue("h", event.tags)
const path = makeCalendarPath(url, event.id)
const shouldProtect = canEnforceNip70(url)
@@ -39,9 +39,9 @@
</script>
<div class="flex flex-grow flex-wrap justify-end gap-2">
{#if room && showRoom}
<Link href={makeSpacePath(url, room)} class="btn btn-neutral btn-xs rounded-full">
Posted in #<ChannelName {room} {url} />
{#if h && showRoom}
<Link href={makeSpacePath(url, h)} class="btn btn-neutral btn-xs rounded-full">
Posted in #<ChannelName {h} {url} />
</Link>
{/if}
<ReactionSummary {url} {event} {deleteReaction} {createReaction} reactionClass="tooltip-left" />
@@ -4,13 +4,13 @@
type Props = {
url: string
room?: string
h?: string
}
const {url, room}: Props = $props()
const {url, h}: Props = $props()
</script>
<CalendarEventForm {url} {room}>
<CalendarEventForm {url} {h}>
{#snippet header()}
<ModalHeader>
{#snippet title()}
+4 -4
View File
@@ -23,7 +23,7 @@
type Props = {
url: string
room?: string
h?: string
header: Snippet
initialValues?: {
d: string
@@ -35,7 +35,7 @@
}
}
const {url, room, header, initialValues}: Props = $props()
const {url, h, header, initialValues}: Props = $props()
const shouldProtect = canEnforceNip70(url)
@@ -85,8 +85,8 @@
tags.push(PROTECTED)
}
if (room) {
tags.push(["h", room])
if (h) {
tags.push(["h", h])
}
const event = makeEvent(EVENT_TIME, {content, tags})
+3 -3
View File
@@ -15,7 +15,7 @@
const {url, event}: Props = $props()
const room = getTagValue("h", event.tags)
const h = getTagValue("h", event.tags)
</script>
<Link class="col-3 card2 bg-alt w-full cursor-pointer" href={makeCalendarPath(url, event.id)}>
@@ -23,8 +23,8 @@
<div class="flex w-full flex-col items-end justify-between gap-2 sm:flex-row">
<span class="whitespace-nowrap py-1 text-sm opacity-75">
Posted by <ProfileLink pubkey={event.pubkey} {url} />
{#if room}
in <ChannelLink {url} {room} />
{#if h}
in <ChannelLink {url} {h} />
{/if}
</span>
<CalendarEventActions showActivity {url} {event} />
+3 -3
View File
@@ -16,13 +16,13 @@
type Props = {
url?: string
room?: string
h?: string
content?: string
onEditPrevious?: () => void
onSubmit: (event: EventContent) => void
}
const {url, room, content, onEditPrevious, onSubmit}: Props = $props()
const {url, h, content, onEditPrevious, onSubmit}: Props = $props()
const autofocus = !isMobile
@@ -90,7 +90,7 @@
<Tippy
bind:popover
component={ComposeMenu}
props={{url, room, onClick: hidePopover}}
props={{url, h, onClick: hidePopover}}
params={{trigger: "manual", interactive: true}}>
<Button
data-tip="More options"
+4 -4
View File
@@ -5,17 +5,17 @@
import {makeSpacePath} from "@app/util/routes"
type Props = {
room: string
h: string
url: string
class?: string
unstyled?: boolean
}
const {room, url, unstyled, ...props}: Props = $props()
const {h, url, unstyled, ...props}: Props = $props()
const path = makeSpacePath(url, room)
const path = makeSpacePath(url, h)
</script>
<Link href={path} class={cx(props.class, {"link-content bg-alt": !unstyled})}>
#<ChannelName {room} {url} />
#<ChannelName {h} {url} />
</Link>
+2 -2
View File
@@ -1,7 +1,7 @@
<script lang="ts">
import {channelsById, makeChannelId} from "@app/core/state"
const {url, room} = $props()
const {url, h} = $props()
</script>
{$channelsById.get(makeChannelId(url, room))?.name || room}
{$channelsById.get(makeChannelId(url, h))?.name || h}
@@ -7,12 +7,12 @@
interface Props {
url: any
room: any
h: any
}
const {url, room}: Props = $props()
const {url, h}: Props = $props()
const channel = deriveChannel(url, room)
const channel = deriveChannel(url, h)
</script>
{#if $channel?.picture}
@@ -28,5 +28,5 @@
<Icon icon={Hashtag} />
{/if}
<div class="min-w-0 overflow-hidden text-ellipsis">
<ChannelName {url} {room} />
<ChannelName {url} {h} />
</div>
+5 -5
View File
@@ -13,16 +13,16 @@
type Props = {
url: string
onClick: () => void
room?: string
h?: string
}
const {url, room, onClick}: Props = $props()
const {url, h, onClick}: Props = $props()
const createGoal = () => pushModal(GoalCreate, {url, room})
const createGoal = () => pushModal(GoalCreate, {url, h})
const createCalendarEvent = () => pushModal(CalendarEventCreate, {url, room})
const createCalendarEvent = () => pushModal(CalendarEventCreate, {url, h})
const createThread = () => pushModal(ThreadCreate, {url, room})
const createThread = () => pushModal(ThreadCreate, {url, h})
let ul: Element
+4 -4
View File
@@ -12,14 +12,14 @@
type Props = {
url: string
room?: string
h?: string
events: TrustedEvent[]
latest: TrustedEvent
earliest: TrustedEvent
participants: string[]
}
const {url, room, events, latest, earliest, participants}: Props = $props()
const {url, h, events, latest, earliest, participants}: Props = $props()
</script>
<Button class="card2 bg-alt" onclick={() => goToEvent(earliest)}>
@@ -28,9 +28,9 @@
<ProfileCircle pubkey={earliest.pubkey} size={10} />
<div class="min-w-0 flex-1">
<div class="flex items-center gap-2 text-sm opacity-70">
{#if room}
{#if h}
<span class="truncate font-medium text-blue-400">
#{displayChannel(url, room)}
#{displayChannel(url, h)}
</span>
<span class="opacity-50"></span>
{/if}
+6 -6
View File
@@ -22,8 +22,8 @@
goto(makeRoomPath(url, selection), {replaceState: true})
}
const toggleRoom = (room: string) => {
selection = room === selection ? "" : room
const toggleRoom = (h: string) => {
selection = h === selection ? "" : h
}
let selection = $state("")
@@ -39,13 +39,13 @@
{/snippet}
</ModalHeader>
<div class="grid grid-cols-3 gap-2">
{#each $channelsByUrl.get(url) || [] as channel (channel.room)}
{#each $channelsByUrl.get(url) || [] as channel (channel.h)}
<button
type="button"
class="btn"
class:btn-neutral={selection !== channel.room}
class:btn-primary={selection === channel.room}
onclick={() => toggleRoom(channel.room)}>
class:btn-neutral={selection !== channel.h}
class:btn-primary={selection === channel.h}
onclick={() => toggleRoom(channel.h)}>
#<ChannelName {...channel} />
</button>
{/each}
+4 -4
View File
@@ -20,7 +20,7 @@
const {url, event, showRoom, showActivity}: Props = $props()
const path = makeGoalPath(url, event.id)
const room = getTagValue("h", event.tags)
const h = getTagValue("h", event.tags)
const shouldProtect = canEnforceNip70(url)
const deleteReaction = async (event: TrustedEvent) =>
@@ -31,9 +31,9 @@
</script>
<div class="flex flex-grow flex-wrap justify-end gap-2">
{#if room && showRoom}
<Link href={makeSpacePath(url, room)} class="btn btn-neutral btn-xs rounded-full">
Posted in #<ChannelName {room} {url} />
{#if h && showRoom}
<Link href={makeSpacePath(url, h)} class="btn btn-neutral btn-xs rounded-full">
Posted in #<ChannelName {h} {url} />
</Link>
{/if}
<ReactionSummary {url} {event} {deleteReaction} {createReaction} reactionClass="tooltip-left" />
+4 -4
View File
@@ -20,10 +20,10 @@
type Props = {
url: string
room?: string
h?: string
}
const {url, room}: Props = $props()
const {url, h}: Props = $props()
const shouldProtect = canEnforceNip70(url)
@@ -64,8 +64,8 @@
tags.push(PROTECTED)
}
if (room) {
tags.push(["h", room])
if (h) {
tags.push(["h", h])
}
publishThunk({
+3 -3
View File
@@ -17,7 +17,7 @@
const {url, event}: Props = $props()
const summary = getTagValue("summary", event.tags)
const room = getTagValue("h", event.tags)
const h = getTagValue("h", event.tags)
</script>
<Link class="col-2 card2 bg-alt w-full cursor-pointer" href={makeGoalPath(url, event.id)}>
@@ -32,8 +32,8 @@
<div class="flex w-full flex-col items-end justify-between gap-2 sm:flex-row">
<span class="whitespace-nowrap py-1 text-sm opacity-75">
Posted by <ProfileLink pubkey={event.pubkey} {url} />
{#if room}
in <ChannelLink {url} {room} />
{#if h}
in <ChannelLink {url} {h} />
{/if}
</span>
<GoalActions showActivity {url} {event} />
+4 -4
View File
@@ -216,8 +216,8 @@
<div class="h-2"></div>
<SecondaryNavHeader>Your Rooms</SecondaryNavHeader>
{/if}
{#each $userRooms as room, i (room)}
<MenuSpaceRoomItem {replaceState} notify {url} {room} />
{#each $userRooms as h, i (h)}
<MenuSpaceRoomItem {replaceState} notify {url} {h} />
{/each}
{#if $otherRooms.length > 0}
<div class="h-2"></div>
@@ -229,8 +229,8 @@
{/if}
</SecondaryNavHeader>
{/if}
{#each $otherRooms as room, i (room)}
<MenuSpaceRoomItem {replaceState} {url} {room} />
{#each $otherRooms as h, i (h)}
<MenuSpaceRoomItem {replaceState} {url} {h} />
{/each}
{#if $canCreateRoom}
<SecondaryNavItem {replaceState} onclick={addRoom}>
+4 -4
View File
@@ -6,19 +6,19 @@
interface Props {
url: any
room: any
h: any
notify?: boolean
replaceState?: boolean
}
const {url, room, notify = false, replaceState = false}: Props = $props()
const {url, h, notify = false, replaceState = false}: Props = $props()
const path = makeRoomPath(url, room)
const path = makeRoomPath(url, h)
</script>
<SecondaryNavItem
href={path}
{replaceState}
notification={notify ? $notifications.has(path) : false}>
<ChannelNameWithImage {url} {room} />
<ChannelNameWithImage {url} {h} />
</SecondaryNavItem>
+5 -5
View File
@@ -19,13 +19,13 @@
type Props = {
url: string
room: string
h: string
}
const {url, room}: Props = $props()
const {url, h}: Props = $props()
const channel = deriveChannel(url, room)
const initialValues = $channel ? readRoomMeta($channel.event) : makeRoomMeta({h: room})
const channel = deriveChannel(url, h)
const initialValues = $channel ? readRoomMeta($channel.event) : makeRoomMeta({h})
const back = () => history.back()
@@ -37,7 +37,7 @@
message:
"This room will no longer be accessible to space members, and all messages posted to it will be deleted.",
confirm: async () => {
const thunk = deleteRoom(url, makeRoomMeta({h: room}))
const thunk = deleteRoom(url, makeRoomMeta({h}))
const message = await waitForThunkError(thunk)
if (message) {
+5 -2
View File
@@ -113,7 +113,10 @@
{#if imagePreview}
<div class="flex items-center gap-2">
<span class="text-sm opacity-75">Selected:</span>
<img src={imagePreview} alt="Room icon preview" class="h-5 w-5 rounded-lg object-cover" />
<img
src={imagePreview}
alt="Room icon preview"
class="h-5 w-5 rounded-lg object-cover" />
</div>
{:else if selectedIcon}
<div class="flex items-center gap-2">
@@ -161,7 +164,7 @@
{/snippet}
{#snippet input()}
<label class="input input-bordered flex w-full items-center gap-2">
<input bind:value={values.description} class="grow" type="text" />
<input bind:value={values.about} class="grow" type="text" />
</label>
{/snippet}
</FieldInline>
+4 -4
View File
@@ -19,8 +19,8 @@
const {url, event, showRoom, showActivity}: Props = $props()
const h = getTagValue("h", event.tags)
const path = makeThreadPath(url, event.id)
const room = getTagValue("h", event.tags)
const shouldProtect = canEnforceNip70(url)
const deleteReaction = async (event: TrustedEvent) =>
@@ -31,9 +31,9 @@
</script>
<div class="flex flex-grow flex-wrap justify-end gap-2">
{#if room && showRoom}
<Link href={makeSpacePath(url, room)} class="btn btn-neutral btn-xs rounded-full">
Posted in #<ChannelName {room} {url} />
{#if h && showRoom}
<Link href={makeSpacePath(url, h)} class="btn btn-neutral btn-xs rounded-full">
Posted in #<ChannelName {h} {url} />
</Link>
{/if}
<ReactionSummary {url} {event} {deleteReaction} {createReaction} reactionClass="tooltip-left" />
+4 -4
View File
@@ -18,10 +18,10 @@
type Props = {
url: string
room?: string
h?: string
}
const {url, room}: Props = $props()
const {url, h}: Props = $props()
const shouldProtect = canEnforceNip70(url)
@@ -57,8 +57,8 @@
tags.push(PROTECTED)
}
if (room) {
tags.push(["h", room])
if (h) {
tags.push(["h", h])
}
publishThunk({
+3 -3
View File
@@ -17,7 +17,7 @@
const {url, event}: Props = $props()
const title = getTagValue("title", event.tags)
const room = getTagValue("h", event.tags)
const h = getTagValue("h", event.tags)
</script>
<Link class="col-2 card2 bg-alt w-full cursor-pointer" href={makeThreadPath(url, event.id)}>
@@ -38,8 +38,8 @@
<span class="whitespace-nowrap py-1 text-sm opacity-75">
Posted by
<ProfileLink pubkey={event.pubkey} {url} />
{#if room}
in <ChannelLink {url} {room} />
{#if h}
in <ChannelLink {url} {h} />
{/if}
</span>
<ThreadActions showActivity {url} {event} />