Skip to content

Commit

Permalink
[UBER-55] Remember collapsed projects (#3194)
Browse files Browse the repository at this point in the history
Signed-off-by: Ruslan Bayandinov <wazsone@ya.ru>
  • Loading branch information
wazsone committed May 16, 2023
1 parent 3e5be43 commit 3d37ac6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<script lang="ts">
import { Ref, Space } from '@hcengineering/core'
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 { SpacesNavModel } from '@hcengineering/workbench'
import { SpecialElement } from '@hcengineering/workbench-resources'
Expand All @@ -27,16 +27,23 @@
export let currentSpecial: string | undefined
export let getActions: Function
export let deselect: boolean = false
const COLLAPSED = 'COLLAPSED'
const getSpaceCollapsedKey = () => `${getCurrentLocation().path[1]}_${space._id}_collapsed`
$: collapsed = localStorage.getItem(getSpaceCollapsedKey()) === COLLAPSED
</script>

{#if model.specials}
<TreeNode
{collapsed}
icon={space?.icon === tracker.component.IconWithEmojii ? IconWithEmojii : space?.icon ?? model.icon}
iconProps={space?.icon === tracker.component.IconWithEmojii
? { icon: space.color }
: { fill: space.color !== undefined ? getPlatformColor(space.color) : getPlatformColorForText(space.name) }}
title={space.name}
actions={() => getActions(space)}
on:click={() => localStorage.setItem(getSpaceCollapsedKey(), collapsed ? '' : COLLAPSED)}
>
{#each model.specials as special}
<NavLink space={space._id} special={special.id}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
{parent}
{indent}
{shortDropbox}
on:click
>
<slot />
</TreeElement>

0 comments on commit 3d37ac6

Please sign in to comment.