mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-02 08:33:36 +00:00
feat: enhance project management with custom icon support and UI improvements
- Introduced custom icon functionality for projects, allowing users to upload and manage their own icons. - Updated Project and ProjectRef types to include customIconPath. - Enhanced the ProjectSwitcher component to display custom icons alongside preset icons. - Added EditProjectDialog for inline editing of project details, including icon uploads. - Improved AppearanceSection to support custom icon uploads and display. - Updated sidebar and project switcher UI for better user experience and accessibility. Implements #469
This commit is contained in:
@@ -874,6 +874,7 @@ export interface AppActions {
|
||||
clearProjectHistory: () => void; // Clear history, keeping only current project
|
||||
toggleProjectFavorite: (projectId: string) => void; // Toggle project favorite status
|
||||
setProjectIcon: (projectId: string, icon: string | null) => void; // Set project icon (null to clear)
|
||||
setProjectCustomIcon: (projectId: string, customIconPath: string | null) => void; // Set custom project icon image path (null to clear)
|
||||
setProjectName: (projectId: string, name: string) => void; // Update project name
|
||||
|
||||
// View actions
|
||||
@@ -1579,6 +1580,25 @@ export const useAppStore = create<AppState & AppActions>()((set, get) => ({
|
||||
}
|
||||
},
|
||||
|
||||
setProjectCustomIcon: (projectId, customIconPath) => {
|
||||
const { projects, currentProject } = get();
|
||||
const updatedProjects = projects.map((p) =>
|
||||
p.id === projectId
|
||||
? { ...p, customIconPath: customIconPath === null ? undefined : customIconPath }
|
||||
: p
|
||||
);
|
||||
set({ projects: updatedProjects });
|
||||
// Also update currentProject if it matches
|
||||
if (currentProject?.id === projectId) {
|
||||
set({
|
||||
currentProject: {
|
||||
...currentProject,
|
||||
customIconPath: customIconPath === null ? undefined : customIconPath,
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
setProjectName: (projectId, name) => {
|
||||
const { projects, currentProject } = get();
|
||||
const updatedProjects = projects.map((p) => (p.id === projectId ? { ...p, name } : p));
|
||||
|
||||
Reference in New Issue
Block a user