* refactor: replacing mobx with jotai Signed-off-by: James <james@jan.ai> Co-authored-by: James <james@jan.ai> Co-authored-by: Louis <louis@jan.ai>
31 lines
743 B
TypeScript
31 lines
743 B
TypeScript
"use client";
|
|
|
|
import ModelDetailSideBar from "../ModelDetailSideBar";
|
|
import ProductOverview from "../ProductOverview";
|
|
import { useAtomValue } from "jotai";
|
|
import {
|
|
getActiveConvoIdAtom,
|
|
showingProductDetailAtom,
|
|
} from "@/_helpers/JotaiWrapper";
|
|
import { ReactNode } from "react";
|
|
|
|
type Props = {
|
|
children: ReactNode;
|
|
};
|
|
|
|
export default function ChatContainer({ children }: Props) {
|
|
const activeConvoId = useAtomValue(getActiveConvoIdAtom);
|
|
const showingProductDetail = useAtomValue(showingProductDetailAtom);
|
|
|
|
if (!activeConvoId) {
|
|
return <ProductOverview />;
|
|
}
|
|
|
|
return (
|
|
<div className="flex flex-1 overflow-hidden">
|
|
{children}
|
|
{showingProductDetail ? <ModelDetailSideBar /> : null}
|
|
</div>
|
|
);
|
|
}
|