mirror of
https://github.com/tooot-app/app
synced 2025-04-26 07:58:48 +02:00
Fix bugs
This commit is contained in:
parent
76d4bc754b
commit
7f97908e23
@ -14,9 +14,11 @@ const HeaderSharedReplies: React.FC = () => {
|
||||
const { t } = useTranslation(['common', 'componentTimeline'])
|
||||
const { colors } = useTheme()
|
||||
|
||||
const mentionsBeginning = rawContent?.current?.[0]
|
||||
const mentionsBeginning = rawContent?.current?.[0]?.length
|
||||
? rawContent?.current?.[0]
|
||||
.match(new RegExp(/^(?:@\S+\s+)+/))?.[0]
|
||||
?.match(new RegExp(/@\S+/, 'g'))
|
||||
: undefined
|
||||
excludeMentions &&
|
||||
(excludeMentions.current =
|
||||
mentionsBeginning?.length && status?.mentions
|
||||
|
@ -92,7 +92,7 @@ const ScreenAccountSelection = ({
|
||||
const { colors } = useTheme()
|
||||
const { t } = useTranslation('screenAccountSelection')
|
||||
|
||||
const accounts = getReadableAccounts()
|
||||
const accounts = getReadableAccounts(true)
|
||||
|
||||
return (
|
||||
<ScrollView
|
||||
|
@ -17,7 +17,7 @@ const ComposeDrafts: React.FC<Props> = ({ accessibleRefDrafts }) => {
|
||||
const navigation = useNavigation<any>()
|
||||
const { composeState } = useContext(ComposeContext)
|
||||
const [drafts] = useAccountStorage.object('drafts')
|
||||
const draftsCount = drafts.filter(draft => draft.timestamp !== composeState.timestamp).length
|
||||
const draftsCount = drafts?.filter(draft => draft.timestamp !== composeState.timestamp).length
|
||||
|
||||
useEffect(() => {
|
||||
layoutAnimation()
|
||||
|
@ -60,7 +60,7 @@ const Collections: React.FC = () => {
|
||||
title={t('screenTabs:me.stacks.favourites.name')}
|
||||
onPress={() => navigation.navigate('Tab-Me-Favourites')}
|
||||
/>
|
||||
{pageMe.lists.shown ? (
|
||||
{pageMe.lists?.shown ? (
|
||||
<MenuRow
|
||||
iconFront='List'
|
||||
iconBack='ChevronRight'
|
||||
@ -68,7 +68,7 @@ const Collections: React.FC = () => {
|
||||
onPress={() => navigation.navigate('Tab-Me-List-List')}
|
||||
/>
|
||||
) : null}
|
||||
{pageMe.followedTags.shown ? (
|
||||
{pageMe.followedTags?.shown ? (
|
||||
<MenuRow
|
||||
iconFront='Hash'
|
||||
iconBack='ChevronRight'
|
||||
@ -76,7 +76,7 @@ const Collections: React.FC = () => {
|
||||
onPress={() => navigation.navigate('Tab-Me-FollowedTags')}
|
||||
/>
|
||||
) : null}
|
||||
{pageMe.announcements.shown ? (
|
||||
{pageMe.announcements?.shown ? (
|
||||
<MenuRow
|
||||
iconFront='Clipboard'
|
||||
iconBack='ChevronRight'
|
||||
|
@ -70,8 +70,8 @@ const TabNotificationsFilters: React.FC<
|
||||
<MenuRow
|
||||
key={index}
|
||||
title={t(`screenTabs:me.push.${type}.heading`)}
|
||||
switchValue={filters[type]}
|
||||
switchOnValueChange={() => setFilters({ ...filters, [type]: !filters[type] })}
|
||||
switchValue={filters?.[type]}
|
||||
switchOnValueChange={() => setFilters({ ...filters, [type]: !filters?.[type] })}
|
||||
/>
|
||||
))}
|
||||
</MenuContainer>
|
||||
@ -80,8 +80,8 @@ const TabNotificationsFilters: React.FC<
|
||||
<MenuRow
|
||||
key={type}
|
||||
title={t(`screenTabs:me.push.${type}.heading`)}
|
||||
switchValue={filters[type]}
|
||||
switchOnValueChange={() => setFilters({ ...filters, [type]: !filters[type] })}
|
||||
switchValue={filters?.[type]}
|
||||
switchOnValueChange={() => setFilters({ ...filters, [type]: !filters?.[type] })}
|
||||
/>
|
||||
))}
|
||||
</MenuContainer>
|
||||
|
@ -38,8 +38,11 @@ const Root: React.FC<NativeStackScreenProps<TabPublicStackParamList, 'Tab-Public
|
||||
const previousSegment = getGlobalStorage.string('app.prev_public_segment')
|
||||
const segments: StorageGlobal['app.prev_public_segment'][] = ['Local', 'LocalPublic', 'Trending']
|
||||
const [segment, setSegment] = useState<number>(
|
||||
Math.min(
|
||||
0,
|
||||
segments.findIndex(segment => segment === previousSegment)
|
||||
)
|
||||
)
|
||||
const [routes] = useState([
|
||||
{ key: 'Local', title: t('tabs.public.segments.local') },
|
||||
{ key: 'LocalPublic', title: t('tabs.public.segments.federated') },
|
||||
|
@ -52,7 +52,7 @@ export const searchLocalStatus = async (uri: Mastodon.Status['uri']): Promise<Ma
|
||||
return await queryClient
|
||||
.fetchQuery(queryKey, queryFunction, { staleTime: 3600, cacheTime: 3600 })
|
||||
.then(res =>
|
||||
res.statuses[0].uri === uri || res.statuses[0].url === uri
|
||||
res.statuses[0]?.uri === uri || res.statuses[0]?.url === uri
|
||||
? res.statuses[0]
|
||||
: Promise.reject()
|
||||
)
|
||||
|
@ -233,14 +233,15 @@ export type ReadableAccountType = {
|
||||
key: string
|
||||
active: boolean
|
||||
}
|
||||
export const getReadableAccounts = (): ReadableAccountType[] => {
|
||||
const accountActive = getGlobalStorage.string('account.active')
|
||||
export const getReadableAccounts = (withoutActive: boolean = false): ReadableAccountType[] => {
|
||||
const accountActive = !withoutActive && getGlobalStorage.string('account.active')
|
||||
const accounts = getGlobalStorage.object('accounts')?.sort((a, b) => a.localeCompare(b))
|
||||
!withoutActive &&
|
||||
accounts?.splice(
|
||||
accounts.findIndex(a => a === accountActive),
|
||||
1
|
||||
)
|
||||
accounts?.unshift(accountActive || '')
|
||||
!withoutActive && accounts?.unshift(accountActive || '')
|
||||
return (
|
||||
accounts?.map(account => {
|
||||
const details = getAccountDetails(
|
||||
|
Loading…
x
Reference in New Issue
Block a user