Enhance voice search to include gender, age, use case, and ID with results counter

This commit is contained in:
DJP 2025-12-10 22:31:38 -05:00
parent e1405d4b6a
commit 5dc665d818

View file

@ -182,7 +182,11 @@ export default function VoicesAdminPage() {
const matchesSearch =
voice.name.toLowerCase().includes(searchQuery.toLowerCase()) ||
voice.description?.toLowerCase().includes(searchQuery.toLowerCase()) ||
voice.labels?.accent?.toLowerCase().includes(searchQuery.toLowerCase());
voice.labels?.accent?.toLowerCase().includes(searchQuery.toLowerCase()) ||
voice.labels?.gender?.toLowerCase().includes(searchQuery.toLowerCase()) ||
voice.labels?.age?.toLowerCase().replace('_', ' ').includes(searchQuery.toLowerCase()) ||
voice.labels?.use_case?.toLowerCase().includes(searchQuery.toLowerCase()) ||
voice.voice_id.toLowerCase().includes(searchQuery.toLowerCase());
const matchesCategory = !categoryFilter || voice.category === categoryFilter;
@ -251,7 +255,7 @@ export default function VoicesAdminPage() {
type="text"
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
placeholder="Search voices by name, accent..."
placeholder="Search by name, accent, gender, age, use case, or ID..."
className="input-field pl-10"
/>
</div>
@ -270,6 +274,13 @@ export default function VoicesAdminPage() {
</select>
</div>
{/* Results Counter */}
{searchQuery && (
<div className="text-sm text-gray-400">
Showing <span className="text-forge-yellow font-medium">{filteredVoices.length}</span> of {voices.length} voices
</div>
)}
{/* Stats */}
<div className="grid grid-cols-4 gap-4">
<div className="bg-forge-dark rounded-xl border border-gray-800 p-4">
@ -354,11 +365,10 @@ export default function VoicesAdminPage() {
</div>
<button
onClick={() => handlePlayPreview(voice)}
className={`p-2 rounded-lg transition-colors ${
playingVoiceId === voice.voice_id
? 'bg-forge-yellow text-black'
: 'bg-forge-gray text-gray-400 hover:text-white'
}`}
className={`p-2 rounded-lg transition-colors ${playingVoiceId === voice.voice_id
? 'bg-forge-yellow text-black'
: 'bg-forge-gray text-gray-400 hover:text-white'
}`}
>
{playingVoiceId === voice.voice_id ? (
<Pause className="w-4 h-4" />
@ -401,11 +411,10 @@ export default function VoicesAdminPage() {
<div className="flex items-center gap-1">
<button
onClick={() => handleSaveVoice(voice.voice_id)}
className={`p-1.5 transition-colors ${
savedVoices.has(voice.voice_id)
? 'text-forge-yellow'
: 'text-gray-400 hover:text-forge-yellow'
}`}
className={`p-1.5 transition-colors ${savedVoices.has(voice.voice_id)
? 'text-forge-yellow'
: 'text-gray-400 hover:text-forge-yellow'
}`}
title={savedVoices.has(voice.voice_id) ? 'Remove from library' : 'Add to library'}
>
<BookmarkPlus className="w-4 h-4" />