feat: default script library to 'All Scripts' tab showing all accessible scripts

Added 'All Scripts' as the first/default tab (no mine/shared filter) so the
page opens with every script the user can access. My Scripts and Team Scripts
tabs remain for filtered views.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
chihlasm
2026-04-01 06:01:58 +00:00
parent 1637d7de8f
commit 67a28664a9

View File

@@ -11,13 +11,13 @@ import { ParameterizeAndSavePanel } from '@/components/scripts/ParameterizeAndSa
import { scriptsApi } from '@/api'
import type { ScriptParameter } from '@/types'
type LibraryTab = 'mine' | 'team'
type LibraryTab = 'all' | 'mine' | 'team'
export default function ScriptLibraryPage() {
const [paneMode, setPaneMode] = useState<'browse' | 'configure'>('browse')
// inputValue owned here so it survives Configure ↔ Browse transitions
const [inputValue, setInputValue] = useState('')
const [activeTab, setActiveTab] = useState<LibraryTab>('mine')
const [activeTab, setActiveTab] = useState<LibraryTab>('all')
const loadCategories = useScriptGeneratorStore(s => s.loadCategories)
const loadTemplates = useScriptGeneratorStore(s => s.loadTemplates)
@@ -52,13 +52,19 @@ export default function ScriptLibraryPage() {
parameters_schema: payload.parameters_schema,
})
setShowImportPanel(false)
const filters = activeTab === 'mine' ? { mine: true } : { shared: true }
const filters =
activeTab === 'mine' ? { mine: true } :
activeTab === 'team' ? { shared: true } :
{}
loadTemplates(filters)
}
useEffect(() => {
loadCategories().then(() => {
const filters = activeTab === 'mine' ? { mine: true } : { shared: true }
const filters =
activeTab === 'mine' ? { mine: true } :
activeTab === 'team' ? { shared: true } :
{}
loadTemplates(filters)
})
}, [loadCategories, loadTemplates, activeTab])
@@ -132,6 +138,13 @@ export default function ScriptLibraryPage() {
{/* Tab bar */}
<div className="flex gap-6 border-b border-border">
<button
type="button"
onClick={() => onTabChange('all')}
className={`pb-2 text-sm font-medium transition-colors ${tabClass('all')}`}
>
All Scripts
</button>
<button
type="button"
onClick={() => onTabChange('mine')}