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
65 changes: 33 additions & 32 deletions package/src/components/Indicators/EmptyStateIndicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,6 @@ import { useTranslationContext } from '../../contexts/translationContext/Transla
import { useViewport } from '../../hooks/useViewport';
import { ChatIcon, MessageIcon } from '../../icons';

const styles = StyleSheet.create({
channelContainer: {
alignItems: 'center',
flex: 1,
justifyContent: 'center',
},
channelDetails: {
fontSize: 14,
textAlign: 'center',
},
channelTitle: {
fontSize: 16,
paddingBottom: 8,
paddingTop: 16,
},
messageContainer: {
alignItems: 'center',
flex: 1,
justifyContent: 'center',
},
messageTitle: {
fontSize: 20,
fontWeight: 'bold',
paddingBottom: 8,
},
});

export type EmptyStateProps = {
listType?: 'channel' | 'message' | 'default';
};
Expand All @@ -41,7 +14,13 @@ export const EmptyStateIndicator = ({ listType }: EmptyStateProps) => {
const {
theme: {
colors: { black, grey, grey_gainsboro },
emptyStateIndicator: { channelContainer, channelDetails, channelTitle },
emptyStateIndicator: {
channelContainer,
channelDetails,
channelTitle,
messageContainer,
messageTitle,
},
},
} = useTheme();
const { vw } = useViewport();
Expand All @@ -51,7 +30,7 @@ export const EmptyStateIndicator = ({ listType }: EmptyStateProps) => {
switch (listType) {
case 'channel':
return (
<View style={[styles.channelContainer, channelContainer]}>
<View style={[styles.container, channelContainer]}>
<MessageIcon height={width} pathFill={grey_gainsboro} width={width} />
<Text
style={[styles.channelTitle, { color: black }, channelTitle]}
Expand All @@ -69,14 +48,36 @@ export const EmptyStateIndicator = ({ listType }: EmptyStateProps) => {
);
case 'message':
return (
<View style={[styles.messageContainer]}>
<View style={[styles.container, messageContainer]}>
<ChatIcon height={width} pathFill={grey_gainsboro} width={width} />
<Text style={[styles.messageTitle, { color: grey_gainsboro }]}>
<Text style={[styles.messageTitle, { color: grey_gainsboro }, messageTitle]}>
{t<string>('No chats here yet…')}
</Text>
</View>
);
default:
return <Text style={{ color: black }}>No items exist</Text>;
return <Text style={[{ color: black }, messageContainer]}>No items exist</Text>;
}
};

const styles = StyleSheet.create({
channelDetails: {
fontSize: 14,
textAlign: 'center',
},
channelTitle: {
fontSize: 16,
paddingBottom: 8,
paddingTop: 16,
},
container: {
alignItems: 'center',
flex: 1,
justifyContent: 'center',
},
messageTitle: {
fontSize: 20,
fontWeight: 'bold',
paddingBottom: 8,
},
});
2 changes: 1 addition & 1 deletion package/src/components/Indicators/LoadingDot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ export const LoadingDot = (props: Props) => {
width: diameter,
},
style,
loadingDot,
dotStyle,
loadingDot,
]}
/>
);
Expand Down
36 changes: 18 additions & 18 deletions package/src/components/Indicators/LoadingErrorIndicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,6 @@ import { StyleSheet, Text, TouchableOpacity } from 'react-native';
import { useTheme } from '../../contexts/themeContext/ThemeContext';
import { useTranslationContext } from '../../contexts/translationContext/TranslationContext';

const styles = StyleSheet.create({
container: {
alignItems: 'center',
height: '100%',
justifyContent: 'center',
width: '100%',
},
errorText: {
fontSize: 14,
fontWeight: '600',
marginTop: 20,
},
retryText: {
fontSize: 30,
fontWeight: '600',
},
});

type LoadingErrorWrapperProps = {
text: string;
onPress?: () => void;
Expand Down Expand Up @@ -85,3 +67,21 @@ export const LoadingErrorIndicator = (props: LoadingErrorProps) => {
};

LoadingErrorIndicator.displayName = 'LoadingErrorIndicator{loadingErrorIndicator}';

const styles = StyleSheet.create({
container: {
alignItems: 'center',
height: '100%',
justifyContent: 'center',
width: '100%',
},
errorText: {
fontSize: 14,
fontWeight: '600',
marginTop: 20,
},
retryText: {
fontSize: 30,
fontWeight: '600',
},
});
26 changes: 13 additions & 13 deletions package/src/components/Indicators/LoadingIndicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,6 @@ import { useTheme } from '../../contexts/themeContext/ThemeContext';
import { useTranslationContext } from '../../contexts/translationContext/TranslationContext';
import { Spinner } from '../Spinner/Spinner';

const styles = StyleSheet.create({
container: {
alignItems: 'center',
flex: 1,
justifyContent: 'center',
},
loadingText: {
fontSize: 14,
fontWeight: '600',
marginTop: 20,
},
});

type LoadingIndicatorWrapperProps = { text: string };

const LoadingIndicatorWrapper = ({ text }: LoadingIndicatorWrapperProps) => {
Expand Down Expand Up @@ -66,3 +53,16 @@ export const LoadingIndicator = (props: LoadingProps) => {
};

LoadingIndicator.displayName = 'LoadingIndicator{loadingIndicator}';

const styles = StyleSheet.create({
container: {
alignItems: 'center',
flex: 1,
justifyContent: 'center',
},
loadingText: {
fontSize: 14,
fontWeight: '600',
marginTop: 20,
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ exports[`TypingIndicator should match typing indicator snapshot 1`] = `
{
"marginRight": 2,
},
{},
{
"opacity": -0.3333333333333333,
},
{},
]
}
/>
Expand All @@ -62,10 +62,10 @@ exports[`TypingIndicator should match typing indicator snapshot 1`] = `
{
"marginHorizontal": 2,
},
{},
{
"opacity": 0.3333333333333333,
},
{},
]
}
/>
Expand All @@ -81,10 +81,10 @@ exports[`TypingIndicator should match typing indicator snapshot 1`] = `
{
"marginLeft": 2,
},
{},
{
"opacity": 1,
},
{},
]
}
/>
Expand Down
4 changes: 4 additions & 0 deletions package/src/contexts/themeContext/utils/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ export type Theme = {
channelContainer: ViewStyle;
channelDetails: TextStyle;
channelTitle: TextStyle;
messageContainer: ViewStyle;
messageTitle: TextStyle;
};
groupAvatar: {
container: ViewStyle;
Expand Down Expand Up @@ -753,6 +755,8 @@ export const defaultTheme: Theme = {
channelContainer: {},
channelDetails: {},
channelTitle: {},
messageContainer: {},
messageTitle: {},
},
groupAvatar: {
container: {},
Expand Down