pixelass commited on
Commit
ebe6926
•
1 Parent(s): 0391bdb

feat: localstorage

Browse files
Files changed (2) hide show
  1. src/pages/index.tsx +11 -7
  2. src/services/api/index.ts +1 -1
src/pages/index.tsx CHANGED
@@ -34,6 +34,8 @@ import { useHost } from "esdeka/react";
34
  import CircularProgress from "@mui/material/CircularProgress";
35
  import CssBaseline from "@mui/material/CssBaseline";
36
  import Slider from "@mui/material/Slider";
 
 
37
 
38
  const base = {
39
  default: `/** CHANGELOG
@@ -54,18 +56,20 @@ const fontMono = Fira_Code({
54
  subsets: ["latin"],
55
  });
56
 
 
 
 
 
 
 
 
 
57
  export default function Home() {
58
  const ref = useRef<HTMLIFrameElement>(null);
59
  const [template, setTemplate] = useState(base.default);
60
  const [runningId, setRunningId] = useState("1");
61
  const [activeId, setActiveId] = useState("1");
62
- const [answers, setAnswers] = useState<{ id: string; content: string; task: string }[]>([
63
- {
64
- id: "1",
65
- content: base.default,
66
- task: "Base Script",
67
- },
68
- ]);
69
  const [loading, setLoading] = useState(false);
70
  const [loadingLive, setLoadingLive] = useState(true);
71
 
 
34
  import CircularProgress from "@mui/material/CircularProgress";
35
  import CssBaseline from "@mui/material/CssBaseline";
36
  import Slider from "@mui/material/Slider";
37
+ import { useAtom } from "jotai";
38
+ import { atomWithStorage } from "jotai/utils";
39
 
40
  const base = {
41
  default: `/** CHANGELOG
 
56
  subsets: ["latin"],
57
  });
58
 
59
+ const answersAtom = atomWithStorage<{ id: string; content: string; task: string }[]>("fail4", [
60
+ {
61
+ id: "1",
62
+ content: base.default,
63
+ task: "Base Script",
64
+ },
65
+ ]);
66
+
67
  export default function Home() {
68
  const ref = useRef<HTMLIFrameElement>(null);
69
  const [template, setTemplate] = useState(base.default);
70
  const [runningId, setRunningId] = useState("1");
71
  const [activeId, setActiveId] = useState("1");
72
+ const [answers, setAnswers] = useAtom(answersAtom);
 
 
 
 
 
 
73
  const [loading, setLoading] = useState(false);
74
  const [loadingLive, setLoadingLive] = useState(true);
75
 
src/services/api/index.ts CHANGED
@@ -57,7 +57,7 @@ export async function toOpenAI({
57
  All UPPERCASE words are IMPORTANT, all "UPPERCASE" words in QUOTES (") indicate KEYWORDS.
58
  You are: expert JavaScript Developer, creative, Canvas-2d expert, performance guru, interaction expert.
59
  You strictly follow all "DOCS".
60
- You extend "CHANGELOG".
61
  You ALWAYS follow the "ADD", "REMOVE", "INPUT" and "OUTPUT FORMAT".
62
  You NEVER explain anything.
63
 
 
57
  All UPPERCASE words are IMPORTANT, all "UPPERCASE" words in QUOTES (") indicate KEYWORDS.
58
  You are: expert JavaScript Developer, creative, Canvas-2d expert, performance guru, interaction expert.
59
  You strictly follow all "DOCS".
60
+ You extend "CHANGELOG" and the CODE.
61
  You ALWAYS follow the "ADD", "REMOVE", "INPUT" and "OUTPUT FORMAT".
62
  You NEVER explain anything.
63