fix: Add Empty Summary placeholder and show Full Novel Title (Closes #355)

This commit is contained in:
Rajarshee Chatterjee
2022-08-14 11:43:49 +05:30
parent 0cf249eec5
commit eac3ee32c8
4 changed files with 29 additions and 27 deletions
@@ -116,7 +116,6 @@ const NovelTitle = ({ theme, children, onLongPress, onPress }) => (
<Text
onLongPress={onLongPress}
onPress={onPress}
numberOfLines={2}
style={[styles.novelTitle, { color: theme.textColorPrimary }]}
>
{children}
@@ -124,10 +123,7 @@ const NovelTitle = ({ theme, children, onLongPress, onPress }) => (
);
const NovelAuthor = ({ theme, children }) => (
<Text
style={[styles.novelAuthor, { color: theme.textColorSecondary }]}
numberOfLines={2}
>
<Text style={[styles.novelAuthor, { color: theme.textColorSecondary }]}>
{children}
</Text>
);
@@ -242,11 +238,8 @@ const styles = StyleSheet.create({
marginBottom: 0,
paddingTop: 90,
},
coverImage: {
height: 270,
},
coverImage: {},
linearGradient: {
height: 271,
flex: 1,
},
novelThumbnail: {
@@ -1,3 +1,4 @@
import { getString } from '@strings/translations';
import React, { useState } from 'react';
import { Pressable, StyleSheet, Text, View } from 'react-native';
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
@@ -19,7 +20,11 @@ const NovelSummary: React.FC<NovelSummaryProps> = ({
const iconBackground = `${theme.colorPrimaryDark}D1`;
const [expanded, setExpanded] = useState(isExpanded);
const toggleExpanded = () => setExpanded(!expanded);
const toggleExpanded = () => {
if (summary) {
setExpanded(!expanded);
}
};
const bottom = expanded ? 0 : 4;
const containerBottomPadding = expanded ? 24 : 8;
@@ -36,24 +41,26 @@ const NovelSummary: React.FC<NovelSummaryProps> = ({
style={[styles.summaryText, { color: textColor }]}
numberOfLines={expanded ? Number.MAX_SAFE_INTEGER : 3}
>
{summary}
{summary || getString('novelScreen.noSummary')}
</Text>
<View
style={[
styles.iconContainer,
{
backgroundColor: iconBackground,
bottom,
},
]}
>
<MaterialCommunityIcons
name={expanded ? 'chevron-up' : 'chevron-down'}
color={theme.textColorPrimary}
size={24}
style={[{ backgroundColor: theme.colorPrimaryDark }, styles.icon]}
/>
</View>
{summary ? (
<View
style={[
styles.iconContainer,
{
backgroundColor: iconBackground,
bottom,
},
]}
>
<MaterialCommunityIcons
name={expanded ? 'chevron-up' : 'chevron-down'}
color={theme.textColorPrimary}
size={24}
style={[{ backgroundColor: theme.colorPrimaryDark }, styles.icon]}
/>
</View>
) : null}
</Pressable>
);
};
+1
View File
@@ -91,6 +91,7 @@
"continueReading": "Continue reading",
"chapters": "chapters",
"migrate": "Migrate",
"noSummary": "No summary",
"bottomSheet": {
"filter": "Filter",
"sort": "Sort",
+1
View File
@@ -72,6 +72,7 @@ export interface StringMap {
'novelScreen.continueReading': 'string';
'novelScreen.chapters': 'string';
'novelScreen.migrate': 'string';
'novelScreen.noSummary': 'string';
'novelScreen.bottomSheet.filter': 'string';
'novelScreen.bottomSheet.sort': 'string';
'novelScreen.bottomSheet.display': 'string';