From ee0754422d1fe112f4c993b599a8958d23679082 Mon Sep 17 00:00:00 2001 From: Alexander Platov Date: Thu, 29 Jun 2023 07:29:12 +0300 Subject: [PATCH] UBER-538: update ListView layout. Subissues, related issues. (#3467) Signed-off-by: Alexander Platov --- models/recruit/src/index.ts | 38 ++--- models/tracker/src/index.ts | 29 ++-- packages/theme/styles/common.scss | 7 +- packages/theme/styles/components.scss | 4 +- packages/ui/src/components/Button.svelte | 2 + packages/ui/src/components/TimeSince.svelte | 8 +- .../ui/src/components/ToggleWithLabel.svelte | 2 +- .../src/components/AssigneeBox.svelte | 2 +- .../src/components/ChannelsDropdown.svelte | 143 +++++++++++------- .../EmployeeAttributePresenter.svelte | 12 +- .../components/EmployeeRefPresenter.svelte | 10 +- .../src/components/state/StateEditor.svelte | 23 +-- .../components/state/StatePresenter.svelte | 12 +- .../components/state/StateRefPresenter.svelte | 9 +- .../src/components/state/StatesPopup.svelte | 2 + .../issues/ModificationDatePresenter.svelte | 2 +- .../issues/ParentNamesPresenter.svelte | 6 +- .../components/issues/TitlePresenter.svelte | 1 - .../components/issues/edit/EditIssue.svelte | 2 +- .../issues/edit/SubIssueList.svelte | 4 +- .../components/issues/edit/SubIssues.svelte | 48 +++--- .../related/RelatedIssueSelector.svelte | 9 +- .../issues/related/RelatedIssues.svelte | 8 +- .../related/RelatedIssuesSection.svelte | 19 ++- .../milestones/MilestoneEditor.svelte | 1 - .../src/components/TimestampPresenter.svelte | 4 +- .../src/components/ViewletSetting.svelte | 84 +++++----- .../components/ViewletSettingButton.svelte | 5 +- .../src/components/list/GrowPresenter.svelte | 9 +- .../src/components/list/ListItem.svelte | 1 + 30 files changed, 301 insertions(+), 205 deletions(-) diff --git a/models/recruit/src/index.ts b/models/recruit/src/index.ts index f11acc09d1..627f5ab521 100644 --- a/models/recruit/src/index.ts +++ b/models/recruit/src/index.ts @@ -683,18 +683,30 @@ export function createModel (builder: Builder): void { descriptor: view.viewlet.List, config: [ { key: '', displayProps: { fixed: 'left', key: 'app' } }, + { + key: 'state', + props: { kind: 'list', size: 'small', shouldShowName: false }, + displayProps: { excludeByKey: 'state' } + }, { key: '$lookup.attachedTo', presenter: contact.component.PersonPresenter, label: recruit.string.Talent, sortingKey: '$lookup.attachedTo.name', - displayProps: { fixed: 'left', key: 'talent' }, props: { _class: recruit.mixin.Candidate, inline: true } }, - { key: 'state', displayProps: { fixed: 'left', key: 'state' }, props: { inline: true, showLabel: false } }, + { key: 'attachments', displayProps: { key: 'attachments', suffix: true } }, + { key: 'comments', displayProps: { key: 'comments', suffix: true } }, + { + key: '', + presenter: tracker.component.RelatedIssueSelector, + label: tracker.string.Issues, + props: { size: 'small' } + }, + { key: '', displayProps: { grow: true } }, { key: '$lookup.space.company', displayProps: { fixed: 'left', key: 'company' }, @@ -703,15 +715,6 @@ export function createModel (builder: Builder): void { maxWidth: '10rem' } }, - { - key: '', - presenter: tracker.component.RelatedIssueSelector, - label: tracker.string.Issues, - displayProps: { fixed: 'left', key: 'issues' } - }, - { key: '', displayProps: { grow: true } }, - { key: 'attachments', displayProps: { fixed: 'left', key: 'attachments' } }, - { key: 'comments', displayProps: { fixed: 'left', key: 'comments' } }, { key: '$lookup.attachedTo.$lookup.channels', label: contact.string.ContactInfo, @@ -719,15 +722,14 @@ export function createModel (builder: Builder): void { props: { length: 'full', size: 'inline' - }, - displayProps: { - fixed: 'left', - key: 'channels', - dividerBefore: true } }, - { key: 'modifiedOn', displayProps: { key: 'modified', fixed: 'left', dividerBefore: true } }, - { key: 'assignee', displayProps: { key: 'assignee', fixed: 'right' }, props: { shouldShowLabel: false } } + { key: 'modifiedOn', displayProps: { key: 'modified', fixed: 'right', dividerBefore: true } }, + { + key: 'assignee', + props: { kind: 'list', shouldShowName: false, avatarSize: 'x-small' }, + displayProps: { key: 'assignee', fixed: 'right', excludeByKey: 'assignee' } + } ], options: { lookup: { diff --git a/models/tracker/src/index.ts b/models/tracker/src/index.ts index 5ba685000b..bb689e0b16 100644 --- a/models/tracker/src/index.ts +++ b/models/tracker/src/index.ts @@ -597,20 +597,22 @@ export function createModel (builder: Builder): void { key: '', label: tracker.string.Priority, presenter: tracker.component.PriorityEditor, - props: { type: 'priority', kind: 'list', size: 'small' } + props: { type: 'priority', kind: 'list', size: 'small' }, + displayProps: { key: 'subpriority' } }, { key: '', label: tracker.string.Issue, presenter: tracker.component.IssuePresenter, props: { type: 'issue' }, - displayProps: { fixed: 'left' } + displayProps: { key: 'subissue', fixed: 'left' } }, { key: '', label: tracker.string.Status, presenter: tracker.component.StatusEditor, - props: { kind: 'list', size: 'small', justify: 'center' } + props: { kind: 'list', size: 'small', justify: 'center' }, + displayProps: { key: 'substatus' } }, { key: '', @@ -619,12 +621,7 @@ export function createModel (builder: Builder): void { props: { shouldUseMargin: true, showParent: false } }, { key: '', label: tracker.string.SubIssues, presenter: tracker.component.SubIssuesSelector, props: {} }, - { - key: '', - label: tracker.string.DueDate, - presenter: tracker.component.DueDatePresenter, - props: { kind: 'list', size: 'small' } - }, + { key: '', displayProps: { grow: true } }, { key: '', label: tracker.string.Milestone, @@ -640,22 +637,28 @@ export function createModel (builder: Builder): void { optional: true } }, + { + key: '', + label: tracker.string.DueDate, + presenter: tracker.component.DueDatePresenter, + displayProps: { key: 'dueDate', optional: true }, + props: { kind: 'list', size: 'small' } + }, { key: '', label: tracker.string.Estimation, presenter: tracker.component.EstimationEditor, - props: { kind: 'list', size: 'small' }, - displayProps: { optional: true } + props: { kind: 'list', size: 'small' } }, - { key: '', displayProps: { grow: true } }, { key: 'modifiedOn', presenter: tracker.component.ModificationDatePresenter, - displayProps: { fixed: 'right', optional: true } + displayProps: { key: 'submodified', fixed: 'right' } }, { key: 'assignee', presenter: tracker.component.AssigneeEditor, + displayProps: { key: 'assigee', fixed: 'right' }, props: { kind: 'list', shouldShowName: false, avatarSize: 'x-small' } } ] diff --git a/packages/theme/styles/common.scss b/packages/theme/styles/common.scss index 236eb8cc41..3a327abd4d 100644 --- a/packages/theme/styles/common.scss +++ b/packages/theme/styles/common.scss @@ -365,6 +365,7 @@ &.dark { background-color: var(--body-accent); } &.noMargin { margin: 0; } + & + & { display: none; } } .antiHSpacer { @@ -390,7 +391,7 @@ align-items: center; height: 2.5rem; min-height: 2.5rem; - border-bottom: 1px solid var(--divider-color); + border-bottom: 1px solid var(--theme-divider-color); &.high { padding-right: 1rem; @@ -403,7 +404,7 @@ align-items: center; margin-right: .5rem; height: 2rem; - color: var(--caption-color); + color: var(--theme-caption-color); } &__title { min-width: 0; @@ -422,7 +423,7 @@ min-width: 0; font-weight: 500; font-size: 1rem; - color: var(--caption-color); + color: var(--theme-caption-color); background: var(--header-bg-color); border-radius: .5rem .5rem 0 0; } diff --git a/packages/theme/styles/components.scss b/packages/theme/styles/components.scss index 721e755c5e..71c317354d 100644 --- a/packages/theme/styles/components.scss +++ b/packages/theme/styles/components.scss @@ -895,7 +895,8 @@ flex-grow: 1; border-radius: 1.625rem; transition: flex-shrink 0.25s cubic-bezier(0.38, 0.01, 0.33, 1) 0s; - + + &:not(:empty) { min-width: 7.5rem; } &:hover { flex-shrink: .5; min-width: initial; @@ -903,7 +904,6 @@ .label-wrapper { display: flex; align-items: center; - width: auto; min-width: 0; } & > *:last-child { diff --git a/packages/ui/src/components/Button.svelte b/packages/ui/src/components/Button.svelte index 108ac9668b..3f87387e08 100644 --- a/packages/ui/src/components/Button.svelte +++ b/packages/ui/src/components/Button.svelte @@ -50,6 +50,7 @@ export let iconSize: IconSize = size === 'inline' ? 'inline' : 'small' export let iconRightSize: IconSize = 'x-small' export let short: boolean = false + export let shrink: number = 0 export let accent: boolean = false export let noFocus: boolean = false @@ -112,6 +113,7 @@ class:short style:width style:height + style:flex-shrink={shrink} {title} type={kind === 'primary' ? 'submit' : 'button'} on:click|stopPropagation|preventDefault diff --git a/packages/ui/src/components/TimeSince.svelte b/packages/ui/src/components/TimeSince.svelte index 8917d0be43..71f126b6cc 100644 --- a/packages/ui/src/components/TimeSince.svelte +++ b/packages/ui/src/components/TimeSince.svelte @@ -30,6 +30,7 @@ import { themeStore } from '@hcengineering/theme' export let value: number | undefined + export let kind: 'no-border' | 'list' = 'no-border' let time: string = '' @@ -73,6 +74,11 @@ : undefined - + {time} diff --git a/packages/ui/src/components/ToggleWithLabel.svelte b/packages/ui/src/components/ToggleWithLabel.svelte index e21e7a69a6..bc3a7ada04 100644 --- a/packages/ui/src/components/ToggleWithLabel.svelte +++ b/packages/ui/src/components/ToggleWithLabel.svelte @@ -28,7 +28,7 @@ const dispatch = createEventDispatcher() -
+
+{:else} +
4 && length === 'short'} + class:tiny={displayItems.length > 2 && length === 'tiny'} + > + {#each displayItems as item, i} +
+{/if} diff --git a/plugins/contact-resources/src/components/EmployeeAttributePresenter.svelte b/plugins/contact-resources/src/components/EmployeeAttributePresenter.svelte index a8f445090c..b230193474 100644 --- a/plugins/contact-resources/src/components/EmployeeAttributePresenter.svelte +++ b/plugins/contact-resources/src/components/EmployeeAttributePresenter.svelte @@ -1,7 +1,7 @@ {#if Array.isArray(value)} @@ -25,6 +27,8 @@ {inline} {colorInherit} {accent} + {shouldShowName} + {avatarSize} on:accent-color /> {/each} @@ -38,6 +42,8 @@ {inline} {colorInherit} {accent} + {shouldShowName} + {avatarSize} on:accent-color /> {/if} diff --git a/plugins/task-resources/src/components/state/StateEditor.svelte b/plugins/task-resources/src/components/state/StateEditor.svelte index 574796e24b..6b2182641f 100644 --- a/plugins/task-resources/src/components/state/StateEditor.svelte +++ b/plugins/task-resources/src/components/state/StateEditor.svelte @@ -29,6 +29,7 @@ export let size: ButtonSize = 'small' export let width: string = 'min-content' export let justify: 'left' | 'center' = 'center' + export let shouldShowName: boolean = true let state: State let opened: boolean = false @@ -56,12 +57,16 @@ } - +{#if kind === 'list' || kind === 'list-header'} + +{:else} + +{/if} diff --git a/plugins/task-resources/src/components/state/StatePresenter.svelte b/plugins/task-resources/src/components/state/StatePresenter.svelte index 46bf5b5441..886a6dc7a7 100644 --- a/plugins/task-resources/src/components/state/StatePresenter.svelte +++ b/plugins/task-resources/src/components/state/StatePresenter.svelte @@ -29,6 +29,8 @@ export let inline: boolean = false export let disabled: boolean = false export let oneLine: boolean = false + export let shouldShowName: boolean = true + export let shouldShowTooltip: boolean = false const dispatch = createEventDispatcher() @@ -43,22 +45,26 @@ {#if value} -
+ +
{#if shouldShowAvatar}
{/if} - {value.name} + {#if shouldShowName} + {value.name} + {/if}
{/if} diff --git a/plugins/tracker-resources/src/components/issues/ParentNamesPresenter.svelte b/plugins/tracker-resources/src/components/issues/ParentNamesPresenter.svelte index e6f16e55ce..b28837ac63 100644 --- a/plugins/tracker-resources/src/components/issues/ParentNamesPresenter.svelte +++ b/plugins/tracker-resources/src/components/issues/ParentNamesPresenter.svelte @@ -53,16 +53,16 @@ .names { display: inline-flex; min-width: 0; - color: var(--content-color); + color: var(--theme-dark-color); } .name { &:hover { - color: var(--caption-color); + color: var(--theme-caption-color); text-decoration: underline; } &:active { - color: var(--accent-color); + color: var(--theme-content-color); } &::before { content: '›'; diff --git a/plugins/tracker-resources/src/components/issues/TitlePresenter.svelte b/plugins/tracker-resources/src/components/issues/TitlePresenter.svelte index 03a80e60aa..ff91043c7c 100644 --- a/plugins/tracker-resources/src/components/issues/TitlePresenter.svelte +++ b/plugins/tracker-resources/src/components/issues/TitlePresenter.svelte @@ -32,7 +32,6 @@ class="name overflow-label select-text" class:with-margin={shouldUseMargin} class:list={kind === 'list'} - style:max-width={showParent ? `${value.parents.length !== 0 ? 95 : 100}%` : '100%'} title={value.title} > {/if} - + {#if embedded} {#if issueId}{issueId}{/if} diff --git a/plugins/tracker-resources/src/components/issues/edit/SubIssueList.svelte b/plugins/tracker-resources/src/components/issues/edit/SubIssueList.svelte index cb4147a1d6..eb32ddd53b 100644 --- a/plugins/tracker-resources/src/components/issues/edit/SubIssueList.svelte +++ b/plugins/tracker-resources/src/components/issues/edit/SubIssueList.svelte @@ -26,7 +26,8 @@ export let issues: Issue[] | undefined = undefined export let viewlet: Viewlet export let viewOptions: ViewOptions - export let disableHeader = false + export let disableHeader: boolean = false + export let compactMode: boolean = false // Extra properties export let projects: Map, Project> | undefined @@ -86,6 +87,7 @@ {createItemDialogProps} {createItemLabel} selectedObjectIds={$selectionStore ?? []} + {compactMode} on:row-focus={(event) => { listProvider.updateFocus(event.detail ?? undefined) }} diff --git a/plugins/tracker-resources/src/components/issues/edit/SubIssues.svelte b/plugins/tracker-resources/src/components/issues/edit/SubIssues.svelte index 47736309ec..6dfe5aa79f 100644 --- a/plugins/tracker-resources/src/components/issues/edit/SubIssues.svelte +++ b/plugins/tracker-resources/src/components/issues/edit/SubIssues.svelte @@ -46,6 +46,7 @@ export let shouldSaveDraft: boolean = false let isCollapsed = false + let listWidth: number $: hasSubIssues = issue.subIssues > 0 @@ -84,11 +85,10 @@ }) -
+
{#if hasSubIssues} {/if} -
+
{#if viewlet && hasSubIssues && viewOptions} {/if} {#if hasSubIssues}
-
- {#if hasSubIssues && viewOptions && viewlet} - {#if !isCollapsed} - -
- -
-
- {/if} +{#if hasSubIssues && viewOptions && viewlet} + {#if !isCollapsed} + +
+ +
+
{/if} -
+{/if} diff --git a/plugins/view-resources/src/components/list/ListItem.svelte b/plugins/view-resources/src/components/list/ListItem.svelte index f055fc9d77..ec18feb31b 100644 --- a/plugins/view-resources/src/components/list/ListItem.svelte +++ b/plugins/view-resources/src/components/list/ListItem.svelte @@ -141,6 +141,7 @@ {/each}
{:else} + {#each model.filter((p) => p.displayProps?.suffix === true) as attrModel}