update toaster
Browse files- src/components/App.tsx +31 -31
- src/components/preview/preview.tsx +8 -0
src/components/App.tsx
CHANGED
@@ -157,40 +157,40 @@ function App() {
|
|
157 |
<DeployButton html={html} error={error} auth={auth} />
|
158 |
</Header>
|
159 |
<main className="max-lg:flex-col flex w-full">
|
160 |
-
<div
|
161 |
-
ref={editor}
|
162 |
-
className="w-full h-[30dvh] lg:h-full relative"
|
163 |
-
onClick={(e) => {
|
164 |
-
if (isAiWorking) {
|
165 |
-
e.preventDefault();
|
166 |
-
e.stopPropagation();
|
167 |
-
toast.warn("Please wait for the AI to finish working.");
|
168 |
-
}
|
169 |
-
}}
|
170 |
-
>
|
171 |
<Tabs />
|
172 |
-
<
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
"pointer-events-none": isAiWorking,
|
179 |
-
}
|
180 |
-
)}
|
181 |
-
value={html}
|
182 |
-
onValidate={(markers) => {
|
183 |
-
if (markers?.length > 0) {
|
184 |
-
setError(true);
|
185 |
}
|
186 |
}}
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
<AskAI
|
195 |
html={html}
|
196 |
setHtml={setHtml}
|
|
|
157 |
<DeployButton html={html} error={error} auth={auth} />
|
158 |
</Header>
|
159 |
<main className="max-lg:flex-col flex w-full">
|
160 |
+
<div ref={editor} className="w-full h-[30dvh] lg:h-full relative">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
<Tabs />
|
162 |
+
<div
|
163 |
+
onClick={(e) => {
|
164 |
+
if (isAiWorking) {
|
165 |
+
e.preventDefault();
|
166 |
+
e.stopPropagation();
|
167 |
+
toast.warn("Please wait for the AI to finish working.");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
}
|
169 |
}}
|
170 |
+
>
|
171 |
+
<Editor
|
172 |
+
language="html"
|
173 |
+
theme="vs-dark"
|
174 |
+
className={classNames(
|
175 |
+
"h-[calc(30dvh-41px)] lg:h-[calc(100dvh-96px)]",
|
176 |
+
{
|
177 |
+
"pointer-events-none": !isAiWorking,
|
178 |
+
}
|
179 |
+
)}
|
180 |
+
value={html}
|
181 |
+
onValidate={(markers) => {
|
182 |
+
if (markers?.length > 0) {
|
183 |
+
setError(true);
|
184 |
+
}
|
185 |
+
}}
|
186 |
+
onChange={(value) => {
|
187 |
+
const newValue = value ?? "";
|
188 |
+
setHtml(newValue);
|
189 |
+
setError(false);
|
190 |
+
}}
|
191 |
+
onMount={(editor) => (editorRef.current = editor)}
|
192 |
+
/>
|
193 |
+
</div>
|
194 |
<AskAI
|
195 |
html={html}
|
196 |
setHtml={setHtml}
|
src/components/preview/preview.tsx
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import classNames from "classnames";
|
2 |
import { useRef } from "react";
|
3 |
import { TbReload } from "react-icons/tb";
|
|
|
4 |
|
5 |
function Preview({
|
6 |
html,
|
@@ -30,6 +31,13 @@ function Preview({
|
|
30 |
<div
|
31 |
ref={ref}
|
32 |
className="w-full border-l border-gray-900 bg-white h-[calc(70dvh-53px)] lg:h-[calc(100dvh-54px)] relative"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
>
|
34 |
<iframe
|
35 |
ref={iframeRef}
|
|
|
1 |
import classNames from "classnames";
|
2 |
import { useRef } from "react";
|
3 |
import { TbReload } from "react-icons/tb";
|
4 |
+
import { toast } from "react-toastify";
|
5 |
|
6 |
function Preview({
|
7 |
html,
|
|
|
31 |
<div
|
32 |
ref={ref}
|
33 |
className="w-full border-l border-gray-900 bg-white h-[calc(70dvh-53px)] lg:h-[calc(100dvh-54px)] relative"
|
34 |
+
onClick={(e) => {
|
35 |
+
if (isAiWorking) {
|
36 |
+
e.preventDefault();
|
37 |
+
e.stopPropagation();
|
38 |
+
toast.warn("Please wait for the AI to finish working.");
|
39 |
+
}
|
40 |
+
}}
|
41 |
>
|
42 |
<iframe
|
43 |
ref={iframeRef}
|