feat(03-01): add skill section type wiring, Zustand slice, i18n, and sidebar nav entry
- Add "skills" to SectionId union in shared types - Add SkillRecord, SkillImportResult, SkillUpdateStatus types to shared/types.ts - Create SkillSlice with skills list, selection, file path, and import modal state - Wire SkillSlice into Zustand store composition - Add "nav.skills" i18n keys for English and Chinese - Add Skills sidebar nav entry with PuzzlePiece icon between Communication and Documents - Add section === "skills" rendering route in App.tsx - Clear skill state on company switch - Add skills case to navigateTo in NavigationSlice Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
c1de05a7f1
commit
e8d642941f
9 files changed
+121
-1
No files matched your search
@@ -105,6 +105,7 @@ export const createNavigationSlice: StateCreator<
|
||||
else if (section === "connectors") state.selectedConnectorId = entityId;
|
||||
else if (section === "communication")
|
||||
state.selectedCommunicationEntityId = entityId;
|
||||
else if (section === "skills") state.selectedSkillId = entityId;
|
||||
}
|
||||
}),
|
||||
});
|
||||
@@ -0,0 +1,42 @@
|
||||
import type { StateCreator } from "zustand";
|
||||
import type { AppState } from "../store";
|
||||
import type { SkillRecord } from "@shared/types";
|
||||
|
||||
export interface SkillSlice {
|
||||
skills: SkillRecord[];
|
||||
setSkills: (skills: SkillRecord[]) => void;
|
||||
selectedSkillId: string | null;
|
||||
setSelectedSkillId: (id: string | null) => void;
|
||||
selectedSkillFilePath: string;
|
||||
setSelectedSkillFilePath: (path: string) => void;
|
||||
skillImportModalOpen: boolean;
|
||||
setSkillImportModalOpen: (open: boolean) => void;
|
||||
}
|
||||
|
||||
export const createSkillSlice: StateCreator<
|
||||
AppState,
|
||||
[["zustand/immer", never]],
|
||||
[],
|
||||
SkillSlice
|
||||
> = (set) => ({
|
||||
skills: [],
|
||||
setSkills: (skills) =>
|
||||
set((state) => {
|
||||
state.skills = skills;
|
||||
}),
|
||||
selectedSkillId: null,
|
||||
setSelectedSkillId: (id) =>
|
||||
set((state) => {
|
||||
state.selectedSkillId = id;
|
||||
}),
|
||||
selectedSkillFilePath: "SKILL.md",
|
||||
setSelectedSkillFilePath: (path) =>
|
||||
set((state) => {
|
||||
state.selectedSkillFilePath = path;
|
||||
}),
|
||||
skillImportModalOpen: false,
|
||||
setSkillImportModalOpen: (open) =>
|
||||
set((state) => {
|
||||
state.skillImportModalOpen = open;
|
||||
}),
|
||||
});
|
||||
@@ -16,13 +16,15 @@ import {
|
||||
type CommunicationSlice,
|
||||
} from "./slices/communication";
|
||||
import { createSocialSlice, type SocialSlice } from "./slices/social";
|
||||
import { createSkillSlice, type SkillSlice } from "./slices/skill";
|
||||
|
||||
export type AppState = NavigationSlice &
|
||||
CompanySlice &
|
||||
SelectionSlice &
|
||||
UiSlice &
|
||||
CommunicationSlice &
|
||||
SocialSlice;
|
||||
SocialSlice &
|
||||
SkillSlice;
|
||||
|
||||
export const useAppStore = create<AppState>()(
|
||||
devtools(
|
||||
@@ -33,6 +35,7 @@ export const useAppStore = create<AppState>()(
|
||||
...createUiSlice(...a),
|
||||
...createCommunicationSlice(...a),
|
||||
...createSocialSlice(...a),
|
||||
...createSkillSlice(...a),
|
||||
})),
|
||||
{
|
||||
name: "AgentCompany",
|
||||
|
||||
Reference in new issue
Block a user