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
2 changes: 2 additions & 0 deletions plugins/card-resources/src/components/CardWidget.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import EditCardNewContent from './EditCardNewContent.svelte'
import { showMenu } from '@hcengineering/view-resources'
import TagsEditor from './TagsEditor.svelte'
import ParentNamesPresenter from './ParentNamesPresenter.svelte'

export let widget: Widget | undefined
export let tab: WidgetTab | undefined
Expand Down Expand Up @@ -107,6 +108,7 @@
dispatch('close')
}}
/>
<ParentNamesPresenter value={doc} compact={true} />
</svelte:fragment>

<svelte:fragment slot="actions">
Expand Down
4 changes: 2 additions & 2 deletions plugins/card-resources/src/components/ColoredCardIcon.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<script lang="ts">
import cardPlugin, { Card, MasterTag } from '@hcengineering/card'
import { getClient } from '@hcengineering/presentation'
import { Component, getPlatformColorDef, themeStore } from '@hcengineering/ui'
import { Component, getPlatformColorDef, themeStore, tooltip } from '@hcengineering/ui'
import communication from '@hcengineering/communication'

import NotifyMarker from './NotifyMarker.svelte'
Expand Down Expand Up @@ -43,7 +43,7 @@
}
</script>

<div class="card-icon" style={getIconStyle(platformColor)}>
<div class="card-icon" style={getIconStyle(platformColor)} use:tooltip={{ label: clazz.label }}>
<Component is={cardPlugin.component.CardIcon} props={{ value: card, size }} />

{#if count > 0}
Expand Down
10 changes: 4 additions & 6 deletions plugins/card-resources/src/components/EditCardNew.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
let element: HTMLElement
let titleEl: HTMLElement | null = null
let extraEl: HTMLElement | null = null
let showParents: boolean = !$deviceInfo.isMobile
let expandedParents: boolean = !$deviceInfo.isMobile
let dropdownTags: boolean = false

const shrinkElement = (el: 'title' | 'extra'): void => {
Expand All @@ -135,8 +135,8 @@
} else if (headerWidth >= DROPDOWN_POINT && !extraEl.classList.contains('flex-shrink-15')) {
shrinkElement('extra')
}
if (headerWidth < NO_PARENTS_POINT && showParents) showParents = false
else if (headerWidth >= NO_PARENTS_POINT && !showParents) showParents = !$deviceInfo.isMobile
if (headerWidth < NO_PARENTS_POINT && expandedParents) expandedParents = false
else if (headerWidth >= NO_PARENTS_POINT && !expandedParents) expandedParents = !$deviceInfo.isMobile
}

afterUpdate(() => {
Expand Down Expand Up @@ -172,9 +172,7 @@
</svelte:fragment>

<svelte:fragment slot="title">
{#if showParents}
<ParentNamesPresenter value={doc} maxWidth={'12rem'} />
{/if}
<ParentNamesPresenter value={doc} maxWidth={'12rem'} compact={!expandedParents} />
<div class="title flex-row-center">
{#if !_readonly}
<EditBox
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,12 @@

&__message {
display: flex;
min-height: 1.375rem;
color: var(--global-secondary-TextColor);
}

&__parent {
display: flex;
align-items: center;
margin-top: 0.5rem;

&.wrap {
flex-wrap: wrap;
Expand Down
38 changes: 29 additions & 9 deletions plugins/card-resources/src/components/ParentNamesPresenter.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
export let value: Card | undefined

export let maxWidth = ''
export let compact = false

const MIN_WIDTH = 2 // rem

function getHref (parentInfo: ParentInfo) {
function getHref (parentInfo: ParentInfo): string {
const loc = getCurrentLocation()
loc.path[2] = cardId
loc.path[3] = parentInfo._id
Expand All @@ -35,26 +36,39 @@
}
</script>

{#if value && Array.isArray(value.parentInfo) && (value.parentInfo.length > 0 || $$slots.default)}
{#if value != null && Array.isArray(value.parentInfo) && (value.parentInfo.length > 0 || $$slots.default)}
<div
class="cards-container cropped-text-presenters"
class:compact
style:max-width={maxWidth}
style:--cards-container-card-min-width={`${MIN_WIDTH}rem`}
style:--cards-container-parents={value.parentInfo.length}
>
{#each value.parentInfo as parentInfo}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
{#if !compact}
{#each value.parentInfo as parentInfo}
<NavLink
href={getHref(parentInfo)}
title={parentInfo.title}
shrink={parentInfo.title.length > 100 ? 2 : 1}
colorInherit
>
{parentInfo.title}
</NavLink>
<span class="separator">›</span>
{/each}
{:else}
{@const parentInfo = value.parentInfo[0]}
{@const shortTitle = (parentInfo.title?.charAt(0) ?? '') + '...'}
<NavLink
href={getHref(parentInfo)}
title={parentInfo.title}
shrink={parentInfo.title.length > 100 ? 2 : 1}
colorInherit
>
{parentInfo.title}
{shortTitle}
</NavLink>
<span class="separator">›</span>
{/each}
<span class="separator compact">›</span>
{/if}
<slot />
</div>
{:else if $$slots.default}
Expand All @@ -66,17 +80,23 @@
display: inline-flex;
flex-shrink: 1;
margin-left: 0;
min-width: 0;
min-width: calc(
(var(--cards-container-card-min-width, 2rem) + 1.26rem) * var(--cards-container-parents, 1) +
var(--cards-container-card-min-width, 2rem)
);
color: var(--theme-darker-color);

&.compact {
min-width: 1rem;
}

.separator {
flex-shrink: 0;
padding: 0 0.5rem;
color: var(--theme-content-color);
&.compact {
padding: 0 0.5rem 0 0;
}
}
:global(a:hover) {
color: var(--theme-caption-color);
Expand Down
Loading