Skip to content

Commit

Permalink
fix: prompt namespace dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyashankar committed Dec 23, 2024
1 parent fb1982d commit 6b5133b
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions website/src/app/playground/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,12 @@ const CodeEditorPipelineApp: React.FC = () => {
return () => window.removeEventListener("resize", checkScreenSize);
}, []);

useEffect(() => {
if (isMounted && !namespace) {
setShowNamespaceDialog(true);
}
}, [isMounted, namespace]);

if (isLoading) {
return <LoadingScreen />;
}
Expand Down Expand Up @@ -329,6 +335,15 @@ const CodeEditorPipelineApp: React.FC = () => {
}
};

const handleNew = () => {
clearPipelineState();
if (!namespace) {
setShowNamespaceDialog(true);
} else {
window.location.reload();
}
};

const topBarStyles =
"p-2 flex justify-between items-center border-b bg-white shadow-sm";
const controlGroupStyles = "flex items-center gap-2";
Expand Down Expand Up @@ -374,12 +389,7 @@ const CodeEditorPipelineApp: React.FC = () => {
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction
onClick={() => {
clearPipelineState();
window.location.reload();
}}
>
<AlertDialogAction onClick={handleNew}>
Clear
</AlertDialogAction>
</AlertDialogFooter>
Expand Down

0 comments on commit 6b5133b

Please sign in to comment.