diff --git a/frontend/src/lib/components/apps/editor/GridEditor.svelte b/frontend/src/lib/components/apps/editor/GridEditor.svelte
index 403660a189..015990c2e4 100644
--- a/frontend/src/lib/components/apps/editor/GridEditor.svelte
+++ b/frontend/src/lib/components/apps/editor/GridEditor.svelte
@@ -166,7 +166,13 @@
Hide bar on view
-
+ $app.norefreshbar ?? false,
+ (v) => ($app.norefreshbar !== undefined || v) && ($app.norefreshbar = v)
+ }
+ />
{policy.on_behalf_of ? `Author ${policy.on_behalf_of_email}` : ''}
diff --git a/frontend/src/lib/components/apps/editor/appUtils.ts b/frontend/src/lib/components/apps/editor/appUtils.ts
index d4e2a2e995..5276ff301f 100644
--- a/frontend/src/lib/components/apps/editor/appUtils.ts
+++ b/frontend/src/lib/components/apps/editor/appUtils.ts
@@ -13,6 +13,8 @@ import {
ccomponents,
components,
getRecommendedDimensionsByComponent,
+ presets,
+ processDimension,
type AppComponent,
type BaseComponent,
type InitialAppComponent,
@@ -36,17 +38,18 @@ import { sendUserToast } from '$lib/toast'
import { getNextId } from '$lib/components/flows/idUtils'
import { enterpriseLicense } from '$lib/stores'
import gridHelp from '../svelte-grid/utils/helper'
+import { DEFAULT_THEME } from './componentsPanel/themeUtils'
type GridItemLocation =
| {
- type: 'grid'
- gridItemIndex: number
- }
+ type: 'grid'
+ gridItemIndex: number
+ }
| {
- type: 'subgrid'
- subgridItemIndex: number
- subgridKey: string
- }
+ type: 'subgrid'
+ subgridItemIndex: number
+ subgridKey: string
+ }
interface GridItemWithLocation {
location: GridItemLocation
item: GridItem
@@ -187,7 +190,7 @@ export function selectId(
selectedComponent: Writable
,
app: App
) {
- ; (document?.activeElement as HTMLElement)?.blur()
+ ;(document?.activeElement as HTMLElement)?.blur()
if (e.shiftKey) {
selectedComponent.update((old) => {
if (old && old?.[0]) {
@@ -492,11 +495,11 @@ export function appComponentFromType(
xData:
type === 'plotlycomponentv2' || type === 'chartjscomponentv2'
? {
- type: 'evalv2',
- fieldType: 'array',
- expr: '[1, 2, 3, 4]',
- connections: []
- }
+ type: 'evalv2',
+ fieldType: 'array',
+ expr: '[1, 2, 3, 4]',
+ connections: []
+ }
: undefined,
...(extra ?? {})
}
@@ -845,33 +848,33 @@ export type InitConfig<
| EvalAppInput
| EvalV2AppInput
| {
- type: 'oneOf'
- selected: string
- configuration: Record<
- string,
- Record
- >
- }
+ type: 'oneOf'
+ selected: string
+ configuration: Record<
+ string,
+ Record
+ >
+ }
>
> = {
- [Property in keyof T]: T[Property] extends StaticAppInput
+ [Property in keyof T]: T[Property] extends StaticAppInput
? T[Property]['value'] | undefined
: T[Property] extends { type: 'oneOf' }
- ? {
- type: 'oneOf'
- selected: keyof T[Property]['configuration']
- configuration: {
- [Choice in keyof T[Property]['configuration']]: {
- [IT in keyof T[Property]['configuration'][Choice]]: T[Property]['configuration'][Choice][IT] extends StaticAppInput
- ? T[Property]['configuration'][Choice][IT] extends StaticAppInputOnDemand
- ? () => Promise
- : T[Property]['configuration'][Choice][IT]['value'] | undefined
- : undefined
+ ? {
+ type: 'oneOf'
+ selected: keyof T[Property]['configuration']
+ configuration: {
+ [Choice in keyof T[Property]['configuration']]: {
+ [IT in keyof T[Property]['configuration'][Choice]]: T[Property]['configuration'][Choice][IT] extends StaticAppInput
+ ? T[Property]['configuration'][Choice][IT] extends StaticAppInputOnDemand
+ ? () => Promise
+ : T[Property]['configuration'][Choice][IT]['value'] | undefined
+ : undefined
+ }
+ }
}
- }
- }
- : undefined
- }
+ : undefined
+}
export function initConfig<
T extends Record<
@@ -880,13 +883,13 @@ export function initConfig<
| EvalAppInput
| EvalV2AppInput
| {
- type: 'oneOf'
- selected: string
- configuration: Record<
- string,
- Record
- >
- }
+ type: 'oneOf'
+ selected: string
+ configuration: Record<
+ string,
+ Record
+ >
+ }
>
>(
r: T,
@@ -894,13 +897,13 @@ export function initConfig<
string,
| StaticAppInput
| {
- type: 'oneOf'
- selected: string
- configuration: Record<
- string,
- Record
- >
- }
+ type: 'oneOf'
+ selected: string
+ configuration: Record<
+ string,
+ Record
+ >
+ }
| any
>
): InitConfig {
@@ -910,31 +913,31 @@ export function initConfig<
Object.entries(r).map(([key, value]) =>
value.type == 'static'
? [
- key,
- configuration?.[key]?.type == 'static' ? configuration?.[key]?.['value'] : undefined
- ]
+ key,
+ configuration?.[key]?.type == 'static' ? configuration?.[key]?.['value'] : undefined
+ ]
: value.type == 'oneOf'
? [
- key,
- {
- selected: value.selected,
- type: 'oneOf',
- configuration: Object.fromEntries(
- Object.entries(value.configuration).map(([choice, config]) => {
- const conf = initConfig(
- config,
- configuration?.[key]?.configuration?.[choice]
- )
- Object.entries(config).forEach(([innerKey, innerValue]) => {
- if (innerValue.type === 'static' && !(innerKey in conf)) {
- conf[innerKey] = innerValue.value
- }
+ key,
+ {
+ selected: value.selected,
+ type: 'oneOf',
+ configuration: Object.fromEntries(
+ Object.entries(value.configuration).map(([choice, config]) => {
+ const conf = initConfig(
+ config,
+ configuration?.[key]?.configuration?.[choice]
+ )
+ Object.entries(config).forEach(([innerKey, innerValue]) => {
+ if (innerValue.type === 'static' && !(innerKey in conf)) {
+ conf[innerKey] = innerValue.value
+ }
+ })
+ return [choice, conf]
})
- return [choice, conf]
- })
- )
- }
- ]
+ )
+ }
+ ]
: [key, undefined]
)
) as any
@@ -1395,3 +1398,45 @@ export function animateTo(start: number, end: number, onUpdate: (newValue: numbe
function easeInOut(t: number) {
return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t
}
+
+export function emptyApp(): App {
+ let value: App = {
+ grid: [],
+ fullscreen: false,
+ unusedInlineScripts: [],
+ hiddenInlineScripts: [],
+ theme: {
+ type: 'path',
+ path: DEFAULT_THEME
+ }
+ }
+ const preset = presets['topbarcomponent']
+
+ const id = insertNewGridItem(
+ value,
+ appComponentFromType(preset.targetComponent, preset.configuration, undefined, {
+ customCss: {
+ container: {
+ class: '!p-0' as any,
+ style: ''
+ }
+ }
+ }) as (id: string) => AppComponent,
+ undefined,
+ undefined,
+ 'topbar',
+ { x: 0, y: 0 },
+ {
+ 3: processDimension(preset.dims, 3),
+ 12: processDimension(preset.dims, 12)
+ },
+ true,
+ true
+ )
+
+ setUpTopBarComponentContent(id, value)
+
+ value.hideLegacyTopBar = true
+ value.mobileViewOnSmallerScreens = false
+ return value
+}
diff --git a/frontend/src/lib/components/apps/editor/component/ComponentNavigation.svelte b/frontend/src/lib/components/apps/editor/component/ComponentNavigation.svelte
index aa81b7f5cc..2ac045feaa 100644
--- a/frontend/src/lib/components/apps/editor/component/ComponentNavigation.svelte
+++ b/frontend/src/lib/components/apps/editor/component/ComponentNavigation.svelte
@@ -11,6 +11,7 @@
left
} from './componentCallbacks.svelte'
import type { AppEditorContext, AppViewerContext } from '../../types'
+ import { isCurrentlyInTutorial } from '$lib/stores'
const { history, movingcomponents, jobsDrawerOpen, runnableJobEditorPanel } =
getContext('AppEditorContext') as AppEditorContext
@@ -33,7 +34,8 @@
if (
(typeof classes === 'string' && classes.includes('inputarea')) ||
['INPUT', 'TEXTAREA'].includes(document.activeElement?.tagName!) ||
- $runnableJobEditorPanel.focused
+ $runnableJobEditorPanel.focused ||
+ isCurrentlyInTutorial.val
) {
return
}
diff --git a/frontend/src/lib/components/apps/editor/contextPanel/ComponentOutputViewer.svelte b/frontend/src/lib/components/apps/editor/contextPanel/ComponentOutputViewer.svelte
index ffc9e7f750..9baad1f998 100644
--- a/frontend/src/lib/components/apps/editor/contextPanel/ComponentOutputViewer.svelte
+++ b/frontend/src/lib/components/apps/editor/contextPanel/ComponentOutputViewer.svelte
@@ -52,7 +52,7 @@
{#if render && object != undefined && Object.keys(object).length > 0}
{#if $hasResult[componentId] || $search == ''}
-