Live video on the AT Protocol

Merge pull request #331 from streamplace/natb/weird-chat-alignment

chat: rework layout so it's much more useable on mobile

authored by Eli Mallon and committed by GitHub 3228a41e 4118e062

+31 -14
+9 -5
js/app/components/mobile/chat.tsx
··· 4 4 5 5 export function ChatPanel() { 6 6 return ( 7 - <> 8 - <View style={[flex.shrink[1], px[4]]}> 9 - <Chat /> 10 - </View> 7 + <View 8 + style={[ 9 + layout.flex.column, 10 + flex.shrink[1], 11 + { width: "100%", maxWidth: "100%" }, 12 + ]} 13 + > 14 + <Chat /> 11 15 <View style={[layout.flex.column, gap.all[2], px[4], py[2]]}> 12 16 <ChatBox chatBoxStyle={{ borderRadius: borderRadius.xl }} /> 13 17 </View> 14 - </> 18 + </View> 15 19 ); 16 20 }
+16 -5
js/app/components/mobile/ui.tsx
··· 13 13 useSegmentTiming as useSegmentMetrics, 14 14 View, 15 15 } from "@streamplace/components"; 16 + import { bottom, zIndex } from "@streamplace/components/src/lib/theme/atoms"; 16 17 import { ChevronLeft, SwitchCamera } from "lucide-react-native"; 17 18 import { useEffect } from "react"; 18 19 import { Image, Pressable } from "react-native"; ··· 150 151 slideKeyboard={slideKeyboard} 151 152 /> 152 153 ) : ( 153 - <Resizable 154 - isPlayerRatioGreater={isPlayerRatioGreater} 155 - slideKeyboard={slideKeyboard} 154 + <View 155 + style={[ 156 + isPlayerRatioGreater 157 + ? layout.position.absolute 158 + : layout.position.relative, 159 + zIndex[50], 160 + bottom[0], 161 + ]} 156 162 > 157 - <ChatPanel /> 158 - </Resizable> 163 + <Resizable 164 + isPlayerRatioGreater={isPlayerRatioGreater} 165 + slideKeyboard={slideKeyboard} 166 + > 167 + <ChatPanel /> 168 + </Resizable> 169 + </View> 159 170 )} 160 171 161 172 <PlayerUI.CountdownOverlay
+4 -2
js/components/src/components/chat/chat-box.tsx
··· 11 11 useSetReplyToMessage, 12 12 View, 13 13 } from "../../"; 14 - import { bg, gap, h, layout, mb, pl, pr, w } from "../../lib/theme/atoms"; 14 + import { bg, flex, gap, h, layout, mb, pl, pr, w } from "../../lib/theme/atoms"; 15 15 import { Textarea } from "../ui/textarea"; 16 16 import { RenderChatMessage } from "./chat-message"; 17 17 import { MentionSuggestions } from "./mention-suggestions"; ··· 92 92 }, [replyTo]); 93 93 94 94 return ( 95 - <View style={{ position: "relative" }}> 95 + <View style={[layout.flex.column, flex.shrink[1], gap.all[2]]}> 96 96 {replyTo && ( 97 97 <View 98 98 style={[ ··· 134 134 ref={textAreaRef} 135 135 numberOfLines={1} 136 136 value={message} 137 + enterKeyHint="send" 138 + multiline={false} 137 139 onChangeText={(text) => { 138 140 setMessage(text); 139 141 updateSuggestions(text);
+2 -2
js/components/src/components/ui/textarea.tsx
··· 1 1 import * as React from "react"; 2 2 import { TextInput, type TextInputProps } from "react-native"; 3 - import { bg, borders, p, text, w } from "../../lib/theme/atoms"; 3 + import { bg, borders, flex, p, text } from "../../lib/theme/atoms"; 4 4 5 5 function Textarea({ 6 6 style, ··· 13 13 return ( 14 14 <TextInput 15 15 style={[ 16 - w.percent[100], 16 + flex.values[1], 17 17 borders.width.thin, 18 18 borders.color.gray[400], 19 19 bg.gray[900],