Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions models/activity/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,10 @@ export function createModel (builder: Builder): void {
txClasses: [core.class.TxCreateDoc]
})

builder.mixin(activity.class.ActivityMessage, core.class.Class, view.mixin.ObjectTooltip, {
provider: activity.function.ActivityMessageTooltipProvider
})

buildActions(builder)
buildNotifications(builder)
}
Expand Down
9 changes: 9 additions & 0 deletions plugins/activity-resources/src/activity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,22 @@ import activity, { type ActivityMessage, type SavedMessage } from '@hcengineerin
import core, { type Ref, SortingOrder, type WithLookup } from '@hcengineering/core'
import { createQuery, onClient } from '@hcengineering/presentation'
import { writable } from 'svelte/store'
import { getCurrentLocation, navigate } from '@hcengineering/ui'

export const savedMessagesStore = writable<Array<WithLookup<SavedMessage>>>([])
export const messageInFocus = writable<Ref<ActivityMessage> | undefined>(undefined)
export const editingMessageStore = writable<Ref<ActivityMessage> | undefined>(undefined)

const savedMessagesQuery = createQuery(true)

export function clearMessageInLocation (): void {
const loc = getCurrentLocation()
if (loc.query?.message != null) {
delete loc.query.message
navigate(loc, true)
}
}

