Files
news-reader-actions-test/components/VoiceSelector.tsx
Anthony 0775104b69 feat: Initialize project with basic structure and dependencies
Sets up the foundational elements for the NewsCaster AI application. This includes:
- Initializing the project with Vite and React.
- Defining core types for articles and player state.
- Configuring build tools and TypeScript.
- Adding essential dependencies like React, Vite, and Google's Gemini API client.
- Providing initial README instructions for running locally.
- Setting up basic styling and structure in index.html.
- Defining available voices and playback constants.
- Implementing utility functions for audio handling.
2025-11-19 19:33:34 +08:00

30 lines
1018 B
TypeScript

import React from 'react';
import { VoiceName } from '../types';
import { AVAILABLE_VOICES } from '../constants';
import { Mic } from 'lucide-react';
interface VoiceSelectorProps {
selectedVoice: VoiceName;
onVoiceChange: (voice: VoiceName) => void;
disabled?: boolean;
}
export const VoiceSelector: React.FC<VoiceSelectorProps> = ({ selectedVoice, onVoiceChange, disabled }) => {
return (
<div className="flex items-center space-x-2">
<Mic className="w-4 h-4 text-slate-500" />
<select
value={selectedVoice}
onChange={(e) => onVoiceChange(e.target.value as VoiceName)}
disabled={disabled}
className="bg-white border border-slate-300 text-slate-700 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 disabled:opacity-50 disabled:cursor-not-allowed"
>
{AVAILABLE_VOICES.map((v) => (
<option key={v.name} value={v.name}>
{v.label}
</option>
))}
</select>
</div>
);
};