1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import Cerebras from "https://esm.sh/@cerebras/cerebras_cloud_sdk";
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client?deps=react@18.2.0";
4import { Prism as SyntaxHighlighter } from "https://esm.sh/react-syntax-highlighter?deps=react@18.2.0,react-dom@18.2.0";
5import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
6import { STARTER_PROMPTS } from "https://esm.town/v/stevekrouse/cerebras_coder_prompts";
7
33}: {
34 prompt: string;
35 setPrompt: React.Dispatch<React.SetStateAction<string>>;
36 handleSubmit: (e: React.FormEvent) => void;
37 handleStarterPromptClick: (promptItem: PromptItem) => void;
38}) {
122
123function App() {
124 const previewRef = React.useRef<HTMLDivElement>(null);
125 const [prompt, setPrompt] = useState("");
126 const [projectId, setProjectId] = useState<number | null>(null);
180 }
181
182 async function handleSubmit(e: React.FormEvent | string) {
183 if (typeof e !== "string") {
184 e.preventDefault();
679 </div>
680 <div className="bg-white w-full h-full flex flex-col grow rounded-xl border-2 border-white overflow-hidden">
681 <React.Fragment key={iframeKey}>
682 <iframe
683 srcDoc={code}
685 className="w-full grow"
686 />
687 </React.Fragment>
688 </div>
689 </div>
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import Cerebras from "https://esm.sh/@cerebras/cerebras_cloud_sdk";
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client?deps=react@18.2.0";
4import { Prism as SyntaxHighlighter } from "https://esm.sh/react-syntax-highlighter?deps=react@18.2.0,react-dom@18.2.0";
5import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
6import { STARTER_PROMPTS } from "https://esm.town/v/stevekrouse/cerebras_coder_prompts";
7
33}: {
34 prompt: string;
35 setPrompt: React.Dispatch<React.SetStateAction<string>>;
36 handleSubmit: (e: React.FormEvent) => void;
37 handleStarterPromptClick: (promptItem: PromptItem) => void;
38}) {
122
123function App() {
124 const previewRef = React.useRef<HTMLDivElement>(null);
125 const [prompt, setPrompt] = useState("");
126 const [projectId, setProjectId] = useState<number | null>(null);
180 }
181
182 async function handleSubmit(e: React.FormEvent | string) {
183 if (typeof e !== "string") {
184 e.preventDefault();
679 </div>
680 <div className="bg-white w-full h-full flex flex-col grow rounded-xl border-2 border-white overflow-hidden">
681 <React.Fragment key={iframeKey}>
682 <iframe
683 srcDoc={code}
685 className="w-full grow"
686 />
687 </React.Fragment>
688 </div>
689 </div>
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import Cerebras from "https://esm.sh/@cerebras/cerebras_cloud_sdk";
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client?deps=react@18.2.0";
4import { Prism as SyntaxHighlighter } from "https://esm.sh/react-syntax-highlighter?deps=react@18.2.0,react-dom@18.2.0";
5import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
6import { STARTER_PROMPTS } from "https://esm.town/v/stevekrouse/cerebras_coder_prompts";
7
33}: {
34 prompt: string;
35 setPrompt: React.Dispatch<React.SetStateAction<string>>;
36 handleSubmit: (e: React.FormEvent) => void;
37 handleStarterPromptClick: (promptItem: PromptItem) => void;
38}) {
122
123function App() {
124 const previewRef = React.useRef<HTMLDivElement>(null);
125 const [prompt, setPrompt] = useState("");
126 const [projectId, setProjectId] = useState<number | null>(null);
180 }
181
182 async function handleSubmit(e: React.FormEvent | string) {
183 if (typeof e !== "string") {
184 e.preventDefault();
679 </div>
680 <div className="bg-white w-full h-full flex flex-col grow rounded-xl border-2 border-white overflow-hidden">
681 <React.Fragment key={iframeKey}>
682 <iframe
683 srcDoc={code}
685 className="w-full grow"
686 />
687 </React.Fragment>
688 </div>
689 </div>
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import Cerebras from "https://esm.sh/@cerebras/cerebras_cloud_sdk";
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client?deps=react@18.2.0";
4import { Prism as SyntaxHighlighter } from "https://esm.sh/react-syntax-highlighter?deps=react@18.2.0,react-dom@18.2.0";
5import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
6import { STARTER_PROMPTS } from "https://esm.town/v/stevekrouse/cerebras_coder_prompts";
7
33}: {
34 prompt: string;
35 setPrompt: React.Dispatch<React.SetStateAction<string>>;
36 handleSubmit: (e: React.FormEvent) => void;
37 handleStarterPromptClick: (promptItem: PromptItem) => void;
38}) {
122
123function App() {
124 const previewRef = React.useRef<HTMLDivElement>(null);
125 const [prompt, setPrompt] = useState("");
126 const [projectId, setProjectId] = useState<number | null>(null);
180 }
181
182 async function handleSubmit(e: React.FormEvent | string) {
183 if (typeof e !== "string") {
184 e.preventDefault();
679 </div>
680 <div className="bg-white w-full h-full flex flex-col grow rounded-xl border-2 border-white overflow-hidden">
681 <React.Fragment key={iframeKey}>
682 <iframe
683 srcDoc={code}
685 className="w-full grow"
686 />
687 </React.Fragment>
688 </div>
689 </div>
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
3import React, { useEffect, useRef, useState } from "https://esm.sh/react@18.2.0";
4
5/* ------------------------------ CSS Styles ------------------------------ */
327}
328
329/* --------------------- React Types & Components --------------------- */
330
331// [ADDED] Add `link` to the App interface
339
340/**
341 * React component that shows an individual app icon & title.
342 */
343function AppCard({ app, onEdit }: { app: App; onEdit: (app: App) => void }) {
348
349 // Right-click => open edit overlay
350 const handleRightClick = (e: React.MouseEvent) => {
351 e.preventDefault();
352 onEdit(app);
556
557/**
558 * Main React component that displays the header, categories, apps, & state.
559 */
560function App() {
646
647 // Import
648 const handleImportApps = async (e: React.ChangeEvent<HTMLInputElement>) => {
649 if (!e.target.files || e.target.files.length === 0) return;
650 const file = e.target.files[0];
777
778/**
779 * Client entry-point to render the React App.
780 */
781function client() {
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import {
3 DragDropContext,
4 Draggable,
5 Droppable,
6} from "https://esm.sh/react-beautiful-dnd@13.1.1?deps=react@18.2.0,react-dom@18.2.0";
7import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
8import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
9
10function TaskBoard() {
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import Cerebras from "https://esm.sh/@cerebras/cerebras_cloud_sdk";
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client?deps=react@18.2.0";
4import { Prism as SyntaxHighlighter } from "https://esm.sh/react-syntax-highlighter?deps=react@18.2.0,react-dom@18.2.0";
5import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
6import { STARTER_PROMPTS } from "https://esm.town/v/stevekrouse/cerebras_coder_prompts";
7
66 const [isEditMode, setIsEditMode] = useState(false);
67
68 const handleSubmit = async (e: React.FormEvent) => {
69 e.preventDefault();
70 setIsLoading(true);
1/** @jsxImportSource https://esm.sh/react@18.2.0 **/
2import { renderToString } from "https://esm.sh/react-dom@18.2.0/server";
3
4export default (req: Request) => {
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
3import React, { useState } from "https://esm.sh/react@18.2.0";
4
5function App() {
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
3import React, { useState } from "https://esm.sh/react@18.2.0";
4
5function App() {