forked from coracle/flotilla
Show notification badge on voice room item
This commit is contained in:
@@ -23,15 +23,13 @@
|
|||||||
const shouldNotifyForSpace = deriveShouldNotify(url)
|
const shouldNotifyForSpace = deriveShouldNotify(url)
|
||||||
const shouldNotifyForRoom = deriveShouldNotify(url, h)
|
const shouldNotifyForRoom = deriveShouldNotify(url, h)
|
||||||
const showDifferenceIcon = $derived($shouldNotifyForRoom !== $shouldNotifyForSpace)
|
const showDifferenceIcon = $derived($shouldNotifyForRoom !== $shouldNotifyForSpace)
|
||||||
|
const notification = $derived($shouldNotifyForRoom ? $notifications.has(path) : false)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if roomType === RoomType.Voice}
|
{#if roomType === RoomType.Voice}
|
||||||
<VoiceRoomItem {url} {h} {replaceState} />
|
<VoiceRoomItem {url} {h} {replaceState} {notification} />
|
||||||
{:else}
|
{:else}
|
||||||
<SecondaryNavItem
|
<SecondaryNavItem href={path} {replaceState} {notification}>
|
||||||
href={path}
|
|
||||||
{replaceState}
|
|
||||||
notification={$shouldNotifyForRoom ? $notifications.has(path) : false}>
|
|
||||||
<RoomNameWithImage {url} {h} />
|
<RoomNameWithImage {url} {h} />
|
||||||
{#if showDifferenceIcon}
|
{#if showDifferenceIcon}
|
||||||
<Icon icon={$shouldNotifyForRoom ? Bell : BellOff} size={4} class="opacity-50" />
|
<Icon icon={$shouldNotifyForRoom ? Bell : BellOff} size={4} class="opacity-50" />
|
||||||
|
|||||||
@@ -25,9 +25,10 @@
|
|||||||
url: string
|
url: string
|
||||||
h: string
|
h: string
|
||||||
replaceState?: boolean
|
replaceState?: boolean
|
||||||
|
notification?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const {url, h, replaceState = false}: Props = $props()
|
const {url, h, replaceState = false, notification = false}: Props = $props()
|
||||||
|
|
||||||
const participants = deriveVoiceParticipants(url, h)
|
const participants = deriveVoiceParticipants(url, h)
|
||||||
const isActive = $derived(
|
const isActive = $derived(
|
||||||
@@ -61,6 +62,7 @@
|
|||||||
<SecondaryNavItem
|
<SecondaryNavItem
|
||||||
href={makeRoomPath(url, h)}
|
href={makeRoomPath(url, h)}
|
||||||
{replaceState}
|
{replaceState}
|
||||||
|
{notification}
|
||||||
onclick={handleClick}
|
onclick={handleClick}
|
||||||
class={cx("!items-start", isActive && "!bg-base-100 !text-base-content")}>
|
class={cx("!items-start", isActive && "!bg-base-100 !text-base-content")}>
|
||||||
<div class="flex w-full min-w-0 flex-col gap-2">
|
<div class="flex w-full min-w-0 flex-col gap-2">
|
||||||
|
|||||||
Reference in New Issue
Block a user