From d93e3422cfbe73712a2196e477bcb55eaf36c696 Mon Sep 17 00:00:00 2001 From: Guilhem Date: Thu, 13 Feb 2025 21:13:52 +0000 Subject: [PATCH] Migrating popup to popover --- .../src/lib/components/DefaultTags.svelte | 18 +- .../lib/components/InstanceNameEditor.svelte | 206 +++++++++--------- frontend/src/lib/components/InviteUser.svelte | 88 ++++---- .../lib/components/ResourceTypePicker.svelte | 98 ++++----- .../table/AppAggridTableActions.svelte | 38 ++-- .../components/display/table/AppTable.svelte | 34 +-- .../apps/editor/ComponentHeader.svelte | 61 +++--- .../editor/componentsPanel/NameEditor.svelte | 42 ++-- .../componentsPanel/ThemeNameEditor.svelte | 61 +++--- .../contextPanel/components/IdEditor.svelte | 30 +-- .../inlineScriptsPanel/CacheTtlPopup.svelte | 57 ++--- .../InlineScriptRunnableByPath.svelte | 20 +- .../inputEditor/IconSelectInput.svelte | 105 ++++----- 13 files changed, 442 insertions(+), 416 deletions(-) diff --git a/frontend/src/lib/components/DefaultTags.svelte b/frontend/src/lib/components/DefaultTags.svelte index df9272cbf5..5218fb7cd2 100644 --- a/frontend/src/lib/components/DefaultTags.svelte +++ b/frontend/src/lib/components/DefaultTags.svelte @@ -1,7 +1,8 @@ - - + + - - + +
+ +
+
+ diff --git a/frontend/src/lib/components/InstanceNameEditor.svelte b/frontend/src/lib/components/InstanceNameEditor.svelte index 3f02f73eaf..1f720a620b 100644 --- a/frontend/src/lib/components/InstanceNameEditor.svelte +++ b/frontend/src/lib/components/InstanceNameEditor.svelte @@ -2,7 +2,7 @@ import { Pencil } from 'lucide-svelte' import { createEventDispatcher } from 'svelte' import Button from './common/button/Button.svelte' - import Popup from './common/popup/Popup.svelte' + import Popover from './meltComponents/Popover.svelte' import { offset, flip, shift } from 'svelte-floating-ui/dom' import ChangeInstanceUsernameInner from './ChangeInstanceUsernameInner.svelte' import { UserService } from '$lib/gen' @@ -26,128 +26,124 @@ sendUserToast('Password must be at least 5 characters long', true) return } - await UserService.setPasswordForUser({user: email, requestBody:{ password }}) + await UserService.setPasswordForUser({ user: email, requestBody: { password } }) sendUserToast(`Password updated for ${email}`) } async function saveLoginType() { - await UserService.setLoginTypeForUser({user: email, requestBody:{ login_type }}) + await UserService.setLoginTypeForUser({ user: email, requestBody: { login_type } }) sendUserToast(`Login type updated for ${email}`) dispatch('refresh') } - - + -
- {#if automateUsernameCreation && username} - - {/if} - +
+
+ diff --git a/frontend/src/lib/components/InviteUser.svelte b/frontend/src/lib/components/InviteUser.svelte index 0455702854..ae5a824190 100644 --- a/frontend/src/lib/components/InviteUser.svelte +++ b/frontend/src/lib/components/InviteUser.svelte @@ -3,7 +3,8 @@ import { createEventDispatcher } from 'svelte' import { globalEmailInvite, superadmin, workspaceStore } from '$lib/stores' import { UserService, WorkspaceService } from '$lib/gen' - import { Button, Popup } from './common' + import { Button } from './common' + import Popover from './meltComponents/Popover.svelte' import { isCloudHosted } from '$lib/cloud' import { goto } from '$lib/navigation' import ToggleButtonGroup from './common/toggleButton-v2/ToggleButtonGroup.svelte' @@ -64,53 +65,54 @@ let selected: 'operator' | 'developer' | 'admin' = 'developer' - - + + - -
- - - +
+ + + - + - + + -
- + on:click={inviteUser} + disabled={email === undefined} + > + Invite + +
+
+ diff --git a/frontend/src/lib/components/ResourceTypePicker.svelte b/frontend/src/lib/components/ResourceTypePicker.svelte index 56d8b97d0a..96458e9bee 100644 --- a/frontend/src/lib/components/ResourceTypePicker.svelte +++ b/frontend/src/lib/components/ResourceTypePicker.svelte @@ -4,7 +4,8 @@ import { ResourceService } from '$lib/gen' import { workspaceStore } from '$lib/stores' import IconedResourceType from './IconedResourceType.svelte' - import { Button, ClearableInput, Popup } from './common' + import { Button, ClearableInput } from './common' + import Popover from './meltComponents/Popover.svelte' import { offset, flip, shift } from 'svelte-floating-ui/dom' import Label from './Label.svelte' import Tooltip from './Tooltip.svelte' @@ -50,66 +51,65 @@ > Clear - - + + +
+ -
- +
+
+ {#if nonePickable && search === ''} + {@const isPicked = value === undefined} + + {/if} + {#each filteredResources as r} + {@const isPicked = value === r} + + {/each} -
-
- {#if nonePickable && search === ''} - {@const isPicked = value === undefined} - - {/if} - {#each filteredResources as r} - {@const isPicked = value === r} - - {/each} - - {#if filteredResources.length === 0 && search !== ''} -
No resources found
- {/if} + {#if filteredResources.length === 0 && search !== ''} +
No resources found
+ {/if} +
-
- + +
diff --git a/frontend/src/lib/components/apps/components/display/table/AppAggridTableActions.svelte b/frontend/src/lib/components/apps/components/display/table/AppAggridTableActions.svelte index da3521a8d2..ecdf94121b 100644 --- a/frontend/src/lib/components/apps/components/display/table/AppAggridTableActions.svelte +++ b/frontend/src/lib/components/apps/components/display/table/AppAggridTableActions.svelte @@ -11,12 +11,12 @@ import AppSelect from '../../inputs/AppSelect.svelte' import { twMerge } from 'tailwind-merge' - import { Popup } from '$lib/components/common' import { Plug2 } from 'lucide-svelte' import ComponentOutputViewer from '$lib/components/apps/editor/contextPanel/ComponentOutputViewer.svelte' import { connectOutput } from '$lib/components/apps/editor/appUtils' import RowWrapper from '../../layout/RowWrapper.svelte' import type { ICellRendererParams } from 'ag-grid-community' + import Popover from '$lib/components/meltComponents/Popover.svelte' export let p: ICellRendererParams export let id: string @@ -124,34 +124,38 @@ {#if $connectingInput.opened}
- - + - { - const tableId = action.id.split('_')[0] + +
+ { + const tableId = action.id.split('_')[0] - connectOutput( - connectingInput, - action.type, - tableId, - `inputs.${action.id}[${rowIndex}].${detail}` - ) - }} - componentId={action.id} - /> - + connectOutput( + connectingInput, + action.type, + tableId, + `inputs.${action.id}[${rowIndex}].${detail}` + ) + }} + componentId={action.id} + /> +
+
+
{/if} {/if} diff --git a/frontend/src/lib/components/apps/components/display/table/AppTable.svelte b/frontend/src/lib/components/apps/components/display/table/AppTable.svelte index 1c13d1c575..e537daaaf6 100644 --- a/frontend/src/lib/components/apps/components/display/table/AppTable.svelte +++ b/frontend/src/lib/components/apps/components/display/table/AppTable.svelte @@ -39,12 +39,12 @@ import AppSelect from '../../inputs/AppSelect.svelte' import RowWrapper from '../../layout/RowWrapper.svelte' import ResolveStyle from '../../helpers/ResolveStyle.svelte' - import { Popup } from '$lib/components/common' import ComponentOutputViewer from '$lib/components/apps/editor/contextPanel/ComponentOutputViewer.svelte' import { EyeIcon, Plug2 } from 'lucide-svelte' import AppCell from './AppCell.svelte' import sum from 'hash-sum' import RefreshButton from '$lib/components/apps/components/helpers/RefreshButton.svelte' + import Popover from '$lib/components/meltComponents/Popover.svelte' export let id: string export let componentInput: AppInput | undefined @@ -553,31 +553,35 @@ {#if $connectingInput.opened}
- - + - - connectOutput( - connectingInput, - 'buttoncomponent', - actionButton.id, - detail - )} - componentId={actionButton.id} - /> - + +
+ + connectOutput( + connectingInput, + 'buttoncomponent', + actionButton.id, + detail + )} + componentId={actionButton.id} + /> +
+
+
{/if} {/if} diff --git a/frontend/src/lib/components/apps/editor/ComponentHeader.svelte b/frontend/src/lib/components/apps/editor/ComponentHeader.svelte index 4c26a56818..468f16359a 100644 --- a/frontend/src/lib/components/apps/editor/ComponentHeader.svelte +++ b/frontend/src/lib/components/apps/editor/ComponentHeader.svelte @@ -3,8 +3,8 @@ import type { AppViewerContext } from '../types' import { Anchor, ArrowDownFromLine, Bug, Network, Pen, Plug } from 'lucide-svelte' import { createEventDispatcher, getContext } from 'svelte' - import Popover from '$lib/components/Popover.svelte' - import { Button, Popup } from '$lib/components/common' + import Popover from '$lib/components/meltComponents/Popover.svelte' + import { Button } from '$lib/components/common' import type { AppComponent } from './component' import { twMerge } from 'tailwind-merge' import { connectOutput } from './appUtils' @@ -69,11 +69,8 @@ style="left: {id_width}px;" data-connection-button > - - + + - - connectOutput(connectingInput, component.type, component.id, detail)} - componentId={component.id} - /> - + +
+ + connectOutput(connectingInput, component.type, component.id, detail)} + componentId={component.id} + /> +
+
+
{/if} @@ -258,21 +259,25 @@ 'text-red-500 px-1 text-2xs py-0.5 font-bold w-fit absolute border border-red-500 -bottom-1 shadow left-1/2 transform -translate-x-1/2 z-50 cursor-pointer' )} > - - - -
-
{error ?? ''}	
-								
+ + + + + +
+
+
{error ?? ''}	
+						
+
+
- - +
{/if} diff --git a/frontend/src/lib/components/apps/editor/componentsPanel/NameEditor.svelte b/frontend/src/lib/components/apps/editor/componentsPanel/NameEditor.svelte index 2fee02c101..6d479df50b 100644 --- a/frontend/src/lib/components/apps/editor/componentsPanel/NameEditor.svelte +++ b/frontend/src/lib/components/apps/editor/componentsPanel/NameEditor.svelte @@ -1,7 +1,6 @@ - - + + -
-
Edit {kind} name
-
- - + +
+
Edit {kind} name
+
+ + +
-
- + + diff --git a/frontend/src/lib/components/apps/editor/componentsPanel/ThemeNameEditor.svelte b/frontend/src/lib/components/apps/editor/componentsPanel/ThemeNameEditor.svelte index e545c622fb..3cb14844e5 100644 --- a/frontend/src/lib/components/apps/editor/componentsPanel/ThemeNameEditor.svelte +++ b/frontend/src/lib/components/apps/editor/componentsPanel/ThemeNameEditor.svelte @@ -2,8 +2,7 @@ import { updateTheme } from './themeUtils' import { workspaceStore } from '$lib/stores' import Button from '$lib/components/common/button/Button.svelte' - - import { Popup } from '$lib/components/common' + import Popover from '$lib/components/meltComponents/Popover.svelte' import { Pen } from 'lucide-svelte' import { createEventDispatcher } from 'svelte' import { sendUserToast } from '$lib/toast' @@ -18,40 +17,38 @@ const dispatch = createEventDispatcher() - - + + -
-
Edit theme name
-
- - + +
+
Edit theme name
+
+ + +
-
- + + diff --git a/frontend/src/lib/components/apps/editor/contextPanel/components/IdEditor.svelte b/frontend/src/lib/components/apps/editor/contextPanel/components/IdEditor.svelte index 2db5998316..0a2dd46a7b 100644 --- a/frontend/src/lib/components/apps/editor/contextPanel/components/IdEditor.svelte +++ b/frontend/src/lib/components/apps/editor/contextPanel/components/IdEditor.svelte @@ -4,7 +4,7 @@ import { Pencil } from 'lucide-svelte' import { createEventDispatcher, getContext } from 'svelte' import IdEditorInput from '$lib/components/IdEditorInput.svelte' - import { Popup } from '$lib/components/common' + import Popover from '$lib/components/meltComponents/Popover.svelte' const { app, selectedComponent } = getContext('AppViewerContext') @@ -15,8 +15,8 @@ $: reservedIds = allItems($app.grid, $app.subgrids).map((item) => item.id) - - + + - close(null)} - on:save={(e) => { - dispatch('save', e.detail) - close(null) - }} - {reservedIds} - /> - + +
+ close()} + on:save={(e) => { + dispatch('save', e.detail) + close() + }} + {reservedIds} + /> +
+
+ diff --git a/frontend/src/lib/components/apps/editor/inlineScriptsPanel/CacheTtlPopup.svelte b/frontend/src/lib/components/apps/editor/inlineScriptsPanel/CacheTtlPopup.svelte index 4ade3ec0fa..60d166fdcb 100644 --- a/frontend/src/lib/components/apps/editor/inlineScriptsPanel/CacheTtlPopup.svelte +++ b/frontend/src/lib/components/apps/editor/inlineScriptsPanel/CacheTtlPopup.svelte @@ -1,13 +1,14 @@ - - + - {:else} -
- No icons match your search + bind:value={search} + type="text" + placeholder="Search" + class="col-span-4 mb-2" + /> +
+ {#each filteredItems as label} + + {:else} +
+ No icons match your search +
+ {/each}
- {/each} -
-
- {:else} -
Couldn't load options
- {/if} - {/if} -
+
+ {:else} +
Couldn't load options
+ {/if} + {/if} +
+ +