onClient(() => {
savedMessagesQuery.query(
activity.class.SavedMessage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import { Action as ViewAction } from '@hcengineering/view'
import { getActions, restrictionStore, showMenu } from '@hcengineering/view-resources'

import { savedMessagesStore } from '../../activity'
import { clearMessageInLocation, savedMessagesStore } from '../../activity'
import { MessageInlineAction } from '../../types'
import ActivityMessageActions from '../ActivityMessageActions.svelte'
import MessageTimestamp from '../MessageTimestamp.svelte'
Expand Down Expand Up @@ -106,6 +106,13 @@
isActionsOpened = false
}

function handleAnimationEnd (event: AnimationEvent): void {
const name = event.animationName.split('-').pop()
if (name === 'highlight') {
clearMessageInLocation()
}
}

$: key = parentMessage != null ? `${message._id}_${parentMessage._id}` : message._id

$: isHidden = !!viewlet?.onlyWithParent && parentMessage === undefined
Expand Down Expand Up @@ -180,6 +187,7 @@
class:stale
on:click={onClick}
on:contextmenu={handleContextMenu}
on:animationend={handleAnimationEnd}
>
{#if showNotify && !embedded && !isShort}
<div class="notify" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<script lang="ts">
import { ActivityMessage } from '@hcengineering/activity'

import ActivityMessagePresenter from './ActivityMessagePresenter.svelte'

export let value: ActivityMessage
</script>

<div class="hulyPopup-container autoWidth scroll" style:minWidth="20rem" style:maxWidth="40rem">
<ActivityMessagePresenter {value} withActions={false} hoverable={false} withShowMore={false} skipLabel />
</div>

<style lang="scss">
.scroll {
flex-grow: 1;
min-height: 0;
height: max-content;
overflow-x: hidden;
overflow-y: auto;
}
</style>
6 changes: 4 additions & 2 deletions plugins/activity-resources/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ import {
canSaveForLater,
canUnpinMessage,
removeFromSaved,
shouldScrollToActivity
shouldScrollToActivity,
activityMessageTooltipProvider
} from './utils'

export * from './types'
Expand Down Expand Up @@ -88,7 +89,8 @@ export default async (): Promise<Resources> => ({
CanRemoveFromSaved: canRemoveFromSaved,
CanPinMessage: canPinMessage,
CanUnpinMessage: canUnpinMessage,
ShouldScrollToActivity: shouldScrollToActivity
ShouldScrollToActivity: shouldScrollToActivity,
ActivityMessageTooltipProvider: activityMessageTooltipProvider
},
backreference: {
Update: updateReferences
Expand Down
29 changes: 27 additions & 2 deletions plugins/activity-resources/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
import type { ActivityMessage, Reaction } from '@hcengineering/activity'
import core, { getCurrentAccount, isOtherHour, type Doc, type Ref, type Space, type Blob } from '@hcengineering/core'
import core, {
getCurrentAccount,
isOtherHour,
type Doc,
type Ref,
type Space,
type Blob,
type TxOperations
} from '@hcengineering/core'
import { getClient, isSpace } from '@hcengineering/presentation'
import {
closePopup,
getCurrentResolvedLocation,
getEventPositionElement,
showPopup,
type Location
type Location,
type LabelAndProps
} from '@hcengineering/ui'
import { type AttributeModel } from '@hcengineering/view'
import emojiPlugin from '@hcengineering/emoji'
import { get } from 'svelte/store'

import { savedMessagesStore } from './activity'
import activity from './plugin'
import ActivityMessageTooltip from './components/activity-message/ActivityMessageTooltip.svelte'

export async function updateDocReactions (
reactions: Reaction[],
Expand Down Expand Up @@ -194,3 +204,18 @@ export function getActivityNewestFirst (): boolean {
export function setActivityNewestFirst (value: boolean): void {
localStorage.setItem(activityNewestFirstLocalStorageKey, JSON.stringify(value))
}

export async function activityMessageTooltipProvider (
_client: TxOperations,
doc?: ActivityMessage | null
): Promise<LabelAndProps | undefined> {
if (doc == null) return undefined

return {
component: ActivityMessageTooltip,
props: { value: doc },
timeout: 300,
style: 'modern',
noArrow: true
}
}
10 changes: 7 additions & 3 deletions plugins/activity/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ import {
Timestamp,
Tx,
TxCUD,
Blob
Blob,
Client
} from '@hcengineering/core'
import type { Asset, IntlString, Plugin, Resource } from '@hcengineering/platform'
import { plugin } from '@hcengineering/platform'
import { Preference } from '@hcengineering/preference'
import type { AnyComponent, ComponentExtensionId } from '@hcengineering/ui'
import type { AnyComponent, ComponentExtensionId, LabelAndProps } from '@hcengineering/ui'
import type { Action } from '@hcengineering/view'

/**
Expand Down Expand Up @@ -348,7 +349,10 @@ export default plugin(activityId, {
ActivityEmployeePresenter: '' as ComponentExtensionId
},
function: {
ShouldScrollToActivity: '' as Resource<() => boolean>
ShouldScrollToActivity: '' as Resource<() => boolean>,
ActivityMessageTooltipProvider: '' as Resource<
(client: Client, doc?: Doc | null) => Promise<LabelAndProps | undefined>
>
},
backreference: {
// Update list of back references
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
const urlSet = new Set<string>()

let progress = false
let loadingLinks = false

let refContainer: HTMLElement

Expand Down Expand Up @@ -380,7 +381,7 @@
}

async function loadLinks (urls: string[]): Promise<void> {
progress = true
loadingLinks = true
for (const url of urls) {
try {
const meta = await fetchLinkPreviewDetails(url)
Expand All @@ -401,7 +402,7 @@
void setPlatformStatus(unknownError(err))
}
}
progress = false
loadingLinks = false
}

async function loadFiles (evt: ClipboardEvent): Promise<void> {
Expand Down Expand Up @@ -492,7 +493,7 @@
{showSend}
{showActions}
autofocus={autofocus ? 'end' : false}
loading={loading || progress}
loading={loading || progress || loadingLinks}
{boundary}
{docClass}
extraActions={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
ActivityMessagePresenter,
canGroupMessages,
messageInFocus,
editingMessageStore
editingMessageStore,
clearMessageInLocation
} from '@hcengineering/activity-resources'
import core, { Doc, generateId, getCurrentAccount, Ref, Space, Timestamp, Tx, TxCUD } from '@hcengineering/core'
import { DocNotifyContext } from '@hcengineering/notification'
Expand Down Expand Up @@ -131,8 +132,8 @@
}
})

$: void initializeScroll($isLoadingStore, separatorDiv, separatorIndex)
$: adjustScrollPosition(selectedMessageId)
$: void initializeScroll($isLoadingStore, separatorDiv, separatorIndex)
$: void handleMessagesUpdated(messages.length)

function adjustScrollPosition (selectedMessageId?: Ref<ActivityMessage>): void {
Expand All @@ -147,9 +148,6 @@
} else {
scrollToMessage()
}
} else if (selectedMessageId === undefined) {
provider.jumpToEnd()
reinitializeScroll()
}
}

Expand Down Expand Up @@ -392,6 +390,7 @@
async function handleScrollToLatestMessage (): Promise<void> {
selectedMessageId = undefined
messageInFocus.set(undefined)
clearMessageInLocation()

const metadata = $metadataStore
const lastMetadata = metadata[metadata.length - 1]
Expand Down Expand Up @@ -579,7 +578,9 @@
$: showBlankView = !$isLoadingStore && messages.length === 0 && !isThread

export function editLastMessage (): void {
if ($isLoadingStore || !isScrollInitialized || !$isTailLoadedStore || scrollDiv == null) return
if ($isLoadingStore || !isScrollInitialized || !$isTailLoadedStore || scrollDiv == null) {
return
}
if (!isScrollAtBottom) return
const me = getCurrentAccount()
let lastMessage: ChatMessage | undefined = undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,6 @@
on:click
/>
{:else}
<ActivityMessagePreview value={displayMessage} {actions} {space} doc={object} />
<ActivityMessagePreview value={displayMessage} {actions} {space} doc={object} on:click />
{/if}
{/if}
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,17 @@
</script>

{#if hierarchy.isDerived(value._class, notification.class.ActivityInboxNotification)}
<ActivityInboxNotificationPresenter value={asDisplayActivityNotification(value)} {object} {viewlets} {space} />
<ActivityInboxNotificationPresenter
value={asDisplayActivityNotification(value)}
{object}
{viewlets}
{space}
on:click
/>
{:else if hierarchy.isDerived(value._class, notification.class.MentionInboxNotification)}
<MentionInboxNotificationPresenter value={asMentionNotification(value)} {object} {space} />
<MentionInboxNotificationPresenter value={asMentionNotification(value)} {object} {space} on:click />
{:else if hierarchy.isDerived(value._class, notification.class.ReactionInboxNotification)}
<ReactionInboxNotificationPresenter value={asReactionNotification(value)} {object} />
<ReactionInboxNotificationPresenter value={asReactionNotification(value)} {object} on:click />
{:else if hierarchy.isDerived(value._class, notification.class.CommonInboxNotification)}
<CommonInboxNotificationPresenter value={asCommonNotification(value)} />
{/if}
1 change: 1 addition & 0 deletions plugins/text-editor-resources/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
"mermaid": "^11.12.0",
"@hcengineering/theme": "workspace:^0.7.0",
"tippy.js": "~6.3.7",
"@hcengineering/activity": "workspace:^0.7.0",
"@hcengineering/chunter": "workspace:^0.7.0",
"@tiptap/extension-text-align": "~2.11.0",
"@tiptap/extension-mathematics": "^2.11.7",
Expand Down
Loading
Loading