Replace filter dropdowns with toggle buttons on Requests page
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+24
-23
@@ -41,33 +41,34 @@ export default function Requests() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style={{ display: 'flex', gap: 10, marginBottom: 20, flexWrap: 'wrap' }}>
|
{companies.length > 0 && (
|
||||||
<select
|
<div style={{ display: 'flex', gap: 6, flexWrap: 'wrap', marginBottom: 10 }}>
|
||||||
value={filterCompany}
|
<button className={`btn btn-sm ${!filterCompany ? 'btn-primary' : 'btn-outline'}`} onClick={() => setFilterCompany('')}>All</button>
|
||||||
onChange={e => setFilterCompany(e.target.value)}
|
|
||||||
style={{ minWidth: 160 }}
|
|
||||||
>
|
|
||||||
<option value="">All Companies</option>
|
|
||||||
{companies.map(co => (
|
{companies.map(co => (
|
||||||
<option key={co.id} value={co.id}>{co.name}</option>
|
<button
|
||||||
))}
|
key={co.id}
|
||||||
</select>
|
className={`btn btn-sm ${filterCompany === co.id ? 'btn-primary' : 'btn-outline'}`}
|
||||||
<select
|
onClick={() => setFilterCompany(f => f === co.id ? '' : co.id)}
|
||||||
value={filterUser}
|
|
||||||
onChange={e => setFilterUser(e.target.value)}
|
|
||||||
style={{ minWidth: 160 }}
|
|
||||||
>
|
>
|
||||||
<option value="">All Users</option>
|
{co.name}
|
||||||
{[...new Set(submissions.map(s => s.submitted_by_name).filter(Boolean))].sort().map(name => (
|
|
||||||
<option key={name} value={name}>{name}</option>
|
|
||||||
))}
|
|
||||||
</select>
|
|
||||||
{(filterCompany || filterUser) && (
|
|
||||||
<button className="btn btn-outline btn-sm" onClick={() => { setFilterCompany(''); setFilterUser(''); }}>
|
|
||||||
Clear Filters
|
|
||||||
</button>
|
</button>
|
||||||
)}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
|
{[...new Set(submissions.map(s => s.submitted_by_name).filter(Boolean))].sort().length > 0 && (
|
||||||
|
<div style={{ display: 'flex', gap: 6, flexWrap: 'wrap', marginBottom: 20 }}>
|
||||||
|
<button className={`btn btn-sm ${!filterUser ? 'btn-primary' : 'btn-outline'}`} onClick={() => setFilterUser('')}>All Users</button>
|
||||||
|
{[...new Set(submissions.map(s => s.submitted_by_name).filter(Boolean))].sort().map(name => (
|
||||||
|
<button
|
||||||
|
key={name}
|
||||||
|
className={`btn btn-sm ${filterUser === name ? 'btn-primary' : 'btn-outline'}`}
|
||||||
|
onClick={() => setFilterUser(f => f === name ? '' : name)}
|
||||||
|
>
|
||||||
|
{name}
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
{submissions.length === 0 ? (
|
{submissions.length === 0 ? (
|
||||||
<div className="empty-state">
|
<div className="empty-state">
|
||||||
|
|||||||
Reference in New Issue
Block a user