mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-12 12:47:45 +02:00
UBERF-5811: rework backlinks (#4887)
Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
@@ -49,7 +49,7 @@
|
||||
attachments: 0,
|
||||
labels: 0,
|
||||
comments: 0,
|
||||
backlinks: 0
|
||||
references: 0
|
||||
}
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
import DocumentEditor from './DocumentEditor.svelte'
|
||||
import DocumentPresenter from './DocumentPresenter.svelte'
|
||||
import DocumentTitle from './DocumentTitle.svelte'
|
||||
import Backlinks from './sidebar/Backlinks.svelte'
|
||||
import References from './sidebar/References.svelte'
|
||||
import History from './sidebar/History.svelte'
|
||||
|
||||
export let _id: Ref<Document>
|
||||
@@ -182,8 +182,8 @@
|
||||
|
||||
const aside: ButtonItem[] = [
|
||||
{
|
||||
id: 'backlinks',
|
||||
icon: document.icon.Backlinks
|
||||
id: 'references',
|
||||
icon: document.icon.References
|
||||
},
|
||||
{
|
||||
id: 'history',
|
||||
@@ -339,8 +339,8 @@
|
||||
</div>
|
||||
|
||||
<svelte:fragment slot="aside">
|
||||
{#if selectedAside === 'backlinks'}
|
||||
<Backlinks doc={doc._id} />
|
||||
{#if selectedAside === 'references'}
|
||||
<References doc={doc._id} />
|
||||
{:else if selectedAside === 'history'}
|
||||
<History value={doc} {readonly} />
|
||||
{/if}
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
<!--
|
||||
//
|
||||
// Copyright © 2023 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 { Backlink } from '@hcengineering/chunter'
|
||||
import { MessageViewer } from '@hcengineering/presentation'
|
||||
import { TimeSince } from '@hcengineering/ui'
|
||||
import { ObjectPresenter } from '@hcengineering/view-resources'
|
||||
|
||||
export let value: Backlink
|
||||
</script>
|
||||
|
||||
<div class="container flex-col flex-gap-2 flex-no-shrink">
|
||||
<div class="flex-between h-8">
|
||||
<div class="fs-bold overflow-label">
|
||||
<ObjectPresenter _class={value.backlinkClass} objectId={value.backlinkId} accent />
|
||||
</div>
|
||||
<div class="time">
|
||||
<TimeSince value={value.createdOn ?? value.modifiedOn} />
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-no-shrink">
|
||||
<MessageViewer message={value.message} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
padding: 0.5rem 1rem;
|
||||
border-bottom: 1px solid var(--theme-divider-color);
|
||||
}
|
||||
.time {
|
||||
font-size: 0.75rem;
|
||||
color: var(--theme-trans-color);
|
||||
}
|
||||
</style>
|
||||
+9
-9
@@ -15,28 +15,28 @@
|
||||
//
|
||||
-->
|
||||
<script lang="ts">
|
||||
import chunter, { Backlink } from '@hcengineering/chunter'
|
||||
import { Ref } from '@hcengineering/core'
|
||||
import { Document } from '@hcengineering/document'
|
||||
import { createQuery } from '@hcengineering/presentation'
|
||||
import { Label, Lazy, Scroller } from '@hcengineering/ui'
|
||||
import activity, { ActivityReference } from '@hcengineering/activity'
|
||||
import { ActivityReferencePresenter } from '@hcengineering/activity-resources'
|
||||
|
||||
import document from '../../plugin'
|
||||
import BacklinkView from './BacklinkView.svelte'
|
||||
|
||||
export let doc: Ref<Document>
|
||||
|
||||
const query = createQuery()
|
||||
|
||||
let backlinks: Backlink[] = []
|
||||
let references: ActivityReference[] = []
|
||||
|
||||
$: query.query(
|
||||
chunter.class.Backlink,
|
||||
activity.class.ActivityReference,
|
||||
{
|
||||
attachedTo: doc
|
||||
},
|
||||
(res) => {
|
||||
backlinks = res
|
||||
references = res
|
||||
}
|
||||
)
|
||||
</script>
|
||||
@@ -48,11 +48,11 @@
|
||||
|
||||
<div class="divider" />
|
||||
|
||||
{#if backlinks.length > 0}
|
||||
<Scroller>
|
||||
{#each backlinks as backlink}
|
||||
{#if references.length > 0}
|
||||
<Scroller padding="0.75rem 0.25rem">
|
||||
{#each references as reference}
|
||||
<Lazy>
|
||||
<BacklinkView value={backlink} />
|
||||
<ActivityReferencePresenter value={reference} hoverStyles="filledHover" />
|
||||
</Lazy>
|
||||
{/each}
|
||||
</Scroller>
|
||||
Reference in New Issue
Block a user