UBERF-7016: Hide channels without any activity long time (#6176)

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
Kristina
2024-07-30 12:53:24 +07:00
committed by GitHub
parent 1340ca78a9
commit 416eb9942e
28 changed files with 743 additions and 346 deletions
@@ -27,7 +27,7 @@
$: notifyContext = $contextByDocStore.get(value._id)
$: inboxNotifications = notifyContext ? $inboxNotificationsByContextStore.get(notifyContext._id) ?? [] : []
$: hasNotification = !notifyContext?.hidden && inboxNotifications.some(({ isViewed }) => !isViewed)
$: hasNotification = inboxNotifications.some(({ isViewed }) => !isViewed)
</script>
{#if hasNotification}
@@ -14,13 +14,14 @@
-->
<script lang="ts">
export let count: number = 0
export let size: 'small' | 'medium' = 'small'
export let kind: 'primary' | 'secondary' = 'primary'
export let size: 'x-small' | 'small' | 'medium' = 'small'
const maxNumber = 9
</script>
{#if count > 0}
<div class="notifyMarker {size}">
<div class="notifyMarker {size} {kind}">
{#if count > maxNumber}
{maxNumber}+
{:else}
@@ -29,6 +30,10 @@
</div>
{/if}
{#if count === 0 && kind === 'secondary'}
<div class="notifyMarker {size} {kind}" />
{/if}
<style lang="scss">
.notifyMarker {
display: flex;
@@ -36,10 +41,22 @@
justify-content: center;
flex-shrink: 0;
border-radius: 50%;
background-color: var(--global-higlight-Color);
color: var(--global-on-accent-TextColor);
font-weight: 700;
&.primary {
background-color: var(--global-higlight-Color);
color: var(--global-on-accent-TextColor);
}
&.secondary {
background-color: var(--global-subtle-BackgroundColor);
}
&.x-small {
width: 0.75rem;
height: 0.75rem;
}
&.small {
width: 1rem;
height: 1rem;
@@ -73,7 +73,7 @@ export class InboxNotificationsClientImpl implements InboxNotificationsClient {
return inboxNotifications.reduce((result, notification) => {
const notifyContext = notifyContexts.find(({ _id }) => _id === notification.docNotifyContext)
if (notifyContext === undefined || notifyContext.hidden) {
if (notifyContext === undefined) {
return result
}
@@ -207,13 +207,6 @@ export class InboxNotificationsClientImpl implements InboxNotificationsClient {
}
)
}
await client.createDoc(notification.class.DocNotifyContext, doc.space, {
attachedTo: _id,
attachedToClass: _class,
user: getCurrentAccount()._id,
hidden: true
})
}
async readNotifications (client: TxOperations, ids: Array<Ref<InboxNotification>>): Promise<void> {
@@ -87,16 +87,10 @@ export function loadNotificationSettings (): void {
loadNotificationSettings()
export async function hasDocNotifyContextPinAction (docNotifyContext: DocNotifyContext): Promise<boolean> {
if (docNotifyContext.hidden) {
return false
}
return docNotifyContext.isPinned !== true
}
export async function hasDocNotifyContextUnpinAction (docNotifyContext: DocNotifyContext): Promise<boolean> {
if (docNotifyContext.hidden) {
return false
}
return docNotifyContext.isPinned === true
}