From 50ea19703ca315101e11970c4e46fd4ca578f242 Mon Sep 17 00:00:00 2001 From: Kristina Date: Wed, 18 Jun 2025 22:28:47 +0400 Subject: [PATCH] Add card ui fixes (#9301) --- communication | 2 +- .../src/components/CardTagColored.svelte | 29 +++++++- .../src/components/CardTagsColored.svelte} | 8 +-- .../src/components/CardWidget.svelte | 71 +++++++++++++++++-- .../src/components/EditCardNew.svelte | 26 +++++-- .../components/EditCardTableOfContents.svelte | 7 +- .../src/components/MasterTagSelector.svelte | 32 ++------- .../src/components/TagsEditor.svelte | 51 +++---------- .../sections/AttachmentsSection.svelte | 2 +- .../sections/ChildrenSection.svelte | 2 +- .../components/sections/ContentSection.svelte | 2 +- .../sections/PropertiesSection.svelte | 2 +- .../sections/RelationsSection.svelte | 2 +- plugins/card-resources/src/index.ts | 4 +- plugins/card/src/index.ts | 3 +- .../src/components/DateSeparator.svelte | 6 +- .../message/MessagePresenter.svelte | 4 +- .../components/message/MessageReplies.svelte | 5 +- .../components/ProcessesCardSection.svelte | 2 +- .../src/components/toc/TableOfContents.svelte | 10 ++- 20 files changed, 162 insertions(+), 108 deletions(-) rename plugins/{communication-resources/src/components/message/Tags.svelte => card-resources/src/components/CardTagsColored.svelte} (81%) diff --git a/communication b/communication index d7bbbc7723..6f4b14aff7 160000 --- a/communication +++ b/communication @@ -1 +1 @@ -Subproject commit d7bbbc7723598a41361dcffd4080e0a954c1fd2c +Subproject commit 6f4b14aff7ab544d9f97a1987a640faac5642581 diff --git a/plugins/card-resources/src/components/CardTagColored.svelte b/plugins/card-resources/src/components/CardTagColored.svelte index 93ff6ee4f0..f616271244 100644 --- a/plugins/card-resources/src/components/CardTagColored.svelte +++ b/plugins/card-resources/src/components/CardTagColored.svelte @@ -13,11 +13,23 @@
- + {#if tags.length > 0}
{#each tags as tag} - + {/each} {/if}
diff --git a/plugins/card-resources/src/components/CardWidget.svelte b/plugins/card-resources/src/components/CardWidget.svelte index f68489b40e..084190028f 100644 --- a/plugins/card-resources/src/components/CardWidget.svelte +++ b/plugins/card-resources/src/components/CardWidget.svelte @@ -15,16 +15,17 @@ {#if widget && tab?.id} -
+
{#if doc} @@ -96,4 +151,10 @@ min-width: 0; min-height: 0; } + + .title { + font-size: 1rem; + flex: 1; + min-width: 2rem; + } diff --git a/plugins/card-resources/src/components/EditCardNew.svelte b/plugins/card-resources/src/components/EditCardNew.svelte index c2c2168974..e9bcf867df 100644 --- a/plugins/card-resources/src/components/EditCardNew.svelte +++ b/plugins/card-resources/src/components/EditCardNew.svelte @@ -60,18 +60,22 @@ let isContextLoaded = false let title: string = '' + let isTitleEditing = false let prevId: Ref = _id $: if (prevId !== _id) { prevId = _id context = undefined isContextLoaded = false + isTitleEditing = false } $: query.query(card.class.Card, { _id }, async (result) => { if (result.length > 0) { ;[doc] = result - title = doc.title + if (!isTitleEditing) { + title = doc.title + } } else { const loc = getCurrentLocation() loc.path.length = 3 @@ -86,17 +90,17 @@ async function saveTitle (ev: Event): Promise { ev.preventDefault() + isTitleEditing = false const client = getClient() + const trimmedTitle = title.trim() + const canSave = trimmedTitle.length > 0 - const canSave = title.trim().length > 0 if (doc === undefined || !canSave) { return } - const nameTrimmed = title.trim() - - if (nameTrimmed.length > 0 && nameTrimmed !== doc.title) { - await client.update(doc, { title: nameTrimmed }) + if (trimmedTitle !== doc.title) { + await client.update(doc, { title: trimmedTitle }) } } @@ -164,7 +168,15 @@ {/if}
- + { + isTitleEditing = true + }} + />
diff --git a/plugins/card-resources/src/components/EditCardTableOfContents.svelte b/plugins/card-resources/src/components/EditCardTableOfContents.svelte index bc527dabdf..d54e7b1ee5 100644 --- a/plugins/card-resources/src/components/EditCardTableOfContents.svelte +++ b/plugins/card-resources/src/components/EditCardTableOfContents.svelte @@ -204,6 +204,7 @@ it.id === selectedToc?.id)} + position="right" on:select={(evt) => { onNavigationClick(evt.detail) }} @@ -269,10 +270,12 @@ .toc-container { position: absolute; pointer-events: none; - inset: 0; + //inset: 0; z-index: 1; top: 0; - left: 0.5rem; + right: 0.75rem; + width: 2rem; + height: fit-content; &.hidden { display: none; diff --git a/plugins/card-resources/src/components/MasterTagSelector.svelte b/plugins/card-resources/src/components/MasterTagSelector.svelte index 1377067d2b..f7bb4ff58f 100644 --- a/plugins/card-resources/src/components/MasterTagSelector.svelte +++ b/plugins/card-resources/src/components/MasterTagSelector.svelte @@ -13,9 +13,10 @@ // limitations under the License. --> -
-
-
-
- - + diff --git a/plugins/card-resources/src/components/TagsEditor.svelte b/plugins/card-resources/src/components/TagsEditor.svelte index f23cfe2f10..3f90a5f2b3 100644 --- a/plugins/card-resources/src/components/TagsEditor.svelte +++ b/plugins/card-resources/src/components/TagsEditor.svelte @@ -18,19 +18,10 @@ import card, { Card, Tag } from '@hcengineering/card' import { Class, Doc, Mixin, Ref } from '@hcengineering/core' import { createQuery, getClient } from '@hcengineering/presentation' - import { - ButtonIcon, - CircleButton, - eventToHTMLElement, - IconAdd, - IconClose, - IconDownOutline, - Label, - SelectPopup, - showPopup, - tooltip - } from '@hcengineering/ui' + import { CircleButton, eventToHTMLElement, IconAdd, IconDownOutline, SelectPopup, showPopup } from '@hcengineering/ui' + import MasterTagSelector from './MasterTagSelector.svelte' + import CardTagColored from './CardTagColored.svelte' export let doc: Card export let dropdownTags: boolean = false @@ -126,14 +117,12 @@ {:else} {#each activeTags as mixin} {@const removable = isRemoveable(mixin._id, activeTags)} -
- - - {#if removable} - removeTag(mixin._id)} /> - {/if} -
+ removeTag(mixin._id)} + /> {/each} {#if dropdownItems.length > 0} @@ -150,28 +139,6 @@ align-items: center; flex-shrink: 1; min-width: 0; - - .tag { - padding: 0.25rem 0.5rem; - height: 1.5rem; - border: 1px solid var(--theme-content-color); - max-width: 12.5rem; - min-width: 2rem; - overflow: hidden; - border-radius: 6rem; - - color: var(--theme-caption-color); - - display: flex; - align-items: center; - flex-shrink: 2; - gap: 0.25rem; - - &.removable { - padding-right: 0.25rem; - min-width: 3.75rem; - } - } } .divider { diff --git a/plugins/card-resources/src/components/sections/AttachmentsSection.svelte b/plugins/card-resources/src/components/sections/AttachmentsSection.svelte index 04df15e221..81d4162463 100644 --- a/plugins/card-resources/src/components/sections/AttachmentsSection.svelte +++ b/plugins/card-resources/src/components/sections/AttachmentsSection.svelte @@ -46,6 +46,6 @@ display: flex; flex-direction: column; width: 100%; - padding: 0 4rem; + padding: 0 2rem; } diff --git a/plugins/card-resources/src/components/sections/ChildrenSection.svelte b/plugins/card-resources/src/components/sections/ChildrenSection.svelte index bfd969f9da..c27e9a480b 100644 --- a/plugins/card-resources/src/components/sections/ChildrenSection.svelte +++ b/plugins/card-resources/src/components/sections/ChildrenSection.svelte @@ -40,6 +40,6 @@ display: flex; flex-direction: column; width: 100%; - padding: 0 4rem; + padding: 0 2rem; } diff --git a/plugins/card-resources/src/components/sections/ContentSection.svelte b/plugins/card-resources/src/components/sections/ContentSection.svelte index 874cc88148..d15486db31 100644 --- a/plugins/card-resources/src/components/sections/ContentSection.svelte +++ b/plugins/card-resources/src/components/sections/ContentSection.svelte @@ -54,7 +54,7 @@ display: flex; flex-direction: column; width: 100%; - padding: 0 5rem; + padding: 0 2.5rem; flex: 1; } diff --git a/plugins/card-resources/src/components/sections/PropertiesSection.svelte b/plugins/card-resources/src/components/sections/PropertiesSection.svelte index 0d9b34e235..6ce393a407 100644 --- a/plugins/card-resources/src/components/sections/PropertiesSection.svelte +++ b/plugins/card-resources/src/components/sections/PropertiesSection.svelte @@ -42,6 +42,6 @@ display: flex; flex-direction: column; width: 100%; - padding: 0 4rem; + padding: 0 2rem; } diff --git a/plugins/card-resources/src/components/sections/RelationsSection.svelte b/plugins/card-resources/src/components/sections/RelationsSection.svelte index 56ccbc4746..d5681331a8 100644 --- a/plugins/card-resources/src/components/sections/RelationsSection.svelte +++ b/plugins/card-resources/src/components/sections/RelationsSection.svelte @@ -30,6 +30,6 @@ display: flex; flex-direction: column; width: 100%; - padding: 0 4rem; + padding: 0 2rem; } diff --git a/plugins/card-resources/src/index.ts b/plugins/card-resources/src/index.ts index 51f0718086..5662a98ae9 100644 --- a/plugins/card-resources/src/index.ts +++ b/plugins/card-resources/src/index.ts @@ -61,6 +61,7 @@ import ContentCardSection from './components/sections/ContentSection.svelte' import PropertiesCardSection from './components/sections/PropertiesSection.svelte' import RelationsCardSection from './components/sections/RelationsSection.svelte' import FavoriteCardPresenter from './components/FavoriteCardPresenter.svelte' +import CardTagsColored from './components/CardTagsColored.svelte' import CardTagColored from './components/CardTagColored.svelte' import CardWidgetTab from './components/CardWidgetTab.svelte' @@ -102,7 +103,8 @@ export default async (): Promise => ({ CardWidget, CardWidgetTab, FavoriteCardPresenter, - CardTagColored + CardTagColored, + CardTagsColored }, sectionComponent: { AttachmentsSection: AttachmentsCardSection, diff --git a/plugins/card/src/index.ts b/plugins/card/src/index.ts index 7758d340a7..b265d7399e 100644 --- a/plugins/card/src/index.ts +++ b/plugins/card/src/index.ts @@ -164,7 +164,8 @@ const cardPlugin = plugin(cardId, { }, component: { LabelsPresenter: '' as AnyComponent, - CardTagColored: '' as AnyComponent + CardTagColored: '' as AnyComponent, + CardTagsColored: '' as AnyComponent }, function: { OpenCardInSidebar: '' as Resource<(_id: Ref, card?: Card) => Promise> diff --git a/plugins/communication-resources/src/components/DateSeparator.svelte b/plugins/communication-resources/src/components/DateSeparator.svelte index 3de072f9e6..06d4f41664 100644 --- a/plugins/communication-resources/src/components/DateSeparator.svelte +++ b/plugins/communication-resources/src/components/DateSeparator.svelte @@ -55,7 +55,7 @@ .date-separator { display: flex; width: 100%; - padding: 0 4rem; + padding: 0 2rem; font-size: 0.75rem; height: 2.25rem; position: relative; @@ -84,9 +84,9 @@ flex: 1; height: 1px; min-height: 1px; - width: calc(100% - 8rem); + width: calc(100% - 4rem); background: var(--highlight-select-border); - margin: 0 4rem; + margin: 0 2rem; margin-top: -2rem; } diff --git a/plugins/communication-resources/src/components/message/MessagePresenter.svelte b/plugins/communication-resources/src/components/message/MessagePresenter.svelte index f887afecf8..1ae1a7e8f8 100644 --- a/plugins/communication-resources/src/components/message/MessagePresenter.svelte +++ b/plugins/communication-resources/src/components/message/MessagePresenter.svelte @@ -225,7 +225,7 @@ align-self: stretch; min-width: 0; position: relative; - padding: 0.5rem 4rem; + padding: 0.5rem 2rem; &:hover:not(.noHover) { background: var(--global-ui-BackgroundColor); @@ -247,7 +247,7 @@ .message__actions { position: absolute; top: -0.75rem; - right: 1rem; + right: 2.25rem; visibility: hidden; z-index: 2; diff --git a/plugins/communication-resources/src/components/message/MessageReplies.svelte b/plugins/communication-resources/src/components/message/MessageReplies.svelte index 95d2c6563e..455d59a7aa 100644 --- a/plugins/communication-resources/src/components/message/MessageReplies.svelte +++ b/plugins/communication-resources/src/components/message/MessageReplies.svelte @@ -14,7 +14,7 @@ --> -
+
@@ -73,6 +74,11 @@ justify-content: flex-start; align-items: flex-start; gap: 1.5rem; + width: 2rem; + + &.right { + align-items: flex-end; + } } .toc {