formatting
This commit is contained in:
parent
0471443716
commit
4b28a69856
111 changed files with 2438 additions and 1874 deletions
35
.github/workflows/main.yml
vendored
Normal file
35
.github/workflows/main.yml
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
name: Run install, format, lint, build, and test on every push or pull request
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version: '20.x'
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm install
|
||||||
|
|
||||||
|
- name: Check formatting
|
||||||
|
run: npm run format:check
|
||||||
|
|
||||||
|
- name: Run linter
|
||||||
|
run: npm run lint
|
||||||
|
|
||||||
|
- name: Run type check
|
||||||
|
run: npm run typecheck
|
||||||
|
|
||||||
|
- name: Run Build
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: npm run test
|
||||||
21
clients/web/package-lock.json
generated
21
clients/web/package-lock.json
generated
|
|
@ -1,11 +1,11 @@
|
||||||
{
|
{
|
||||||
"name": "web",
|
"name": "@modelcontextprotocol/inspector-web",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "web",
|
"name": "@modelcontextprotocol/inspector-web",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emotion/react": "^11.14.0",
|
"@emotion/react": "^11.14.0",
|
||||||
|
|
@ -36,6 +36,7 @@
|
||||||
"eslint-plugin-storybook": "^10.2.19",
|
"eslint-plugin-storybook": "^10.2.19",
|
||||||
"globals": "^17.4.0",
|
"globals": "^17.4.0",
|
||||||
"playwright": "^1.58.2",
|
"playwright": "^1.58.2",
|
||||||
|
"prettier": "^3.8.1",
|
||||||
"storybook": "^10.2.19",
|
"storybook": "^10.2.19",
|
||||||
"typescript": "~5.9.3",
|
"typescript": "~5.9.3",
|
||||||
"typescript-eslint": "^8.56.1",
|
"typescript-eslint": "^8.56.1",
|
||||||
|
|
@ -5009,6 +5010,22 @@
|
||||||
"node": ">= 0.8.0"
|
"node": ">= 0.8.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/prettier": {
|
||||||
|
"version": "3.8.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.1.tgz",
|
||||||
|
"integrity": "sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"bin": {
|
||||||
|
"prettier": "bin/prettier.cjs"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/prettier/prettier?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/pretty-format": {
|
"node_modules/pretty-format": {
|
||||||
"version": "27.5.1",
|
"version": "27.5.1",
|
||||||
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz",
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "tsc -b && vite build",
|
"build": "tsc -b && vite build",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
|
"format": "prettier --write src",
|
||||||
|
"format:check": "prettier --check src",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"storybook": "storybook dev -p 6006",
|
"storybook": "storybook dev -p 6006",
|
||||||
"build-storybook": "storybook build"
|
"build-storybook": "storybook build"
|
||||||
|
|
@ -32,6 +34,7 @@
|
||||||
"globals": "^17.4.0",
|
"globals": "^17.4.0",
|
||||||
"typescript": "~5.9.3",
|
"typescript": "~5.9.3",
|
||||||
"typescript-eslint": "^8.56.1",
|
"typescript-eslint": "^8.56.1",
|
||||||
|
"prettier": "^3.8.1",
|
||||||
"vite": "^8.0.0",
|
"vite": "^8.0.0",
|
||||||
"storybook": "^10.2.19",
|
"storybook": "^10.2.19",
|
||||||
"@storybook/react-vite": "^10.2.19",
|
"@storybook/react-vite": "^10.2.19",
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dark mode overrides — tokens that need adjustment in dark scheme */
|
/* Dark mode overrides — tokens that need adjustment in dark scheme */
|
||||||
[data-mantine-color-scheme='dark'] {
|
[data-mantine-color-scheme="dark"] {
|
||||||
--inspector-surface-code: var(--mantine-color-dark-6);
|
--inspector-surface-code: var(--mantine-color-dark-6);
|
||||||
--inspector-border-subtle: var(--mantine-color-dark-4);
|
--inspector-border-subtle: var(--mantine-color-dark-4);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,15 +7,15 @@ import {
|
||||||
useComputedColorScheme,
|
useComputedColorScheme,
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
Group,
|
Group,
|
||||||
} from '@mantine/core'
|
} from "@mantine/core";
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
const { setColorScheme } = useMantineColorScheme()
|
const { setColorScheme } = useMantineColorScheme();
|
||||||
const computedColorScheme = useComputedColorScheme('light')
|
const computedColorScheme = useComputedColorScheme("light");
|
||||||
|
|
||||||
const toggleColorScheme = () => {
|
const toggleColorScheme = () => {
|
||||||
setColorScheme(computedColorScheme === 'dark' ? 'light' : 'dark')
|
setColorScheme(computedColorScheme === "dark" ? "light" : "dark");
|
||||||
}
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container size="sm" py="xl">
|
<Container size="sm" py="xl">
|
||||||
|
|
@ -28,7 +28,7 @@ function App() {
|
||||||
size="lg"
|
size="lg"
|
||||||
aria-label="Toggle color scheme"
|
aria-label="Toggle color scheme"
|
||||||
>
|
>
|
||||||
{computedColorScheme === 'dark' ? '\u2600' : '\u263E'}
|
{computedColorScheme === "dark" ? "\u2600" : "\u263E"}
|
||||||
</ActionIcon>
|
</ActionIcon>
|
||||||
</Group>
|
</Group>
|
||||||
<Text c="var(--inspector-text-secondary)">
|
<Text c="var(--inspector-text-secondary)">
|
||||||
|
|
@ -36,7 +36,7 @@ function App() {
|
||||||
</Text>
|
</Text>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Container>
|
</Container>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default App
|
export default App;
|
||||||
|
|
|
||||||
|
|
@ -1,52 +1,52 @@
|
||||||
import type { Meta, StoryObj } from '@storybook/react-vite'
|
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||||
import { AnnotationBadge } from './AnnotationBadge'
|
import { AnnotationBadge } from "./AnnotationBadge";
|
||||||
|
|
||||||
const meta: Meta<typeof AnnotationBadge> = {
|
const meta: Meta<typeof AnnotationBadge> = {
|
||||||
title: 'Atoms/AnnotationBadge',
|
title: "Atoms/AnnotationBadge",
|
||||||
component: AnnotationBadge,
|
component: AnnotationBadge,
|
||||||
}
|
};
|
||||||
|
|
||||||
export default meta
|
export default meta;
|
||||||
type Story = StoryObj<typeof AnnotationBadge>
|
type Story = StoryObj<typeof AnnotationBadge>;
|
||||||
|
|
||||||
export const Audience: Story = {
|
export const Audience: Story = {
|
||||||
args: {
|
args: {
|
||||||
label: 'user',
|
label: "user",
|
||||||
variant: 'audience',
|
variant: "audience",
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
|
|
||||||
export const ReadOnly: Story = {
|
export const ReadOnly: Story = {
|
||||||
args: {
|
args: {
|
||||||
label: 'read-only',
|
label: "read-only",
|
||||||
variant: 'readOnly',
|
variant: "readOnly",
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
|
|
||||||
export const Destructive: Story = {
|
export const Destructive: Story = {
|
||||||
args: {
|
args: {
|
||||||
label: 'destructive',
|
label: "destructive",
|
||||||
variant: 'destructive',
|
variant: "destructive",
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
|
|
||||||
export const LongRun: Story = {
|
export const LongRun: Story = {
|
||||||
args: {
|
args: {
|
||||||
label: 'long-run',
|
label: "long-run",
|
||||||
variant: 'longRun',
|
variant: "longRun",
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
|
|
||||||
export const PriorityHigh: Story = {
|
export const PriorityHigh: Story = {
|
||||||
args: {
|
args: {
|
||||||
label: 'priority: high',
|
label: "priority: high",
|
||||||
variant: 'priority',
|
variant: "priority",
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
|
|
||||||
export const Default: Story = {
|
export const Default: Story = {
|
||||||
args: {
|
args: {
|
||||||
label: 'custom',
|
label: "custom",
|
||||||
variant: 'default',
|
variant: "default",
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,39 @@
|
||||||
import { Badge } from '@mantine/core'
|
import { Badge } from "@mantine/core";
|
||||||
|
|
||||||
export type AnnotationVariant = 'audience' | 'readOnly' | 'destructive' | 'longRun' | 'priority' | 'default'
|
export type AnnotationVariant =
|
||||||
|
| "audience"
|
||||||
|
| "readOnly"
|
||||||
|
| "destructive"
|
||||||
|
| "longRun"
|
||||||
|
| "priority"
|
||||||
|
| "default";
|
||||||
|
|
||||||
export interface AnnotationBadgeProps {
|
export interface AnnotationBadgeProps {
|
||||||
label: string
|
label: string;
|
||||||
variant?: AnnotationVariant
|
variant?: AnnotationVariant;
|
||||||
}
|
}
|
||||||
|
|
||||||
const variantMap: Record<AnnotationVariant, { color: string; variant: string }> = {
|
const variantMap: Record<
|
||||||
audience: { color: 'gray', variant: 'outline' },
|
AnnotationVariant,
|
||||||
readOnly: { color: 'dark', variant: 'filled' },
|
{ color: string; variant: string }
|
||||||
destructive: { color: 'red', variant: 'outline' },
|
> = {
|
||||||
longRun: { color: 'yellow', variant: 'outline' },
|
audience: { color: "gray", variant: "outline" },
|
||||||
priority: { color: 'orange', variant: 'light' },
|
readOnly: { color: "dark", variant: "filled" },
|
||||||
default: { color: 'gray', variant: 'light' },
|
destructive: { color: "red", variant: "outline" },
|
||||||
}
|
longRun: { color: "yellow", variant: "outline" },
|
||||||
|
priority: { color: "orange", variant: "light" },
|
||||||
|
default: { color: "gray", variant: "light" },
|
||||||
|
};
|
||||||
|
|
||||||
export function AnnotationBadge({ label, variant = 'default' }: AnnotationBadgeProps) {
|
export function AnnotationBadge({
|
||||||
const { color, variant: badgeVariant } = variantMap[variant]
|
label,
|
||||||
|
variant = "default",
|
||||||
|
}: AnnotationBadgeProps) {
|
||||||
|
const { color, variant: badgeVariant } = variantMap[variant];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Badge color={color} variant={badgeVariant}>
|
<Badge color={color} variant={badgeVariant}>
|
||||||
{label}
|
{label}
|
||||||
</Badge>
|
</Badge>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||||
import { CapabilityItem } from './CapabilityItem';
|
import { CapabilityItem } from "./CapabilityItem";
|
||||||
|
|
||||||
const meta: Meta<typeof CapabilityItem> = {
|
const meta: Meta<typeof CapabilityItem> = {
|
||||||
title: 'Atoms/CapabilityItem',
|
title: "Atoms/CapabilityItem",
|
||||||
component: CapabilityItem,
|
component: CapabilityItem,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -11,14 +11,14 @@ type Story = StoryObj<typeof CapabilityItem>;
|
||||||
|
|
||||||
export const Supported: Story = {
|
export const Supported: Story = {
|
||||||
args: {
|
args: {
|
||||||
name: 'Tools',
|
name: "Tools",
|
||||||
supported: true,
|
supported: true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SupportedWithCount: Story = {
|
export const SupportedWithCount: Story = {
|
||||||
args: {
|
args: {
|
||||||
name: 'Tools',
|
name: "Tools",
|
||||||
supported: true,
|
supported: true,
|
||||||
count: 4,
|
count: 4,
|
||||||
},
|
},
|
||||||
|
|
@ -26,7 +26,7 @@ export const SupportedWithCount: Story = {
|
||||||
|
|
||||||
export const NotSupported: Story = {
|
export const NotSupported: Story = {
|
||||||
args: {
|
args: {
|
||||||
name: 'Completions',
|
name: "Completions",
|
||||||
supported: false,
|
supported: false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { Group, Text } from '@mantine/core';
|
import { Group, Text } from "@mantine/core";
|
||||||
|
|
||||||
export interface CapabilityItemProps {
|
export interface CapabilityItemProps {
|
||||||
name: string;
|
name: string;
|
||||||
|
|
@ -6,12 +6,18 @@ export interface CapabilityItemProps {
|
||||||
count?: number;
|
count?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function CapabilityItem({ name, supported, count }: CapabilityItemProps) {
|
export function CapabilityItem({
|
||||||
|
name,
|
||||||
|
supported,
|
||||||
|
count,
|
||||||
|
}: CapabilityItemProps) {
|
||||||
const label = count != null ? `${name} (${count})` : name;
|
const label = count != null ? `${name} (${count})` : name;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Group gap="xs">
|
<Group gap="xs">
|
||||||
<Text c={supported ? 'green' : 'red'}>{supported ? '\u2713' : '\u2717'}</Text>
|
<Text c={supported ? "green" : "red"}>
|
||||||
|
{supported ? "\u2713" : "\u2717"}
|
||||||
|
</Text>
|
||||||
<Text>{label}</Text>
|
<Text>{label}</Text>
|
||||||
</Group>
|
</Group>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||||
import { fn } from 'storybook/test';
|
import { fn } from "storybook/test";
|
||||||
import { ConnectionToggle } from './ConnectionToggle';
|
import { ConnectionToggle } from "./ConnectionToggle";
|
||||||
|
|
||||||
const meta: Meta<typeof ConnectionToggle> = {
|
const meta: Meta<typeof ConnectionToggle> = {
|
||||||
title: 'Atoms/ConnectionToggle',
|
title: "Atoms/ConnectionToggle",
|
||||||
component: ConnectionToggle,
|
component: ConnectionToggle,
|
||||||
args: {
|
args: {
|
||||||
onChange: fn(),
|
onChange: fn(),
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { Switch } from '@mantine/core';
|
import { Switch } from "@mantine/core";
|
||||||
|
|
||||||
export interface ConnectionToggleProps {
|
export interface ConnectionToggleProps {
|
||||||
checked: boolean;
|
checked: boolean;
|
||||||
|
|
@ -7,7 +7,12 @@ export interface ConnectionToggleProps {
|
||||||
onChange: (checked: boolean) => void;
|
onChange: (checked: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ConnectionToggle({ checked, loading, disabled, onChange }: ConnectionToggleProps) {
|
export function ConnectionToggle({
|
||||||
|
checked,
|
||||||
|
loading,
|
||||||
|
disabled,
|
||||||
|
onChange,
|
||||||
|
}: ConnectionToggleProps) {
|
||||||
return (
|
return (
|
||||||
<Switch
|
<Switch
|
||||||
size="lg"
|
size="lg"
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||||
import { fn } from 'storybook/test';
|
import { fn } from "storybook/test";
|
||||||
import { ContentViewer } from './ContentViewer';
|
import { ContentViewer } from "./ContentViewer";
|
||||||
|
|
||||||
const meta: Meta<typeof ContentViewer> = {
|
const meta: Meta<typeof ContentViewer> = {
|
||||||
title: 'Atoms/ContentViewer',
|
title: "Atoms/ContentViewer",
|
||||||
component: ContentViewer,
|
component: ContentViewer,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -12,56 +12,57 @@ type Story = StoryObj<typeof ContentViewer>;
|
||||||
|
|
||||||
export const PlainText: Story = {
|
export const PlainText: Story = {
|
||||||
args: {
|
args: {
|
||||||
type: 'text',
|
type: "text",
|
||||||
content: 'Hello, world!\nThis is plain text.',
|
content: "Hello, world!\nThis is plain text.",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const JsonContent: Story = {
|
export const JsonContent: Story = {
|
||||||
args: {
|
args: {
|
||||||
type: 'json',
|
type: "json",
|
||||||
content: '{"name":"my-app","version":"1.0.0","description":"Sample configuration file"}',
|
content:
|
||||||
|
'{"name":"my-app","version":"1.0.0","description":"Sample configuration file"}',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ImagePreview: Story = {
|
export const ImagePreview: Story = {
|
||||||
args: {
|
args: {
|
||||||
type: 'image',
|
type: "image",
|
||||||
content:
|
content:
|
||||||
'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==',
|
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
|
||||||
mimeType: 'image/png',
|
mimeType: "image/png",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const LongContent: Story = {
|
export const LongContent: Story = {
|
||||||
args: {
|
args: {
|
||||||
type: 'json',
|
type: "json",
|
||||||
content: JSON.stringify({
|
content: JSON.stringify({
|
||||||
name: 'my-app',
|
name: "my-app",
|
||||||
version: '2.5.0',
|
version: "2.5.0",
|
||||||
description: 'A comprehensive application configuration',
|
description: "A comprehensive application configuration",
|
||||||
author: 'Inspector Team',
|
author: "Inspector Team",
|
||||||
license: 'MIT',
|
license: "MIT",
|
||||||
repository: 'https://github.com/example/my-app',
|
repository: "https://github.com/example/my-app",
|
||||||
dependencies: {
|
dependencies: {
|
||||||
react: '^18.0.0',
|
react: "^18.0.0",
|
||||||
typescript: '^5.0.0',
|
typescript: "^5.0.0",
|
||||||
mantine: '^7.0.0',
|
mantine: "^7.0.0",
|
||||||
},
|
},
|
||||||
devDependencies: {
|
devDependencies: {
|
||||||
vitest: '^1.0.0',
|
vitest: "^1.0.0",
|
||||||
storybook: '^8.0.0',
|
storybook: "^8.0.0",
|
||||||
eslint: '^9.0.0',
|
eslint: "^9.0.0",
|
||||||
},
|
},
|
||||||
scripts: {
|
scripts: {
|
||||||
dev: 'vite',
|
dev: "vite",
|
||||||
build: 'tsc && vite build',
|
build: "tsc && vite build",
|
||||||
test: 'vitest',
|
test: "vitest",
|
||||||
lint: 'eslint .',
|
lint: "eslint .",
|
||||||
},
|
},
|
||||||
settings: {
|
settings: {
|
||||||
theme: 'dark',
|
theme: "dark",
|
||||||
language: 'en',
|
language: "en",
|
||||||
notifications: true,
|
notifications: true,
|
||||||
maxRetries: 3,
|
maxRetries: 3,
|
||||||
},
|
},
|
||||||
|
|
@ -71,8 +72,8 @@ export const LongContent: Story = {
|
||||||
|
|
||||||
export const WithCopyButton: Story = {
|
export const WithCopyButton: Story = {
|
||||||
args: {
|
args: {
|
||||||
type: 'text',
|
type: "text",
|
||||||
content: 'Hello, world!\nThis text can be copied.',
|
content: "Hello, world!\nThis text can be copied.",
|
||||||
onCopy: fn(),
|
onCopy: fn(),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { Button, Code, Image, Stack } from '@mantine/core';
|
import { Button, Code, Image, Stack } from "@mantine/core";
|
||||||
|
|
||||||
export interface ContentViewerProps {
|
export interface ContentViewerProps {
|
||||||
type: 'text' | 'json' | 'image' | 'audio';
|
type: "text" | "json" | "image" | "audio";
|
||||||
content: string;
|
content: string;
|
||||||
mimeType?: string;
|
mimeType?: string;
|
||||||
onCopy?: () => void;
|
onCopy?: () => void;
|
||||||
|
|
@ -15,22 +15,27 @@ function formatJson(content: string): string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ContentViewer({ type, content, mimeType, onCopy }: ContentViewerProps) {
|
export function ContentViewer({
|
||||||
|
type,
|
||||||
|
content,
|
||||||
|
mimeType,
|
||||||
|
onCopy,
|
||||||
|
}: ContentViewerProps) {
|
||||||
return (
|
return (
|
||||||
<Stack gap="xs">
|
<Stack gap="xs">
|
||||||
{type === 'json' && <Code block>{formatJson(content)}</Code>}
|
{type === "json" && <Code block>{formatJson(content)}</Code>}
|
||||||
{type === 'text' && <Code block>{content}</Code>}
|
{type === "text" && <Code block>{content}</Code>}
|
||||||
{type === 'image' && (
|
{type === "image" && (
|
||||||
<Image
|
<Image
|
||||||
src={`data:${mimeType || 'image/png'};base64,${content}`}
|
src={`data:${mimeType || "image/png"};base64,${content}`}
|
||||||
alt="Content preview"
|
alt="Content preview"
|
||||||
maw={400}
|
maw={400}
|
||||||
radius="md"
|
radius="md"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{type === 'audio' && (
|
{type === "audio" && (
|
||||||
<audio controls>
|
<audio controls>
|
||||||
<source src={`data:${mimeType || 'audio/wav'};base64,${content}`} />
|
<source src={`data:${mimeType || "audio/wav"};base64,${content}`} />
|
||||||
</audio>
|
</audio>
|
||||||
)}
|
)}
|
||||||
{onCopy && (
|
{onCopy && (
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||||
import { CopyButton } from './CopyButton';
|
import { CopyButton } from "./CopyButton";
|
||||||
|
|
||||||
const meta: Meta<typeof CopyButton> = {
|
const meta: Meta<typeof CopyButton> = {
|
||||||
title: 'Atoms/CopyButton',
|
title: "Atoms/CopyButton",
|
||||||
component: CopyButton,
|
component: CopyButton,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -11,13 +11,13 @@ type Story = StoryObj<typeof CopyButton>;
|
||||||
|
|
||||||
export const Default: Story = {
|
export const Default: Story = {
|
||||||
args: {
|
args: {
|
||||||
value: 'Hello, world!',
|
value: "Hello, world!",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const LongValue: Story = {
|
export const LongValue: Story = {
|
||||||
args: {
|
args: {
|
||||||
value:
|
value:
|
||||||
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.',
|
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
import { ActionIcon, CopyButton as MantineCopyButton, Tooltip } from '@mantine/core';
|
import {
|
||||||
|
ActionIcon,
|
||||||
|
CopyButton as MantineCopyButton,
|
||||||
|
Tooltip,
|
||||||
|
} from "@mantine/core";
|
||||||
|
|
||||||
export interface CopyButtonProps {
|
export interface CopyButtonProps {
|
||||||
value: string;
|
value: string;
|
||||||
|
|
@ -8,9 +12,13 @@ export function CopyButton({ value }: CopyButtonProps) {
|
||||||
return (
|
return (
|
||||||
<MantineCopyButton value={value}>
|
<MantineCopyButton value={value}>
|
||||||
{({ copied, copy }) => (
|
{({ copied, copy }) => (
|
||||||
<Tooltip label={copied ? 'Copied' : 'Copy'}>
|
<Tooltip label={copied ? "Copied" : "Copy"}>
|
||||||
<ActionIcon variant="subtle" color={copied ? 'green' : 'gray'} onClick={copy}>
|
<ActionIcon
|
||||||
{copied ? '\u2713' : '\u2398'}
|
variant="subtle"
|
||||||
|
color={copied ? "green" : "gray"}
|
||||||
|
onClick={copy}
|
||||||
|
>
|
||||||
|
{copied ? "\u2713" : "\u2398"}
|
||||||
</ActionIcon>
|
</ActionIcon>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||||
import { InlineError } from './InlineError';
|
import { InlineError } from "./InlineError";
|
||||||
|
|
||||||
const meta: Meta<typeof InlineError> = {
|
const meta: Meta<typeof InlineError> = {
|
||||||
title: 'Atoms/InlineError',
|
title: "Atoms/InlineError",
|
||||||
component: InlineError,
|
component: InlineError,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -11,13 +11,13 @@ type Story = StoryObj<typeof InlineError>;
|
||||||
|
|
||||||
export const ShortError: Story = {
|
export const ShortError: Story = {
|
||||||
args: {
|
args: {
|
||||||
message: 'Connection timeout after 20s',
|
message: "Connection timeout after 20s",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const WithRetryCount: Story = {
|
export const WithRetryCount: Story = {
|
||||||
args: {
|
args: {
|
||||||
message: 'Connection failed',
|
message: "Connection failed",
|
||||||
retryCount: 3,
|
retryCount: 3,
|
||||||
maxRetries: 5,
|
maxRetries: 5,
|
||||||
},
|
},
|
||||||
|
|
@ -25,26 +25,26 @@ export const WithRetryCount: Story = {
|
||||||
|
|
||||||
export const WithDetails: Story = {
|
export const WithDetails: Story = {
|
||||||
args: {
|
args: {
|
||||||
message: 'Connection refused',
|
message: "Connection refused",
|
||||||
details:
|
details:
|
||||||
'Error: ECONNREFUSED 127.0.0.1:3000\n at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16)',
|
"Error: ECONNREFUSED 127.0.0.1:3000\n at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16)",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const WithDocLink: Story = {
|
export const WithDocLink: Story = {
|
||||||
args: {
|
args: {
|
||||||
message: 'Connection failed',
|
message: "Connection failed",
|
||||||
docLink: 'https://example.com/troubleshooting',
|
docLink: "https://example.com/troubleshooting",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const FullError: Story = {
|
export const FullError: Story = {
|
||||||
args: {
|
args: {
|
||||||
message: 'Connection refused',
|
message: "Connection refused",
|
||||||
details:
|
details:
|
||||||
'Error: ECONNREFUSED 127.0.0.1:3000\n at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16)',
|
"Error: ECONNREFUSED 127.0.0.1:3000\n at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16)",
|
||||||
retryCount: 3,
|
retryCount: 3,
|
||||||
maxRetries: 5,
|
maxRetries: 5,
|
||||||
docLink: 'https://example.com/troubleshooting',
|
docLink: "https://example.com/troubleshooting",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { Alert, Anchor, Group, Spoiler, Stack, Text } from '@mantine/core';
|
import { Alert, Anchor, Group, Spoiler, Stack, Text } from "@mantine/core";
|
||||||
|
|
||||||
export interface InlineErrorProps {
|
export interface InlineErrorProps {
|
||||||
message: string;
|
message: string;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||||
import { fn } from 'storybook/test';
|
import { fn } from "storybook/test";
|
||||||
import { ListChangedIndicator } from './ListChangedIndicator';
|
import { ListChangedIndicator } from "./ListChangedIndicator";
|
||||||
|
|
||||||
const meta: Meta<typeof ListChangedIndicator> = {
|
const meta: Meta<typeof ListChangedIndicator> = {
|
||||||
title: 'Atoms/ListChangedIndicator',
|
title: "Atoms/ListChangedIndicator",
|
||||||
component: ListChangedIndicator,
|
component: ListChangedIndicator,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { Button, Flex, Group, Text } from '@mantine/core';
|
import { Button, Flex, Group, Text } from "@mantine/core";
|
||||||
|
|
||||||
export interface ListChangedIndicatorProps {
|
export interface ListChangedIndicatorProps {
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
|
|
@ -8,17 +8,22 @@ export interface ListChangedIndicatorProps {
|
||||||
const Dot = Flex.withProps({
|
const Dot = Flex.withProps({
|
||||||
w: 8,
|
w: 8,
|
||||||
h: 8,
|
h: 8,
|
||||||
style: { borderRadius: '50%' },
|
style: { borderRadius: "50%" },
|
||||||
bg: 'var(--inspector-status-connecting)',
|
bg: "var(--inspector-status-connecting)",
|
||||||
});
|
});
|
||||||
|
|
||||||
export function ListChangedIndicator({ visible, onRefresh }: ListChangedIndicatorProps) {
|
export function ListChangedIndicator({
|
||||||
|
visible,
|
||||||
|
onRefresh,
|
||||||
|
}: ListChangedIndicatorProps) {
|
||||||
if (!visible) return null;
|
if (!visible) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Group gap="xs">
|
<Group gap="xs">
|
||||||
<Dot />
|
<Dot />
|
||||||
<Text size="sm" c="dimmed">List updated</Text>
|
<Text size="sm" c="dimmed">
|
||||||
|
List updated
|
||||||
|
</Text>
|
||||||
<Button size="xs" variant="light" onClick={onRefresh}>
|
<Button size="xs" variant="light" onClick={onRefresh}>
|
||||||
↻ Refresh
|
↻ Refresh
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||||
import { LogEntry } from './LogEntry';
|
import { LogEntry } from "./LogEntry";
|
||||||
|
|
||||||
const meta: Meta<typeof LogEntry> = {
|
const meta: Meta<typeof LogEntry> = {
|
||||||
title: 'Atoms/LogEntry',
|
title: "Atoms/LogEntry",
|
||||||
component: LogEntry,
|
component: LogEntry,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -11,73 +11,73 @@ type Story = StoryObj<typeof LogEntry>;
|
||||||
|
|
||||||
export const Debug: Story = {
|
export const Debug: Story = {
|
||||||
args: {
|
args: {
|
||||||
timestamp: '2026-03-17T10:00:00Z',
|
timestamp: "2026-03-17T10:00:00Z",
|
||||||
level: 'debug',
|
level: "debug",
|
||||||
message: 'Initializing connection pool',
|
message: "Initializing connection pool",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Info: Story = {
|
export const Info: Story = {
|
||||||
args: {
|
args: {
|
||||||
timestamp: '2026-03-17T10:00:01Z',
|
timestamp: "2026-03-17T10:00:01Z",
|
||||||
level: 'info',
|
level: "info",
|
||||||
message: 'Server started on port 3000',
|
message: "Server started on port 3000",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Notice: Story = {
|
export const Notice: Story = {
|
||||||
args: {
|
args: {
|
||||||
timestamp: '2026-03-17T10:00:02Z',
|
timestamp: "2026-03-17T10:00:02Z",
|
||||||
level: 'notice',
|
level: "notice",
|
||||||
message: 'Configuration reloaded successfully',
|
message: "Configuration reloaded successfully",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Warning: Story = {
|
export const Warning: Story = {
|
||||||
args: {
|
args: {
|
||||||
timestamp: '2026-03-17T10:00:03Z',
|
timestamp: "2026-03-17T10:00:03Z",
|
||||||
level: 'warning',
|
level: "warning",
|
||||||
message: 'Memory usage above 80%',
|
message: "Memory usage above 80%",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Error: Story = {
|
export const Error: Story = {
|
||||||
args: {
|
args: {
|
||||||
timestamp: '2026-03-17T10:00:04Z',
|
timestamp: "2026-03-17T10:00:04Z",
|
||||||
level: 'error',
|
level: "error",
|
||||||
message: 'Failed to connect to database',
|
message: "Failed to connect to database",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Critical: Story = {
|
export const Critical: Story = {
|
||||||
args: {
|
args: {
|
||||||
timestamp: '2026-03-17T10:00:05Z',
|
timestamp: "2026-03-17T10:00:05Z",
|
||||||
level: 'critical',
|
level: "critical",
|
||||||
message: 'Disk space critically low',
|
message: "Disk space critically low",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Alert: Story = {
|
export const Alert: Story = {
|
||||||
args: {
|
args: {
|
||||||
timestamp: '2026-03-17T10:00:06Z',
|
timestamp: "2026-03-17T10:00:06Z",
|
||||||
level: 'alert',
|
level: "alert",
|
||||||
message: 'Service degradation detected',
|
message: "Service degradation detected",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Emergency: Story = {
|
export const Emergency: Story = {
|
||||||
args: {
|
args: {
|
||||||
timestamp: '2026-03-17T10:00:07Z',
|
timestamp: "2026-03-17T10:00:07Z",
|
||||||
level: 'emergency',
|
level: "emergency",
|
||||||
message: 'System is unusable',
|
message: "System is unusable",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const WithLogger: Story = {
|
export const WithLogger: Story = {
|
||||||
args: {
|
args: {
|
||||||
timestamp: '2026-03-17T10:00:08Z',
|
timestamp: "2026-03-17T10:00:08Z",
|
||||||
level: 'info',
|
level: "info",
|
||||||
message: 'Tool execution completed',
|
message: "Tool execution completed",
|
||||||
logger: 'mcp-server',
|
logger: "mcp-server",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue