1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Removed autolinker

This commit is contained in:
xmflsct
2022-09-20 22:23:01 +02:00
parent fb3cfa0db1
commit 7ec7f85893
70 changed files with 253 additions and 7171 deletions

View File

@ -1,3 +1,4 @@
import { emojis } from '@components/Emojis'
import Icon from '@components/Icon'
import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
@ -16,7 +17,7 @@ const EmojisButton: React.FC = () => {
return (
<Pressable
disabled={!emojisState.emojis || !emojisState.emojis.length}
disabled={!emojis.current || !emojis.current.length}
onPress={() => {
if (emojisState.targetIndex === -1) {
Keyboard.dismiss()
@ -38,12 +39,10 @@ const EmojisButton: React.FC = () => {
}}
>
<Icon
name={emojisState.emojis && emojisState.emojis.length ? 'Smile' : 'Meh'}
name={emojis.current && emojis.current.length ? 'Smile' : 'Meh'}
size={24}
color={
emojisState.emojis && emojisState.emojis.length
? colors.primaryDefault
: colors.disabled
emojis.current && emojis.current.length ? colors.primaryDefault : colors.disabled
}
/>
</View>

View File

@ -1,3 +1,4 @@
import { emojis } from '@components/Emojis'
import Icon from '@components/Icon'
import CustomText from '@components/Text'
import { useAppDispatch } from '@root/store'
@ -175,17 +176,19 @@ const EmojisList = () => {
? [
{
title: 'Search result',
data: chunk(
emojisState.emojis
.filter(e => e.type !== 'frequent')
.flatMap(e =>
e.data.flatMap(e => e).filter(emoji => emoji.shortcode.includes(search))
),
2
)
data: emojis.current
? chunk(
emojis.current
.filter(e => e.type !== 'frequent')
.flatMap(e =>
e.data.flatMap(e => e).filter(emoji => emoji.shortcode.includes(search))
),
2
)
: []
}
]
: emojisState.emojis
: emojis.current || []
}
keyExtractor={item => item[0]?.shortcode}
renderSectionHeader={({ section: { title } }) => (

View File

@ -10,18 +10,21 @@ type inputProps = {
addFunc?: (add: string) => void // For none default state update
}
export type Emojis = MutableRefObject<
| {
title: string
data: Pick<Mastodon.Emoji, 'shortcode' | 'url' | 'static_url'>[][]
type?: 'frequent'
}[]
| null
>
export type EmojisState = {
emojis: {
title: string
data: Pick<Mastodon.Emoji, 'shortcode' | 'url' | 'static_url'>[][]
type?: 'frequent'
}[]
inputProps: inputProps[]
targetIndex: number
}
export type EmojisAction =
| { type: 'load'; payload: NonNullable<EmojisState['emojis']> }
| { type: 'input'; payload: EmojisState['inputProps'] }
| { type: 'target'; payload: EmojisState['targetIndex'] }
@ -33,8 +36,6 @@ const EmojisContext = createContext<ContextType>({} as ContextType)
export const emojisReducer = (state: EmojisState, action: EmojisAction) => {
switch (action.type) {
case 'load':
return { ...state, emojis: action.payload }
case 'input':
return { ...state, inputProps: action.payload }
case 'target':