From 919cd4be3b1d63486c26fd532720a2d37ee20de4 Mon Sep 17 00:00:00 2001 From: Adolfo Reyna Date: Mon, 17 Jul 2023 17:08:32 -0400 Subject: [PATCH] Some UI improvements --- components/Media.js | 89 +++++++++++++++++++------------- components/Post.js | 15 ++++-- components/ProfilePhotoCircle.js | 11 ++-- 3 files changed, 70 insertions(+), 45 deletions(-) diff --git a/components/Media.js b/components/Media.js index 8d61a5d..927fbc1 100644 --- a/components/Media.js +++ b/components/Media.js @@ -93,15 +93,15 @@ let Media = (props) => { ) ) : (videosId.length ? : <>); - const video2 = (hlsUrl && !props.skiptVideo) ? ( - loaded ? + const video2 = (hlsUrl && !props.skiptVideo) ? ( + loaded ? : { - //setLoaded(true) - GlobalState.currentMedia = hlsUrl; - GlobalState.mediaPost = props.post; - }}> - {poster ? + //setLoaded(true) + GlobalState.currentMedia = hlsUrl; + GlobalState.mediaPost = props.post; + }}> + {poster ? : } - ): <>; + ) : <>; const iframe = iframeSrc.length ? : <>; - const youtubeEmb = youtubeId.length ? + const youtubeEmb = youtubeId.length ? : <>; const renderImages = (({ item, index }) => { return ( - { - //alert("hello"); - navigation.navigate('Slideshow', { images: imagesTag, startIndex: index}); - }} - onLongPress={()=>{ - Share.share({ - //message: image[1], - url: item[1], - }); - }}> - + { + //alert("hello"); + navigation.navigate('Slideshow', { images: imagesTag, startIndex: index }); + }} + onLongPress={() => { + Share.share({ + //message: image[1], + url: item[1], + }); + }}> + - ); + ); }); let progress = <>; - if(viewer.data && viewer.data[props.postId]) { + if (viewer.data && viewer.data[props.postId]) { const percent = Math.round(viewer.data[props.postId].time / viewer.data[props.postId].duration * 100); - if(percent) + if (percent) progress = <> {percent}% {Moment(viewer.data[props.postId].ts).fromNow()} @@ -149,7 +149,12 @@ let Media = (props) => { ; } return ( - + { (imagesTag.length > 2) ? { renderItem={renderImages} keyExtractor={item => item[1]} initialNumToRender={2} + style={{ + transform: [{ + scale: 1.1 + }], + paddingTop: 5, + }} + showsHorizontalScrollIndicator={false} /> : { imagesTag.map((image, i) => { return ( //{post.content} - { - navigation.navigate('Slideshow', { images: imagesTag, startIndex: i }); - }} - onLongPress={()=>{ - Share.share({ - //message: image[1], - url: image[1], - }); - }}> + { + navigation.navigate('Slideshow', { images: imagesTag, startIndex: i }); + }} + onLongPress={() => { + Share.share({ + //message: image[1], + url: image[1], + }); + }}> ) @@ -196,6 +208,7 @@ const styles = StyleSheet.create({ image: { width: "100%", aspectRatio: 1, + borderRadius: 15, }, poster: { width: "100%", @@ -204,12 +217,14 @@ const styles = StyleSheet.create({ multipleImage: { width: "49%", aspectRatio: 1, - margin: 2, + margin: 3, + borderRadius: 15, }, flatlistImages: { width: 300, aspectRatio: 1, - margin: 2, + margin: 5, + borderRadius: 15, }, iframe: { width: "100%", diff --git a/components/Post.js b/components/Post.js index 48444d3..baa8455 100644 --- a/components/Post.js +++ b/components/Post.js @@ -60,7 +60,10 @@ let Post = (props) => { ); return ( - + {!post.nonOrganicType ? @@ -71,7 +74,10 @@ let Post = (props) => { {" " + Moment(post.createdAt).fromNow()} - {cleanContent} + { cleanContent.length ? + {cleanContent} + : <> + } @@ -142,9 +148,10 @@ const styles = StyleSheet.create({ }, card: { margin: 0, - backgroundColor: "#FFFAFA", + backgroundColor: "#FAFAFA", borderRadius: 0, - marginBottom: 2 + marginBottom: 2, + padding: 0 }, comment: { margin: 8, diff --git a/components/ProfilePhotoCircle.js b/components/ProfilePhotoCircle.js index f5ec53b..2346fb9 100644 --- a/components/ProfilePhotoCircle.js +++ b/components/ProfilePhotoCircle.js @@ -2,12 +2,13 @@ import React, { useState, useEffect } from 'react'; import { Avatar } from 'react-native-paper'; import { View, StyleSheet, Text } from 'react-native'; import API from './../API.js'; +import { useNavigation } from '@react-navigation/native'; const DefaultPhoto = "https://social.emmint.com/uploads/e6f9be6d665dc43417701bf16a90122c.png"; const ProfileHeader = ({ profileid, withName = false, small = false }) => { let [profile, setProfile] = useState({}); - + const navigation = useNavigation(); useEffect(() => { let subscribed = true; let getData = async () => { @@ -22,14 +23,16 @@ const ProfileHeader = ({ profileid, withName = false, small = false }) => { }, [profileid]); let photoUrl = profile.profile && profile.profile.photo ? 'https://social.emmint.com/' + profile.profile.photo : DefaultPhoto; const fullName = " " + profile.profile?.firstName + " " + profile.profile?.lastName; - console.log(photoUrl); + const onPress = () => { + return navigation.navigate('Profile', { profileid }) + } return ( - + - {fullName} + {fullName} );