From 940bd14d6e2d0119ff6d8e1e39d6c27eafca0fe8 Mon Sep 17 00:00:00 2001 From: Adolfo Reyna Date: Sun, 16 Jul 2023 22:13:30 -0400 Subject: [PATCH] Refresh Look on posts --- components/Post.js | 53 +++--- components/ProfilePhotoCircle.js | 60 +++++++ i18nMessages.js | 278 +++++++++++++++++++++++-------- 3 files changed, 305 insertions(+), 86 deletions(-) create mode 100644 components/ProfilePhotoCircle.js diff --git a/components/Post.js b/components/Post.js index ad7765f..48444d3 100644 --- a/components/Post.js +++ b/components/Post.js @@ -11,6 +11,7 @@ import Moment from 'moment'; import { useSnapshot } from 'valtio'; import GlobalState from '../contexts/GlobalState.js'; import i18n from "../i18nMessages.js"; +import ProfilePhotoCircle from './ProfilePhotoCircle.js'; let Post = (props) => { @@ -21,7 +22,7 @@ let Post = (props) => { let [likes, changeLikes] = useState(Object.keys(post.reactions).length); let [bookmarked, changeBookmarked] = useState(post.bookmarks && post.bookmarks.includes(viewer._id)); let toProfileText = post.toProfile && post.toProfile !== post.profileid ? - {">"} : undefined; + : undefined; let cleanContent = post.content.replace(/@[A-z]+:.+\w/g, ''); //cleanContent = convertLinks(cleanContent); const newComentAdded = (commentData) => { @@ -60,18 +61,20 @@ let Post = (props) => { return ( - + {!post.nonOrganicType ? - - + + {toProfileText} {" " + Moment(post.createdAt).fromNow()} - - {cleanContent} - + + {cleanContent} + + + : {i18n.t("message.news")} @@ -81,27 +84,36 @@ let Post = (props) => { } - + - - + + @@ -129,9 +141,10 @@ const styles = StyleSheet.create({ fontSize: 17, }, card: { - margin: 8, - backgroundColor: "#FFFFFF", - borderRadius: 5, + margin: 0, + backgroundColor: "#FFFAFA", + borderRadius: 0, + marginBottom: 2 }, comment: { margin: 8, diff --git a/components/ProfilePhotoCircle.js b/components/ProfilePhotoCircle.js new file mode 100644 index 0000000..f5ec53b --- /dev/null +++ b/components/ProfilePhotoCircle.js @@ -0,0 +1,60 @@ +import React, { useState, useEffect } from 'react'; +import { Avatar } from 'react-native-paper'; +import { View, StyleSheet, Text } from 'react-native'; +import API from './../API.js'; + +const DefaultPhoto = "https://social.emmint.com/uploads/e6f9be6d665dc43417701bf16a90122c.png"; + +const ProfileHeader = ({ profileid, withName = false, small = false }) => { + let [profile, setProfile] = useState({}); + + useEffect(() => { + let subscribed = true; + let getData = async () => { + let p = await API.getUserProfile(profileid).catch(() => { return {} }); + if (subscribed) + setProfile(p); + } + getData(); + return () => { + subscribed = 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); + return ( + + + + + + {fullName} + + + ); + +} + +const styles = StyleSheet.create({ + container: { + flexDirection: 'row', + alignItems: 'center', + }, + avatarContainer: { + marginRight: 5, + }, + textContainer: { + alignItems: 'center', + }, + profileName: { + fontSize: 16, + fontWeight: 'bold', + }, + smallProfileName: { + fontSize: 14, + fontWeight: 'bold', + }, +}); + +export default React.memo(ProfileHeader); \ No newline at end of file diff --git a/i18nMessages.js b/i18nMessages.js index 5704f27..37de9ce 100644 --- a/i18nMessages.js +++ b/i18nMessages.js @@ -3,6 +3,8 @@ import { I18n } from 'i18n-js'; import moment from 'moment' import 'moment/min/locales' +I18n.enableFallback = true; + const messages = { en: { message: { @@ -78,75 +80,219 @@ const messages = { }, es: { message: { - feed: 'Mural', - events: "Eventos", - livestream: "En Vivo", - search: 'Busqueda', - invite: "Invitaciones", + feed: 'Inicio', + events: 'Eventos', + livestream: 'Transmisión en vivo', + search: 'Buscar', + invite: 'Invitar', groups: 'Grupos', courses: 'Cursos', - giving: "Ofrendas", - profile: "Perfil", - settings: 'Configuraciones', - logout: "Cerrar Sesión", - about: 'Acerca', - statusUpdate: "Publicación Nueva", - newsPost: "Noticias?", - post: "Publica", - add: 'Añade', - whatIsNew: "Que hay de nuevo?", - saySomethingTo: "Publica algo para ", - follow: "Seguir", - unfollow: "Dejar", - subscribe: "Subscribirse", - unsubscribe: 'Abandonar', - pending: "Pendiente", - subscribers: "Subscriptores", - loading: "Cargando", - login: 'Inicia Sesión', - email: "Correo Electronico", - cancel: "Cancelar", - password: "Contraseña", - rpassword: "Confirma tu Contraseña", - resetPassword: "Recuperar Contraseña", - register: "Registrate", + giving: 'Donaciones', + profile: 'Perfil', + settings: 'Configuración', + logout: 'Cerrar sesión', + about: 'Acerca de', + statusUpdate: 'Nueva publicación', + newsPost: 'Publicación de noticias', + post: 'Publicar', + add: 'Agregar', + whatIsNew: '¿Qué hay de nuevo?', + saySomethingTo: 'Di algo a ', + follow: 'Seguir', + unfollow: 'Dejar de seguir', + subscribe: 'Suscribirse', + unsubscribe: 'Cancelar suscripción', + pending: 'Pendiente', + subscribers: 'Suscriptores', + loading: 'Cargando', + login: 'Iniciar sesión', + email: 'Correo electrónico', + cancel: 'Cancelar', + password: 'Contraseña', + rpassword: 'Repetir contraseña', + resetPassword: 'Restablecer contraseña', + register: 'Registrarse', name: 'Nombre', - lastName: "Apeido", - describeYourself: 'Describete en unas cuantas palabras', - continueWatching: "Continua viendo", - createCourse: "Crea tu propio curso!", - createGroup: "Crea un grupo nuevo!", - title: "Titulo", - subtitle: "Subtitulo", - recentlyAdded: "Recientemente añadido", - popularCourses: "Cursos populares", - privateGroup: "Grupo privado", - tithesAndOfferings: "Diezmos y Ofrendas", - type: "Tipo", - description: "Descripción", - amount: "Cantidad", - tithes: "Diezmos", - offerings: "Ofrendas", - event: "Evento", - proceedToPayment: "Continuar con el pago", - minimumAmount: "La cantidad mínima es de ", - notifications: "Notificaciones", - searchUsers: "Busca Usuarios", - searchCourses: "Busca Cursos", - news: "Noticias", - wrongInformation: "Por favor revisa la información introducida.", - submit: "Ingresar", - IKnowThisPerson: "Conozco a esta persona", - update: "Actualizar", - invalidEmail: "El correo electronico es invalido!", - reviewPassword: "Revisa la constraseña introducida.", - updatePhoto: "Nueva foto", - optional: "Opcional", - birthday: "Cumpleaños", - localMinistry: "Ministerio Local", - ocupation: "Ocupación", - country: 'Pais', - }, + lastName: 'Apellido', + describeYourself: 'Describirse', + continueWatching: 'Continuar viendo', + createCourse: '¡Crea tu propio curso nuevo!', + createGroup: '¡Crea tu propio grupo nuevo!', + title: 'Título', + subtitle: 'Subtítulo', + recentlyAdded: 'Agregado recientemente', + popularCourses: 'Cursos populares', + privateGroup: 'Grupo privado', + tithesAndOfferings: 'Diezmos y Ofrendas', + type: 'Tipo', + description: 'Descripción', + amount: 'Monto', + tithes: 'Diezmos', + offerings: 'Ofrendas', + event: 'Evento', + proceedToPayment: 'Continuar al pago', + minimumAmount: 'El monto mínimo es ', + notifications: 'Notificaciones', + searchUsers: 'Buscar usuarios', + searchCourses: 'Buscar cursos', + news: 'Noticias', + wrongInformation: 'Por favor, revisa la información.', + submit: 'Enviar', + IKnowThisPerson: 'Conozco a esta persona', + update: 'Actualizar', + invalidEmail: '¡La dirección de correo electrónico no es válida!', + reviewPassword: 'Por favor, revisa tu contraseña.', + updatePhoto: 'Actualizar foto', + optional: 'Opcional', + birthday: 'Cumpleaños', + localMinistry: 'Ministerio local', + ocupation: 'Ocupación', + country: 'País', + } + }, + fr: { + message: { + feed: 'Fil d\'actualité', + events: 'Événements', + livestream: 'Diffusion en direct', + search: 'Rechercher', + invite: 'Inviter', + groups: 'Groupes', + courses: 'Cours', + giving: 'Don', + profile: 'Profil', + settings: 'Paramètres', + logout: 'Se déconnecter', + about: 'À propos', + statusUpdate: 'Nouvelle publication', + newsPost: 'Publication de nouvelles', + post: 'Publier', + add: 'Ajouter', + whatIsNew: 'Quoi de neuf ?', + saySomethingTo: 'Dire quelque chose à ', + follow: 'Suivre', + unfollow: 'Ne plus suivre', + subscribe: 'S\'abonner', + unsubscribe: 'Se désabonner', + pending: 'En attente', + subscribers: 'Abonnés', + loading: 'Chargement', + login: 'Connexion', + email: 'Email', + cancel: 'Annuler', + password: 'Mot de passe', + rpassword: 'Répéter le mot de passe', + resetPassword: 'Réinitialiser le mot de passe', + register: 'S\'inscrire', + name: 'Nom', + lastName: 'Nom de famille', + describeYourself: 'Décrivez-vous', + continueWatching: 'Continuer à regarder', + createCourse: 'Créer votre propre nouveau cours !', + createGroup: 'Créer votre propre nouveau groupe !', + title: 'Titre', + subtitle: 'Sous-titre', + recentlyAdded: 'Récemment ajouté', + popularCourses: 'Cours populaires', + privateGroup: 'Groupe privé', + tithesAndOfferings: 'Dîmes et offrandes', + type: 'Type', + description: 'Description', + amount: 'Montant', + tithes: 'Dîmes', + offerings: 'Offrandes', + event: 'Événement', + proceedToPayment: 'Procéder au paiement', + minimumAmount: 'Le montant minimum est de ', + notifications: 'Notifications', + searchUsers: 'Rechercher des utilisateurs', + searchCourses: 'Rechercher des cours', + news: 'Actualités', + wrongInformation: 'Veuillez vérifier les informations.', + submit: 'Soumettre', + IKnowThisPerson: 'Je connais cette personne', + update: 'Mettre à jour', + invalidEmail: 'L\'adresse email est invalide !', + reviewPassword: 'Veuillez vérifier votre mot de passe.', + updatePhoto: 'Mettre à jour la photo', + optional: 'Facultatif', + birthday: 'Date de naissance', + localMinistry: 'Ministère local', + ocupation: 'Occupation', + country: 'Pays', + } + }, + da: { + message: { + feed: 'Feed', + events: "Begivenheder", + livestream: "Live stream", + search: 'Søg', + invite: 'Inviter', + groups: 'Grupper', + courses: "Kurser", + giving: "Donation", + profile: "Profil", + settings: 'Indstillinger', + logout: "Log ud", + about: 'Om', + statusUpdate: "Ny opdatering", + newsPost: "Nyhedsopslag", + post: "Indlæg", + add: 'Tilføj', + whatIsNew: "Hvad er nyt?", + saySomethingTo: "Sig noget til ", + follow: "Følg", + unfollow: "Følg ikke", + subscribe: "Abonnér", + unsubscribe: 'Afmeld', + pending: "Afventer", + subscribers: "Abonnenter", + loading: "Indlæser", + login: 'Log ind', + email: "E-mail", + cancel: "Annuller", + password: "Adgangskode", + rpassword: "Gentag adgangskode", + resetPassword: "Nulstil adgangskode", + register: "Registrer", + name: "Navn", + lastName: "Efternavn", + describeYourself: 'Beskriv dig selv', + continueWatching: "Fortsæt med at se", + createCourse: "Opret din egen nye kursus!", + createGroup: "Opret din egen nye gruppe!", + title: "Titel", + subtitle: "Undertitel", + recentlyAdded: "Nyligt tilføjet", + popularCourses: "Populære kurser", + privateGroup: "Privat gruppe", + tithesAndOfferings: "Tiende og offer", + type: "Type", + description: "Beskrivelse", + amount: "Beløb", + tithes: "Tiende", + offerings: "Offergaver", + event: "Begivenhed", + proceedToPayment: "Fortsæt til betaling", + minimumAmount: "Det mindste beløb er ", + notifications: "Notifikationer", + searchUsers: "Søg efter brugere", + searchCourses: "Søg efter kurser", + news: "Nyheder", + wrongInformation: "Gennemse venligst oplysningerne.", + submit: "Indsend", + IKnowThisPerson: "Jeg kender denne person", + update: "Opdater", + invalidEmail: "E-mailadressen er ugyldig!", + reviewPassword: "Gennemse venligst din adgangskode.", + updatePhoto: "Opdater foto", + optional: "Valgfrit", + birthday: "Fødselsdag", + localMinistry: "Lokalt ministerium", + ocupation: "Beskæftigelse", + country: 'Land', + } } }