From eac3ee32c828bee996c762d6ece1d72d5a4f82a2 Mon Sep 17 00:00:00 2001 From: Rajarshee Chatterjee Date: Sun, 14 Aug 2022 11:43:49 +0530 Subject: [PATCH] fix: Add Empty Summary placeholder and show Full Novel Title (Closes #355) --- .../components/Info/NovelInfoComponents.js | 11 +---- .../components/NovelSummary/NovelSummary.tsx | 43 +++++++++++-------- strings/languages/en/strings.json | 1 + strings/types/index.ts | 1 + 4 files changed, 29 insertions(+), 27 deletions(-) diff --git a/src/screens/novel/components/Info/NovelInfoComponents.js b/src/screens/novel/components/Info/NovelInfoComponents.js index aebf2ceb..5646c284 100644 --- a/src/screens/novel/components/Info/NovelInfoComponents.js +++ b/src/screens/novel/components/Info/NovelInfoComponents.js @@ -116,7 +116,6 @@ const NovelTitle = ({ theme, children, onLongPress, onPress }) => ( {children} @@ -124,10 +123,7 @@ const NovelTitle = ({ theme, children, onLongPress, onPress }) => ( ); const NovelAuthor = ({ theme, children }) => ( - + {children} ); @@ -242,11 +238,8 @@ const styles = StyleSheet.create({ marginBottom: 0, paddingTop: 90, }, - coverImage: { - height: 270, - }, + coverImage: {}, linearGradient: { - height: 271, flex: 1, }, novelThumbnail: { diff --git a/src/screens/novel/components/NovelSummary/NovelSummary.tsx b/src/screens/novel/components/NovelSummary/NovelSummary.tsx index dd5f782c..c1d20b28 100644 --- a/src/screens/novel/components/NovelSummary/NovelSummary.tsx +++ b/src/screens/novel/components/NovelSummary/NovelSummary.tsx @@ -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 = ({ 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 = ({ style={[styles.summaryText, { color: textColor }]} numberOfLines={expanded ? Number.MAX_SAFE_INTEGER : 3} > - {summary} + {summary || getString('novelScreen.noSummary')} - - - + {summary ? ( + + + + ) : null} ); }; diff --git a/strings/languages/en/strings.json b/strings/languages/en/strings.json index b9815707..6b74aee6 100644 --- a/strings/languages/en/strings.json +++ b/strings/languages/en/strings.json @@ -91,6 +91,7 @@ "continueReading": "Continue reading", "chapters": "chapters", "migrate": "Migrate", + "noSummary": "No summary", "bottomSheet": { "filter": "Filter", "sort": "Sort", diff --git a/strings/types/index.ts b/strings/types/index.ts index 23000d9f..3790e920 100644 --- a/strings/types/index.ts +++ b/strings/types/index.ts @@ -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';