Skip to content
Open
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
22 changes: 15 additions & 7 deletions models/card/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ export function createModel (builder: Builder): void {
_class: card.class.Card,
icon: card.icon.All,
label: card.string.AllCards,
defaultViewletDescriptor: card.viewlet.CardFeedDescriptor
defaultViewletDescriptor: view.viewlet.Table
},
position: 'top'
},
Expand All @@ -491,7 +491,17 @@ export function createModel (builder: Builder): void {
position: 'top'
}
],
spaces: [],
spaces: [
{
id: 'spaces',
label: core.string.Spaces,
spaceClass: card.class.CardSpace,
addSpaceLabel: core.string.Space,
icon: card.icon.Space,
// intentionally left empty in order to make space presenter working
specials: []
}
],
groups: [
{
id: 'types',
Expand All @@ -503,14 +513,12 @@ export function createModel (builder: Builder): void {
{
id: 'type',
label: card.string.Cards,
component: card.component.Main,
componentProps: {
defaultViewletDescriptor: card.viewlet.CardFeedDescriptor
}
component: card.component.Main
}
]
}
]
],
hideStarred: true
},
navHeaderActions: card.component.CardHeaderButton
},
Expand Down
1 change: 0 additions & 1 deletion plugins/card-resources/src/components/Favorites.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,5 @@
_class={card.class.FavoriteCard}
icon={view.icon.Star}
label={preference.string.Starred}
defaultViewletDescriptor={view.viewlet.List}
baseQuery={{ application }}
/>
14 changes: 8 additions & 6 deletions plugins/card-resources/src/components/Main.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
-->
<script lang="ts">
import { MasterTag } from '@hcengineering/card'
import { Class, Doc, Ref } from '@hcengineering/core'
import { Class, Doc, Ref, Space } from '@hcengineering/core'
import { IntlString } from '@hcengineering/platform'
import { createQuery } from '@hcengineering/presentation'
import { location } from '@hcengineering/ui'
Expand All @@ -23,11 +23,12 @@
import card from '../plugin'

let _class: Ref<Class<Doc>> | undefined
let space: Ref<Space> | undefined

onDestroy(
location.subscribe((loc) => {
const isTypeSpecified = loc.path[3] === 'type'
_class = isTypeSpecified ? loc.path[4] : card.class.Card
space = loc.path[3] === 'type' ? undefined : loc.path[3]
_class = loc.path[4]
})
)

Expand All @@ -38,7 +39,7 @@
allClasses = res.filter((it) => it.removed !== true)
})

$: clazz = allClasses.find((it) => it._id === _class)
$: clazz = allClasses.find((it) => it._id === _class) ?? allClasses.find((it) => it._id === card.class.Card)

$: label = getLabel(clazz)

Expand All @@ -50,8 +51,9 @@
{#if clazz !== undefined && label !== undefined}
<SpecialView
_class={clazz._id}
defaultViewletDescriptor={card.viewlet.CardFeedDescriptor}
baseQuery={space !== undefined ? { space } : {}}
{space}
{label}
icon={card.icon.Card}
icon={clazz.icon ?? card.icon.Card}
/>
{/if}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.
-->
<script lang="ts">
import core, { Class, Doc, getCurrentAccount, Ref } from '@hcengineering/core'
import core, { Class, Doc, getCurrentAccount, Ref, Space } from '@hcengineering/core'
import { createQuery, getClient } from '@hcengineering/presentation'
import { Action, getCurrentLocation, navigate, location as locationStore } from '@hcengineering/ui'
import { MasterTag, FavoriteType } from '@hcengineering/card'
Expand All @@ -25,6 +25,7 @@
import card from '../../plugin'

export let model: GroupsNavModel
export let currentSpace: Ref<Space> | undefined

let classes: MasterTag[] = []
let _class: Ref<Class<Doc>> | undefined
Expand Down Expand Up @@ -115,7 +116,7 @@
$: empty = rootClasses === undefined || rootClasses.length === 0
</script>

<div class="flex-col w-full">
<div class="flex-col w-full flex-no-shrink">
{#if favoriteRootClasses.length > 0}
<TreeNode
_id={'tree-favorites-' + model.id}
Expand All @@ -129,7 +130,7 @@
allClasses={classes}
{_class}
space={undefined}
currentSpace={undefined}
{currentSpace}
{getItemActions}
on:select={(e) => {
selectType(e.detail)
Expand All @@ -151,7 +152,7 @@
allClasses={classes}
{_class}
space={undefined}
currentSpace={undefined}
{currentSpace}
{getItemActions}
excludedClasses={favoriteTypes}
on:select={(e) => {
Expand Down
24 changes: 12 additions & 12 deletions plugins/workbench-resources/src/components/Navigator.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@

let requestIndex = 0
async function update (model: NavigatorModel, spaces: Space[], preferences: Map<Ref<Doc>, SpacePreference>) {
shownSpaces = spaces.filter((sp) => !sp.archived && !preferences.has(sp._id))
starred = spaces.filter((sp) => preferences.has(sp._id))
shownSpaces = spaces.filter((sp) => !sp.archived && (model.hideStarred || !preferences.has(sp._id)))
starred = model.hideStarred ? [] : spaces.filter((sp) => preferences.has(sp._id))
if (model.specials !== undefined) {
const [sp, resIndex] = await updateSpecials(model.specials, spaces, ++requestIndex)
if (resIndex !== requestIndex) return
Expand Down Expand Up @@ -173,7 +173,7 @@
<div class="min-h-3 flex-no-shrink" />

<SavedView alias={currentApplication?.alias} on:select={(res) => (menuSelection = res.detail)} />
{#if starred.length}
{#if (starred.length > 0) && !model.hideStarred}
<StarredNav
label={preference.string.Starred}
spaces={starred}
Expand All @@ -186,6 +186,15 @@
/>
{/if}

{#if model.groups && model.groups.length > 0}
<div class="min-h-3 flex-no-shrink" />
{#each model.groups as group (group.id)}
{#if group.component}
<Component is={group.component} props={{ model: group, currentSpace }} />
{/if}
{/each}
{/if}

{#each model.spaces as m (m.label)}
<SpacesNav
spaces={shownSpaces.filter((it) => hierarchy.isDerived(it._class, m.spaceClass))}
Expand All @@ -198,14 +207,5 @@
deselect={menuSelection || starred.some((s) => s._id === currentSpace)}
/>
{/each}

{#if model.groups && model.groups.length > 0}
<div class="min-h-3 flex-no-shrink" />
{#each model.groups as group (group.id)}
{#if group.component}
<Component is={group.component} props={{ model: group }} />
{/if}
{/each}
{/if}
</Scroller>
{/if}
1 change: 1 addition & 0 deletions plugins/workbench/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export interface NavigatorModel {
spaces: SpacesNavModel[]
specials?: SpecialNavModel[]
groups?: GroupsNavModel[]
hideStarred?: boolean
}

/** @public */
Expand Down
Loading