Live video on the AT Protocol

chat: fix chat popup in prod

Eli Mallon 28c40398 a823ecbb

+48 -30
+8
hack/firehose-proxy.sh
··· 1 + #!/bin/bash 2 + 3 + set -euo pipefail 4 + 5 + upstream="${1:-"wss://bsky.network"}" 6 + echo "listening on port 8765" 7 + 8 + websocat --binary -E ws-l:0.0.0.0:8765 $upstream/xrpc/com.atproto.sync.subscribeRepos
+40 -30
js/app/components/chat/chat-box.tsx
··· 5 5 selectIsReady, 6 6 selectUserProfile, 7 7 } from "features/bluesky/blueskySlice"; 8 - import { usePlayerLivestream } from "features/player/playerSlice"; 8 + import { 9 + LivestreamViewHydrated, 10 + usePlayerLivestream, 11 + } from "features/player/playerSlice"; 9 12 import { 10 13 chatWarn, 11 14 selectChatWarned, ··· 26 29 const livestream = useAppSelector(usePlayerLivestream()); 27 30 const textAreaRef = useRef<Input>(null); 28 31 const dispatch = useAppDispatch(); 32 + const navigate = useNavigation(); 29 33 const submit = () => { 30 34 if (!isWeb) { 31 35 Keyboard.dismiss(); ··· 49 53 50 54 return ( 51 55 <View position="relative"> 52 - {loggedOut && <Login />} 56 + {loggedOut && ( 57 + <View flexDirection="row" justifyContent="center"> 58 + <Button 59 + backgroundColor="$accentColor" 60 + onPress={() => { 61 + navigate.navigate("Login"); 62 + }} 63 + > 64 + Log in to chat 65 + </Button> 66 + <PopoutButton livestream={livestream} isPopout={isPopout} /> 67 + </View> 68 + )} 53 69 {!loggedOut && ( 54 70 <Form 55 71 zIndex={1} ··· 112 128 buttonProps={{ backgroundColor: "transparent" }} 113 129 text={(color) => <Palette size={16} color={color} />} 114 130 /> 115 - {isWeb && !isPopout && ( 116 - <Button 117 - flexShrink={0} 118 - backgroundColor="transparent" 119 - disabled={loggedOut} 120 - onPress={() => { 121 - window.open( 122 - "http://127.0.0.1:38080/chat-popout/iame.li", 123 - "_blank", 124 - "popup=true", 125 - ); 126 - }} 127 - > 128 - <SquareArrowOutUpRight size={16} /> 129 - </Button> 130 - )} 131 + <PopoutButton livestream={livestream} isPopout={isPopout} /> 131 132 <Button 132 133 flexShrink={0} 133 134 backgroundColor="transparent" ··· 145 146 ); 146 147 } 147 148 148 - const Login = () => { 149 - const navigate = useNavigation(); 149 + const PopoutButton = ({ 150 + livestream, 151 + isPopout, 152 + }: { 153 + livestream: LivestreamViewHydrated | null; 154 + isPopout?: boolean; 155 + }) => { 156 + if (!isWeb || isPopout) { 157 + return <></>; 158 + } 150 159 return ( 151 - <View alignItems="center"> 152 - <Button 153 - backgroundColor="$accentColor" 154 - onPress={() => { 155 - navigate.navigate("Login"); 156 - }} 157 - > 158 - Log in to chat 159 - </Button> 160 - </View> 160 + <Button 161 + flexShrink={0} 162 + backgroundColor="transparent" 163 + onPress={() => { 164 + const u = new URL(window.location.href); 165 + u.pathname = `/chat-popout/${livestream?.author?.did}`; 166 + window.open(u.toString(), "_blank", "popup=true"); 167 + }} 168 + > 169 + <SquareArrowOutUpRight size={16} /> 170 + </Button> 161 171 ); 162 172 };