From af1543135d42adc2e97dc5243aeef7418cd3b00d Mon Sep 17 00:00:00 2001
From: Matthias Nott <mnott@mnsoft.org>
Date: Sat, 07 Mar 2026 08:39:26 +0100
Subject: [PATCH] feat: dual address auto-switch, custom icon, notifications, image support
---
components/chat/InputBar.tsx | 52 +++++++++++++++++++++++++++++++---------------------
1 files changed, 31 insertions(+), 21 deletions(-)
diff --git a/components/chat/InputBar.tsx b/components/chat/InputBar.tsx
index 6f1bc35..ee2fa20 100644
--- a/components/chat/InputBar.tsx
+++ b/components/chat/InputBar.tsx
@@ -8,22 +8,30 @@
} from "react-native";
import * as Haptics from "expo-haptics";
import { VoiceButton } from "./VoiceButton";
+import { useTheme } from "../../contexts/ThemeContext";
interface InputBarProps {
onSendText: (text: string) => void;
+ onVoiceRecorded: (uri: string) => void;
onReplay: () => void;
isTextMode: boolean;
onToggleMode: () => void;
+ audioPlaying?: boolean;
}
export function InputBar({
onSendText,
+ onVoiceRecorded,
onReplay,
isTextMode,
onToggleMode,
+ audioPlaying = false,
}: InputBarProps) {
const [text, setText] = useState("");
const inputRef = useRef<TextInput>(null);
+ const { colors } = useTheme();
+
+ const canSend = !!text.trim();
const handleSend = useCallback(() => {
const trimmed = text.trim();
@@ -43,11 +51,11 @@
paddingVertical: 10,
paddingBottom: 6,
borderTopWidth: 1,
- borderTopColor: "#2E2E45",
+ borderTopColor: colors.border,
alignItems: "center",
}}
>
- {/* Replay last message */}
+ {/* Replay / Stop */}
<Pressable
onPress={() => {
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
@@ -61,19 +69,21 @@
borderRadius: 34,
alignItems: "center",
justifyContent: "center",
- backgroundColor: "#1A2E1A",
+ backgroundColor: colors.bgTertiary,
borderWidth: 1.5,
- borderColor: "#3A6A3A",
+ borderColor: colors.border,
}}
>
- <Text style={{ fontSize: 24 }}>▶</Text>
- <Text style={{ color: "#8ABF8A", fontSize: 10, marginTop: 1, fontWeight: "600" }}>Replay</Text>
+ <Text style={{ fontSize: 24 }}>{audioPlaying ? "\u23F8" : "\u25B6"}</Text>
+ <Text style={{ color: colors.textSecondary, fontSize: 10, marginTop: 1, fontWeight: "600" }}>
+ {audioPlaying ? "Stop" : "Replay"}
+ </Text>
</View>
</Pressable>
- {/* Talk button — center, biggest */}
+ {/* Talk button */}
<View style={{ flex: 1, alignItems: "center" }}>
- <VoiceButton onTranscript={onSendText} />
+ <VoiceButton onVoiceRecorded={onVoiceRecorded} />
</View>
{/* Text mode toggle */}
@@ -91,12 +101,12 @@
borderRadius: 34,
alignItems: "center",
justifyContent: "center",
- backgroundColor: "#1A1A3E",
+ backgroundColor: colors.bgTertiary,
borderWidth: 1.5,
- borderColor: "#3A3A7A",
+ borderColor: colors.border,
}}
>
- <Text style={{ fontSize: 22, color: "#9898D0", fontWeight: "700" }}>Aa</Text>
+ <Text style={{ fontSize: 22, color: colors.textSecondary, fontWeight: "700" }}>Aa</Text>
</View>
</Pressable>
</View>
@@ -112,7 +122,7 @@
paddingHorizontal: 12,
paddingVertical: 8,
borderTopWidth: 1,
- borderTopColor: "#2E2E45",
+ borderTopColor: colors.border,
alignItems: "flex-end",
}}
>
@@ -129,11 +139,11 @@
borderRadius: 20,
alignItems: "center",
justifyContent: "center",
- backgroundColor: "#1E1E2E",
+ backgroundColor: colors.bgTertiary,
marginBottom: 2,
}}
>
- <Text style={{ fontSize: 20 }}>🎤</Text>
+ <Text style={{ fontSize: 20 }}>{"\uD83C\uDFA4"}</Text>
</Pressable>
{/* Text input */}
@@ -142,7 +152,7 @@
value={text}
onChangeText={setText}
placeholder="Message PAI..."
- placeholderTextColor="#5A5A78"
+ placeholderTextColor={colors.textMuted}
multiline
maxLength={2000}
onSubmitEditing={handleSend}
@@ -150,12 +160,12 @@
blurOnSubmit
style={{
flex: 1,
- backgroundColor: "#1E1E2E",
+ backgroundColor: colors.bgTertiary,
borderRadius: 20,
paddingHorizontal: 16,
paddingVertical: 10,
maxHeight: 120,
- color: "#E8E8F0",
+ color: colors.text,
fontSize: 16,
}}
/>
@@ -163,7 +173,7 @@
{/* Send button */}
<Pressable
onPress={handleSend}
- disabled={!text.trim()}
+ disabled={!canSend}
style={{
width: 40,
height: 40,
@@ -171,17 +181,17 @@
alignItems: "center",
justifyContent: "center",
marginBottom: 2,
- backgroundColor: text.trim() ? "#4A9EFF" : "#1E1E2E",
+ backgroundColor: canSend ? colors.accent : colors.bgTertiary,
}}
>
<Text
style={{
fontSize: 18,
fontWeight: "bold",
- color: text.trim() ? "#FFFFFF" : "#5A5A78",
+ color: canSend ? "#FFFFFF" : colors.textMuted,
}}
>
- ↑
+ {"\u2191"}
</Text>
</Pressable>
</View>
--
Gitblit v1.3.1