import { FC, useState } from 'react';
const CallScreen: FC = () => {
const [callStatus, setCallStatus] = useState<'idle' | 'calling' | 'connected'>('idle');
const [selectedLanguage, setSelectedLanguage] = useState('zh-en');
const handleStartCall = () => {
setCallStatus('calling');
// 模拟连接过程
setTimeout(() => {
setCallStatus('connected');
}, 2000);
};
const handleEndCall = () => {
setCallStatus('idle');
};
const languageOptions = [
{ value: 'zh-en', label: '中文 ⇄ 英文' },
{ value: 'zh-es', label: '中文 ⇄ 西班牙文' },
{ value: 'zh-fr', label: '中文 ⇄ 法文' },
{ value: 'zh-ja', label: '中文 ⇄ 日文' },
{ value: 'zh-ko', label: '中文 ⇄ 韩文' },
];
return (
{/* 语言选择 */}
选择翻译语言
{/* 通话状态 */}
{callStatus === 'idle' && (
📞
准备开始通话
点击下方按钮开始翻译通话
)}
{callStatus === 'calling' && (
📞
正在连接...
请稍候,正在为您连接译员
●
●
●
)}
{callStatus === 'connected' && (
✅
通话中
译员已连接,可以开始对话
{/* 通话控制 */}
{/* 通话信息 */}
)}
{/* 快速操作 */}
快速操作
);
};
const styles = {
container: {
display: 'flex',
flexDirection: 'column' as const,
height: '100%',
backgroundColor: '#f5f5f5',
},
content: {
flex: 1,
padding: '16px',
paddingBottom: '100px',
},
section: {
marginBottom: '24px',
},
sectionTitle: {
fontSize: '18px',
fontWeight: 'bold',
color: '#333',
margin: '0 0 16px 0',
},
languageSelect: {
width: '100%',
padding: '12px',
fontSize: '16px',
border: '1px solid #d9d9d9',
borderRadius: '8px',
backgroundColor: '#fff',
},
callContainer: {
display: 'flex',
flexDirection: 'column' as const,
alignItems: 'center',
justifyContent: 'center',
minHeight: '300px',
backgroundColor: '#fff',
borderRadius: '16px',
padding: '32px',
marginBottom: '24px',
boxShadow: '0 4px 12px rgba(0, 0, 0, 0.1)',
},
idleState: {
textAlign: 'center' as const,
},
callingState: {
textAlign: 'center' as const,
},
connectedState: {
textAlign: 'center' as const,
width: '100%',
},
callIcon: {
fontSize: '64px',
marginBottom: '16px',
},
pulsingIcon: {
fontSize: '64px',
marginBottom: '16px',
animation: 'pulse 1.5s ease-in-out infinite alternate',
},
connectedIcon: {
fontSize: '64px',
marginBottom: '16px',
},
statusText: {
fontSize: '24px',
fontWeight: 'bold',
color: '#333',
margin: '0 0 8px 0',
},
statusSubtext: {
fontSize: '16px',
color: '#666',
margin: '0 0 24px 0',
},
startButton: {
backgroundColor: '#52c41a',
color: '#fff',
border: 'none',
borderRadius: '50px',
padding: '16px 32px',
fontSize: '18px',
fontWeight: 'bold',
cursor: 'pointer',
transition: 'background-color 0.3s ease',
},
loadingDots: {
display: 'flex',
gap: '8px',
justifyContent: 'center',
},
callControls: {
display: 'flex',
gap: '16px',
justifyContent: 'center',
margin: '24px 0',
},
muteButton: {
backgroundColor: '#1890ff',
color: '#fff',
border: 'none',
borderRadius: '50%',
width: '56px',
height: '56px',
fontSize: '20px',
cursor: 'pointer',
},
endButton: {
backgroundColor: '#ff4d4f',
color: '#fff',
border: 'none',
borderRadius: '50px',
padding: '16px 24px',
fontSize: '16px',
fontWeight: 'bold',
cursor: 'pointer',
},
speakerButton: {
backgroundColor: '#1890ff',
color: '#fff',
border: 'none',
borderRadius: '50%',
width: '56px',
height: '56px',
fontSize: '20px',
cursor: 'pointer',
},
callInfo: {
display: 'flex',
justifyContent: 'space-around',
width: '100%',
marginTop: '24px',
},
infoItem: {
display: 'flex',
flexDirection: 'column' as const,
alignItems: 'center',
},
infoLabel: {
fontSize: '14px',
color: '#666',
marginBottom: '4px',
},
infoValue: {
fontSize: '16px',
fontWeight: 'bold',
color: '#333',
},
quickActions: {
display: 'grid',
gridTemplateColumns: 'repeat(3, 1fr)',
gap: '12px',
},
actionButton: {
display: 'flex',
flexDirection: 'column' as const,
alignItems: 'center',
padding: '16px 8px',
backgroundColor: '#fff',
border: 'none',
borderRadius: '12px',
cursor: 'pointer',
boxShadow: '0 2px 8px rgba(0, 0, 0, 0.1)',
},
actionIcon: {
fontSize: '24px',
marginBottom: '8px',
},
actionLabel: {
fontSize: '12px',
color: '#666',
textAlign: 'center' as const,
},
};
export default CallScreen;