From d00a80a8f69a9074bfa5613c16c3f878147d0df9 Mon Sep 17 00:00:00 2001 From: Faton Ramadani Date: Fri, 10 Mar 2023 21:59:13 +0100 Subject: [PATCH] feat(frontend): hierarchical output panel WIP --- .../contextPanel/ComponentOutput.svelte | 77 ++++++++++++++++ .../contextPanel/ContainerOutput.svelte | 0 .../editor/contextPanel/ContextPanel.svelte | 87 ++----------------- 3 files changed, 86 insertions(+), 78 deletions(-) create mode 100644 frontend/src/lib/components/apps/editor/contextPanel/ComponentOutput.svelte create mode 100644 frontend/src/lib/components/apps/editor/contextPanel/ContainerOutput.svelte diff --git a/frontend/src/lib/components/apps/editor/contextPanel/ComponentOutput.svelte b/frontend/src/lib/components/apps/editor/contextPanel/ComponentOutput.svelte new file mode 100644 index 0000000000..eb40537efb --- /dev/null +++ b/frontend/src/lib/components/apps/editor/contextPanel/ComponentOutput.svelte @@ -0,0 +1,77 @@ + + +{#if $staticOutputs[gridItem.id] || gridItem.data.numberOfSubgrids > 1} +
+
+
+ {gridItem.id} +
+
+ {getComponentNameById(gridItem.id)} +
+
+ {#if $selectedComponent === gridItem.id} +
+ +
+ +
+ {#each subGrids as subGridId, index} + {#if subGrids.length > 1} +
+ {x(name)} + {index + 1} + + {subGridId} +
+ {/if} + {#if $app.subgrids} + {#each $app.subgrids[subGridId] as subGridItem} + {#if subGridItem} +
+ +
+ {/if} + {/each} + {/if} + {/each} +
+ {/if} +
+{/if} diff --git a/frontend/src/lib/components/apps/editor/contextPanel/ContainerOutput.svelte b/frontend/src/lib/components/apps/editor/contextPanel/ContainerOutput.svelte new file mode 100644 index 0000000000..e69de29bb2 diff --git a/frontend/src/lib/components/apps/editor/contextPanel/ContextPanel.svelte b/frontend/src/lib/components/apps/editor/contextPanel/ContextPanel.svelte index 918063f381..a5c3095fcf 100644 --- a/frontend/src/lib/components/apps/editor/contextPanel/ContextPanel.svelte +++ b/frontend/src/lib/components/apps/editor/contextPanel/ContextPanel.svelte @@ -3,16 +3,19 @@ import { X } from 'lucide-svelte' import { getContext } from 'svelte' import { flip } from 'svelte/animate' - import { fade } from 'svelte/transition' + import { fade, slide } from 'svelte/transition' import type { AppEditorContext } from '../../types' import { findGridItem } from '../appUtils' import { components } from '../component' import PanelSection from '../settingsPanel/common/PanelSection.svelte' + import ComponentOutput from './ComponentOutput.svelte' import ComponentOutputViewer from './ComponentOutputViewer.svelte' const { connectingInput, staticOutputs, worldStore, selectedComponent, app } = getContext('AppEditorContext') + const manualyOpenedIds = new Set() + function connectInput(componentId: string, path: string) { if ($connectingInput) { $connectingInput = { @@ -42,6 +45,7 @@ return 'Table action' } } + $: panels = [['ctx', ['email', 'username', 'query', 'hash']] as [string, string[]]].concat( Object.entries($staticOutputs) ) @@ -78,82 +82,9 @@ {/if} -
- {#each filteredPanels as [componentId, outputs] (componentId)} -
- {#if outputs.length > 0 && $worldStore?.outputsById[componentId]} - {@const name = getComponentNameById(componentId)} -
-
- - - {name} - -
-
- {#key $selectedComponent} - {#key $connectingInput?.opened} - { - connectInput(componentId, detail) - }} - /> - {/key} - {/key} -
-
- {/if} -
- {:else} -
- No outputs found -
- {/each} -
+ + {#each $app.grid as gridItem} + + {/each}