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: condense / cleanup static banner (#5245)

Myles Scolnickf006f5cd4a2e
diff --git a/frontend/src/components/editor/renderers/vertical-layout/vertical-layout.tsx b/frontend/src/components/editor/renderers/vertical-layout/vertical-layout.tsx
index ace83ef0c8..825d3eadff 100644
--- a/frontend/src/components/editor/renderers/vertical-layout/vertical-layout.tsx
+++ b/frontend/src/components/editor/renderers/vertical-layout/vertical-layout.tsx
@@ -40,6 +40,7 @@ import { useResolvedMarimoConfig } from "@/core/config/config";
import { MarkdownLanguageAdapter } from "@/core/codemirror/language/languages/markdown";
import { isErrorMime } from "@/core/mime";
import { showCodeInRunModeAtom } from "@/core/meta/state";
+import { Alert, AlertTitle, AlertDescription } from "@/components/ui/alert";
type VerticalLayout = null;
type VerticalLayoutProps = ICellRendererProps<VerticalLayout>;
@@ -127,6 +128,19 @@ const VerticalLayoutRenderer: React.FC<VerticalLayoutProps> = ({
);
}
+ if (cells.length === 0) {
+ return (
+ <div className="flex-1 flex flex-col items-center justify-center py-8">
+ <Alert variant="info">
+ <AlertTitle>Empty Notebook</AlertTitle>
+ <AlertDescription>
+ This notebook has no code or outputs.
+ </AlertDescription>
+ </Alert>
+ </div>
+ );
+ }
+
return <>{cells.map(renderCell)}</>;
};
diff --git a/frontend/src/components/pages/run-page.tsx b/frontend/src/components/pages/run-page.tsx
index 6411240a2a..d04ad94927 100644
--- a/frontend/src/components/pages/run-page.tsx
+++ b/frontend/src/components/pages/run-page.tsx
@@ -44,7 +44,7 @@ const Watermark = () => {
target="_blank"
className="text-sm text-[var(--grass-11)] font-bold tracking-wide transition-colors bg-[var(--grass-4)] hover:bg-[var(--grass-5)] border-t border-l border-[var(--grass-8)] px-3 py-1 rounded-tl-md flex items-center gap-2"
>
- <span className="pb-[2px]">made with marimo</span>
+ <span>made with marimo</span>
<img src={faviconUrl} alt="marimo" className="h-4 w-auto" />
</a>
</div>
diff --git a/frontend/src/components/static-html/static-banner.tsx b/frontend/src/components/static-html/static-banner.tsx
index 8d4a317ea9..3d47794d1e 100644
--- a/frontend/src/components/static-html/static-banner.tsx
+++ b/frontend/src/components/static-html/static-banner.tsx
@@ -36,17 +36,19 @@ export const StaticBanner: React.FC = () => {
return (
<div
- className="px-4 py-2 bg-[var(--sky-2)] border-b border-[var(--sky-7)] text-md text-[var(--sky-11)] font-semibold flex justify-between items-center gap-4 no-print"
+ className="px-4 py-2 bg-[var(--sky-2)] border-b border-[var(--sky-7)] text-[var(--sky-11)] flex justify-between items-center gap-4 no-print text-sm"
data-testid="static-notebook-banner"
>
<span>
- This is a static Python notebook built using{" "}
- <a href={Constants.githubPage} target="_blank" className="underline">
+ Static{" "}
+ <a
+ href={Constants.githubPage}
+ target="_blank"
+ className="text-[var(--sky-11)] font-medium underline"
+ >
marimo
- </a>
- .
- <br />
- Some interactive features may not work, see ways to run or edit this.
+ </a>{" "}
+ notebook - Run or edit for full interactivity
</span>
<span className="flex-shrink-0">
<StaticBannerDialog code={code} />
@@ -71,80 +73,89 @@ const StaticBannerDialog = ({ code }: { code: string }) => {
<DialogTrigger asChild={true}>
<Button
data-testid="static-notebook-dialog-trigger"
- variant="secondary"
+ variant="outline"
+ size="xs"
>
- Run or edit this notebook
+ Run or Edit
</Button>
</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>{filename}</DialogTitle>
- <DialogDescription className="pt-4 text-md text-left">
- This is a static notebook built using{" "}
- <a
- href={Constants.githubPage}
- target="_blank"
- className="text-link hover:underline"
- >
- marimo
- </a>
- . marimo is an open-source next-generation Python notebook.
- <hr className="my-3" />
- In order to edit this notebook, you will need to download the code
- locally, install marimo, and run the following in your terminal:
- <div className="font-mono text-sm bg-[var(--sky-2)] rounded-md my-3 p-2 border border-[var(--sky-7)]">
- pip install marimo
- <br />
- marimo edit {filename}
+ <DialogDescription className="pt-3 text-left space-y-3">
+ <p>
+ This is a static{" "}
+ <a
+ href={Constants.githubPage}
+ target="_blank"
+ className="text-[var(--sky-11)] hover:underline font-medium"
+ >
+ marimo
+ </a>{" "}
+ notebook. To run interactively:
+ </p>
+
+ <div className="rounded-lg p-3 border bg-[var(--sky-2)] border-[var(--sky-7)]">
+ <div className="font-mono text-[var(--sky-11)] leading-relaxed">
+ pip install marimo
+ <br />
+ marimo edit {filename}
+ </div>
</div>
+
{!href.endsWith(".html") && (
- <>
- or
- <div className="font-mono text-sm bg-[var(--sky-2)] rounded-md my-3 p-2 border border-[var(--sky-7)] break-all">
+ <div className="rounded-lg p-3 border bg-[var(--sky-2)] border-[var(--sky-7)]">
+ <div className="text-sm text-[var(--sky-12)] mb-1">
+ Or run directly from URL:
+ </div>
+ <div className="font-mono text-[var(--sky-11)] break-all">
marimo edit {window.location.href}
</div>
- </>
+ </div>
)}
- <hr className="my-3" />
- You may also be able to run this notebook entirely in the browser
- via WebAssembly at:{" "}
- <a
- href={wasmLink}
- target="_blank"
- className="text-link hover:underline"
- rel="noreferrer"
- >
- {wasmLink.slice(0, 40)}...
- </a>
- <br />
- <div className="text-sm text-muted-foreground pt-2">
- <strong>Note:</strong> This feature is experimental and may not
- work for all notebooks. Additionally, some dependencies may not be
- available in the browser.
+
+ <div className="pt-3 border-t border-[var(--sky-7)]">
+ <p className="text-sm text-[var(--sky-12)] mb-2">
+ <strong>Try in browser with WebAssembly:</strong>{" "}
+ <a
+ href={wasmLink}
+ target="_blank"
+ className="text-[var(--sky-11)] hover:underline break-all"
+ rel="noreferrer"
+ >
+ {wasmLink.slice(0, 50)}...
+ </a>
+ </p>
+ <p className="text-sm text-[var(--sky-12)]">
+ Note: WebAssembly may not work for all notebooks. Additionally,
+ some dependencies may not be available in the browser.
+ </p>
</div>
</DialogDescription>
</DialogHeader>
- <div className="flex gap-4 flex-wrap">
+ <div className="flex gap-3 pt-2">
<Button
data-testid="copy-static-notebook-dialog-button"
- variant="secondary"
+ variant="outline"
+ size="sm"
onClick={async () => {
await copyToClipboard(code);
toast({ title: "Copied to clipboard" });
}}
>
- <CopyIcon className="w-4 h-4 mr-1" />
+ <CopyIcon className="w-3 h-3 mr-2" />
Copy code
</Button>
<Button
data-testid="download-static-notebook-dialog-button"
- variant="secondary"
+ variant="outline"
+ size="sm"
onClick={() => {
downloadBlob(new Blob([code], { type: "text/plain" }), filename);
}}
>
- <DownloadIcon className="w-4 h-4 mr-1" />
- Download code
+ <DownloadIcon className="w-3 h-3 mr-2" />
+ Download
</Button>
</div>
</DialogContent>
diff --git a/frontend/src/components/ui/alert.tsx b/frontend/src/components/ui/alert.tsx
index cb223bbf56..153eae6e9b 100644
--- a/frontend/src/components/ui/alert.tsx
+++ b/frontend/src/components/ui/alert.tsx
@@ -12,6 +12,7 @@ const alertVariants = cva(
default: "bg-background text-foreground",
destructive:
"text-destructive border-destructive/50 dark:border-destructive [&>svg]:text-destructive text-destructive",
+ info: "bg-[var(--sky-2)] border-[var(--sky-7)] text-[var(--sky-11)]",
},
},
defaultVariants: {