-
Notifications
You must be signed in to change notification settings - Fork 0
[Feature] 채팅 멤버 목록 보기 기능 구현 #89
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 all commits
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,20 @@ | ||
| import Text from '@/components/Text'; | ||
| import TouchableRipple from '@/components/TouchableRipple'; | ||
|
|
||
| import { styles } from './index.style'; | ||
|
|
||
| export type ActionButton = { | ||
| label: string; | ||
| onPress: () => void; | ||
| }; | ||
|
|
||
| export const ActionButton = ({ | ||
| label, | ||
| onPress, | ||
| }: ActionButton) => ( | ||
| <TouchableRipple containerStyle={styles.actionButtonContainer} onPress={onPress}> | ||
| <Text font='b2'> | ||
| {label} | ||
| </Text> | ||
| </TouchableRipple> | ||
| ); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import { StyleSheet } from 'react-native'; | ||
|
|
||
| export const styles = StyleSheet.create({ | ||
| actionButtonContainer: { | ||
| justifyContent: 'center', | ||
| alignItems: 'center', | ||
| paddingVertical: 12, | ||
| }, | ||
| }); |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,29 @@ | ||||||
| import { Shapes } from '@components'; | ||||||
| import { View } from 'react-native'; | ||||||
|
|
||||||
| import type { BottomSheetProps } from '..'; | ||||||
| import { BottomSheet } from '../index'; | ||||||
| import { ActionButton } from './ActionButton'; | ||||||
|
|
||||||
| interface ActionListBottomSheetProps extends BottomSheetProps { | ||||||
| actionItems: ActionButton[]; | ||||||
| } | ||||||
|
|
||||||
| const ActionListBottomSheet = ({ | ||||||
| actionItems, | ||||||
| ...props | ||||||
| }: ActionListBottomSheetProps) => ( | ||||||
| <BottomSheet {...props}> | ||||||
| {actionItems.map((item, idx) => ( | ||||||
| <View key={`actionButton-${item.label}`}> | ||||||
|
||||||
| <View key={`actionButton-${item.label}`}> | |
| <View key={`actionButton-${idx}`}> |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,8 +1,6 @@ | ||||||||||
| import { StyleSheet } from 'react-native'; | ||||||||||
|
|
||||||||||
| export const styles = StyleSheet.create({ | ||||||||||
| container: { | ||||||||||
| flex: 1, | ||||||||||
| alignItems: 'center', | ||||||||||
| container: { | ||||||||||
|
||||||||||
| container: { | |
| container: { | |
| flex: 1, | |
| alignItems: 'center', |
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,8 +1,10 @@ | ||||||||||||
| import type { ReactNode } from 'react'; | ||||||||||||
| import { View } from 'react-native'; | ||||||||||||
|
|
||||||||||||
| import Text from '@/components/Text'; | ||||||||||||
| import { useDialog } from '@/hooks/useDialog'; | ||||||||||||
|
|
||||||||||||
| import { TITLE_TEXT_STYLE } from '../index.style'; | ||||||||||||
|
Comment on lines
+4
to
+7
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.
Comment on lines
+4
to
+7
|
||||||||||||
| import Text from '@/components/Text'; | |
| import { useDialog } from '@/hooks/useDialog'; | |
| import { TITLE_TEXT_STYLE } from '../index.style'; | |
| import { useDialog } from '@/hooks/useDialog'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| { | ||
| "write-message": "메시지 작성" | ||
| "write-message": "메시지 작성", | ||
| "group-member-list": "그룹 멤버 목록" | ||
| } |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,42 @@ | ||||
| import { ActionListBottomSheet } from '@/components'; | ||||
| import type { GetChatRoomInfoResponse } from '@/features/chat/model/getChatRoomInfo'; | ||||
| import { useTranslatedText } from '@/hooks'; | ||||
| import { dialogService } from '@/utils/dialog'; | ||||
|
|
||||
| import UserInfosDialog from '../UserInfosDialog'; | ||||
|
|
||||
| interface ChatMoreActionsBottomSheetProps { | ||||
| userInfos: GetChatRoomInfoResponse['data']['userInfos']; | ||||
| bottomSheetEnabled: boolean; | ||||
| setBottomSheetEnabled: (enabled: boolean) => void; | ||||
| } | ||||
|
|
||||
| const ChatMoreActionsBottomSheet = ({ | ||||
| userInfos, | ||||
| bottomSheetEnabled, | ||||
| setBottomSheetEnabled, | ||||
| }: ChatMoreActionsBottomSheetProps) => { | ||||
| const tViewGroupMembers = useTranslatedText({ tKey: 'groupChat.group-member-list' }); | ||||
|
|
||||
| return ( | ||||
| <ActionListBottomSheet | ||||
| actionItems={[ | ||||
| { | ||||
| label: tViewGroupMembers, | ||||
| onPress: () => { | ||||
| dialogService.add({ | ||||
| content: ( | ||||
| <UserInfosDialog userInfos={userInfos} /> | ||||
| ), | ||||
| }); | ||||
| }, | ||||
|
Comment on lines
+26
to
+32
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.
Comment on lines
+26
to
+32
|
||||
| }, | ||||
| ]} | ||||
| enabled={bottomSheetEnabled} | ||||
| onClose={() => setBottomSheetEnabled(false)} | ||||
| /> | ||||
| ); | ||||
|
|
||||
|
||||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,39 @@ | ||||||||||
| import { StyleSheet } from 'react-native'; | ||||||||||
|
|
||||||||||
| import type { TextProps } from '@/components/Text'; | ||||||||||
| import { theme } from '@/theme'; | ||||||||||
|
|
||||||||||
| export const styles = StyleSheet.create({ | ||||||||||
| userInfoContainer: { | ||||||||||
| flexDirection: 'row', | ||||||||||
| gap: 12, | ||||||||||
| paddingHorizontal: 16, | ||||||||||
| alignItems: 'center', | ||||||||||
| }, | ||||||||||
| scrollView: { | ||||||||||
| flexGrow: 0, | ||||||||||
| maxHeight: 500, | ||||||||||
| borderWidth: 1, | ||||||||||
| borderColor: theme.color.neutral[300], | ||||||||||
| borderRadius: theme.radius[200], | ||||||||||
| paddingVertical: 8, | ||||||||||
| }, | ||||||||||
| scrollViewContentContainer: { | ||||||||||
| paddingVertical: 8, | ||||||||||
| gap: 12, | ||||||||||
| }, | ||||||||||
| }); | ||||||||||
|
|
||||||||||
| export const TITLE_TEXT_STYLE: TextProps = { | ||||||||||
| font: 't1', | ||||||||||
| textStyle: { | ||||||||||
| alignSelf: 'center', | ||||||||||
| }, | ||||||||||
| containerStyle: { | ||||||||||
| paddingBottom: 12, | ||||||||||
| }, | ||||||||||
| }; | ||||||||||
|
|
||||||||||
| export const USER_INFO_NICKNAME_TEXT_STYLE: TextProps = { | ||||||||||
| font: 'b3', | ||||||||||
|
Comment on lines
+35
to
+38
|
||||||||||
| }; | |
| export const USER_INFO_NICKNAME_TEXT_STYLE: TextProps = { | |
| font: 'b3', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
리스트를 렌더링할 때
key는 각 항목을 고유하게 식별해야 합니다. 현재item.label을 사용하고 있는데, 만약actionItems배열에 동일한label을 가진 항목이 여러 개 존재할 경우 React가 항목을 제대로 구분하지 못해 예기치 않은 동작을 유발할 수 있습니다.key의 고유성을 보장하기 위해idx를 함께 사용하는 것을 권장합니다.