52 lines
1.1 KiB
TypeScript
52 lines
1.1 KiB
TypeScript
"use client";
|
|
|
|
import { memo } from "react";
|
|
import { useRouter } from "next/navigation";
|
|
import { CreateFlowTopNavView } from "./CreateFlowTopNav.view";
|
|
import type { CreateFlowTopNavProps } from "./CreateFlowTopNav.types";
|
|
|
|
const CreateFlowTopNavContainer = memo<CreateFlowTopNavProps>(
|
|
({
|
|
hasShare = false,
|
|
hasExport = false,
|
|
hasEdit = false,
|
|
loggedIn = false,
|
|
onShare,
|
|
onExport,
|
|
onEdit,
|
|
onExit,
|
|
buttonPalette,
|
|
className = "",
|
|
}) => {
|
|
const router = useRouter();
|
|
|
|
const handleExit = () => {
|
|
if (onExit) {
|
|
onExit();
|
|
} else {
|
|
// Default behavior: navigate to home
|
|
router.push("/");
|
|
}
|
|
};
|
|
|
|
return (
|
|
<CreateFlowTopNavView
|
|
hasShare={hasShare}
|
|
hasExport={hasExport}
|
|
hasEdit={hasEdit}
|
|
loggedIn={loggedIn}
|
|
onShare={onShare}
|
|
onExport={onExport}
|
|
onEdit={onEdit}
|
|
onExit={handleExit}
|
|
buttonPalette={buttonPalette}
|
|
className={className}
|
|
/>
|
|
);
|
|
},
|
|
);
|
|
|
|
CreateFlowTopNavContainer.displayName = "CreateFlowTopNav";
|
|
|
|
export default CreateFlowTopNavContainer;
|