优化工作流,添加app-icon
This commit is contained in:
@@ -501,7 +501,6 @@ function ChatInputBar({
|
||||
styles.iconButton,
|
||||
pressed && styles.iconButtonPressed,
|
||||
]}
|
||||
disabled={disabled && !isRecording}
|
||||
accessibilityLabel={
|
||||
inputMode === 'text' ? switchToVoiceLabel : switchToTextLabel
|
||||
}
|
||||
@@ -510,11 +509,7 @@ function ChatInputBar({
|
||||
<Icon
|
||||
as={inputMode === 'text' ? Mic : Type}
|
||||
size={22}
|
||||
color={
|
||||
disabled && !isRecording
|
||||
? 'rgba(141, 140, 144, 0.56)'
|
||||
: CHAT_COLORS.onSurfaceVariant
|
||||
}
|
||||
color={CHAT_COLORS.onSurfaceVariant}
|
||||
/>
|
||||
</Pressable>
|
||||
{/* 中间:文字输入 或 语音录制按钮 */}
|
||||
@@ -531,7 +526,7 @@ function ChatInputBar({
|
||||
scrollEnabled
|
||||
textAlignVertical="top"
|
||||
maxLength={2000}
|
||||
editable={!disabled}
|
||||
editable
|
||||
onContentSizeChange={onInputContentSizeChange}
|
||||
onSubmitEditing={onSend}
|
||||
returnKeyType="send"
|
||||
@@ -715,6 +710,15 @@ export default function ConversationScreen() {
|
||||
const handleSend = () => {
|
||||
const text = input.trim();
|
||||
if (!text) return;
|
||||
if (connectionState !== 'connected') {
|
||||
Alert.alert(
|
||||
t('chatUnavailableTitle'),
|
||||
connectionState === 'connecting'
|
||||
? t('chatUnavailableConnecting')
|
||||
: t('chatUnavailableDisconnected'),
|
||||
);
|
||||
return;
|
||||
}
|
||||
sendText(text);
|
||||
setInput('');
|
||||
setInputResetKey((k) => k + 1);
|
||||
@@ -726,6 +730,12 @@ export default function ConversationScreen() {
|
||||
: connectionState === 'connecting'
|
||||
? t('connectionConnecting')
|
||||
: t('connectionDisconnected');
|
||||
const showConnectionBadge = __DEV__;
|
||||
const showConnectionNotice = connectionState !== 'connected';
|
||||
const connectionNoticeText =
|
||||
connectionState === 'connecting'
|
||||
? t('chatUnavailableConnecting')
|
||||
: t('chatUnavailableDisconnected');
|
||||
|
||||
/** iOS:用键盘高度直接顶起根布局,替代 KAV(避免与 safe area 叠出缝,见 RN #52626) */
|
||||
const keyboardLift =
|
||||
@@ -744,22 +754,25 @@ export default function ConversationScreen() {
|
||||
title={
|
||||
<View style={styles.headerTitleBlock}>
|
||||
<Text style={styles.headerTitle}>{tApp('name')}</Text>
|
||||
<View
|
||||
style={[
|
||||
styles.statusBadge,
|
||||
connectionState === 'connected' && styles.statusBadgeConnected,
|
||||
]}
|
||||
>
|
||||
<Text
|
||||
{showConnectionBadge ? (
|
||||
<View
|
||||
style={[
|
||||
styles.statusBadgeText,
|
||||
styles.statusBadge,
|
||||
connectionState === 'connected' &&
|
||||
styles.statusBadgeTextConnected,
|
||||
styles.statusBadgeConnected,
|
||||
]}
|
||||
>
|
||||
{connectionLabel}
|
||||
</Text>
|
||||
</View>
|
||||
<Text
|
||||
style={[
|
||||
styles.statusBadgeText,
|
||||
connectionState === 'connected' &&
|
||||
styles.statusBadgeTextConnected,
|
||||
]}
|
||||
>
|
||||
{connectionLabel}
|
||||
</Text>
|
||||
</View>
|
||||
) : null}
|
||||
</View>
|
||||
}
|
||||
backAccessibilityLabel={t('chatTitle')}
|
||||
@@ -810,6 +823,16 @@ export default function ConversationScreen() {
|
||||
},
|
||||
]}
|
||||
>
|
||||
{showConnectionNotice ? (
|
||||
<View style={styles.connectionNotice}>
|
||||
<Text style={styles.connectionNoticeTitle}>
|
||||
{t('chatUnavailableTitle')}
|
||||
</Text>
|
||||
<Text style={styles.connectionNoticeText}>
|
||||
{connectionNoticeText}
|
||||
</Text>
|
||||
</View>
|
||||
) : null}
|
||||
<ChatInputBar
|
||||
value={input}
|
||||
onChangeText={setInput}
|
||||
@@ -1028,6 +1051,28 @@ const styles = StyleSheet.create({
|
||||
shadowRadius: 12,
|
||||
elevation: 8,
|
||||
},
|
||||
connectionNotice: {
|
||||
marginHorizontal: 14,
|
||||
marginTop: 14,
|
||||
marginBottom: 4,
|
||||
paddingHorizontal: 12,
|
||||
paddingVertical: 10,
|
||||
borderRadius: 14,
|
||||
backgroundColor: 'rgba(186, 26, 26, 0.08)',
|
||||
borderWidth: 1,
|
||||
borderColor: 'rgba(186, 26, 26, 0.14)',
|
||||
},
|
||||
connectionNoticeTitle: {
|
||||
fontSize: 13,
|
||||
fontWeight: '700',
|
||||
color: CHAT_COLORS.errorRed,
|
||||
marginBottom: 2,
|
||||
},
|
||||
connectionNoticeText: {
|
||||
fontSize: 13,
|
||||
lineHeight: 18,
|
||||
color: CHAT_COLORS.onSurface,
|
||||
},
|
||||
inputBar: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
|
||||
@@ -66,6 +66,9 @@ interface Resources {
|
||||
cancel: 'Cancel';
|
||||
cancelRecording: 'Cancel recording';
|
||||
chatTitle: 'Conversation';
|
||||
chatUnavailableConnecting: 'Reconnecting now. You can keep typing and send once the connection is back.';
|
||||
chatUnavailableDisconnected: 'Connection lost. You can keep typing and send after reconnecting.';
|
||||
chatUnavailableTitle: 'Chat unavailable';
|
||||
confirm: 'OK';
|
||||
confirmDeleteConversation: 'Are you sure you want to delete this conversation? It cannot be recovered.';
|
||||
connectionConnected: 'Connected';
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
{
|
||||
"confirmDeleteConversation": "Are you sure you want to delete this conversation? It cannot be recovered.",
|
||||
"createError": "Unable to create conversation. Please check your network and try again.",
|
||||
"chatUnavailableTitle": "Chat unavailable",
|
||||
"chatUnavailableConnecting": "Reconnecting now. You can keep typing and send once the connection is back.",
|
||||
"chatUnavailableDisconnected": "Connection lost. You can keep typing and send after reconnecting.",
|
||||
"confirm": "OK",
|
||||
"cancel": "Cancel",
|
||||
"delete": "Delete",
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
{
|
||||
"confirmDeleteConversation": "确定要删除此对话吗?删除后无法恢复。",
|
||||
"createError": "无法创建对话,请检查网络连接或稍后重试",
|
||||
"chatUnavailableTitle": "聊天暂不可用",
|
||||
"chatUnavailableConnecting": "正在重新连接。你仍可继续输入,恢复后再发送。",
|
||||
"chatUnavailableDisconnected": "当前连接已断开。你仍可先输入,连接恢复后再发送。",
|
||||
"confirm": "知道了",
|
||||
"cancel": "取消",
|
||||
"delete": "删除",
|
||||
|
||||
Reference in New Issue
Block a user