blob: d634752bd193efc667f12fa6fdc77a0c96e4b145 [file] [log] [blame]
bankseand52d39d2025-07-20 14:57:38 -07001/* eslint-disable @typescript-eslint/no-explicit-any */
2import { DemoModule } from "./demo-framework/types";
3import { demoUtils } from "./demo-fixtures/index";
4
5const demo: DemoModule = {
6 title: "Mobile Chat Demo",
7 description: "Mobile chat interface with message display and scroll behavior",
8 imports: ["../mobile-chat.js"],
9
10 customStyles: `
11 body {
12 margin: 0;
13 padding: 0;
14 height: 100vh;
15 font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", sans-serif;
16 }
17 `,
18
19 setup: async (container: HTMLElement) => {
20 const section = demoUtils.createDemoSection(
21 "Mobile Chat Interface",
22 "Demonstrates mobile chat with multiple messages and scroll behavior",
23 );
24
25 // Create the mobile chat element
26 const chatElement = document.createElement("mobile-chat") as any;
27 chatElement.style.height = "60vh";
28 chatElement.style.display = "block";
29 chatElement.style.border = "1px solid #ccc";
30 chatElement.style.borderRadius = "8px";
31
32 // Sample messages to test scroll behavior
33 const messages = [
34 {
35 id: "1",
36 type: "user",
37 content: "Hello, I need help with setting up a project.",
38 timestamp: new Date().toISOString(),
39 },
40 {
41 id: "2",
42 type: "agent",
43 content:
44 "Hello! I'd be happy to help you set up a project. What kind of project are you working on?",
45 timestamp: new Date().toISOString(),
46 },
47 {
48 id: "3",
49 type: "user",
50 content:
51 "I'm trying to build a web application using React and TypeScript.",
52 timestamp: new Date().toISOString(),
53 },
54 {
55 id: "4",
56 type: "agent",
57 content:
58 "Great choice! React with TypeScript is a powerful combination. Let me help you get started. First, we'll need to set up the project structure. Here are the steps:\n\n1. Create a new React app with TypeScript template\n2. Install additional dependencies\n3. Set up the folder structure\n4. Configure the development environment\n\nWould you like me to walk you through each step?",
59 timestamp: new Date().toISOString(),
60 },
61 {
62 id: "5",
63 type: "user",
64 content:
65 "Yes, please walk me through each step. I want to make sure I understand everything.",
66 timestamp: new Date().toISOString(),
67 },
68 {
69 id: "6",
70 type: "agent",
71 content:
72 "Perfect! Let's start with step 1:\n\n**Step 1: Create a new React app with TypeScript template**\n\nOpen your terminal and run:\n```bash\nnpx create-react-app my-app --template typescript\ncd my-app\n```\n\nThis will create a new React application with TypeScript already configured. The `--template typescript` flag tells Create React App to set up TypeScript for you automatically.",
73 timestamp: new Date().toISOString(),
74 },
75 {
76 id: "7",
77 type: "user",
78 content:
79 "Okay, I ran that command and it created the project. What's next?",
80 timestamp: new Date().toISOString(),
81 },
82 {
83 id: "8",
84 type: "agent",
85 content:
86 "Excellent! Now let's move to step 2:\n\n**Step 2: Install additional dependencies**\n\nYou might want to install some commonly used packages. Here are some recommendations:\n\n```bash\n# For routing\nnpm install react-router-dom\nnpm install @types/react-router-dom\n\n# For styling (choose one)\nnpm install styled-components # or\nnpm install @mui/material\n\n# For state management (if needed)\nnpm install redux @reduxjs/toolkit react-redux\n```\n\nWhich of these sound useful for your project?",
87 timestamp: new Date().toISOString(),
88 },
89 {
90 id: "9",
91 type: "user",
92 content:
93 "I think I'll need routing and probably Material-UI for styling. Should I install both?",
94 timestamp: new Date().toISOString(),
95 },
96 {
97 id: "10",
98 type: "agent",
99 content:
100 "Absolutely! React Router and Material-UI work great together. Run these commands:\n\n```bash\nnpm install react-router-dom @types/react-router-dom\nnpm install @mui/material @emotion/react @emotion/styled\nnpm install @mui/icons-material\n```\n\nMaterial-UI (now called MUI) requires @emotion packages for styling, and the icons package gives you access to thousands of Material Design icons.",
101 timestamp: new Date().toISOString(),
102 },
103 ];
104
105 // Set messages after a brief delay to simulate loading
106 setTimeout(() => {
107 chatElement.messages = messages;
108 }, 100);
109
110 section.appendChild(chatElement);
111 container.appendChild(section);
112 },
113};
114
115export default demo;