Skip to content

Commit

Permalink
Fix new project in top bar
Browse files Browse the repository at this point in the history
  • Loading branch information
abrenneke committed Oct 31, 2023
1 parent d7ce527 commit 2f31aaf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/app/src/components/ProjectSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { type SyntheticListenerMap } from '@dnd-kit/core/dist/hooks/utilities';
import { SortableContext, horizontalListSortingStrategy, useSortable, arrayMove } from '@dnd-kit/sortable';
import { useLoadProjectWithFileBrowser } from '../hooks/useLoadProjectWithFileBrowser';
import { graphNavigationStackState } from '../state/graphBuilder';
import { newProjectModalOpenState } from '../state/ui';

export const styles = css`
position: absolute;
Expand Down Expand Up @@ -199,7 +200,7 @@ export const ProjectSelector: FC = () => {
}, [openedProjectsSortedIds, openedProjects]);

const loadProject = useLoadProject();
const newProject = useNewProject();
const setNewProjectModalOpen = useSetRecoilState(newProjectModalOpenState);
const loadProjectWithFileBrowser = useLoadProjectWithFileBrowser();

useSyncCurrentStateIntoOpenedProjects();
Expand Down Expand Up @@ -236,7 +237,7 @@ export const ProjectSelector: FC = () => {
if (closestProject) {
loadProject(closestProject.project);
} else {
newProject();
setNewProjectModalOpen(true);
}
};

Expand Down Expand Up @@ -268,7 +269,7 @@ export const ProjectSelector: FC = () => {
</div>
</div>
<div className="actions">
<button className="new-project" onClick={newProject} title="New Project">
<button className="new-project" onClick={() => setNewProjectModalOpen(true)} title="New Project">
<FileIcon />
</button>
<button className="open-project" onClick={loadProjectWithFileBrowser} title="Open Project">
Expand Down

0 comments on commit 2f31aaf

Please sign in to comment.