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:
@@ -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')}
|
||||
|
||||
Reference in New Issue
Block a user