Skip to content

Commit

Permalink
fix: can't change files
Browse files Browse the repository at this point in the history
  • Loading branch information
lajbel committed Sep 30, 2024
1 parent 7232217 commit 7befb40
Show file tree
Hide file tree
Showing 5 changed files with 403 additions and 427 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"preview": "vite preview",
"generate:examples": "node --experimental-strip-types scripts/examples.ts",
"fmt": "dprint fmt",
"check": "tsc --noEmit"
"check": "tsc --noEmit --p tsconfig.app.json"
},
"dependencies": {
"@formkit/drag-and-drop": "^0.0.38",
Expand Down
10 changes: 5 additions & 5 deletions src/components/FileTree/FileEntry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ const logoByKind = {

const FileEntry: FC<Props> = ({ file }) => {
const { removeFile } = useProject();
const { currentFile, setCurrentFile } = useEditor();
const { getRuntime } = useEditor();

const handleClick: MouseEventHandler = () => {
setCurrentFile(file.path);
getRuntime().currentFile = file.path;
};

const handleDelete: MouseEventHandler = (e) => {
Expand All @@ -35,7 +35,7 @@ const FileEntry: FC<Props> = ({ file }) => {

if (confirm("Are you sure you want to remove this scene?")) {
removeFile(file.path);
setCurrentFile("main.js");
getRuntime().currentFile = "main.js";
}
};

Expand All @@ -44,8 +44,8 @@ const FileEntry: FC<Props> = ({ file }) => {
className={cn(
"file | btn btn-sm w-full justify-start rounded-none px-2",
{
"btn-primary": currentFile === file.path,
"btn-ghost": currentFile !== file.path,
"btn-primary": getRuntime().currentFile === file.path,
"btn-ghost": getRuntime().currentFile !== file.path,
},
)}
onClick={handleClick}
Expand Down
1 change: 1 addition & 0 deletions src/components/Toolbar/Projects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const Projects: FC = () => {
showNotification("Exporting the project, check downloads...");
};

// @ts-ignore
const handleProjectUpload = (e: React.ChangeEvent<HTMLInputElement>) => {
alert("reimplement project upload");
// const file = e.target.files?.[0];
Expand Down
Loading

0 comments on commit 7befb40

Please sign in to comment.