UBERF-8164 Display activity in wiki document sidebar (#6620)

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov 2024-09-18 17:49:17 +07:00 committed by GitHub
parent 78e601ff43
commit 85c285741a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 133 additions and 28 deletions

View File

@ -29,6 +29,7 @@
export let messages: ActivityMessage[]
export let object: Doc
export let isNewestFirst = false
export let showFilter = true
const allId = activity.ids.AllFilter
const client = getClient()
@ -117,8 +118,9 @@
)
</script>
{#if showFilter}
<div class="w-4 min-w-4 max-w-4" />
{#if selectedFiltersRefs === 'All'}
{#if selectedFiltersRefs === allId}
<div class="antiSection-header__tag highlight">
<Label label={activity.string.All} />
</div>
@ -142,5 +144,6 @@
</div>
{/each}
{/if}
{/if}
<div class="w-4 min-w-4 max-w-4" />
<ActionIcon icon={IconFilter} size={'medium'} action={handleOptions} />

View File

@ -52,6 +52,7 @@ export { default as ActivityMessagePresenter } from './components/activity-messa
export { default as ActivityExtension } from './components/ActivityExtension.svelte'
export { default as ActivityDocLink } from './components/ActivityDocLink.svelte'
export { default as ReactionPresenter } from './components/reactions/ReactionPresenter.svelte'
export { default as ActivityFilter } from './components/ActivityFilter.svelte'
export { default as ActivityMessageNotificationLabel } from './components/activity-message/ActivityMessageNotificationLabel.svelte'
export { default as ActivityMessageHeader } from './components/activity-message/ActivityMessageHeader.svelte'
export { default as ActivityMessageAction } from './components/ActivityMessageAction.svelte'

View File

@ -15,6 +15,7 @@
//
-->
<script lang="ts">
import activity from '@hcengineering/activity'
import attachment, { Attachment } from '@hcengineering/attachment'
import core, { Doc, Ref, WithLookup, generateId, type Blob } from '@hcengineering/core'
import { Document, DocumentEvents } from '@hcengineering/document'
@ -58,8 +59,9 @@
import DocumentEditor from './DocumentEditor.svelte'
import DocumentPresenter from './DocumentPresenter.svelte'
import DocumentTitle from './DocumentTitle.svelte'
import References from './sidebar/References.svelte'
import Activity from './sidebar/Activity.svelte'
import History from './sidebar/History.svelte'
import References from './sidebar/References.svelte'
export let _id: Ref<Document>
export let readonly: boolean = false
@ -185,11 +187,11 @@
{
id: 'references',
icon: document.icon.References
},
{
id: 'activity',
icon: activity.icon.Activity
}
// {
// id: 'history',
// icon: document.icon.History
// }
]
let selectedAside: string | boolean = false
@ -372,6 +374,8 @@
<svelte:fragment slot="aside">
{#if selectedAside === 'references'}
<References doc={doc._id} />
{:else if selectedAside === 'activity'}
<Activity value={doc} />
{:else if selectedAside === 'history'}
<History value={doc} {readonly} />
{/if}

View File

@ -0,0 +1,97 @@
<!--
//
// Copyright © 2024 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
-->
<script lang="ts">
import activity, { ActivityMessage } from '@hcengineering/activity'
import { ActivityFilter, ActivityMessagePresenter, canGroupMessages } from '@hcengineering/activity-resources'
import { SortingOrder } from '@hcengineering/core'
import { Document } from '@hcengineering/document'
import { createQuery } from '@hcengineering/presentation'
import { Label, Lazy, Scroller } from '@hcengineering/ui'
export let value: Document
const query = createQuery()
let messages: ActivityMessage[] = []
let filteredMessages: ActivityMessage[] = []
$: query.query(
activity.class.ActivityMessage,
{ attachedTo: value._id, space: value.space },
(res) => {
messages = res
},
{
sort: {
createdOn: SortingOrder.Ascending
}
}
)
</script>
{#key value._id}
<div class="h-full flex-col clear-mins">
<div class="header">
<div class="title"><Label label={activity.string.Activity} /></div>
<ActivityFilter
{messages}
object={value}
showFilter={false}
on:update={(e) => {
filteredMessages = e.detail
}}
/>
</div>
<div class="divider" />
{#if filteredMessages.length > 0}
<Scroller padding="0.75rem 0.25rem">
{#each filteredMessages as message, index}
{@const canGroup = canGroupMessages(message, filteredMessages[index - 1])}
<Lazy>
<ActivityMessagePresenter
value={message}
doc={value}
hideLink={true}
type={canGroup ? 'short' : 'default'}
/>
</Lazy>
{/each}
</Scroller>
{/if}
</div>
{/key}
<style lang="scss">
.header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 1.25rem;
height: 3rem;
min-height: 3rem;
border-bottom: 1px solid var(--theme-divider-color);
.title {
flex-grow: 1;
font-weight: 500;
color: var(--caption-color);
user-select: none;
}
}
</style>