mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
0
fork

Configure Feed

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

Multiple improvements to link cards and quote posts (#2398)

* fix canvas

* fix external link embed styles

* Use the same link-card style on web and mobile and give a little more height on desktop to the card images

* Use dark border on link embeds to match quote post style

* Fix the highlighting behavior on linkcards and quoteposts

---------

Co-authored-by: Hailey <me@haileyok.com>

authored by

Paul Frazee
Hailey
and committed by
GitHub
df277e59 2c31e2a0

+27 -44
+4 -6
src/lib/media/manip.web.ts
··· 117 117 return reject(new Error('Failed to resize image')) 118 118 } 119 119 120 - canvas.width = width 121 - canvas.height = height 122 - 123 120 let scale = 1 124 121 if (mode === 'cover') { 125 122 scale = img.width < img.height ? width / img.width : height / img.height ··· 128 125 } 129 126 let w = img.width * scale 130 127 let h = img.height * scale 131 - let x = (width - w) / 2 132 - let y = (height - h) / 2 128 + 129 + canvas.width = w 130 + canvas.height = h 133 131 134 - ctx.drawImage(img, x, y, w, h) 132 + ctx.drawImage(img, 0, 0, w, h) 135 133 resolve(canvas.toDataURL('image/jpeg', quality)) 136 134 }) 137 135 img.src = dataUri
+2
src/lib/themes.ts
··· 25 25 postCtrl: '#71768A', 26 26 brandText: '#0066FF', 27 27 emptyStateIcon: '#B6B6C9', 28 + borderLinkHover: '#cac1c1', 28 29 }, 29 30 primary: { 30 31 background: colors.blue3, ··· 310 311 postCtrl: '#707489', 311 312 brandText: '#0085ff', 312 313 emptyStateIcon: colors.gray4, 314 + borderLinkHover: colors.gray5, 313 315 }, 314 316 primary: { 315 317 ...defaultTheme.palette.primary,
+11 -29
src/view/com/util/post-embeds/ExternalLinkEmbed.tsx
··· 23 23 ) 24 24 25 25 return ( 26 - <View 27 - style={{ 28 - flexDirection: !isMobile && !embedPlayerParams ? 'row' : 'column', 29 - }}> 26 + <View style={{flexDirection: 'column'}}> 30 27 {link.thumb && !embedPlayerParams ? ( 31 28 <View 32 - style={ 33 - !isMobile 34 - ? { 35 - borderTopLeftRadius: 6, 36 - borderBottomLeftRadius: 6, 37 - width: 120, 38 - aspectRatio: 1, 39 - overflow: 'hidden', 40 - } 41 - : { 42 - borderTopLeftRadius: 6, 43 - borderTopRightRadius: 6, 44 - width: '100%', 45 - height: 200, 46 - overflow: 'hidden', 47 - } 48 - }> 29 + style={{ 30 + borderTopLeftRadius: 6, 31 + borderTopRightRadius: 6, 32 + width: '100%', 33 + height: isMobile ? 200 : 300, 34 + overflow: 'hidden', 35 + }}> 49 36 <Image 50 37 style={styles.extImage} 51 38 source={{uri: link.thumb}} ··· 61 48 paddingHorizontal: isMobile ? 10 : 14, 62 49 paddingTop: 8, 63 50 paddingBottom: 10, 64 - flex: !isMobile ? 1 : undefined, 65 51 }}> 66 52 <Text 67 53 type="sm" ··· 69 55 style={[pal.textLight, styles.extUri]}> 70 56 {toNiceDomain(link.uri)} 71 57 </Text> 72 - <Text 73 - type="lg-bold" 74 - numberOfLines={isMobile ? 4 : 2} 75 - style={[pal.text]}> 58 + <Text type="lg-bold" numberOfLines={4} style={[pal.text]}> 76 59 {link.title || link.uri} 77 60 </Text> 78 61 {link.description ? ( 79 62 <Text 80 63 type="md" 81 - numberOfLines={isMobile ? 4 : 2} 64 + numberOfLines={4} 82 65 style={[pal.text, styles.extDescription]}> 83 66 {link.description} 84 67 </Text> ··· 90 73 91 74 const styles = StyleSheet.create({ 92 75 extImage: { 93 - width: '100%', 94 - height: 200, 76 + flex: 1, 95 77 }, 96 78 extUri: { 97 79 marginTop: 2,
+1
src/view/com/util/post-embeds/QuoteEmbed.tsx
··· 98 98 return ( 99 99 <Link 100 100 style={[styles.container, pal.borderDark, style]} 101 + hoverStyle={{borderColor: pal.colors.borderLinkHover}} 101 102 href={itemHref} 102 103 title={itemTitle}> 103 104 <PostMeta
+9 -9
src/view/com/util/post-embeds/index.tsx
··· 63 63 const mediaModeration = isModOnQuote ? {} : moderation 64 64 const quoteModeration = isModOnQuote ? moderation : {} 65 65 return ( 66 - <View style={[styles.stackContainer, style]}> 66 + <View style={style}> 67 67 <PostEmbeds embed={embed.media} moderation={mediaModeration} /> 68 68 <ContentHider moderation={quoteModeration}> 69 69 <MaybeQuoteEmbed embed={embed.record} moderation={quoteModeration} /> ··· 168 168 const link = embed.external 169 169 170 170 return ( 171 - <View style={[styles.extOuter, pal.view, pal.border, style]}> 172 - <Link asAnchor href={link.uri}> 173 - <ExternalLinkEmbed link={link} /> 174 - </Link> 175 - </View> 171 + <Link 172 + asAnchor 173 + anchorNoUnderline 174 + href={link.uri} 175 + style={[styles.extOuter, pal.view, pal.borderDark, style]} 176 + hoverStyle={{borderColor: pal.colors.borderLinkHover}}> 177 + <ExternalLinkEmbed link={link} /> 178 + </Link> 176 179 ) 177 180 } 178 181 ··· 180 183 } 181 184 182 185 const styles = StyleSheet.create({ 183 - stackContainer: { 184 - gap: 6, 185 - }, 186 186 imagesContainer: { 187 187 marginTop: 8, 188 188 },