Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/quiet-boxes-smoke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"roo-cline": minor
---

Redesign chat window, update start screen, fix chat disabling, add Storybook stories.
15 changes: 14 additions & 1 deletion webview-ui/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,23 @@ import type { StorybookConfig } from "@storybook/react-vite"

const config: StorybookConfig = {
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
addons: ["@storybook/addon-essentials", "storybook-dark-mode"],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
"storybook-dark-mode",
"storybook-vscode-component/register",
],
framework: {
name: "@storybook/react-vite",
options: {},
},
docs: {
autodocs: "tag",
},
core: {
builder: "@storybook/builder-vite",
},
}

export default config
175 changes: 175 additions & 0 deletions webview-ui/.storybook/preview-context.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
import { ExtensionStateContextType, ExtensionStateContext } from "../src/context/ExtensionStateContext"
import { McpServer } from "../../src/shared/mcp"
import { ApiConfiguration, ModelInfo } from "../../src/shared/api"
import { HistoryItem } from "../../src/shared/HistoryItem" // Import HistoryItem
import { useContext } from "react"

// Mock ModelInfo
const mockModelInfo: ModelInfo = {
contextWindow: 2048,
supportsImages: true,
supportsPromptCache: true,
reasoningEffort: "low",
}

// Mock API configuration
const mockApiConfig: ApiConfiguration = {
apiModelId: "mock-model",
glamaModelInfo: mockModelInfo,
}

// Mock MCP server
const mockMcpServer: McpServer = {
name: "mock-server",
tools: [],
resources: [],
resourceTemplates: [],
disabled: false,
config: "?",
status: "disconnected",
}

// Mock task history item (Corrected to match HistoryItem type)
const mockTaskHistoryItem: HistoryItem = {
id: "mock-task-id",
ts: Date.now(),
task: "Sample task",
tokensIn: 100,
tokensOut: 200,
totalCost: 0.5,
}

// Mock file paths and opened tabs (more realistic mock data)
const mockFilePaths: string[] = [
"/Roo-Code/src/components/chat/ChatTextArea.tsx",
"/Roo-Code/src/components/common/CodeBlock.tsx",
"/Roo-Code/webview-ui/.storybook/preview-context.tsx",
]
const mockOpenedTabs: Array<{ label: string; isActive: boolean; path?: string }> = [
{ label: "ChatTextArea.tsx", isActive: true, path: "/Roo-Code/src/components/chat/ChatTextArea.tsx" },
{ label: "CodeBlock.tsx", isActive: false, path: "/Roo-Code/src/components/common/CodeBlock.tsx" },
]

const defaultContext: ExtensionStateContextType = {
// Version and state
version: "1.0.0",
didHydrateState: true,
showWelcome: false,

// Messages and history
clineMessages: [],
taskHistory: [mockTaskHistoryItem],
shouldShowAnnouncement: false,

// API and models
apiConfiguration: mockApiConfig,
glamaModels: {},
requestyModels: {},
openRouterModels: {},
unboundModels: {},
openAiModels: [],

// MCP
mcpServers: [mockMcpServer],
mcpEnabled: true,
enableMcpServerCreation: true,

// Files and tabs
filePaths: mockFilePaths,
openedTabs: mockOpenedTabs,
currentCheckpoint: undefined,

// Settings
mode: "code",
preferredLanguage: "English",
requestDelaySeconds: 0,
rateLimitSeconds: 0,
writeDelayMs: 0,
browserViewportSize: "1200x800",
screenshotQuality: 75,
terminalOutputLineLimit: 500,
fuzzyMatchThreshold: 1.0,
maxOpenTabsContext: 20,

// Features
diffEnabled: false,
checkpointsEnabled: false,
soundEnabled: false,
soundVolume: 0.5,
autoApprovalEnabled: true,

// Permissions
alwaysAllowBrowser: true,
alwaysAllowExecute: true,
alwaysAllowMcp: true,
alwaysAllowModeSwitch: true,
alwaysAllowReadOnly: true,
alwaysApproveResubmit: true,
alwaysAllowWrite: true,
allowedCommands: [],

// Other state
customModePrompts: {},
customSupportPrompts: {},
experiments: {
experimentalDiffStrategy: false,
search_and_replace: false,
insert_content: false,
powerSteering: false,
},
customModes: [],
enhancementApiConfigId: undefined,
currentApiConfigName: "default",
listApiConfigMeta: [],
theme: {},

// Setters
setApiConfiguration: () => {},
setCustomInstructions: () => {},
setAlwaysAllowReadOnly: () => {},
setAlwaysAllowWrite: () => {},
setAlwaysAllowExecute: () => {},
setAlwaysAllowBrowser: () => {},
setAlwaysAllowMcp: () => {},
setAlwaysAllowModeSwitch: () => {},
setShowAnnouncement: () => {},
setAllowedCommands: () => {},
setSoundEnabled: () => {},
setSoundVolume: () => {},
setDiffEnabled: () => {},
setCheckpointsEnabled: () => {},
setBrowserViewportSize: () => {},
setFuzzyMatchThreshold: () => {},
setPreferredLanguage: () => {},
setWriteDelayMs: () => {},
setScreenshotQuality: () => {},
setTerminalOutputLineLimit: () => {},
setMcpEnabled: () => {},
setEnableMcpServerCreation: () => {},
setAlwaysApproveResubmit: () => {},
setRequestDelaySeconds: () => {},
setRateLimitSeconds: () => {},
setCurrentApiConfigName: () => {},
setListApiConfigMeta: () => {},
onUpdateApiConfig: () => {},
setMode: () => {},
setCustomModePrompts: () => {},
setCustomSupportPrompts: () => {},
setEnhancementApiConfigId: () => {},
setExperimentEnabled: () => {},
setAutoApprovalEnabled: () => {},
setCustomModes: () => {},
setMaxOpenTabsContext: () => {},
}

export const PreviewExtensionStateContextProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
console.log("PreviewExtensionStateContextProvider is rendering!") // Re-add console log
console.log("Context Value:", defaultContext) // Log context value
return <ExtensionStateContext.Provider value={defaultContext}>{children}</ExtensionStateContext.Provider>
}

export const usePreviewExtensionState = () => {
const context = useContext(ExtensionStateContext)
console.log("useExtensionState Hook Context:", context) // Log context in hook
return context
}
110 changes: 110 additions & 0 deletions webview-ui/.storybook/preview.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/* VS Code theme variables */
:root {
/* Base theme */
--vscode-foreground: #d1d5da;
--vscode-editor-background: #24292e;
--vscode-editor-foreground: #e1e4e8;

/* Input elements */
--vscode-input-background: #2f363d;
--vscode-input-foreground: #e1e4e8;
--vscode-input-border: #1b1f23;
--vscode-focusBorder: #005cc5;

/* Buttons */
--vscode-button-background: #176f2c;
--vscode-button-foreground: #dcffe4;
--vscode-button-hoverBackground: #1177bb;
--vscode-button-secondaryBackground: #444d56;
--vscode-button-secondaryForeground: #ffffff;

/* Dropdowns and Lists */
--vscode-dropdown-background: #2f363d;
--vscode-dropdown-foreground: #e1e4e8;
--vscode-dropdown-border: #1b1f23;
--vscode-list-hoverBackground: #282e34;
--vscode-list-hoverForeground: #e1e4e8;
--vscode-list-focusBackground: #044289;

/* Badges and Notifications */
--vscode-badge-background: #044289;
--vscode-badge-foreground: #c8e1ff;
--vscode-notifications-background: #2f363d;
--vscode-notifications-foreground: #e1e4e8;
--vscode-notifications-border: #1b1f23;

/* Editor elements */
--vscode-editorGroup-border: #444444;
--vscode-diffEditor-insertedTextBackground: #37373d;
--vscode-diffEditor-removedTextBackground: #3c1f1f;
--vscode-textCodeBlock-background: #1e1e1e;
--vscode-textSeparator-foreground: #424242;
--vscode-textPreformat-foreground: #d7ba7d;
--vscode-textLink-foreground: #3794ff;

/* Status indicators */
--vscode-errorForeground: #f97583;
--vscode-descriptionForeground: #959da5;
--vscode-charts-green: #89d185;
--vscode-titleBar-inactiveForeground: #cccccc99;

/* Menu (from shadcn/ui) */
--vscode-menu-background: #2f363d;
--vscode-menu-foreground: #e1e4e8;
--vscode-disabledForeground: #cccccc;

/* Typography */
--vscode-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
--vscode-font-size: 13px;
--vscode-editor-font-family: "SF Mono", Monaco, Menlo, Consolas, "Ubuntu Mono", "Liberation Mono",
"DejaVu Sans Mono", "Courier New", monospace;
--vscode-editor-font-size: 12px;
--vscode-editor-line-height: 18px;
}

/* Dark theme */
.dark {
color-scheme: dark;
background-color: var(--vscode-editor-background);
color: var(--vscode-editor-foreground);
}

/* Light theme */
.light {
color-scheme: light;
background-color: #ffffff;
color: #000000;
}

/* Global styles */
body {
margin: 0;
padding: 0;
font-family: var(--vscode-font-family);
font-size: var(--vscode-font-size);
line-height: 1.4;
}

/* Mermaid diagram styles */
.mermaid {
background: var(--vscode-editor-background);
}

/* VS Code scrollbar styles */
::-webkit-scrollbar {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: The scrollbar pseudo-element selectors on lines 94, 99, 103, and 108 are incorrectly prefixed with three colons (e.g., ':::-webkit-scrollbar'). They should be written with two colons (e.g., '::-webkit-scrollbar').

Suggested change
::-webkit-scrollbar {
::-webkit-scrollbar {

width: 10px;
height: 10px;
}

::-webkit-scrollbar-track {
background: transparent;
}

::-webkit-scrollbar-thumb {
background: #424242;
border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
background: #686868;
}
17 changes: 0 additions & 17 deletions webview-ui/.storybook/preview.ts

This file was deleted.

34 changes: 34 additions & 0 deletions webview-ui/.storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from "react"
import type { Preview, StoryFn } from "@storybook/react"
import { themes } from "@storybook/theming"
import "./preview.css"
import "@vscode/codicons/dist/codicon.css"
import { PreviewExtensionStateContextProvider } from "./preview-context"

const preview: Preview = {
parameters: {
actions: { argTypesRegex: "^on.*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
darkMode: {
dark: { ...themes.dark },
light: { ...themes.light },
current: "dark",
},
},
decorators: [
(Story: StoryFn) => {
return (
<PreviewExtensionStateContextProvider>
<Story />
</PreviewExtensionStateContextProvider>
)
},
],
}

export default preview
Loading