Skip to content

Commit 831c973

Browse files
fix(c): schema editor
1 parent 72bf4a8 commit 831c973

File tree

6 files changed

+28
-14
lines changed

6 files changed

+28
-14
lines changed

bun.lockb

9.86 KB
Binary file not shown.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"@codemirror/theme-one-dark": "^6.1.2",
2121
"@headlessui/react": "^2.2.0",
2222
"@monaco-editor/react": "^4.6.0",
23+
"@radix-ui/react-tooltip": "^1.1.7",
2324
"@uiw/react-codemirror": "^4.23.6",
2425
"class-variance-authority": "^0.7.1",
2526
"clsx": "^2.1.1",

src/components/editor/ContextChipInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export function ContextChipInput({ contexts, onChange }: ContextChipInputProps)
7979
</div>
8080
{hoveredIndex === index && (
8181
<div className="absolute left-0 bottom-full mb-2 z-50">
82-
<div className="bg-gray-900 px-2 py-1 rounded text-xs whitespace-nowrap">
82+
<div className="bg-gray-200 dark:bg-gray-700 px-2 py-1 rounded text-xs whitespace-nowrap">
8383
<div>{context.uri}</div>
8484
{context.description && (
8585
<div className="text-gray-400">{context.description}</div>

src/components/editor/FieldComponent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const FieldComponent: React.FC<FieldComponentProps> = ({
4141
className="text-gray-400 hover:text-gray-300 cursor-help"
4242
/>
4343
<div className="absolute left-1/2 -translate-x-1/2 bottom-full mb-2 hidden group-hover:block">
44-
<div className="bg-gray-900 text-sm rounded px-2 py-1 whitespace-nowrap">
44+
<div className="text-sm rounded px-2 py-1 whitespace-nowrap">
4545
{field.$comment}
4646
</div>
4747
</div>

src/components/editor/SchemaEditor.tsx

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { ContextChipInput } from './ContextChipInput';
1010
import Editor from '@monaco-editor/react';
1111
import { Tabs, Tab, TabPanel } from "../../components/tabs/Tabs";
1212
import { Button } from '../button/Button';
13+
import { Tooltip } from '../tooltip/Tooltip';
1314

1415
interface Errors {
1516
title?: string;
@@ -854,8 +855,8 @@ export function SchemaEditor({
854855
{/* Tabs Section */}
855856
<div className="border-b border-gray-200 dark:border-gray-700">
856857
<Tabs defaultValue="form">
857-
<Tab value="form">Form View</Tab>
858-
<Tab value="json">JSON View</Tab>
858+
<Tab value="form" type="button">Form View</Tab>
859+
<Tab value="json" type="button">JSON View</Tab>
859860

860861
<TabPanel value="form">
861862
<div className="space-y-6">
@@ -888,12 +889,14 @@ export function SchemaEditor({
888889
</div>
889890
<div className="mb-4">
890891
<label className="flex items-center space-x-2 text-gray-700 dark:text-gray-300">
891-
<input
892-
type="checkbox"
893-
checked={formData.allowId}
894-
onChange={(e) => setFormData({ ...formData, allowId: e.target.checked })}
895-
className="form-checkbox h-4 w-4 text-blue-500"
896-
/>
892+
<Tooltip content="Enable ID field">
893+
<input
894+
type="checkbox"
895+
checked={formData.allowId}
896+
onChange={(e) => setFormData({ ...formData, allowId: e.target.checked })}
897+
className="form-checkbox h-4 w-4 text-blue-500"
898+
/>
899+
</Tooltip>
897900
<span>Allow ID field (URI format)</span>
898901
</label>
899902
<p className="text-gray-600 dark:text-gray-400 text-sm mt-1">
@@ -1097,10 +1100,14 @@ export function SchemaEditor({
10971100
<div className="w-2 h-2 rounded-full border-2 border-current border-t-transparent animate-spin" />
10981101
)}
10991102
{normalizationStatus === 'valid' && (
1100-
<div className="w-2 h-2 rounded-full bg-emerald-400 dark:bg-emerald-500" title="Valid JSON-LD" />
1103+
<Tooltip content="Valid JSON-LD">
1104+
<div className="w-2 h-2 rounded-full bg-emerald-400 dark:bg-emerald-500" />
1105+
</Tooltip>
11011106
)}
11021107
{normalizationStatus === 'invalid' && (
1103-
<div className="w-2 h-2 rounded-full bg-red-400 dark:bg-red-500" title="Invalid JSON-LD" />
1108+
<Tooltip content="Invalid JSON-LD">
1109+
<div className="w-2 h-2 rounded-full bg-red-400 dark:bg-red-500" />
1110+
</Tooltip>
11041111
)}
11051112
</div>
11061113
</button>
@@ -1133,10 +1140,14 @@ export function SchemaEditor({
11331140
<div className="w-2 h-2 rounded-full border-2 border-current border-t-transparent animate-spin" />
11341141
)}
11351142
{normalizationStatus === 'valid' && (
1136-
<div className="w-2 h-2 rounded-full bg-emerald-400 dark:bg-emerald-500" title="Valid JSON-LD" />
1143+
<Tooltip content="Valid JSON-LD">
1144+
<div className="w-2 h-2 rounded-full bg-emerald-400 dark:bg-emerald-500" />
1145+
</Tooltip>
11371146
)}
11381147
{normalizationStatus === 'invalid' && (
1139-
<div className="w-2 h-2 rounded-full bg-red-400 dark:bg-red-500" title="Invalid JSON-LD" />
1148+
<Tooltip content="Invalid JSON-LD">
1149+
<div className="w-2 h-2 rounded-full bg-red-400 dark:bg-red-500" />
1150+
</Tooltip>
11401151
)}
11411152
<span className="text-sm text-gray-500 dark:text-gray-400">
11421153
{normalizationStatus === 'valid' && 'Valid JSON-LD'}

src/components/tabs/Tabs.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export interface TabsProps extends React.HTMLAttributes<HTMLDivElement> {
1313
export interface TabProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
1414
/** Value that identifies the tab */
1515
value: string;
16+
/** Type of button */
17+
type?: "button" | "submit" | "reset";
1618
}
1719

1820
interface TabPanelProps extends React.HTMLAttributes<HTMLDivElement> {

0 commit comments

Comments
 (0)