feat: add My Scripts/Team Scripts tabs and Build button to Script Library

- Add language field to ScriptTemplateListItem frontend type
- Add mine/shared params to scriptsApi.getTemplates
- Update scriptGeneratorStore.loadTemplates to accept filter params
- Reorganize ScriptLibraryPage with tab bar (My Scripts / Team Scripts)
- Add "Build a New Script" button linking to /script-builder

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Michael Chihlas
2026-03-21 17:17:47 -04:00
parent 628761473f
commit 535284c4ce
4 changed files with 70 additions and 20 deletions

View File

@@ -30,7 +30,7 @@ interface ScriptGeneratorState {
// Actions
loadCategories: () => Promise<void>
loadTemplates: () => Promise<void>
loadTemplates: (filters?: { mine?: boolean; shared?: boolean }) => Promise<void>
selectTemplate: (id: string) => Promise<void>
setCategory: (id: string | null) => void
setSearch: (query: string) => void
@@ -67,14 +67,16 @@ export const useScriptGeneratorStore = create<ScriptGeneratorState>()((set, get)
}
},
loadTemplates: async () => {
loadTemplates: async (filters) => {
set({ isLoadingTemplates: true })
try {
const { activeCategoryId, categories, searchQuery } = get()
const category = categories.find(c => c.id === activeCategoryId)
const params: { category_slug?: string; search?: string } = {}
const params: { category_slug?: string; search?: string; mine?: boolean; shared?: boolean } = {}
if (category) params.category_slug = category.slug
if (searchQuery) params.search = searchQuery
if (filters?.mine) params.mine = true
if (filters?.shared) params.shared = true
const templates = await scriptsApi.getTemplates(params)
set({ templates, isLoadingTemplates: false })
} catch {