mirror of
https://github.com/hcengineering/platform.git
synced 2025-01-03 17:05:16 +03:00
[UBER-55] Remember collapsed projects (#3194)
Signed-off-by: Ruslan Bayandinov <wazsone@ya.ru>
This commit is contained in:
parent
3e5be43900
commit
3d37ac6471
@ -15,7 +15,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Ref, Space } from '@hcengineering/core'
|
import { Ref, Space } from '@hcengineering/core'
|
||||||
import { Project } from '@hcengineering/tracker'
|
import { Project } from '@hcengineering/tracker'
|
||||||
import { IconWithEmojii, getPlatformColor, getPlatformColorForText } from '@hcengineering/ui'
|
import { IconWithEmojii, getPlatformColor, getPlatformColorForText, getCurrentLocation } from '@hcengineering/ui'
|
||||||
import { NavLink, TreeNode } from '@hcengineering/view-resources'
|
import { NavLink, TreeNode } from '@hcengineering/view-resources'
|
||||||
import { SpacesNavModel } from '@hcengineering/workbench'
|
import { SpacesNavModel } from '@hcengineering/workbench'
|
||||||
import { SpecialElement } from '@hcengineering/workbench-resources'
|
import { SpecialElement } from '@hcengineering/workbench-resources'
|
||||||
@ -27,16 +27,23 @@
|
|||||||
export let currentSpecial: string | undefined
|
export let currentSpecial: string | undefined
|
||||||
export let getActions: Function
|
export let getActions: Function
|
||||||
export let deselect: boolean = false
|
export let deselect: boolean = false
|
||||||
|
|
||||||
|
const COLLAPSED = 'COLLAPSED'
|
||||||
|
const getSpaceCollapsedKey = () => `${getCurrentLocation().path[1]}_${space._id}_collapsed`
|
||||||
|
|
||||||
|
$: collapsed = localStorage.getItem(getSpaceCollapsedKey()) === COLLAPSED
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if model.specials}
|
{#if model.specials}
|
||||||
<TreeNode
|
<TreeNode
|
||||||
|
{collapsed}
|
||||||
icon={space?.icon === tracker.component.IconWithEmojii ? IconWithEmojii : space?.icon ?? model.icon}
|
icon={space?.icon === tracker.component.IconWithEmojii ? IconWithEmojii : space?.icon ?? model.icon}
|
||||||
iconProps={space?.icon === tracker.component.IconWithEmojii
|
iconProps={space?.icon === tracker.component.IconWithEmojii
|
||||||
? { icon: space.color }
|
? { icon: space.color }
|
||||||
: { fill: space.color !== undefined ? getPlatformColor(space.color) : getPlatformColorForText(space.name) }}
|
: { fill: space.color !== undefined ? getPlatformColor(space.color) : getPlatformColorForText(space.name) }}
|
||||||
title={space.name}
|
title={space.name}
|
||||||
actions={() => getActions(space)}
|
actions={() => getActions(space)}
|
||||||
|
on:click={() => localStorage.setItem(getSpaceCollapsedKey(), collapsed ? '' : COLLAPSED)}
|
||||||
>
|
>
|
||||||
{#each model.specials as special}
|
{#each model.specials as special}
|
||||||
<NavLink space={space._id} special={special.id}>
|
<NavLink space={space._id} special={special.id}>
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
{parent}
|
{parent}
|
||||||
{indent}
|
{indent}
|
||||||
{shortDropbox}
|
{shortDropbox}
|
||||||
|
on:click
|
||||||
>
|
>
|
||||||
<slot />
|
<slot />
|
||||||
</TreeElement>
|
</TreeElement>
|
||||||
|
Loading…
Reference in New Issue
Block a user