Live video on the AT Protocol
79
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix system message, nick color in temp message

+37 -55
+4 -5
js/components/src/components/chat/chat-message.tsx
··· 17 17 pl, 18 18 w, 19 19 } from "../../lib/theme/atoms"; 20 - import { atoms, layout } from "../ui"; 20 + import { atoms, colors, layout } from "../ui"; 21 21 22 22 interface Facet { 23 23 index: { ··· 35 35 import { Text } from "../ui/text"; 36 36 37 37 const getRgbColor = (color?: { red: number; green: number; blue: number }) => 38 - color ? `rgb(${color.red}, ${color.green}, ${color.blue})` : "$accentColor"; 38 + color ? `rgb(${color.red}, ${color.green}, ${color.blue})` : colors.gray[500]; 39 39 40 40 const segmentedObject = ( 41 41 obj: RichtextSegment, ··· 114 114 hour12: false, 115 115 }); 116 116 }, []); 117 - 118 117 return ( 119 118 <> 120 119 {item.replyTo && showReply && ( ··· 141 140 </Text>{" "} 142 141 <Text 143 142 style={{ 144 - color: atoms.colors.gray[300], 143 + color: colors.gray[300], 145 144 fontStyle: "italic", 146 145 }} 147 146 > ··· 155 154 <Text 156 155 style={{ 157 156 fontVariant: ["tabular-nums"], 158 - color: atoms.colors.gray[300], 157 + color: colors.gray[400], 159 158 }} 160 159 > 161 160 {formatTime(item.record.createdAt)}
+31 -48
js/components/src/components/chat/chat.tsx
··· 1 - import { Reply, ShieldEllipsis } from "lucide-react-native"; 1 + import { Ellipsis, Reply, ShieldEllipsis } from "lucide-react-native"; 2 2 import { ComponentProps, memo, useEffect, useRef, useState } from "react"; 3 3 import { FlatList, Platform, Pressable } from "react-native"; 4 4 import Swipeable, { ··· 14 14 Text, 15 15 useChat, 16 16 usePlayerStore, 17 - usePointerDevice, 18 17 useSetReplyToMessage, 19 18 View, 20 19 } from "../../"; ··· 63 62 ({ 64 63 item, 65 64 visible, 66 - canModerate, 67 65 hoverTimeoutRef, 68 66 }: { 69 67 item: ChatMessageViewHydrated; 70 68 visible: boolean; 71 - canModerate: boolean; 72 69 hoverTimeoutRef: React.MutableRefObject<NodeJS.Timeout | null>; 73 70 }) => { 74 71 const setReply = useSetReplyToMessage(); ··· 112 109 > 113 110 <Reply color="white" size={16} /> 114 111 </Pressable> 115 - {canModerate && ( 116 - <Pressable 117 - onPress={() => setModMsg(item)} 118 - style={[ 119 - { 120 - padding: 6, 121 - borderRadius: 4, 122 - backgroundColor: "rgba(255, 255, 255, 0.1)", 123 - }, 124 - ]} 125 - onHoverIn={() => { 126 - // Keep the actions bar visible when hovering over it 127 - if (hoverTimeoutRef.current) { 128 - clearTimeout(hoverTimeoutRef.current); 129 - hoverTimeoutRef.current = null; 130 - } 131 - }} 132 - > 133 - <ShieldEllipsis color="white" size={16} /> 134 - </Pressable> 135 - )} 112 + <Pressable 113 + onPress={() => setModMsg(item)} 114 + style={[ 115 + { 116 + padding: 6, 117 + borderRadius: 4, 118 + backgroundColor: "rgba(255, 255, 255, 0.1)", 119 + }, 120 + ]} 121 + onHoverIn={() => { 122 + // Keep the actions bar visible when hovering over it 123 + if (hoverTimeoutRef.current) { 124 + clearTimeout(hoverTimeoutRef.current); 125 + hoverTimeoutRef.current = null; 126 + } 127 + }} 128 + > 129 + <Ellipsis color="white" size={16} /> 130 + </Pressable> 136 131 </View> 137 132 ); 138 133 }, ··· 149 144 const setReply = useSetReplyToMessage(); 150 145 const setModMsg = usePlayerStore((state) => state.setModMessage); 151 146 const swipeableRef = useRef<SwipeableMethods | null>(null); 152 - const { isMouseDriven } = usePointerDevice(); 153 147 const [isHovered, setIsHovered] = useState(false); 154 148 const hoverTimeoutRef = useRef<NodeJS.Timeout | null>(null); 155 149 ··· 175 169 }; 176 170 }, []); 177 171 178 - // Check if this is a system message 179 - const isSystemMessage = item.author.did === "did:sys:system"; 180 - 181 - // For system messages, render without swipe gestures 182 - if (isSystemMessage) { 172 + if (item.author.did === "did:sys:system") { 183 173 return ( 184 - <View style={[py[1]]}> 185 - <SystemMessage 186 - title={item.record.text} 187 - timestamp={new Date(item.record.createdAt)} 188 - /> 189 - </View> 174 + <SystemMessage 175 + timestamp={new Date(item.record.createdAt)} 176 + title={item.record.text} 177 + /> 190 178 ); 191 179 } 192 180 193 - if (isMouseDriven) { 181 + if (Platform.OS === "web") { 194 182 return ( 195 183 <View 196 184 style={[ ··· 202 190 onPointerEnter={handleHoverIn} 203 191 onPointerLeave={handleHoverOut} 204 192 > 205 - <Pressable 206 - onLongPress={canModerate ? () => setModMsg(item) : undefined} 207 - > 193 + <Pressable> 208 194 <RenderChatMessage item={item} /> 209 195 </Pressable> 210 196 <ActionsBar 211 197 item={item} 212 198 visible={isHovered} 213 - canModerate={canModerate} 214 199 hoverTimeoutRef={hoverTimeoutRef} 215 200 /> 216 201 </View> ··· 218 203 } 219 204 220 205 return ( 221 - <Pressable onLongPress={canModerate ? () => setModMsg(item) : undefined}> 206 + <> 222 207 <Swipeable 223 208 containerStyle={[py[1]]} 224 209 friction={2} 225 210 enableTrackpadTwoFingerGesture 226 211 rightThreshold={40} 212 + leftThreshold={40} 227 213 renderRightActions={ 228 214 Platform.OS === "android" ? undefined : RightAction 229 215 } ··· 236 222 if (r === (Platform.OS === "android" ? "right" : "left")) { 237 223 setReply(item); 238 224 } 239 - if ( 240 - r === (Platform.OS === "android" ? "left" : "right") && 241 - canModerate 242 - ) { 225 + if (r === (Platform.OS === "android" ? "left" : "right")) { 243 226 setModMsg(item); 244 227 } 245 228 // close this swipeable ··· 251 234 > 252 235 <RenderChatMessage item={item} /> 253 236 </Swipeable> 254 - </Pressable> 237 + </> 255 238 ); 256 239 }, 257 240 );
+2 -2
js/components/src/components/chat/system-message.tsx
··· 1 1 import { View } from "react-native"; 2 - import { flex, gap, layout, ml, p, pl, w } from "../../ui"; 2 + import { flex, gap, layout, ml, pb, pl, px, w } from "../../ui"; 3 3 import { atoms } from "../ui"; 4 4 import { Code, Text } from "../ui/text"; 5 5 ··· 10 10 11 11 export function SystemMessage({ title, timestamp }: SystemMessageProps) { 12 12 return ( 13 - <View style={[w.percent[100], p[2]]}> 13 + <View style={[w.percent[100], px[2], pb[2]]}> 14 14 <Code color="muted" tracking="widest" style={[pl[12], ml[1]]}> 15 15 SYSTEM MESSAGE 16 16 </Code>