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.

at session/schema 54 lines 1.3 kB view raw
1import React from 'react' 2import {StyleProp, StyleSheet, TextStyle} from 'react-native' 3import {TextLinkOnWebOnly} from './Link' 4import {LoadingPlaceholder} from './LoadingPlaceholder' 5import {TypographyVariant} from 'lib/ThemeContext' 6import {sanitizeDisplayName} from 'lib/strings/display-names' 7import {useFeedSourceInfoQuery} from '#/state/queries/feed' 8 9export function FeedNameText({ 10 type = 'md', 11 uri, 12 href, 13 lineHeight, 14 numberOfLines, 15 style, 16}: { 17 type?: TypographyVariant 18 uri: string 19 href: string 20 lineHeight?: number 21 numberOfLines?: number 22 style?: StyleProp<TextStyle> 23}) { 24 const {data, isError} = useFeedSourceInfoQuery({uri}) 25 26 let inner 27 if (data?.displayName || isError) { 28 const displayName = data?.displayName || uri.split('/').pop() || '' 29 inner = ( 30 <TextLinkOnWebOnly 31 type={type} 32 style={style} 33 lineHeight={lineHeight} 34 numberOfLines={numberOfLines} 35 href={href} 36 text={sanitizeDisplayName(displayName)} 37 /> 38 ) 39 } else { 40 inner = ( 41 <LoadingPlaceholder 42 width={80} 43 height={8} 44 style={styles.loadingPlaceholder} 45 /> 46 ) 47 } 48 49 return inner 50} 51 52const styles = StyleSheet.create({ 53 loadingPlaceholder: {position: 'relative', top: 1, left: 2}, 54})