import { Pressable, View } from 'react-native';
import { useChatContext } from '../../chat';
import { useColors } from '../../hook';
import { useI18nContext } from '../../i18n';
import { usePaletteContext } from '../../theme';
import { IconButton } from '../../ui/Button';
import { SingleLineText } from '../../ui/Text';
import { TopNavigationBar, TopNavigationBarLeft } from '../TopNavigationBar';
import type { GroupParticipantListNavigationBarProps } from './types';
type _GroupParticipantListNavigationBarProps =
GroupParticipantListNavigationBarProps & {
groupId: string;
ownerId?: string;
onDelParticipant?: () => void;
onSelectParticipant?: () => void;
selectedCount?: number;
participantCount?: number;
};
export const GroupParticipantListNavigationBar = (
props: _GroupParticipantListNavigationBarProps
) => {
const {
participantType,
onBack,
onDelParticipant,
onSelectParticipant,
selectedCount,
participantCount,
onClickedAddParticipant,
onClickedDelParticipant,
customNavigationBar,
ownerId,
} = props;
const { tr } = useI18nContext();
const im = useChatContext();
const isOwner = ownerId === im.userId;
const { colors } = usePaletteContext();
const { getColor } = useColors({
text_disable: {
light: colors.neutral[7],
dark: colors.neutral[3],
},
text_enable: {
light: colors.error[5],
dark: colors.error[6],
},
});
if (customNavigationBar) {
return <>{customNavigationBar}>;
}
if (participantType === 'delete') {
return (
}
Right={
isOwner === true ? (
{tr('_uikit_group_del_member_button', selectedCount)}
) : null
}
/>
);
} else if (participantType === 'change-owner') {
return (
) : null
}
Right={}
/>
);
} else if (participantType === 'mention') {
return (
}
Right={}
/>
);
} else if (participantType === 'av-meeting') {
return (
}
Right={
0 ? 'enable' : 'text_disable'
),
}}
>
{tr('_uikit_group_av_button', selectedCount ?? 0)}
}
/>
);
} else {
return (
}
Right={
isOwner === true ? (
) : null
}
/>
);
}
};