From d3b6c209f47e7b578f4aa19726d26763ba5f6310 Mon Sep 17 00:00:00 2001 From: Matthew Turk Date: Sat, 1 Apr 2023 15:30:12 -0700 Subject: [PATCH 01/80] Minor refactoring --- components/screens/Home.js | 88 +++++++++++--------------------------- 1 file changed, 25 insertions(+), 63 deletions(-) diff --git a/components/screens/Home.js b/components/screens/Home.js index 47fe759..a423ff4 100644 --- a/components/screens/Home.js +++ b/components/screens/Home.js @@ -14,68 +14,30 @@ const FirstPage = React.memo(({ articles, data, navigation, deviceType }) => { return ( - - - + + + - - - - + + + + - {_.chunk(articles?.culture?.slice(0, 4 * groupSize), groupSize)?.map( - (group, outerIndex) => ( - - {group.map((item, index) => ( - - ))} - - ) - )} + {_.chunk(articles?.culture?.slice(0, 4 * groupSize), groupSize)?.map((group, outerIndex) => ( + + {group.map((item, index) => ( + + ))} + + ))} - - + + ); @@ -86,7 +48,7 @@ export default function Home({ navigation, route }) { const { data, articles, error, loading } = useWordPress(pageNumber); const { theme, deviceType } = useContext(ThemeContext); - const firstPageComponent = useMemo(() => { + const Header = useMemo(() => { return ( ( setPageNumber(pageNumber + 1)} onEndReachedThreshold={0.25} - keyExtractor={(item, index) => index.toString()} + keyExtractor={item => item.id.toString()} ListFooterComponent={() => } /> ) : ( - {loading ? : (Something went wrong.{`\n${JSON.stringify(error)}`})} + {loading ? : Something went wrong.{`\n${JSON.stringify(error)}`}} ); } From 38c7fc5c557c82cec44435b67787ea06339a6d09 Mon Sep 17 00:00:00 2001 From: Matthew Turk Date: Sat, 1 Apr 2023 15:40:23 -0700 Subject: [PATCH 02/80] Minor refactoring --- components/screens/Home.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/screens/Home.js b/components/screens/Home.js index a423ff4..794f60a 100644 --- a/components/screens/Home.js +++ b/components/screens/Home.js @@ -89,11 +89,11 @@ export default function Home({ navigation, route }) { const styles = StyleSheet.create({ container: { - flex: 1, + flex: 1 }, empty: { flex: 1, justifyContent: "center", - alignItems: "center", - }, + alignItems: "center" + } }); \ No newline at end of file From 1aaba3d83b362aa320adfd0cdc666eee5bc827bc Mon Sep 17 00:00:00 2001 From: Matthew Turk Date: Sat, 1 Apr 2023 16:01:26 -0700 Subject: [PATCH 03/80] Indentation --- components/common/Diptych.js | 132 +++++++++++++++++------------------ 1 file changed, 66 insertions(+), 66 deletions(-) diff --git a/components/common/Diptych.js b/components/common/Diptych.js index 7d4aeae..53330b5 100644 --- a/components/common/Diptych.js +++ b/components/common/Diptych.js @@ -13,75 +13,75 @@ const { width, height } = Dimensions.get("window") const pixelRatio = PixelRatio.get() export default function Diptych(props) { - const articles = props.articles.length % 2 === 0 ? props.articles : props.articles.slice(0, -1) - const [selection, setSelection] = useState(0) - const { deviceType } = useContext(ThemeContext) - const groupSize = deviceType === Device.DeviceType.PHONE ? 2 : 3 - - const Header = (props) => ( - - - - ) + const articles = props.articles.length % 2 === 0 ? props.articles : props.articles.slice(0, -1) + const [selection, setSelection] = useState(0) + const { deviceType } = useContext(ThemeContext) + const groupSize = deviceType === Device.DeviceType.PHONE ? 2 : 3 + + const Header = (props) => ( + + + + ) - const Footer = (props) => ( - - {moment(new Date(props.date)).fromNow().toUpperCase()} - - ) + const Footer = (props) => ( + + {moment(new Date(props.date)).fromNow().toUpperCase()} + + ) - return ( - setSelection(e.nativeEvent.position)} overdrag> - {_.chunk(articles, groupSize).map((couplet, index) => ( - - {couplet.map((item, _index) => ( - } - footer={