about summary refs log tree commit diff
path: root/src/view/com/post-thread
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-01-24 13:00:11 -0600
committerGitHub <noreply@github.com>2023-01-24 13:00:11 -0600
commitf36c9565362b741c58672204fe0c155252affe28 (patch)
tree85d90f3caae2c8f2103ec50346f9274cf8b243c5 /src/view/com/post-thread
parent3a90114f3afc66cfef70c71c2ee343c29e1f3e8d (diff)
downloadvoidsky-f36c9565362b741c58672204fe0c155252affe28.tar.zst
Resolve all remaining lint issues (#88)
* Rework 'navIdx' variables from number arrays to strings to avoid equality-check failures in react hooks

* Resolve all remaining lint issues

* Fix tests

* Use node v18 in gh action test
Diffstat (limited to 'src/view/com/post-thread')
-rw-r--r--src/view/com/post-thread/PostRepostedBy.tsx6
-rw-r--r--src/view/com/post-thread/PostThread.tsx11
-rw-r--r--src/view/com/post-thread/PostThreadItem.tsx16
-rw-r--r--src/view/com/post-thread/PostVotedBy.tsx6
4 files changed, 15 insertions, 24 deletions
diff --git a/src/view/com/post-thread/PostRepostedBy.tsx b/src/view/com/post-thread/PostRepostedBy.tsx
index c68ceee0b..02d61b47b 100644
--- a/src/view/com/post-thread/PostRepostedBy.tsx
+++ b/src/view/com/post-thread/PostRepostedBy.tsx
@@ -53,11 +53,7 @@ export const PostRepostedBy = observer(function PostRepostedBy({
   if (view.hasError) {
     return (
       <View>
-        <ErrorMessage
-          message={view.error}
-          style={{margin: 6}}
-          onPressTryAgain={onRefresh}
-        />
+        <ErrorMessage message={view.error} onPressTryAgain={onRefresh} />
       </View>
     )
   }
diff --git a/src/view/com/post-thread/PostThread.tsx b/src/view/com/post-thread/PostThread.tsx
index dcdc1eb49..a52bc643c 100644
--- a/src/view/com/post-thread/PostThread.tsx
+++ b/src/view/com/post-thread/PostThread.tsx
@@ -7,6 +7,7 @@ import {
 } from '../../../state/models/post-thread-view'
 import {PostThreadItem} from './PostThreadItem'
 import {ErrorMessage} from '../util/error/ErrorMessage'
+import {s} from '../../lib/styles'
 
 export const PostThread = observer(function PostThread({
   uri,
@@ -60,11 +61,7 @@ export const PostThread = observer(function PostThread({
   if (view.hasError) {
     return (
       <View>
-        <ErrorMessage
-          message={view.error}
-          style={{margin: 6}}
-          onPressTryAgain={onRefresh}
-        />
+        <ErrorMessage message={view.error} onPressTryAgain={onRefresh} />
       </View>
     )
   }
@@ -84,8 +81,8 @@ export const PostThread = observer(function PostThread({
       onRefresh={onRefresh}
       onLayout={onLayout}
       onScrollToIndexFailed={onScrollToIndexFailed}
-      style={{flex: 1}}
-      contentContainerStyle={{paddingBottom: 200}}
+      style={s.h100pct}
+      contentContainerStyle={s.contentContainer}
     />
   )
 })
diff --git a/src/view/com/post-thread/PostThreadItem.tsx b/src/view/com/post-thread/PostThreadItem.tsx
index 2c7ab716c..92f7acc03 100644
--- a/src/view/com/post-thread/PostThreadItem.tsx
+++ b/src/view/com/post-thread/PostThreadItem.tsx
@@ -80,7 +80,7 @@ export const PostThreadItem = observer(function PostThreadItem({
       .catch(e => store.log.error('Failed to toggle upvote', e))
   }
   const onCopyPostText = () => {
-    Clipboard.setString(record.text)
+    Clipboard.setString(record?.text || '')
     Toast.show('Copied to clipboard')
   }
   const onDeletePost = () => {
@@ -131,8 +131,8 @@ export const PostThreadItem = observer(function PostThreadItem({
               </Link>
             </View>
             <View style={styles.layoutContent}>
-              <View style={[styles.meta, {paddingTop: 5, paddingBottom: 0}]}>
-                <View style={{flexDirection: 'row', alignItems: 'baseline'}}>
+              <View style={[styles.meta, styles.metaExpandedLine1]}>
+                <View style={[s.flexRow, s.alignBaseline]}>
                   <Link
                     style={styles.metaItem}
                     href={authorHref}
@@ -305,10 +305,8 @@ export const PostThreadItem = observer(function PostThreadItem({
                     lineHeight={1.3}
                   />
                 </View>
-              ) : (
-                <View style={{height: 5}} />
-              )}
-              <PostEmbeds embed={item.post.embed} style={{marginBottom: 10}} />
+              ) : undefined}
+              <PostEmbeds embed={item.post.embed} style={s.mb10} />
               <PostCtrls
                 itemHref={itemHref}
                 itemTitle={itemTitle}
@@ -389,6 +387,10 @@ const styles = StyleSheet.create({
     paddingTop: 2,
     paddingBottom: 2,
   },
+  metaExpandedLine1: {
+    paddingTop: 5,
+    paddingBottom: 0,
+  },
   metaItem: {
     paddingRight: 5,
     maxWidth: 240,
diff --git a/src/view/com/post-thread/PostVotedBy.tsx b/src/view/com/post-thread/PostVotedBy.tsx
index 06fe53888..011df4aa1 100644
--- a/src/view/com/post-thread/PostVotedBy.tsx
+++ b/src/view/com/post-thread/PostVotedBy.tsx
@@ -48,11 +48,7 @@ export const PostVotedBy = observer(function PostVotedBy({
   if (view.hasError) {
     return (
       <View>
-        <ErrorMessage
-          message={view.error}
-          style={{margin: 6}}
-          onPressTryAgain={onRefresh}
-        />
+        <ErrorMessage message={view.error} onPressTryAgain={onRefresh} />
       </View>
     )
   }