mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-04 09:13:08 +00:00
fix: also remove theme calculation from dashboard-view
Missed this code path which is used when opening projects from the dashboard after completing setup.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import { useState, useCallback } from 'react';
|
import { useState, useCallback } from 'react';
|
||||||
import { createLogger } from '@automaker/utils/logger';
|
import { createLogger } from '@automaker/utils/logger';
|
||||||
import { useNavigate } from '@tanstack/react-router';
|
import { useNavigate } from '@tanstack/react-router';
|
||||||
import { useAppStore, type ThemeMode } from '@/store/app-store';
|
import { useAppStore } from '@/store/app-store';
|
||||||
import { useOSDetection } from '@/hooks/use-os-detection';
|
import { useOSDetection } from '@/hooks/use-os-detection';
|
||||||
import { getElectronAPI, isElectron } from '@/lib/electron';
|
import { getElectronAPI, isElectron } from '@/lib/electron';
|
||||||
import { initializeProject } from '@/lib/project-init';
|
import { initializeProject } from '@/lib/project-init';
|
||||||
@@ -76,14 +76,11 @@ export function DashboardView() {
|
|||||||
|
|
||||||
const {
|
const {
|
||||||
projects,
|
projects,
|
||||||
trashedProjects,
|
|
||||||
currentProject,
|
|
||||||
upsertAndSetCurrentProject,
|
upsertAndSetCurrentProject,
|
||||||
addProject,
|
addProject,
|
||||||
setCurrentProject,
|
setCurrentProject,
|
||||||
toggleProjectFavorite,
|
toggleProjectFavorite,
|
||||||
moveProjectToTrash,
|
moveProjectToTrash,
|
||||||
theme: globalTheme,
|
|
||||||
} = useAppStore();
|
} = useAppStore();
|
||||||
|
|
||||||
const [showNewProjectModal, setShowNewProjectModal] = useState(false);
|
const [showNewProjectModal, setShowNewProjectModal] = useState(false);
|
||||||
@@ -143,12 +140,8 @@ export function DashboardView() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const trashedProject = trashedProjects.find((p) => p.path === path);
|
// Theme handling (trashed project recovery or undefined for global) is done by the store
|
||||||
const effectiveTheme =
|
upsertAndSetCurrentProject(path, name);
|
||||||
(trashedProject?.theme as ThemeMode | undefined) ||
|
|
||||||
(currentProject?.theme as ThemeMode | undefined) ||
|
|
||||||
globalTheme;
|
|
||||||
upsertAndSetCurrentProject(path, name, effectiveTheme);
|
|
||||||
|
|
||||||
toast.success('Project opened', {
|
toast.success('Project opened', {
|
||||||
description: `Opened ${name}`,
|
description: `Opened ${name}`,
|
||||||
@@ -164,15 +157,7 @@ export function DashboardView() {
|
|||||||
setIsOpening(false);
|
setIsOpening(false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[
|
[projects, upsertAndSetCurrentProject, navigate, moveProjectToTrash]
|
||||||
projects,
|
|
||||||
trashedProjects,
|
|
||||||
currentProject,
|
|
||||||
globalTheme,
|
|
||||||
upsertAndSetCurrentProject,
|
|
||||||
navigate,
|
|
||||||
moveProjectToTrash,
|
|
||||||
]
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleOpenProject = useCallback(async () => {
|
const handleOpenProject = useCallback(async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user