Skip to content

Commit

Permalink
refactor: improve chat room display using updated Party object structure
Browse files Browse the repository at this point in the history
  • Loading branch information
soy0ka committed Aug 5, 2024
1 parent c29cb09 commit 35e6904
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
1 change: 0 additions & 1 deletion app/tabs/chat/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Stack } from 'expo-router'
import React from 'react'

export default function Layout() {
// headerright 에 설정 버튼 추가
return (
<Stack>
<Stack.Screen
Expand Down
14 changes: 5 additions & 9 deletions app/tabs/chat/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { ChatRoom } from '@/types/chatrooms'
import { fetcher } from '@/utils/apiClient'
import { formatDateToKorean } from '@/utils/dateFormatter'
import { Profile } from '@/utils/gravatar'
import {
Avatar,
Expand All @@ -15,7 +17,6 @@ import {
} from '@gluestack-ui/themed'
import { router, useNavigation } from 'expo-router'
import React from 'react'
import { ChatRoom } from '../../../types/chatrooms'

export default function ChatRooms() {
const [chatRooms, setChatRooms] = React.useState<ChatRoom[]>([])
Expand All @@ -35,13 +36,6 @@ export default function ChatRooms() {
setChatRooms(res.data)
}

const formatTime = (date: string) => {
const d = new Date(date)
return `${d.getFullYear()}${
d.getMonth() + 1
}${d.getDate()}${d.getHours()}:${d.getMinutes()}`
}

return (
<SafeAreaView>
<ScrollView style={{ padding: 20 }} mt={10}>
Expand Down Expand Up @@ -69,7 +63,9 @@ export default function ChatRooms() {
</Text>
</VStack>
</HStack>
<Text size="sm">{formatTime(room.Party[0].departure)}</Text>
<Text size="sm">
{formatDateToKorean(room.Party[0].departure)} 출발
</Text>
</Card>
</Pressable>
))
Expand Down

0 comments on commit 35e6904

Please sign in to comment.