Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 50 additions & 50 deletions examples/SampleApp/src/components/ChannelInfoOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ export const ChannelInfoOverlay = (props: ChannelInfoOverlayProps) => {

const {
theme: {
colors: { accent_red, black, border, grey, white },
colors: { accent_red, black, grey, white },
semantics,
},
} = useTheme();

Expand All @@ -127,19 +128,19 @@ export const ChannelInfoOverlay = (props: ChannelInfoOverlayProps) => {
}
showScreen.value = show
? withTiming(1, {
duration: 150,
easing: Easing.in(Easing.ease),
})
duration: 150,
easing: Easing.in(Easing.ease),
})
: withTiming(
0,
{
duration: 150,
easing: Easing.out(Easing.ease),
},
() => {
runOnJS(reset)();
},
);
0,
{
duration: 150,
easing: Easing.out(Easing.ease),
},
() => {
runOnJS(reset)();
},
);
};

useEffect(() => {
Expand Down Expand Up @@ -185,12 +186,12 @@ export const ChannelInfoOverlay = (props: ChannelInfoOverlayProps) => {
translateY.value =
evt.velocityY > 1000
? withDecay({
velocity: evt.velocityY,
})
velocity: evt.velocityY,
})
: withTiming(screenHeight, {
duration: 200,
easing: Easing.out(Easing.ease),
});
duration: 200,
easing: Easing.out(Easing.ease),
});
} else {
translateY.value = withTiming(0);
overlayOpacity.value = withTiming(1);
Expand Down Expand Up @@ -225,31 +226,31 @@ export const ChannelInfoOverlay = (props: ChannelInfoOverlayProps) => {
: 0;
const channelName = channel
? channel.data?.name ||
Object.values<ChannelMemberResponse>(channel.state.members)
.slice(0)
.reduce<string>((returnString, currentMember, index, originalArray) => {
const returnStringLength = returnString.length;
const currentMemberName =
currentMember.user?.name || currentMember.user?.id || 'Unknown User';
// a rough approximation of when the +Number shows up
if (returnStringLength + (currentMemberName.length + 2) < maxWidth) {
if (returnStringLength) {
returnString += `, ${currentMemberName}`;
} else {
returnString = currentMemberName;
}
Object.values<ChannelMemberResponse>(channel.state.members)
.slice(0)
.reduce<string>((returnString, currentMember, index, originalArray) => {
const returnStringLength = returnString.length;
const currentMemberName =
currentMember.user?.name || currentMember.user?.id || 'Unknown User';
// a rough approximation of when the +Number shows up
if (returnStringLength + (currentMemberName.length + 2) < maxWidth) {
if (returnStringLength) {
returnString += `, ${currentMemberName}`;
} else {
const remainingMembers = originalArray.length - index;
returnString += `, +${remainingMembers}`;
originalArray.splice(1); // exit early
returnString = currentMemberName;
}
return returnString;
}, '')
} else {
const remainingMembers = originalArray.length - index;
returnString += `, +${remainingMembers}`;
originalArray.splice(1); // exit early
}
return returnString;
}, '')
: '';
const otherMembers = channel
? Object.values<ChannelMemberResponse>(channel.state.members).filter(
(member) => member.user?.id !== clientId,
)
(member) => member.user?.id !== clientId,
)
: [];

const { viewInfo, pinUnpin, archiveUnarchive, leaveGroup, deleteConversation, cancel } =
Expand Down Expand Up @@ -285,11 +286,10 @@ export const ChannelInfoOverlay = (props: ChannelInfoOverlayProps) => {
? otherMembers[0].user?.online
? 'Online'
: `Last Seen ${dayjs(otherMembers[0].user?.last_active).fromNow()}`
: `${Object.keys(channel.state.members).length} Members, ${
Object.values<ChannelMemberResponse>(channel.state.members).filter(
(member) => !!member.user?.online,
).length
} Online`}
: `${Object.keys(channel.state.members).length} Members, ${Object.values<ChannelMemberResponse>(channel.state.members).filter(
(member) => !!member.user?.online,
).length
} Online`}
</Text>
<FlatList
contentContainerStyle={styles.flatListContent}
Expand Down Expand Up @@ -329,7 +329,7 @@ export const ChannelInfoOverlay = (props: ChannelInfoOverlayProps) => {
style={[
styles.row,
{
borderTopColor: border.surfaceSubtle,
borderTopColor: semantics.borderCoreDefault,
},
]}
>
Expand All @@ -344,7 +344,7 @@ export const ChannelInfoOverlay = (props: ChannelInfoOverlayProps) => {
style={[
styles.row,
{
borderTopColor: border.surfaceSubtle,
borderTopColor: semantics.borderCoreDefault,
},
]}
>
Expand All @@ -361,7 +361,7 @@ export const ChannelInfoOverlay = (props: ChannelInfoOverlayProps) => {
style={[
styles.row,
{
borderTopColor: border.surfaceSubtle,
borderTopColor: semantics.borderCoreDefault,
},
]}
>
Expand All @@ -376,7 +376,7 @@ export const ChannelInfoOverlay = (props: ChannelInfoOverlayProps) => {

{otherMembers.length > 1 && (
<Pressable onPress={leaveGroup}>
<View style={[styles.row, { borderTopColor: border.surfaceSubtle }]}>
<View style={[styles.row, { borderTopColor: semantics.borderCoreDefault }]}>
<View style={styles.rowInner}>
<UserMinus pathFill={grey} />
</View>
Expand All @@ -389,7 +389,7 @@ export const ChannelInfoOverlay = (props: ChannelInfoOverlayProps) => {
style={[
styles.row,
{
borderTopColor: border.surfaceSubtle,
borderTopColor: semantics.borderCoreDefault,
},
]}
>
Expand All @@ -406,8 +406,8 @@ export const ChannelInfoOverlay = (props: ChannelInfoOverlayProps) => {
style={[
styles.lastRow,
{
borderBottomColor: border.surfaceSubtle,
borderTopColor: border.surfaceSubtle,
borderBottomColor: semantics.borderCoreDefault,
borderTopColor: semantics.borderCoreDefault,
},
]}
>
Expand Down
5 changes: 3 additions & 2 deletions examples/SampleApp/src/components/ConfirmationBottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ export const ConfirmationBottomSheet: React.FC = () => {

const {
theme: {
colors: { accent_red, black, border, grey, white },
colors: { accent_red, black, grey, white },
semantics,
},
} = useTheme();
const inset = useSafeAreaInsets();
Expand Down Expand Up @@ -86,7 +87,7 @@ export const ConfirmationBottomSheet: React.FC = () => {
style={[
styles.actionButtonsContainer,
{
borderTopColor: border.surfaceSubtle,
borderTopColor: semantics.borderCoreDefault,
},
]}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ export const MessageSearchList: React.FC<MessageSearchListProps> = React.forward
} = props;
const {
theme: {
colors: { black, border, grey, white_snow },
colors: { black, grey, white_snow },
semantics,
},
} = useTheme();
const { vw } = useViewport();
Expand All @@ -94,13 +95,11 @@ export const MessageSearchList: React.FC<MessageSearchListProps> = React.forward
}}
>
<Text style={{ color: grey }}>
{`${
messages.length >= DEFAULT_PAGINATION_LIMIT
? DEFAULT_PAGINATION_LIMIT
: messages.length
}${messages.length >= DEFAULT_PAGINATION_LIMIT ? '+ ' : ' '} result${
messages.length === 1 ? '' : 's'
}`}
{`${messages.length >= DEFAULT_PAGINATION_LIMIT
? DEFAULT_PAGINATION_LIMIT
: messages.length
}${messages.length >= DEFAULT_PAGINATION_LIMIT ? '+ ' : ' '} result${messages.length === 1 ? '' : 's'
}`}
</Text>
</View>
)}
Expand Down Expand Up @@ -130,7 +129,7 @@ export const MessageSearchList: React.FC<MessageSearchListProps> = React.forward
messageId: item.id,
});
}}
style={[styles.itemContainer, { borderBottomColor: border.surfaceSubtle }]}
style={[styles.itemContainer, { borderBottomColor: semantics.borderCoreDefault }]}
testID='channel-preview-button'
>
{item.user ? <UserAvatar user={item.user} size={'lg'} /> : null}
Expand Down
51 changes: 26 additions & 25 deletions examples/SampleApp/src/components/UserInfoOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ export const UserInfoOverlay = (props: UserInfoOverlayProps) => {

const {
theme: {
colors: { accent_red, black, border, grey, white },
colors: { accent_red, black, grey, white },
semantics,
},
} = useTheme();

Expand All @@ -122,19 +123,19 @@ export const UserInfoOverlay = (props: UserInfoOverlayProps) => {
}
showScreen.value = show
? withTiming(1, {
duration: 150,
easing: Easing.in(Easing.ease),
})
duration: 150,
easing: Easing.in(Easing.ease),
})
: withTiming(
0,
{
duration: 150,
easing: Easing.out(Easing.ease),
},
() => {
runOnJS(reset)();
},
);
0,
{
duration: 150,
easing: Easing.out(Easing.ease),
},
() => {
runOnJS(reset)();
},
);
};

