-
Notifications
You must be signed in to change notification settings - Fork 0
[FEAT/#86] 채팅 내역 UI 구현 #93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
fa38321
d2a39f7
dbe8ae6
b2c7763
ba5a7f4
b3f6840
12f6dbd
1c6e5d5
d0c9b07
4223c22
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import type { ChatRoomItemProps } from "@/entities/chat"; | ||
|
|
||
| export const MOCK_ADMIN_CHAT_ROOMS: ChatRoomItemProps[] = [ | ||
| { | ||
| id: "1", | ||
| profileImage: { uri: "https://picsum.photos/seed/store1/48" }, | ||
| roomName: "인쌩맥주 숭실대점", | ||
| lastMessage: "제휴 협력 가능할까요?", | ||
| unreadCount: 1, | ||
| }, | ||
| { | ||
| id: "2", | ||
| profileImage: { uri: "https://picsum.photos/seed/store2/48" }, | ||
| roomName: "역전할머니맥주 숭실대점", | ||
| lastMessage: "감사합니다..!", | ||
| unreadCount: 200, | ||
| }, | ||
| { | ||
| id: "3", | ||
| profileImage: { uri: "https://picsum.photos/seed/store3/48" }, | ||
| roomName: "리얼후라이", | ||
| lastMessage: "잘 부탁드립니다", | ||
| unreadCount: 0, | ||
| }, | ||
| ]; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,46 @@ | ||
| import { Text, View } from "react-native"; | ||
| import { FlatList, View } from "react-native"; | ||
|
|
||
| import { ChatRoomItem, type ChatRoomItemProps } from "@/entities/chat"; | ||
| import { EmptyState } from "@/shared/ui/empty-state"; | ||
| import { PageLayout } from "@/shared/ui/layout"; | ||
| import { PageTitle } from "@/shared/ui/page-title"; | ||
|
|
||
| import { MOCK_ADMIN_CHAT_ROOMS } from "../model/mockChatRooms"; //목데이터 | ||
|
|
||
| // 채팅방 리스트 로컬 컴포넌트 | ||
| function ChatRoomList({ rooms }: { rooms: ChatRoomItemProps[] }) { | ||
| return ( | ||
| <FlatList | ||
| data={rooms} | ||
| keyExtractor={(item) => item.id} | ||
| getItemLayout={(_, index) => ({ | ||
| length: 70, | ||
| offset: 70 * index, | ||
| index, | ||
| })} | ||
| renderItem={({ item }) => <ChatRoomItem {...item} />} | ||
| ListEmptyComponent={ | ||
| <EmptyState | ||
| title="아직 채팅 내역이 없어요" | ||
| description={"제휴 협력을 원하는 매장에 채팅을\n시도 할 수 있어요!"} | ||
| /> | ||
| } | ||
| /> | ||
| ); | ||
| } | ||
| // PageLayout에 px-6을 적용하지 않은 이유: 디자인 상 채팅방 아이템이 화면 양 끝까지 닿아야 하기 때문 | ||
| export function AdminChatPage() { | ||
| return ( | ||
| <View className="flex-1 items-center justify-center bg-canvas"> | ||
| <Text className="text-content-primary font-medium">관리자 채팅</Text> | ||
| </View> | ||
| <PageLayout | ||
| withTopInset={true} | ||
| withBottomInset={false} | ||
| className="flex-1 bg-canvas" | ||
| contentContainerClassName="flex-1 pt-6" | ||
| > | ||
| <View className="px-6"> | ||
| <PageTitle title="채팅 내역" /> | ||
| </View> | ||
| <ChatRoomList rooms={MOCK_ADMIN_CHAT_ROOMS} /> | ||
| </PageLayout> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import type { ChatRoomItemProps } from "@/entities/chat"; | ||
|
|
||
| export const MOCK_PARTNER_CHAT_ROOMS: ChatRoomItemProps[] = [ | ||
| { | ||
| id: "1", | ||
| profileImage: { uri: "https://picsum.photos/seed/admin1/48" }, | ||
| roomName: "ASSU 운영진", | ||
| lastMessage: "제휴 조건 검토 중입니다.", | ||
| unreadCount: 2, | ||
| }, | ||
| { | ||
| id: "2", | ||
| profileImage: { uri: "https://picsum.photos/seed/admin2/48" }, | ||
| roomName: "ASSU 관리자", | ||
| lastMessage: "확인했습니다. 감사합니다!", | ||
| unreadCount: 0, | ||
| }, | ||
| ]; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,48 @@ | ||
| import { Text, View } from "react-native"; | ||
| import { FlatList, View } from "react-native"; | ||
|
|
||
| import { ChatRoomItem, type ChatRoomItemProps } from "@/entities/chat"; | ||
| import { EmptyState } from "@/shared/ui/empty-state"; | ||
| import { PageLayout } from "@/shared/ui/layout"; | ||
| import { PageTitle } from "@/shared/ui/page-title"; | ||
|
|
||
| import { MOCK_PARTNER_CHAT_ROOMS } from "../model/mockChatRooms"; // 목데이터 | ||
|
|
||
| // 채팅방 리스트 로컬 컴포넌트 | ||
| function ChatRoomList({ rooms }: { rooms: ChatRoomItemProps[] }) { | ||
| return ( | ||
| <FlatList | ||
| data={rooms} | ||
| keyExtractor={(item) => item.id} | ||
| getItemLayout={(_, index) => ({ | ||
| length: 70, | ||
| offset: 70 * index, | ||
| index, | ||
| })} | ||
| renderItem={({ item }) => <ChatRoomItem {...item} />} | ||
| ListEmptyComponent={ | ||
| <EmptyState | ||
| title="아직 채팅 내역이 없어요" | ||
| description={"제휴 협력을 원하는 매장에 채팅을\n시도 할 수 있어요!"} | ||
|
eunhyekimyeah marked this conversation as resolved.
Outdated
|
||
| /> | ||
| } | ||
| contentContainerClassName="pt-2" | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| // PageLayout에 px-6을 적용하지 않은 이유: 디자인 상 채팅방 아이템이 화면 양 끝까지 닿아야 하기 때문 | ||
| export function PartnerChatPage() { | ||
| return ( | ||
| <View className="flex-1 items-center justify-center bg-canvas"> | ||
| <Text className="text-content-primary font-medium">업체 채팅</Text> | ||
| </View> | ||
| <PageLayout | ||
| withTopInset={true} | ||
| withBottomInset={false} | ||
| className="flex-1 bg-canvas" | ||
| contentContainerClassName="flex-1 pt-6" | ||
| > | ||
| <View className="px-6"> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 큰 문제는 아니고 궁금한건데
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 첨에 작성하고 나중에 더 구현하다가 놓친거같습니다!ㅎㅎ 수정했어용 |
||
| <PageTitle title="채팅 내역" /> | ||
| </View> | ||
| <ChatRoomList rooms={MOCK_PARTNER_CHAT_ROOMS} /> | ||
| </PageLayout> | ||
| ); | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.