feat(playground): add submit button to the editor interface with icon

This commit is contained in:
ngc2207 2025-01-05 08:38:37 +08:00
parent 44ef62c03a
commit c30398a453

View File

@ -1,6 +1,8 @@
"use client"; "use client";
import { Send } from "lucide-react";
import * as monaco from "monaco-editor"; import * as monaco from "monaco-editor";
import { Button } from "@/components/ui/button";
import { useEffect, useRef, useState } from "react"; import { useEffect, useRef, useState } from "react";
import { Editor, loader } from "@monaco-editor/react"; import { Editor, loader } from "@monaco-editor/react";
import { MonacoLanguageClient } from "monaco-languageclient"; import { MonacoLanguageClient } from "monaco-languageclient";
@ -78,7 +80,7 @@ export default function PlaygroundPage() {
webSocketRef.current.close(); webSocketRef.current.close();
webSocketRef.current = null; webSocketRef.current = null;
} }
if(language in LSP_SUPPORTED_LANGUAGES){ if (language in LSP_SUPPORTED_LANGUAGES) {
try { try {
const languageClient = await connectToLanguageServer( const languageClient = await connectToLanguageServer(
language, language,
@ -98,6 +100,7 @@ export default function PlaygroundPage() {
return ( return (
<div className="h-full flex flex-col"> <div className="h-full flex flex-col">
<div className="flex items-center justify-between">
<Tabs defaultValue={language as string}> <Tabs defaultValue={language as string}>
<ScrollArea> <ScrollArea>
<TabsList className="m-3"> <TabsList className="m-3">
@ -146,6 +149,18 @@ export default function PlaygroundPage() {
<ScrollBar orientation="horizontal" /> <ScrollBar orientation="horizontal" />
</ScrollArea> </ScrollArea>
</Tabs> </Tabs>
<div className="m-3">
<Button variant="outline">
Submit
<Send
className="-me-1 ms-2 opacity-60"
size={16}
strokeWidth={2}
aria-hidden="true"
/>
</Button>
</div>
</div>
<Editor <Editor
theme="vs-dark" theme="vs-dark"
path={file.name} path={file.name}