Bluesky app fork with some witchin' additions 馃挮 witchsky.app
bluesky fork client
120
fork

Configure Feed

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

at a876aae44ea07494ebea9727350aa060b81f317b 84 lines 2.6 kB view raw
1import {memo} from 'react' 2import {useWindowDimensions, View} from 'react-native' 3import {type $Typed, type AppBskyEmbedRecord} from '@atproto/api' 4 5import {useEnableSquareButtons} from '#/state/preferences/enable-square-buttons' 6import {atoms as a, native, useTheme, web} from '#/alf' 7import {Embed, PostEmbedViewContext} from '#/components/Post/Embed' 8import {MessageContextProvider} from './MessageContext' 9 10const CLUSTERED_MESSAGE_GAP = 2 11const SQUARED_BORDER_RADIUS = 4 12 13let MessageItemEmbed = ({ 14 embed, 15 isFromSelf, 16 squaredTopCorner, 17 squaredBottomCorner, 18}: { 19 embed: $Typed<AppBskyEmbedRecord.View> 20 isFromSelf: boolean 21 squaredTopCorner: boolean 22 squaredBottomCorner: boolean 23}): React.ReactNode => { 24 const enableSquareButtons = useEnableSquareButtons() 25 const t = useTheme() 26 const screen = useWindowDimensions() 27 const borderRadius = enableSquareButtons ? 4 : 20 28 29 return ( 30 <MessageContextProvider> 31 <View 32 style={[ 33 !isFromSelf && a.ml_sm, 34 t.atoms.bg, 35 native({ 36 flexBasis: 0, 37 width: Math.min(screen.width, 600) / 1.4, 38 }), 39 web({ 40 width: '100%', 41 minWidth: 280, 42 maxWidth: 360, 43 }), 44 { 45 marginTop: CLUSTERED_MESSAGE_GAP, 46 }, 47 ]}> 48 <View style={{marginTop: -8}}> 49 <Embed 50 embed={embed} 51 allowNestedQuotes 52 viewContext={PostEmbedViewContext.ChatMessage} 53 style={[ 54 enableSquareButtons ? a.rounded_sm : a.rounded_xl, 55 a.overflow_hidden, 56 a.border_0, 57 isFromSelf 58 ? { 59 backgroundColor: t.palette.primary_50, 60 borderBottomRightRadius: squaredBottomCorner 61 ? SQUARED_BORDER_RADIUS 62 : borderRadius, 63 borderTopRightRadius: squaredTopCorner 64 ? SQUARED_BORDER_RADIUS 65 : borderRadius, 66 } 67 : { 68 backgroundColor: t.palette.contrast_50, 69 borderBottomLeftRadius: squaredBottomCorner 70 ? SQUARED_BORDER_RADIUS 71 : borderRadius, 72 borderTopLeftRadius: squaredTopCorner 73 ? SQUARED_BORDER_RADIUS 74 : borderRadius, 75 }, 76 ]} 77 /> 78 </View> 79 </View> 80 </MessageContextProvider> 81 ) 82} 83MessageItemEmbed = memo(MessageItemEmbed) 84export {MessageItemEmbed}