Skip to content

Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)

Python

cleaner resets with resetHead

Abi Raja089f4302d235
diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx
index 4ec5c6fe..7605b0d1 100644
--- a/frontend/src/App.tsx
+++ b/frontend/src/App.tsx
@@ -42,6 +42,7 @@ function App() {
appendCommitCode,
setCommitCode,
resetCommits,
+ resetHead,
// Outputs
appendExecutionConsole,
@@ -116,6 +117,7 @@ function App() {
resetExecutionConsoles();
resetCommits();
+ resetHead();
// Inputs
setInputMode("image");
diff --git a/frontend/src/store/project-store.ts b/frontend/src/store/project-store.ts
index 5edb63f7..5304edd2 100644
--- a/frontend/src/store/project-store.ts
+++ b/frontend/src/store/project-store.ts
@@ -17,8 +17,8 @@ interface ProjectStore {
addCommit: (commit: Commit) => void;
removeCommit: (hash: CommitHash) => void;
+ resetCommits: () => void;
- setHead: (hash: CommitHash) => void;
appendCommitCode: (
hash: CommitHash,
numVariant: number,
@@ -26,7 +26,9 @@ interface ProjectStore {
) => void;
setCommitCode: (hash: CommitHash, numVariant: number, code: string) => void;
updateSelectedVariantIndex: (hash: CommitHash, index: number) => void;
- resetCommits: () => void;
+
+ setHead: (hash: CommitHash) => void;
+ resetHead: () => void;
executionConsoles: { [key: number]: string[] };
appendExecutionConsole: (variantIndex: number, line: string) => void;
@@ -58,8 +60,8 @@ export const useProjectStore = create<ProjectStore>((set) => ({
return { commits: newCommits };
});
},
+ resetCommits: () => set({ commits: {} }),
- setHead: (hash: CommitHash) => set({ head: hash }),
appendCommitCode: (hash: CommitHash, numVariant: number, code: string) =>
set((state) => ({
commits: {
@@ -96,8 +98,9 @@ export const useProjectStore = create<ProjectStore>((set) => ({
},
},
})),
- resetCommits: () => set({ commits: {}, head: null }),
- // TODO: Reset heads
+
+ setHead: (hash: CommitHash) => set({ head: hash }),
+ resetHead: () => set({ head: null }),
executionConsoles: {},
appendExecutionConsole: (variantIndex: number, line: string) =>