Skip to content

Commit

Permalink
fix: simple-code-editor esbuild compat (#512)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yonom authored Jul 15, 2024
1 parent 7ee0b0b commit 7d212e9
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 10 deletions.
3 changes: 3 additions & 0 deletions examples/with-playground/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import {
import { usePlaygroundRuntime } from "@assistant-ui/react-playground";
import { AssistantRuntimeProvider } from "@assistant-ui/react";

import "prismjs/components/prism-json";
import "prismjs/themes/prism.css";

export default function Home() {
const runtime = usePlaygroundRuntime({
api: "/api/chat",
Expand Down
5 changes: 3 additions & 2 deletions examples/with-playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
},
"dependencies": {
"@ai-sdk/openai": "^0.0.36",
"@assistant-ui/react": "workspace:*",
"@assistant-ui/react-playground": "workspace:*",
"@assistant-ui/react": "^0.4.7",
"@assistant-ui/react-playground": "^0.0.0-alpha.1",
"next": "14.2.5",
"prismjs": "^1.29.0",
"react": "^18",
"react-dom": "^18",
"tailwindcss-animate": "^1.0.7"
Expand Down
3 changes: 1 addition & 2 deletions examples/with-playground/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
}
],
"paths": {
"@/*": ["./*"],

"@/*": ["./*"]
},
"allowJs": true,
"strictNullChecks": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-playground/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@assistant-ui/react-playground",
"version": "0.0.0-alpha.0",
"version": "0.0.0-alpha.1",
"license": "MIT",
"exports": {
".": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import Editor from "react-simple-code-editor";
import { highlight, languages } from "prismjs";
import "prismjs/components/prism-json";
import "prismjs/themes/prism.css";
import { FC } from "react";
import { cn } from "../../../lib/utils";

// https://github.com/react-simple-code-editor/react-simple-code-editor/issues/106
const EditorComponent =
(Editor as unknown as { default: typeof Editor }).default ?? Editor;

type JSONEditorProps = {
placeholder?: string;
value: string;
Expand All @@ -14,7 +16,7 @@ type JSONEditorProps = {

export const JSONEditor: FC<JSONEditorProps> = ({ className, ...props }) => {
return (
<Editor
<EditorComponent
{...props}
highlight={(code) => highlight(code, languages["json"]!, "json")}
className={cn("w-full font-mono [&>textarea]:outline-none", className)}
Expand Down
7 changes: 5 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7d212e9

Please sign in to comment.