Skip to content

Commit

Permalink
fix: missing user card editor fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Vali-98 committed Oct 19, 2024
1 parent cc26f41 commit b81af23
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app/components/ChatMenu/SettingsDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ const SettingsDrawer: React.FC<SettingsDrawerProps> = ({ booleans: [showModal, s
const router = useRouter()
const { userName, imageID } = Characters.useUserCard(
useShallow((state) => ({
userName: state.card?.data.name,
imageID: state.card?.data.image_id ?? 0,
userName: state.card?.name,
imageID: state.card?.image_id ?? 0,
}))
)

Expand Down
14 changes: 7 additions & 7 deletions app/components/UserEditor/UserCardEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Avatar from '@components/Avatar'
import { CharacterCardV2 } from '@constants/Characters'
import { CharacterCardData } from '@constants/Characters'
import { AntDesign } from '@expo/vector-icons'
import { Characters, Style } from '@globals'
import * as DocumentPicker from 'expo-document-picker'
Expand All @@ -11,13 +11,13 @@ const UserCardEditor = () => {
const { userCard, imageID, id, setCard } = Characters.useUserCard(
useShallow((state) => ({
userCard: state.card,
imageID: state.card?.data.image_id ?? 0,
imageID: state.card?.image_id ?? 0,
id: state.id,
setCard: state.setCard,
}))
)

const [currentCard, setCurrentCard] = useState<CharacterCardV2 | undefined>(userCard)
const [currentCard, setCurrentCard] = useState<CharacterCardData | undefined>(userCard)

useEffect(() => {
setCurrentCard(userCard)
Expand Down Expand Up @@ -50,12 +50,12 @@ const UserCardEditor = () => {
style={styles.inputName}
textAlignVertical="center"
textAlign="center"
value={currentCard?.data.name ?? ''}
value={currentCard?.name ?? ''}
onChangeText={(text) => {
if (currentCard)
setCurrentCard({
...currentCard,
data: { ...currentCard.data, name: text },
name: text,
})
}}
placeholder="Empty names are discouraged!"
Expand All @@ -69,12 +69,12 @@ const UserCardEditor = () => {
style={styles.input}
multiline
numberOfLines={10}
value={currentCard?.data.description ?? ''}
value={currentCard?.description ?? ''}
onChangeText={(text) => {
if (currentCard)
setCurrentCard({
...currentCard,
data: { ...currentCard.data, description: text },
description: text,
})
}}
placeholder="Describe this user..."
Expand Down

0 comments on commit b81af23

Please sign in to comment.