mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-20 16:47:50 +02:00
New Activity - squashed (#4032)
Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com> Co-authored-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
co-authored by
Andrey Sobolev
parent
119d65653a
commit
ea3eb4af83
@@ -15,12 +15,13 @@
|
||||
<script lang="ts">
|
||||
import attachment from '@hcengineering/attachment'
|
||||
import { AttachmentDocList } from '@hcengineering/attachment-resources'
|
||||
import chunter from '@hcengineering/chunter'
|
||||
import { CommentPopup } from '@hcengineering/chunter-resources'
|
||||
import notification from '@hcengineering/notification'
|
||||
import { Ref } from '@hcengineering/core'
|
||||
import { IconForward, MessageViewer, createQuery, getClient } from '@hcengineering/presentation'
|
||||
import { Issue, Project } from '@hcengineering/tracker'
|
||||
import { Label, Scroller, resizeObserver } from '@hcengineering/ui'
|
||||
import { ChatMessagePopup } from '@hcengineering/notification-resources'
|
||||
|
||||
import tracker from '../../plugin'
|
||||
import { activeProjects } from '../../utils'
|
||||
import AssigneeEditor from './AssigneeEditor.svelte'
|
||||
@@ -113,9 +114,9 @@
|
||||
{/if}
|
||||
{#if issue.comments}
|
||||
<div class="mt-6 mb-2 overflow-label fs-bold content-dark-color">
|
||||
<Label label={chunter.string.Comments} />:
|
||||
<Label label={notification.string.Comments} />:
|
||||
</div>
|
||||
<CommentPopup objectId={issue._id} object={issue} />
|
||||
<ChatMessagePopup objectId={issue._id} object={issue} />
|
||||
{/if}
|
||||
<div class="h-3 flex-no-shrink" />
|
||||
</Scroller>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
import tracker from '../../plugin'
|
||||
import StatusIcon from '../icons/StatusIcon.svelte'
|
||||
|
||||
export let value: WithLookup<IssueStatus>
|
||||
export let value: WithLookup<IssueStatus> | undefined
|
||||
export let size: IconSize
|
||||
export let space: Ref<Project> | undefined
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
})
|
||||
: (_space = undefined)
|
||||
|
||||
$: if (value.category === tracker.issueStatusCategory.Started) {
|
||||
$: if (value?.category === tracker.issueStatusCategory.Started) {
|
||||
statuses = getStates(_space, $typeStore, $statusStore.byId).filter(
|
||||
(p) => p.category === tracker.issueStatusCategory.Started
|
||||
)
|
||||
@@ -56,11 +56,13 @@
|
||||
if (status.$lookup?.category) {
|
||||
category = status.$lookup.category
|
||||
}
|
||||
if (category === undefined || category._id !== value.category) {
|
||||
category = await client.findOne(core.class.StatusCategory, { _id: value.category })
|
||||
if (category === undefined || category._id !== value?.category) {
|
||||
if (value) {
|
||||
category = await client.findOne(core.class.StatusCategory, { _id: value.category })
|
||||
}
|
||||
}
|
||||
if (value.category !== undefined && dynamicFillCategories.includes(value.category)) {
|
||||
const index = statuses.findIndex((p) => p._id === value._id)
|
||||
if (value?.category !== undefined && dynamicFillCategories.includes(value?.category)) {
|
||||
const index = statuses.findIndex((p) => p._id === value?._id)
|
||||
if (index !== -1) {
|
||||
statusIcon.index = index + 1
|
||||
statusIcon.count = statuses.length + 1
|
||||
@@ -83,11 +85,11 @@
|
||||
|
||||
$: type = _space ? $typeStore.get(_space.type) : undefined
|
||||
|
||||
$: viewState = getViewState(type, value)
|
||||
$: viewState = value && getViewState(type, value)
|
||||
|
||||
$: updateCategory(_space, value, statuses)
|
||||
$: value && updateCategory(_space, value, statuses)
|
||||
$: icon = category?.icon
|
||||
$: color = viewState.color !== undefined ? viewState.color : category !== undefined ? category.color : -1
|
||||
$: color = viewState?.color !== undefined ? viewState?.color : category !== undefined ? category.color : -1
|
||||
</script>
|
||||
|
||||
{#if icon !== undefined && color !== undefined && category !== undefined}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { AttachmentsPresenter } from '@hcengineering/attachment-resources'
|
||||
import { CommentsPresenter } from '@hcengineering/chunter-resources'
|
||||
import {
|
||||
CategoryType,
|
||||
Class,
|
||||
@@ -65,7 +64,9 @@
|
||||
setGroupByValues,
|
||||
statusStore
|
||||
} from '@hcengineering/view-resources'
|
||||
import { ChatMessagesPresenter } from '@hcengineering/notification-resources'
|
||||
import { onMount } from 'svelte'
|
||||
|
||||
import tracker from '../../plugin'
|
||||
import { activeProjects } from '../../utils'
|
||||
import ComponentEditor from '../components/ComponentEditor.svelte'
|
||||
@@ -255,12 +256,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
function shouldShowFooter (
|
||||
async function shouldShowFooter (
|
||||
config: (string | BuildModelKey)[],
|
||||
reports: number,
|
||||
estimations: number,
|
||||
issue: WithLookup<Issue>
|
||||
): boolean {
|
||||
): Promise<boolean> {
|
||||
if (enabledConfig(config, 'estimation') && (reports > 0 || estimations > 0)) return true
|
||||
if (enabledConfig(config, 'comments')) {
|
||||
if ((issue.comments ?? 0) > 0) return true
|
||||
@@ -459,32 +460,28 @@
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
{#if shouldShowFooter(config, reports, estimations, object)}
|
||||
<div class="card-footer flex-between">
|
||||
{#if enabledConfig(config, 'estimation')}
|
||||
<EstimationEditor kind={'list'} size={'small'} value={issue} />
|
||||
{/if}
|
||||
<div class="flex-row-center gap-3 reverse">
|
||||
{#if enabledConfig(config, 'attachments') && (object.attachments ?? 0) > 0}
|
||||
<AttachmentsPresenter value={object.attachments} {object} />
|
||||
{#await shouldShowFooter(config, reports, estimations, object) then withFooter}
|
||||
{#if withFooter}
|
||||
<div class="card-footer flex-between">
|
||||
{#if enabledConfig(config, 'estimation')}
|
||||
<EstimationEditor kind={'list'} size={'small'} value={issue} />
|
||||
{/if}
|
||||
{#if enabledConfig(config, 'comments')}
|
||||
{#if (object.comments ?? 0) > 0}
|
||||
<CommentsPresenter value={object.comments} {object} />
|
||||
<div class="flex-row-center gap-3 reverse">
|
||||
{#if enabledConfig(config, 'attachments') && (object.attachments ?? 0) > 0}
|
||||
<AttachmentsPresenter value={object.attachments} {object} />
|
||||
{/if}
|
||||
{#if object.$lookup?.attachedTo !== undefined && (object.$lookup.attachedTo.comments ?? 0) > 0}
|
||||
<CommentsPresenter
|
||||
value={object.$lookup?.attachedTo?.comments}
|
||||
object={object.$lookup?.attachedTo}
|
||||
withInput={false}
|
||||
/>
|
||||
{/if}
|
||||
{/if}
|
||||
<ChatMessagesPresenter value={object.comments} {object} />
|
||||
<ChatMessagesPresenter
|
||||
object={object.$lookup?.attachedTo}
|
||||
value={object.$lookup?.attachedTo?.comments}
|
||||
withInput={false}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="min-h-4 max-h-4 h-4" />
|
||||
{/if}
|
||||
{:else}
|
||||
<div class="min-h-4 max-h-4 h-4" />
|
||||
{/if}
|
||||
{/await}
|
||||
</div>
|
||||
{/key}
|
||||
</svelte:fragment>
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<!--
|
||||
// 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 { IssuePriority } from '@hcengineering/tracker'
|
||||
import { Icon } from '@hcengineering/ui'
|
||||
import { issuePriorities } from '../../utils'
|
||||
|
||||
export let value: IssuePriority
|
||||
export let size: 'small' | 'medium' = 'small'
|
||||
|
||||
$: icon = issuePriorities[value]?.icon
|
||||
</script>
|
||||
|
||||
<Icon {icon} {size} fill={'var(--theme-caption-color)'} />
|
||||
@@ -24,6 +24,7 @@
|
||||
export let accent: boolean = false
|
||||
export let inline: boolean = false
|
||||
export let shouldShowLabel: boolean = true
|
||||
export let shouldShowAvatar: boolean = true
|
||||
|
||||
$: icon = issuePriorities[value]?.icon
|
||||
$: label = issuePriorities[value]?.label
|
||||
@@ -38,13 +39,13 @@
|
||||
</script>
|
||||
|
||||
<div class="flex-presenter">
|
||||
{#if !inline && icon}
|
||||
{#if !inline && icon && shouldShowAvatar}
|
||||
<Icon {icon} {size} fill={'var(--theme-caption-color)'} />
|
||||
{/if}
|
||||
{#if shouldShowLabel}
|
||||
<span
|
||||
class="overflow-label"
|
||||
class:ml-2={!inline && icon}
|
||||
class:ml-2={!inline && icon && shouldShowAvatar}
|
||||
style:color={colorInherit ? 'inherit' : 'var(--theme-content-color)'}
|
||||
class:fs-bold={accent}
|
||||
>
|
||||
|
||||
@@ -24,16 +24,17 @@
|
||||
export let colorInherit: boolean = false
|
||||
export let accent: boolean = false
|
||||
export let inline: boolean = false
|
||||
export let shouldShowAvatar: boolean = true
|
||||
</script>
|
||||
|
||||
{#if value}
|
||||
<div class="flex-presenter" style:color={'inherit'}>
|
||||
{#if !inline}
|
||||
{#if !inline && shouldShowAvatar}
|
||||
<IssueStatusIcon {value} {size} {space} on:accent-color />
|
||||
{/if}
|
||||
<span
|
||||
class="overflow-label"
|
||||
class:ml-2={!inline}
|
||||
class:ml-2={!inline && shouldShowAvatar}
|
||||
class:list-header={kind === 'list-header'}
|
||||
class:colorInherit
|
||||
class:fs-bold={accent}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
export let id: string | undefined = undefined
|
||||
export let kind: 'link' | undefined = undefined
|
||||
export let value: number
|
||||
export let accent: boolean = false
|
||||
|
||||
// TODO: Make configurable?
|
||||
const hoursInWorkingDay = 8
|
||||
@@ -60,6 +61,7 @@
|
||||
<span
|
||||
{id}
|
||||
class:link={kind === 'link'}
|
||||
class:fs-bold={accent}
|
||||
on:click
|
||||
use:tooltip={{
|
||||
component: Label,
|
||||
|
||||
@@ -22,10 +22,12 @@
|
||||
|
||||
export let value: WithLookup<TimeSpendReport>
|
||||
export let currentProject: Project | undefined
|
||||
export let accent = false
|
||||
|
||||
const client = getClient()
|
||||
|
||||
$: issue = value.$lookup?.attachedTo
|
||||
$: if (!issue) {
|
||||
$: if (!issue && value.attachedToClass) {
|
||||
client.findOne(value.attachedToClass, { _id: value.attachedTo }).then((r) => {
|
||||
issue = r as Issue
|
||||
})
|
||||
@@ -33,6 +35,9 @@
|
||||
$: defaultTimeReportDay = currentProject?.defaultTimeReportDay
|
||||
|
||||
function editSpendReport (event: MouseEvent): void {
|
||||
if (!issue) {
|
||||
return
|
||||
}
|
||||
showPopup(
|
||||
TimeSpendReportPopup,
|
||||
{
|
||||
@@ -49,5 +54,5 @@
|
||||
</script>
|
||||
|
||||
{#if value && value.value}
|
||||
<TimePresenter id="TimeSpendReportValue" kind="link" value={value.value} on:click={editSpendReport} />
|
||||
<TimePresenter id="TimeSpendReportValue" kind="link" value={value.value} on:click={editSpendReport} {accent} />
|
||||
{/if}
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
export let justify: 'left' | 'center' = 'left'
|
||||
export let width: string | undefined = undefined
|
||||
export let disabled = false
|
||||
export let shouldShowAvatar: boolean = true
|
||||
export let accent: boolean = false
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
const client = getClient()
|
||||
@@ -83,8 +85,10 @@
|
||||
</button>
|
||||
{:else if kind === 'list-header'}
|
||||
<div class="flex-row-center pl-0-5">
|
||||
<Icon {icon} {size} />
|
||||
<span class="overflow-label ml-1-5"><Label {label} /></span>
|
||||
{#if shouldShowAvatar}
|
||||
<Icon {icon} {size} />
|
||||
{/if}
|
||||
<span class="overflow-label" class:ml-1-5={shouldShowAvatar} class:fs-bold={accent}><Label {label} /></span>
|
||||
</div>
|
||||
{:else}
|
||||
<Button
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<!--
|
||||
// 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 { Milestone } from '@hcengineering/tracker'
|
||||
import { ButtonSize, Icon } from '@hcengineering/ui'
|
||||
import { milestoneStatusAssets } from '../../utils'
|
||||
import tracker from '../../plugin'
|
||||
|
||||
export let value: Milestone['status'] | undefined
|
||||
export let size: ButtonSize = 'large'
|
||||
|
||||
$: icon = value === undefined ? tracker.icon.MilestoneStatusPlanned : milestoneStatusAssets[value]?.icon
|
||||
</script>
|
||||
|
||||
<Icon {icon} {size} />
|
||||
@@ -24,6 +24,8 @@
|
||||
export let size: ButtonSize = 'large'
|
||||
export let justify: 'left' | 'center' = 'left'
|
||||
export let width: string | undefined = '100%'
|
||||
export let shouldShowAvatar: boolean = true
|
||||
export let accent: boolean = false
|
||||
|
||||
$: disabled = onChange === undefined
|
||||
</script>
|
||||
@@ -36,5 +38,7 @@
|
||||
{width}
|
||||
{justify}
|
||||
{disabled}
|
||||
{accent}
|
||||
{shouldShowAvatar}
|
||||
on:change={({ detail }) => onChange?.(detail)}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user