Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

improvement: Add show-chrome=false (#3862)

Myles Scolnicka89c2569fa76
diff --git a/frontend/src/components/editor/__tests__/data-attributes.test.tsx b/frontend/src/components/editor/__tests__/data-attributes.test.tsx
index 0fecce7e41..a3a5533c4d 100644
--- a/frontend/src/components/editor/__tests__/data-attributes.test.tsx
+++ b/frontend/src/components/editor/__tests__/data-attributes.test.tsx
@@ -54,6 +54,8 @@ describe("Cell data attributes", () => {
auto_reload: "off",
on_cell_change: "lazy",
watcher_on_save: "lazy",
+ output_max_bytes: 1_000_000,
+ std_stream_max_bytes: 1_000_000,
},
server: {
browser: "default",
diff --git a/frontend/src/components/pages/edit-page.tsx b/frontend/src/components/pages/edit-page.tsx
index 0f51ca7a35..5804106b78 100644
--- a/frontend/src/components/pages/edit-page.tsx
+++ b/frontend/src/components/pages/edit-page.tsx
@@ -3,13 +3,28 @@ import { EditApp } from "@/core/edit-app";
import { AppChrome } from "../editor/chrome/wrapper/app-chrome";
import { CommandPalette } from "../editor/controls/command-palette";
import type { AppConfig, UserConfig } from "@/core/config/config-schema";
+import { KnownQueryParams } from "@/core/constants";
interface Props {
userConfig: UserConfig;
appConfig: AppConfig;
}
+const hideChrome = (() => {
+ const url = new URL(window.location.href);
+ return url.searchParams.get(KnownQueryParams.showChrome) === "false";
+})();
+
const EditPage = (props: Props) => {
+ if (hideChrome) {
+ return (
+ <>
+ <EditApp hideControls={true} {...props} />
+ <CommandPalette />
+ </>
+ );
+ }
+
return (
<AppChrome>
<EditApp {...props} />
diff --git a/frontend/src/core/config/config-schema.ts b/frontend/src/core/config/config-schema.ts
index a3f1af9e4d..5b456e5358 100644
--- a/frontend/src/core/config/config-schema.ts
+++ b/frontend/src/core/config/config-schema.ts
@@ -45,6 +45,7 @@ export const UserConfigSchema = z
}),
codeium_api_key: z.string().nullish(),
})
+ .passthrough()
.default({}),
save: z
.object({
@@ -57,6 +58,7 @@ export const UserConfigSchema = z
.default(1000),
format_on_save: z.boolean().default(false),
})
+ .passthrough()
.default({}),
formatting: z
.object({
@@ -66,12 +68,14 @@ export const UserConfigSchema = z
.default(79)
.transform((n) => Math.min(n, 1000)),
})
+ .passthrough()
.default({}),
keymap: z
.object({
preset: z.enum(["default", "vim"]).default("default"),
overrides: z.record(z.string()).default({}),
})
+ .passthrough()
.default({}),
runtime: z
.object({
@@ -80,6 +84,7 @@ export const UserConfigSchema = z
auto_reload: z.enum(["off", "lazy", "autorun"]).default("off"),
watcher_on_save: z.enum(["lazy", "autorun"]).default("lazy"),
})
+ .passthrough()
.default({}),
display: z
.object({
@@ -97,11 +102,13 @@ export const UserConfigSchema = z
return width;
}),
})
+ .passthrough()
.default({}),
package_management: z
.object({
manager: z.enum(PackageManagerNames).default("pip"),
})
+ .passthrough()
.default({ manager: "pip" }),
ai: z
.object({
@@ -124,6 +131,7 @@ export const UserConfigSchema = z
})
.optional(),
})
+ .passthrough()
.default({}),
experimental: z
.object({
diff --git a/frontend/src/core/constants.ts b/frontend/src/core/constants.ts
index 5626bca3a3..76b730b7f3 100644
--- a/frontend/src/core/constants.ts
+++ b/frontend/src/core/constants.ts
@@ -40,4 +40,10 @@ export const KnownQueryParams = {
* layout view.
*/
viewAs: "view-as",
+ /**
+ * Show the chrome in edit mode.
+ * If true, the chrome will be shown.
+ * If false, the chrome will be hidden.
+ */
+ showChrome: "show-chrome",
};
diff --git a/frontend/src/core/edit-app.tsx b/frontend/src/core/edit-app.tsx
index 8adc0539c2..604a48237f 100644
--- a/frontend/src/core/edit-app.tsx
+++ b/frontend/src/core/edit-app.tsx
@@ -39,11 +39,25 @@ import { TooltipProvider } from "@radix-ui/react-tooltip";
import { lastSavedNotebookAtom } from "./saving/state";
interface AppProps {
+ /**
+ * The user config.
+ */
userConfig: UserConfig;
+ /**
+ * The app config.
+ */
appConfig: AppConfig;
+ /**
+ * If true, the floating controls will be hidden.
+ */
+ hideControls?: boolean;
}
-export const EditApp: React.FC<AppProps> = ({ userConfig, appConfig }) => {
+export const EditApp: React.FC<AppProps> = ({
+ userConfig,
+ appConfig,
+ hideControls = false,
+}) => {
useJotaiEffect(cellIdsAtom, CellEffects.onCellIdsChange);
const { setCells, mergeAllColumns } = useCellActions();
@@ -150,17 +164,19 @@ export const EditApp: React.FC<AppProps> = ({ userConfig, appConfig }) => {
</CellsRenderer>
)}
</AppContainer>
- <TooltipProvider>
- <Controls
- presenting={isPresenting}
- onTogglePresenting={togglePresenting}
- onInterrupt={sendInterrupt}
- onRun={runStaleCells}
- closed={connection.state === WebSocketState.CLOSED}
- running={isRunning}
- appConfig={appConfig}
- />
- </TooltipProvider>
+ {!hideControls && (
+ <TooltipProvider>
+ <Controls
+ presenting={isPresenting}
+ onTogglePresenting={togglePresenting}
+ onInterrupt={sendInterrupt}
+ onRun={runStaleCells}
+ closed={connection.state === WebSocketState.CLOSED}
+ running={isRunning}
+ appConfig={appConfig}
+ />
+ </TooltipProvider>
+ )}
</>
);
};