feat(planner): save accordion state (#5042)

Signed-off-by: Eduard Aksamitov <e@euaaaio.ru>
This commit is contained in:
Eduard Aksamitov
2024-03-25 09:56:52 +07:00
committed by GitHub
parent 18e8dcab57
commit 2bb4295f4d
4 changed files with 23 additions and 13 deletions
@@ -23,7 +23,6 @@
import ToDoDraggable from './ToDoDraggable.svelte'
import ToDoDuration from './ToDoDuration.svelte'
import ToDoElement from './ToDoElement.svelte'
import time from '../plugin'
import { dragging } from '../dragging'
import ToDoProjectGroup from './ToDoProjectGroup.svelte'
import { getClient } from '@hcengineering/presentation'
@@ -49,6 +48,8 @@
let groups: Project[] | undefined = undefined
let withoutProject: boolean = false
$: id = `group:${title}`
$: groups = updateGroups(todos, projects)
const updateGroups = (_todos: WithLookup<ToDo>[], _projects: IdMap<Project>): Project[] | undefined => {
@@ -92,12 +93,12 @@
{#if showTitle}
<AccordionItem
{id}
label={title}
size={'large'}
bottomSpace={false}
counter={todos.length}
duration={showDuration}
isOpen={title !== time.string.Done}
fixHeader
background={'var(--theme-navpanel-color)'}
>
@@ -44,6 +44,7 @@
let projectId: string | false
$: id = project === undefined ? groupName : `group:${groupName}_project:${project === false ? 'none' : project?._id}`
$: icon = project
? project.icon === view.ids.IconWithEmoji
? IconWithEmoji
@@ -81,7 +82,7 @@
}
</script>
<AccordionItem {icon} {iconProps} {title} {label} size={'medium'} isOpen nested>
<AccordionItem {id} {icon} {iconProps} {title} {label} size={'medium'} nested>
{#each todos as todo, index}
<ToDoDraggable {todo} {index} {groupName} {projectId} on:drop={handleDrop}>
<ToDoElement {todo} size={largeSize ? 'large' : 'small'} planned={mode !== 'unplanned'} />