Skip to content

Commit 0ed24c6

Browse files
committed
feat: something
1 parent 744ee73 commit 0ed24c6

File tree

6 files changed

+88
-15
lines changed

6 files changed

+88
-15
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<link rel="stylesheet" href="src/index.css" />
1717
</head>
1818

19-
<body class="dark">
19+
<body class="">
2020
<div id="root"></div>
2121
<script type="module" src="/src/main.tsx"></script>
2222
</body>

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"class-variance-authority": "^0.7.1",
1919
"clsx": "^2.1.1",
2020
"lucide-react": "^0.511.0",
21+
"motion": "^12.15.0",
2122
"prismjs": "^1.30.0",
2223
"react": "^19.1.0",
2324
"react-dom": "^19.1.0",

pnpm-lock.yaml

Lines changed: 60 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Preview.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { Button } from "@/components/Button";
22
import { ResizablePanel } from "@/components/Resizable";
3-
import { ActivityIcon, ExternalLinkIcon, LoaderIcon } from "lucide-react";
4-
import { useEffect, useState, type FC } from "react";
5-
import { useStore } from "@/store";
63
import { useDebouncedValue } from "@/hooks/debounce";
4+
import { useStore } from "@/store";
75
import { cn } from "@/utils/cn";
6+
import { ActivityIcon, ExternalLinkIcon, LoaderIcon } from "lucide-react"
7+
import { type FC, useEffect, useState } from "react";
88

99
export const Preview: FC = () => {
1010
const $wasmState = useStore((state) => state.wasmState);
@@ -129,7 +129,7 @@ const ErrorPane = () => {
129129
<div
130130
className={cn(
131131
"absolute bottom-0 left-0 w-full",
132-
$error.show && "h-2/3",
132+
$error.show && "h-auto",
133133
)}
134134
>
135135
<button

src/store.tsx

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type State = {
1414
code: string;
1515
wasmState: WasmState;
1616
error?: {
17-
message: string;
17+
message?: string;
1818
show: boolean;
1919
};
2020
setCode: (code: string) => void;
@@ -26,16 +26,28 @@ type State = {
2626
export const useStore = create<State>()((set) => ({
2727
code: defaultCode,
2828
wasmState: "loading",
29-
error: {
30-
message: "wibble: wobble",
31-
show: true,
32-
},
29+
// error: {
30+
// message: "wibble: wobble",
31+
// show: false,
32+
// },
3333
setCode: (code) => set((_) => ({ code })),
3434
setError: (message) =>
35-
set((state) => ({ error: { message, show: state.error?.show ?? false } })),
35+
set((state) => {
36+
// If there is currently no error, then we want to show this new error
37+
const error = state.error ?? { show: true };
38+
39+
return {
40+
error: { ...error, message },
41+
};
42+
}),
3643
toggleShowError: () =>
37-
set((state) => ({
38-
error: { show: !state.error?.show, message: state.error?.message ?? "" },
39-
})),
44+
set((state) => {
45+
return {
46+
error: {
47+
show: !(state.error?.show ?? true),
48+
message: state.error?.message ?? "",
49+
},
50+
};
51+
}),
4052
setWasmState: (wasmState) => set((_) => ({ wasmState })),
4153
}));

vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import path from "node:path";
66
// https://vite.dev/config/
77
export default defineConfig({
88
server: {
9-
allowedHosts: [".coder"],
9+
allowedHosts: [".coder", ".ngrok"],
1010
},
1111
plugins: [
1212
react(),

0 commit comments

Comments
 (0)