Skip to content

Commit fe81a9d

Browse files
authored
chore: Multiple minor fixes and improvements (#917)
1 parent f0f558c commit fe81a9d

File tree

16 files changed

+179
-73
lines changed

16 files changed

+179
-73
lines changed

app.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default ({ config }: ConfigContext): ExpoConfig => {
44
return {
55
name: 'Chatwoot',
66
slug: process.env.EXPO_PUBLIC_APP_SLUG || 'chatwoot-mobile',
7-
version: '4.0.15',
7+
version: '4.0.16',
88
orientation: 'portrait',
99
icon: './assets/icon.png',
1010
userInterfaceStyle: 'light',

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@chatwoot/mobile-app",
3-
"version": "4.0.15",
3+
"version": "4.0.16",
44
"main": "expo/AppEntry.js",
55
"scripts": {
66
"start": "expo start",
@@ -102,6 +102,7 @@
102102
"redux-persist": "^6.0.0",
103103
"rn-fetch-blob": "^0.12.0",
104104
"semver": "^7.6.3",
105+
"snakecase-keys": "^8.0.1",
105106
"string.prototype.matchall": "4.0.3",
106107
"tailwindcss": "^3.4.12",
107108
"twrnc": "^4.5.1",

pnpm-lock.yaml

Lines changed: 50 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components-next/common/filters/FilterBar.tsx

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import Animated, { LinearTransition, withTiming } from 'react-native-reanimated';
33
import { tailwind } from '@/theme';
44
import { FilterButton } from './FilterButton';
5+
import i18n from '@/i18n';
56

67
// Generic type for filter options
78
export type BaseFilterOption = {
@@ -32,22 +33,42 @@ export const FilterBar = ({ allFilters, selectedFilters, onFilterPress }: Filter
3233
};
3334
};
3435

36+
const getFilterTitle = (value: BaseFilterOption) => {
37+
return i18n.t(
38+
`CONVERSATION.FILTERS.${value.type.toUpperCase()}.OPTIONS.${selectedFilters[value.type].toUpperCase()}`,
39+
);
40+
};
41+
3542
return (
3643
<Animated.View
3744
exiting={exiting}
3845
style={tailwind.style('px-3 pt-2 pb-1.5 h-[46px] flex flex-row')}>
39-
{allFilters.map((value, index) => (
40-
<Animated.View
41-
layout={LinearTransition.springify().stiffness(200).damping(24)}
42-
key={index}
43-
style={tailwind.style('pr-2')}>
44-
<FilterButton
45-
handleOnPress={() => onFilterPress(value.type)}
46-
allFilters={value}
47-
selectedFilters={selectedFilters}
48-
/>
49-
</Animated.View>
50-
))}
46+
{allFilters.map((value, index) => {
47+
if (value.type === 'inbox_id') {
48+
return (
49+
<Animated.View
50+
layout={LinearTransition.springify().stiffness(200).damping(24)}
51+
key={index}
52+
style={tailwind.style('pr-2')}>
53+
<FilterButton
54+
handleOnPress={() => onFilterPress(value.type)}
55+
value={value.options[selectedFilters[value.type] as keyof typeof value.options]}
56+
/>
57+
</Animated.View>
58+
);
59+
}
60+
return (
61+
<Animated.View
62+
layout={LinearTransition.springify().stiffness(200).damping(24)}
63+
key={index}
64+
style={tailwind.style('pr-2')}>
65+
<FilterButton
66+
handleOnPress={() => onFilterPress(value.type)}
67+
value={getFilterTitle(value)}
68+
/>
69+
</Animated.View>
70+
);
71+
})}
5172
</Animated.View>
5273
);
5374
};

src/components-next/common/filters/FilterButton.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,14 @@ import { CaretBottomSmall } from '@/svg-icons';
88
import { tailwind } from '@/theme';
99
import { useHaptic, useScaleAnimation } from '@/utils';
1010
import { Icon } from '../icon';
11-
import { BaseFilterOption } from './FilterBar';
1211

1312
type FilterButtonProps = {
14-
allFilters: BaseFilterOption;
15-
selectedFilters: Record<string, string>;
13+
value: string;
1614
handleOnPress: () => void;
1715
};
1816

1917
export const FilterButton = (props: FilterButtonProps) => {
20-
const { allFilters, handleOnPress, selectedFilters } = props;
18+
const { value, handleOnPress } = props;
2119
const { handlers, animatedStyle } = useScaleAnimation();
2220
const { filtersModalSheetRef } = useRefsContext();
2321

@@ -40,7 +38,7 @@ export const FilterButton = (props: FilterButtonProps) => {
4038
style={tailwind.style(
4139
'text-sm font-inter-medium-24 leading-[16px] tracking-[0.24px] pr-1 capitalize text-gray-950',
4240
)}>
43-
{allFilters.options[selectedFilters[allFilters.type] as keyof typeof allFilters.options]}
41+
{value}
4442
</Animated.Text>
4543
<Icon icon={<CaretBottomSmall />} size={7.5} />
4644
</Pressable>

src/i18n/en.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,6 @@
5959
"AGENT": {
6060
"SEARCH_AGENT": "Search agents"
6161
},
62-
"ASSIGNEE_TYPE": {
63-
"TITLE": "Filter by assignee type",
64-
"OPTIONS": {
65-
"ME": "Me",
66-
"UNASSIGNED": "Unassigned",
67-
"ALL": "All"
68-
}
69-
},
7062
"INBOX": {
7163
"TITLE": "Filter by inbox"
7264
},
@@ -87,6 +79,14 @@
8779
"RESOLVED": "Resolved",
8880
"ALL": "All"
8981
}
82+
},
83+
"ASSIGNEE_TYPE": {
84+
"TITLE": "Filter by assignee type",
85+
"OPTIONS": {
86+
"ME": "Me",
87+
"UNASSIGNED": "Unassigned",
88+
"ALL": "All"
89+
}
9090
}
9191
},
9292
"ASSIGNEE": {

src/screens/chat-screen/components/message-components/ImageBubble.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
import React from 'react';
2-
import { Dimensions } from 'react-native';
32
import Animated from 'react-native-reanimated';
43
import { LightBox, LightBoxProps } from '@alantoa/lightbox';
54
import { Image } from 'expo-image';
65
import { tailwind } from '@/theme';
76

8-
const { width, height } = Dimensions.get('screen');
9-
107
const AnimatedExpoImage = Animated.createAnimatedComponent(Image);
118

129
type ImageCellProps = {
@@ -18,12 +15,13 @@ type ImageContainerProps = Pick<ImageCellProps, 'imageSrc'> &
1815

1916
export const ImageBubbleContainer = (props: ImageContainerProps) => {
2017
const { imageSrc, height: lightboxH, width: lightboxW } = props;
18+
2119
return (
2220
<LightBox
2321
width={lightboxW}
2422
height={lightboxH}
25-
imgLayout={{ height: height * 0.8, width: width * 0.8 }}
26-
tapToClose={false}>
23+
imgLayout={{ width: lightboxW, height: lightboxH }}
24+
tapToClose={true}>
2725
<AnimatedExpoImage
2826
source={{ uri: imageSrc }}
2927
contentFit="cover"
@@ -32,6 +30,7 @@ export const ImageBubbleContainer = (props: ImageContainerProps) => {
3230
</LightBox>
3331
);
3432
};
33+
3534
export const ImageBubble = (props: ImageCellProps) => {
3635
const { imageSrc } = props;
3736

src/screens/chat-screen/components/reply-box/MessageTextInput.tsx

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -183,32 +183,34 @@ export const MessageTextInput = ({
183183
if (keyword == null || !isPrivateMessage) {
184184
return null;
185185
}
186+
const filteredSuggestions = suggestions.filter(one =>
187+
one.name?.toLocaleLowerCase().includes(keyword.toLocaleLowerCase()),
188+
);
186189
return (
187190
<Animated.View
188191
style={[
189192
tailwind.style(
190-
'absolute bottom-full rounded-[13px] mx-4 px-2 bg-white w-full max-h-[250px]',
193+
'bg-white border-t border-gray-200 rounded-[13px] mx-4 px-2 w-full max-h-[250px]',
194+
Platform.OS === 'ios' ? 'absolute bottom-full' : 'relative h-[150px]',
191195
),
192196
styles.listShadow,
193197
]}>
194198
<ScrollView keyboardShouldPersistTaps="always">
195-
{suggestions
196-
.filter(one => one.name?.toLocaleLowerCase().includes(keyword.toLocaleLowerCase()))
197-
.map(agent => {
198-
const agentSuggestion: AgentSuggestion = {
199-
...agent,
200-
id: String(agent.id),
201-
name: agent.name || '',
202-
};
203-
return (
204-
<MentionUser
205-
key={agent.id}
206-
agent={agent}
207-
lastItem={false}
208-
onPress={() => onSuggestionPress(agentSuggestion)}
209-
/>
210-
);
211-
})}
199+
{filteredSuggestions.map(agent => {
200+
const agentSuggestion: AgentSuggestion = {
201+
...agent,
202+
id: String(agent.id),
203+
name: agent.name || '',
204+
};
205+
return (
206+
<MentionUser
207+
key={agent.id}
208+
agent={agent}
209+
lastItem={false}
210+
onPress={() => onSuggestionPress(agentSuggestion)}
211+
/>
212+
);
213+
})}
212214
</ScrollView>
213215
</Animated.View>
214216
);

0 commit comments

Comments
 (0)