Skip to content

Commit 55c5ae4

Browse files
feat: pass chatDefaultOpen to all uses of CopilotSidebar in Dojo
No instances of `CopilotPopup` are currently being used, and `CopilotChat` does not support `defaultOpen` prop
1 parent 2b6cc30 commit 55c5ae4

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

typescript-sdk/apps/dojo/src/app/[integrationId]/feature/predictive_state_updates/page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { CopilotKit, useCoAgent, useCopilotAction, useCopilotChat } from "@copil
1313
import { CopilotChat, CopilotSidebar } from "@copilotkit/react-ui";
1414
import { useMobileView } from "@/utils/use-mobile-view";
1515
import { useMobileChat } from "@/utils/use-mobile-chat";
16+
import { useURLParams } from "@/contexts/url-params-context";
1617

1718
const extensions = [StarterKit];
1819

@@ -25,6 +26,7 @@ interface PredictiveStateUpdatesProps {
2526
export default function PredictiveStateUpdates({ params }: PredictiveStateUpdatesProps) {
2627
const { integrationId } = React.use(params);
2728
const { isMobile } = useMobileView();
29+
const { chatDefaultOpen } = useURLParams();
2830
const defaultChatHeight = 50;
2931
const { isChatOpen, setChatHeight, setIsChatOpen, isDragging, chatHeight, handleDragStart } =
3032
useMobileChat(defaultChatHeight);
@@ -162,7 +164,7 @@ export default function PredictiveStateUpdates({ params }: PredictiveStateUpdate
162164
</>
163165
) : (
164166
<CopilotSidebar
165-
defaultOpen={true}
167+
defaultOpen={chatDefaultOpen}
166168
suggestions={[
167169
{
168170
title: "Write a pirate story",

typescript-sdk/apps/dojo/src/app/[integrationId]/feature/shared_state/page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import "@copilotkit/react-ui/styles.css";
77
import "./style.css";
88
import { useMobileView } from "@/utils/use-mobile-view";
99
import { useMobileChat } from "@/utils/use-mobile-chat";
10+
import { useURLParams } from "@/contexts/url-params-context";
1011

1112
interface SharedStateProps {
1213
params: Promise<{
@@ -17,6 +18,7 @@ interface SharedStateProps {
1718
export default function SharedState({ params }: SharedStateProps) {
1819
const { integrationId } = React.use(params);
1920
const { isMobile } = useMobileView();
21+
const { chatDefaultOpen } = useURLParams();
2022
const defaultChatHeight = 50;
2123
const { isChatOpen, setChatHeight, setIsChatOpen, isDragging, chatHeight, handleDragStart } =
2224
useMobileChat(defaultChatHeight);
@@ -137,7 +139,7 @@ export default function SharedState({ params }: SharedStateProps) {
137139
</>
138140
) : (
139141
<CopilotSidebar
140-
defaultOpen={true}
142+
defaultOpen={chatDefaultOpen}
141143
labels={{
142144
title: chatTitle,
143145
initial: initialLabel,

typescript-sdk/apps/dojo/src/app/[integrationId]/feature/subgraphs/page.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { CopilotKit, useCoAgent, useLangGraphInterrupt } from "@copilotkit/react
66
import { CopilotSidebar } from "@copilotkit/react-ui";
77
import { useMobileView } from "@/utils/use-mobile-view";
88
import { useMobileChat } from "@/utils/use-mobile-chat";
9+
import { useURLParams } from "@/contexts/url-params-context";
910

1011
interface SubgraphsProps {
1112
params: Promise<{
@@ -152,6 +153,7 @@ function InterruptHumanInTheLoop<TAgent extends AvailableAgents>({
152153
export default function Subgraphs({ params }: SubgraphsProps) {
153154
const { integrationId } = React.use(params);
154155
const { isMobile } = useMobileView();
156+
const { chatDefaultOpen } = useURLParams();
155157
const defaultChatHeight = 50;
156158
const {
157159
isChatOpen,
@@ -240,7 +242,7 @@ export default function Subgraphs({ params }: SubgraphsProps) {
240242
{/* Chat Content */}
241243
<div className="flex-1 flex flex-col min-h-0 overflow-hidden pb-16">
242244
<CopilotSidebar
243-
defaultOpen={true}
245+
defaultOpen={chatDefaultOpen}
244246
labels={{
245247
title: chatTitle,
246248
initial: initialLabel,
@@ -260,7 +262,7 @@ export default function Subgraphs({ params }: SubgraphsProps) {
260262
</>
261263
) : (
262264
<CopilotSidebar
263-
defaultOpen={true}
265+
defaultOpen={chatDefaultOpen}
264266
labels={{
265267
title: chatTitle,
266268
initial: initialLabel,

typescript-sdk/apps/dojo/src/app/[integrationId]/feature/tool_based_generative_ui/page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
CarouselNext,
1111
CarouselPrevious,
1212
} from "@/components/ui/carousel";
13+
import { useURLParams } from "@/contexts/url-params-context";
1314

1415
interface ToolBasedGenerativeUIProps {
1516
params: Promise<{
@@ -26,9 +27,10 @@ interface Haiku {
2627

2728
export default function ToolBasedGenerativeUI({ params }: ToolBasedGenerativeUIProps) {
2829
const { integrationId } = React.use(params);
30+
const { chatDefaultOpen } = useURLParams();
2931

3032
const chatProps = {
31-
defaultOpen: true,
33+
defaultOpen: chatDefaultOpen,
3234
labels: {
3335
title: "Haiku Generator",
3436
initial: "I'm a haiku generator 👋. How can I help you?",

0 commit comments

Comments
 (0)