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 on-module-change footer config (#2462)

Myles Scolnickbf5fc60bff31
diff --git a/frontend/src/components/editor/chrome/wrapper/footer.tsx b/frontend/src/components/editor/chrome/wrapper/footer.tsx
index 2a1a850dc9..aa2566e1f2 100644
--- a/frontend/src/components/editor/chrome/wrapper/footer.tsx
+++ b/frontend/src/components/editor/chrome/wrapper/footer.tsx
@@ -9,12 +9,24 @@ import { cellErrorCount } from "@/core/cells/cells";
import { type PanelDescriptor, PANELS } from "../types";
import { MachineStats } from "./machine-stats";
import { useUserConfig } from "@/core/config/config";
-import { TerminalSquareIcon, ZapIcon, ZapOffIcon } from "lucide-react";
+import {
+ PowerOffIcon,
+ TerminalSquareIcon,
+ ZapIcon,
+ ZapOffIcon,
+} from "lucide-react";
import { saveUserConfig } from "@/core/network/requests";
import type { UserConfig } from "@/core/config/config-schema";
import { ShowInKioskMode } from "../../kiosk-mode";
import { invariant } from "@/utils/invariant";
import { IfCapability } from "@/core/config/if-capability";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from "@/components/ui/dropdown-menu";
+import { ChevronDownIcon } from "lucide-react";
export const Footer: React.FC = () => {
const { selectedPanel, isTerminalOpen } = useChromeState();
@@ -75,7 +87,7 @@ export const Footer: React.FC = () => {
{config.runtime.auto_instantiate ? (
<ZapIcon size={14} />
) : (
- <ZapOffIcon size={16} />
+ <ZapOffIcon size={14} />
)}
<span>{config.runtime.auto_instantiate ? "autorun" : "lazy"}</span>
</div>
@@ -111,12 +123,63 @@ export const Footer: React.FC = () => {
{config.runtime.on_cell_change === "autorun" ? (
<ZapIcon size={14} />
) : (
- <ZapOffIcon size={16} />
+ <ZapOffIcon size={14} />
)}
<span>{config.runtime.on_cell_change}</span>
</div>
</FooterItem>
+ <div className="border-r border-border h-6 mx-1" />
+
+ <FooterItem tooltip={null} selected={false}>
+ <DropdownMenu>
+ <DropdownMenuTrigger className="font-prose text-sm flex items-center gap-1">
+ <span>on module change: </span>
+ {config.runtime.auto_reload === "off" && <PowerOffIcon size={14} />}
+ {config.runtime.auto_reload === "lazy" && <ZapOffIcon size={14} />}
+ {config.runtime.auto_reload === "autorun" && <ZapIcon size={14} />}
+ <span>{config.runtime.auto_reload}</span>
+ <ChevronDownIcon size={14} />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent>
+ {["off", "lazy", "autorun"].map((option) => (
+ <DropdownMenuItem
+ key={option}
+ onClick={async () => {
+ const newConfig: UserConfig = {
+ ...config,
+ runtime: {
+ ...config.runtime,
+ auto_reload: option as "off" | "lazy" | "autorun",
+ },
+ };
+ await saveUserConfig({ config: newConfig }).then(() =>
+ setConfig(newConfig),
+ );
+ }}
+ >
+ {option === "off" && (
+ <PowerOffIcon
+ size={14}
+ className="mr-2 text-muted-foreground"
+ />
+ )}
+ {option === "lazy" && (
+ <ZapOffIcon
+ size={14}
+ className="mr-2 text-muted-foreground"
+ />
+ )}
+ {option === "autorun" && (
+ <ZapIcon size={14} className="mr-2 text-muted-foreground" />
+ )}
+ {option}
+ </DropdownMenuItem>
+ ))}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </FooterItem>
+
<div className="mx-auto" />
<ShowInKioskMode>
@@ -145,19 +208,27 @@ const FooterItem: React.FC<
} & React.HTMLAttributes<HTMLDivElement>
>
> = ({ children, tooltip, selected, className, ...rest }) => {
- return (
- <Tooltip content={tooltip} side="top" delayDuration={200}>
- <div
- className={cn(
- "h-full flex items-center p-2 text-sm mx-[1px] shadow-inset font-mono cursor-pointer rounded",
- !selected && "hover:bg-[var(--sage-3)]",
- selected && "bg-[var(--sage-4)]",
- className,
- )}
- {...rest}
- >
- {children}
- </div>
- </Tooltip>
+ const content = (
+ <div
+ className={cn(
+ "h-full flex items-center p-2 text-sm mx-[1px] shadow-inset font-mono cursor-pointer rounded",
+ !selected && "hover:bg-[var(--sage-3)]",
+ selected && "bg-[var(--sage-4)]",
+ className,
+ )}
+ {...rest}
+ >
+ {children}
+ </div>
);
+
+ if (tooltip) {
+ return (
+ <Tooltip content={tooltip} side="top" delayDuration={200}>
+ {content}
+ </Tooltip>
+ );
+ }
+
+ return content;
};