useEffect(() => {
Expand Down Expand Up @@ -180,12 +181,12 @@ export const UserInfoOverlay = (props: UserInfoOverlayProps) => {
translateY.value =
evt.velocityY > 1000
? withDecay({
velocity: evt.velocityY,
})
velocity: evt.velocityY,
})
: withTiming(screenHeight, {
duration: 200,
easing: Easing.out(Easing.ease),
});
duration: 200,
easing: Easing.out(Easing.ease),
});
} else {
translateY.value = withTiming(0);
overlayOpacity.value = withTiming(1);
Expand Down Expand Up @@ -216,8 +217,8 @@ export const UserInfoOverlay = (props: UserInfoOverlayProps) => {

const self = channel
? Object.values(channel.state.members).find(
(channelMember) => channelMember.user?.id === client.user?.id,
)
(channelMember) => channelMember.user?.id === client.user?.id,
)
: undefined;

const { viewInfo, messageUser, removeFromGroup, cancel } = useUserInfoOverlayActions();
Expand Down Expand Up @@ -277,7 +278,7 @@ export const UserInfoOverlay = (props: UserInfoOverlayProps) => {
style={[
styles.row,
{
borderTopColor: border.surfaceSubtle,
borderTopColor: semantics.borderCoreDefault,
},
]}
>
Expand All @@ -292,7 +293,7 @@ export const UserInfoOverlay = (props: UserInfoOverlayProps) => {
style={[
styles.row,
{
borderTopColor: border.surfaceSubtle,
borderTopColor: semantics.borderCoreDefault,
},
]}
>
Expand All @@ -308,7 +309,7 @@ export const UserInfoOverlay = (props: UserInfoOverlayProps) => {
style={[
styles.row,
{
borderTopColor: border.surfaceSubtle,
borderTopColor: semantics.borderCoreDefault,
},
]}
>
Expand All @@ -326,8 +327,8 @@ export const UserInfoOverlay = (props: UserInfoOverlayProps) => {
style={[
styles.lastRow,
{
borderBottomColor: border.surfaceSubtle,
borderTopColor: border.surfaceSubtle,
borderBottomColor: semantics.borderCoreDefault,
borderTopColor: semantics.borderCoreDefault,
},
]}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ export const UserSearchResults: React.FC<UserSearchResultsProps> = ({
bg_gradient_end,
bg_gradient_start,
black,
border,
grey,
grey_gainsboro,
white_smoke,
white_snow,
},
semantics,
},
} = useTheme();
const { vw } = useViewport();
Expand Down Expand Up @@ -199,7 +199,7 @@ export const UserSearchResults: React.FC<UserSearchResultsProps> = ({
styles.searchResultContainer,
{
backgroundColor: white_snow,
borderBottomColor: border.surfaceSubtle,
borderBottomColor: semantics.borderCoreDefault,
},
]}
>
Expand Down
5 changes: 3 additions & 2 deletions examples/SampleApp/src/screens/ChannelFilesScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ export const ChannelFilesScreen: React.FC<ChannelFilesScreenProps> = ({
const insets = useSafeAreaInsets();
const {
theme: {
colors: { black, border, grey, white_snow },
colors: { black, grey, white_snow },
semantics,
},
} = useTheme();

Expand Down Expand Up @@ -149,7 +150,7 @@ export const ChannelFilesScreen: React.FC<ChannelFilesScreenProps> = ({
Alert.alert('Not implemented.');
}}
style={{
borderBottomColor: border.surfaceSubtle,
borderBottomColor: semantics.borderCoreDefault,
borderBottomWidth: index === section.data.length - 1 ? 0 : 1,
}}
>
Expand Down
Loading
Loading