From e8aafce789d5b5905fe1f3d4c5098e045f42e80a Mon Sep 17 00:00:00 2001 From: Faton Ramadani Date: Mon, 27 Mar 2023 11:50:40 +0200 Subject: [PATCH] fix(frontend): Small app fixes (#1331) * fix(frontend): wip * fix(frontend): wip * fix(frontend): merge main * fix(frontend): fix build * fix(frontend): revert css * fix(frontend): fix alignement + remove id from if deleted * fix(frontend): fix connection height * fix(frontend): done --- .../lib/components/apps/editor/AppEditor.svelte | 2 +- .../components/apps/editor/AppPreview.svelte | 1 - .../components/apps/editor/GridEditor.svelte | 4 ++-- .../components/apps/editor/GridViewer.svelte | 1 - .../components/apps/editor/SettingsPanel.svelte | 3 +-- .../apps/editor/component/Component.svelte | 4 +++- .../apps/editor/componentsPanel/store.ts | 9 ++++----- .../editor/contextPanel/ContextPanel.svelte | 10 +++++----- .../inlineScriptsPanel/EmptyInlineScript.svelte | 11 ++--------- .../InlineScriptEditor.svelte | 17 ++++++++--------- .../InlineScriptEditorDrawer.svelte | 1 - .../InlineScriptEditorPanel.svelte | 7 ++++--- .../InlineScriptsPanel.svelte | 1 - .../InlineScriptsPanelWithTable.svelte | 3 ++- .../settingsPanel/ArrayStaticInputEditor.svelte | 4 ++-- .../editor/settingsPanel/ComponentPanel.svelte | 8 +++++++- .../apps/editor/settingsPanel/GridTab.svelte | 3 +-- .../settingsPanel/SelectedRunnable.svelte | 3 +-- .../inputEditor/EvalInputEditor.svelte | 7 +++++-- .../inputEditor/IconSelectInput.svelte | 7 ++++--- frontend/src/lib/components/apps/rx.ts | 4 ++-- .../src/lib/components/flows/map/MapItem.svelte | 6 +++--- 22 files changed, 57 insertions(+), 59 deletions(-) diff --git a/frontend/src/lib/components/apps/editor/AppEditor.svelte b/frontend/src/lib/components/apps/editor/AppEditor.svelte index 68460c3de6..5f6fb69103 100644 --- a/frontend/src/lib/components/apps/editor/AppEditor.svelte +++ b/frontend/src/lib/components/apps/editor/AppEditor.svelte @@ -243,7 +243,7 @@ {#if $appStore.grid} -
+
diff --git a/frontend/src/lib/components/apps/editor/AppPreview.svelte b/frontend/src/lib/components/apps/editor/AppPreview.svelte index 136d3ba6ae..ec490b983c 100644 --- a/frontend/src/lib/components/apps/editor/AppPreview.svelte +++ b/frontend/src/lib/components/apps/editor/AppPreview.svelte @@ -4,7 +4,6 @@ import { buildWorld } from '../rx' import type { App, - AppEditorContext, AppViewerContext, ConnectingInput, EditorBreakpoint, diff --git a/frontend/src/lib/components/apps/editor/GridEditor.svelte b/frontend/src/lib/components/apps/editor/GridEditor.svelte index 4eda481dc1..b904f2af3e 100644 --- a/frontend/src/lib/components/apps/editor/GridEditor.svelte +++ b/frontend/src/lib/components/apps/editor/GridEditor.svelte @@ -1,6 +1,6 @@ - -
+ +
-
-
+
+
('AppViewerContext') - const dispatch = createEventDispatcher() async function inferInlineScriptSchema( @@ -47,8 +46,6 @@ path: string, subkind: 'pgsql' | 'mysql' | undefined = undefined ) { - const componentType = $app.grid.find((c) => c.data.id === id)?.data?.type - const content = defaultCode(componentType ?? '', language) ?? initialCode(language, Script.kind.SCRIPT, subkind ?? 'flow') @@ -93,10 +90,6 @@ } const langs = ['deno', 'python3', 'go', 'bash'] as Script.language[] - - function loadSchemaFromTriggerable(path: string, arg1: string) { - throw new Error('Function not implemented.') - } diff --git a/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte b/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte index de8de910e5..082914389e 100644 --- a/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +++ b/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte @@ -9,7 +9,7 @@ import type { Schema } from '$lib/common' import Badge from '$lib/components/common/badge/Badge.svelte' import Editor from '$lib/components/Editor.svelte' - import { emptySchema, scriptLangToEditorLang } from '$lib/utils' + import { emptySchema, isMac, scriptLangToEditorLang } from '$lib/utils' import Popover from '../../../Popover.svelte' import { computeFields } from './utils' import { deepEqual } from 'fast-equals' @@ -67,6 +67,7 @@ loadSchemaAndInputsByName() } }) + const dispatch = createEventDispatcher() let runLoading = false @@ -82,8 +83,6 @@ } } - let isMac = navigator.userAgent.indexOf('Mac OS X') !== -1 - $: extraLib = inlineScript?.language == 'frontend' && worldStore ? buildExtraLib($worldStore?.outputsById ?? {}, id, false, $state, true) @@ -177,7 +176,7 @@ Format
- {isMac ? '⌘' : 'CTRL'} + {isMac() ? '⌘' : 'CTRL'} S
@@ -199,7 +198,7 @@ Run
- {isMac ? '⌘' : 'CTRL'} + {isMac() ? '⌘' : 'CTRL'}
@@ -248,15 +247,15 @@ {:else} { runLoading = true await $runnableComponents[id]?.cb?.(!transformer ? inlineScript : undefined) runLoading = false }} - class="h-full" - {extraLib} - bind:code={inlineScript.content} - lang="javascript" on:change={() => { $app = $app }} diff --git a/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditorDrawer.svelte b/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditorDrawer.svelte index a91780f7cd..2aa702c0d2 100644 --- a/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditorDrawer.svelte +++ b/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditorDrawer.svelte @@ -2,7 +2,6 @@ import { Button, Drawer, DrawerContent } from '$lib/components/common' import type Editor from '$lib/components/Editor.svelte' import ScriptEditor from '$lib/components/ScriptEditor.svelte' - import type { Preview } from '$lib/gen' import { faSave } from '@fortawesome/free-solid-svg-icons' import type { InlineScript } from '../../types' diff --git a/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte b/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte index 1c7007d91d..01aabef491 100644 --- a/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte +++ b/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditorPanel.svelte @@ -18,6 +18,7 @@ export let componentInput: AppInput | undefined export let defaultUserInput = false + export let componentType: string export let id: string export let transformer: boolean @@ -97,8 +98,8 @@ }} /> {:else} - Selected editor component is a transformer but component has no transformer + + Selected editor component is a transformer but component has no transformer {/if} {:else if componentInput && componentInput.type == 'runnable'} @@ -115,7 +116,7 @@ /> {:else} { diff --git a/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte b/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte index 02f595849f..2937faefd2 100644 --- a/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte +++ b/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptsPanel.svelte @@ -74,7 +74,6 @@ /> {:else} deleteBackgroundScript(hiddenInlineScript)} on:new={(e) => { diff --git a/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelWithTable.svelte b/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelWithTable.svelte index 6f6a97bfc4..c2d7114499 100644 --- a/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelWithTable.svelte +++ b/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelWithTable.svelte @@ -1,7 +1,6 @@ diff --git a/frontend/src/lib/components/apps/rx.ts b/frontend/src/lib/components/apps/rx.ts index 26e1f01844..38256fff6a 100644 --- a/frontend/src/lib/components/apps/rx.ts +++ b/frontend/src/lib/components/apps/rx.ts @@ -4,11 +4,11 @@ import { deepEqual } from 'fast-equals' export interface Subscriber { id?: string - next(v: T) + next(v: T): void } export interface Observable { - subscribe(x: Subscriber) + subscribe(x: Subscriber): void } export interface Output extends Observable { set(x: T, force?: boolean): void diff --git a/frontend/src/lib/components/flows/map/MapItem.svelte b/frontend/src/lib/components/flows/map/MapItem.svelte index 8118232115..27727b96be 100644 --- a/frontend/src/lib/components/flows/map/MapItem.svelte +++ b/frontend/src/lib/components/flows/map/MapItem.svelte @@ -82,9 +82,9 @@
{#if moving == mod.id}
- +
{/if}