import React, { Component } from "react"; import "./preview.css"; import { withRouter, } from "react-router-dom"; import { CarouselItem, Container, OverlayTrigger, Tooltip, } from 'react-bootstrap' import Carousel from 'react-bootstrap/Carousel' import ReactPlayer from 'react-player'; import ModalsPreviewPage from "./modals.preview.page"; import IconZoom from "./IconZoom"; import IconCall from "./IconCall"; import IconWhatsapp from "./IconWhatsapp"; import IconMail from "./IconMail"; import IconFacebook from "./IconFacebook"; import IconTwitter from "./IconTwitter"; import IconInstagram from "./IconInstagram"; import IconYoutube from "./IconYoutube"; import IconLinkedin from "./IconLinkedin"; import IconWebsite from "./IconWebsite"; import IconBehance from "./IconBehance"; import IconBlog from "./IconBlog"; import IconDeviantart from "./IconDeviantart"; import IconDiscord from "./IconDiscord"; import IconDribble from "./IconDribble"; import IconDrive from "./IconDrive"; import IconDropbox from "./IconDropbox"; import IconFeed from "./IconFeed"; import IconFlickr from "./IconFlickr"; import IconFoursquare from "./IconFoursquare"; import IconGithub from "./IconGithub"; import IconHangout from "./IconHangout"; import IconKickstart from "./IconKickstart"; import IconMessenger from "./IconMessenger"; import IconPhotos from "./IconPhotos"; import IconPinterest from "./IconPinterest"; import IconReddit from "./IconReddit"; import IconSnapchat from "./IconSnapchat"; import IconSoundcloud from "./IconSoundcloud"; import IconSpotify from "./IconSpotify"; import IconTarjetaid from "./IconTarjetaid"; import IconTiktok from "./IconTiktok"; import IconTumblr from "./IconTumblr"; import IconTwitch from "./IconTwitch"; import IconVimeo from "./IconVimeo"; import IconShare from "./IconShare"; import IconWeb from "./IconWeb"; const renderTooltipUrl = (props) => ( Haz click para abrir este enlace ); class PreviewPage extends Component { constructor(props) { super(props); this.refCarousel = React.createRef(); this.refDocumentos = React.createRef(); this.state = { isOpenModal: false, titleModal : '', typeArr: '' } } componentDidMount() { } makeStyle(){ const { arrDatos, primaryColor } = this.props.initState const { diseno } = arrDatos if(diseno.portada != '') { var styleBackground = { backgroundImage:"url("+diseno.portada+")", backgroundPosition:"50% 0%", backgroundSize:"cover", backgroundRepeat:"no-repeat", height:220, width:'100%' } }else{ var styleBackground = { backgroundColor:primaryColor, height:220, width:'100%' } } return styleBackground; } makeViewCoverPage() { const { arrDatos, primaryColor } = this.props.initState const { diseno } = arrDatos if(diseno.coverPage === 1) { return (
portada { diseno.portada == '' ? : null }
{'Imagen'}
) } else if(diseno.coverPage === 2) { return (
{'Imagen'}
) } else if(diseno.coverPage === 3) { return (
{'Imagen'}
) } } render() { const { width, height, arrDatos, primaryColor, secundaryColor, viewMenu, } = this.props.initState const { descripcion, promo, ubicacion,diseno } = arrDatos const { nombre, cargo, empresa, slogan } = descripcion const { facebook, instagram,linkedin,youtube,twitter,site } = arrDatos const viewFacebook = (facebook.checked) ? 'block' : 'none' ; const viewInstagram = (instagram.checked) ? 'block' : 'none' ; const viewLinkedin = (linkedin.checked) ? 'block' : 'none' ; const viewYoutube = (youtube.checked) ? 'block' : 'none' ; const viewTwitter = (twitter.checked) ? 'block' : 'none' ; const viewSite = (site.checked) ? 'block' : 'none' ; let overflowType = width > 900 ? 'auto' : ( !viewMenu ? 'auto' : 'hidden' ) return (
{ /* Preview section */ }
{ /* Cover */ this.makeViewCoverPage() } { /* Datos */ this.makeViewDatos() } { /* Descripcion promo */ (this.props.initState.arrDatos.promo.checked) ? this.makeViewDescripcion() : <> } { /* Datos de Contacto */ this.makeViewContacto() } { /* Slider carousel */ this.makeViewCarousel() } { /* Slider Opiniones */ this.makeViewOpiniones() } { /*Mapa Visítame*/ this.makeViewVisitame() } { /* Documentos */ this.makeViewDocumentos() } { /* Redes Sociales */ this.makeViewRedesSociales() } { /* Compartir y Código QR */ this.makeViewShareQR() } { /* Footer */ this.makeViewFooter() } { this.props.addTarjeta() }} previewState={ this.state } previewSetState={ (param) => this.setState(param) } initState={ this.props.initState } initsetState={ (param) => this.props.initsetState(param) } />
) } makeViewDatos() { const { primaryColor, secundaryColor, arrDatos,checkedSecundaryColor } = this.props.initState const { descripcion, } = arrDatos const { nombre, cargo, empresa, slogan } = descripcion return (

{ nombre.trim() === '' ? 'Nombre' : nombre }

{ cargo.trim() === '' ? 'Puesto / actividad' : cargo }

{ empresa.trim() === '' ? 'Empresa' : empresa }

{ slogan.trim() === '' ? '' : slogan }

) } makeViewDescripcion() { const { primaryColor, arrDatos, } = this.props.initState const { promo, } = arrDatos let showVideo = (promo.video!='' ? 'block' : 'none' ) if(promo.checked) { return (

{promo.titulo === '' ? 'Título del video' : promo.titulo}

{promo.descripcion === '' ? `` : promo.descripcion}

{}
) } return null } makeShadowColor(hex) { var c; if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)) { c= hex.substring(1).split(''); if(c.length== 3){ c= [c[0], c[0], c[1], c[1], c[2], c[2]]; } c= '0x'+c.join(''); return {boxShadow: '0 0 0 0 ' + 'rgba('+[(c>>16)&255, (c>>8)&255, c&255].join(',')+',0.7)'} } // throw new Error('Bad Hex'); return {boxShadow: '0 0 0 0 rgba(226, 10, 79, 0.7)'} } makeViewContacto() { const { primaryColor, arrDatos,secundaryColor,checkedSecundaryColor } = this.props.initState let { telefono, whatsapp, email, addContact, } = arrDatos return (
btn-add

{addContact.titulo}

{ this.onModalActionButton(1,'tel') } }> btn-call

{ this.onModalActionButton(1,'tel') } }>{telefono.titulo}

{ this.onModalActionButton(1,'whats')} }> btn-whats

{ this.onModalActionButton(1,'whats')} }>{whatsapp.titulo}

{ this.onModalActionButton(1,'email') } }> btn-mail

{ this.onModalActionButton(1,'email') } }>{email.titulo}

) } makeViewCarousel() { const { primaryColor, secundaryColor, arrDatos, } = this.props.initState const { arrCarousel } = arrDatos const { arrImages } = arrCarousel if(!arrCarousel.checked || arrImages.length === 0) return null return (

{ arrCarousel.title == '' ? 'Título del Slider' : arrCarousel.title }

{ arrImages.map((t,e) => ( { t.url_share && t.url_share !== '' ? (

{ this.onOpenURLShare(t.url_share) }}>{t.url_share}

) : null } {t.title}

{t.title}

)) }
) } makeViewOpiniones() { const { primaryColor, arrDatos,secundaryColor} = this.props.initState const { arrCarouselOp } = arrDatos const { arrOpiniones } = arrCarouselOp if(!arrCarouselOp.checked || arrOpiniones.length === 0) return null return (

{ arrCarouselOp.title === '' ? 'TESTIMONIALES' : arrCarouselOp.title }

{ arrOpiniones.map((t,e)=>(

{ t.val === '' ? 'Texto Descriptivo' : t.val }

{ t.autor === '' ? 'Nombre' : t.autor }

{ t.trabajo === '' ? 'Puesto / Trabajo' : t.trabajo }

{/*

{ t.autor === '' ? 'Nombre' : t.autor }

{ t.trabajo === '' ? 'Puesto / Trabajo' : t.trabajo }

{ t.val === '' ? 'Texto Descriptivo' : t.val }

*/}
)) }
) } makeViewVisitame() { const { primaryColor, arrDatos, secundaryColor,checkedSecundaryColor } = this.props.initState const { ubicacion } = arrDatos const { direccion, ciudad, codigoPostal, estado } = ubicacion const urlMap = `https://www.google.com/maps/embed/v1/place?key=AIzaSyCK5pcmRfRbz_tuBlgkCYDw8_rybcqEAuY&q=${direccion}+${ciudad}+${codigoPostal}+${estado}`; const backColor = (checkedSecundaryColor) ? secundaryColor : '#FFFFFF'; const color = (checkedSecundaryColor) ? '#ffffff' : '#000000'; if(!ubicacion.checked) return null return (

VISÍTAME EN:

{ direccion!='' ? direccion : 'Ciudad de México' } {ciudad!='' ? ', ' + ciudad : ', CDMX' } {codigoPostal!='' ? ', ' + codigoPostal : '' } {estado != '' ? ', '+estado : '' }

¡Abrir en Google Maps!
) } makeViewDocumentos() { const { primaryColor, secundaryColor, arrDatos, } = this.props.initState let { arrDocumentos } = arrDatos const { arrFiles } = arrDocumentos if(!arrDocumentos.checked || arrFiles.length === 0) return null return (

{ arrDocumentos.title == '' ? 'Título de la nube' : arrDocumentos.title }

{ arrFiles.map((t,e) => (

{t.title}

0

Descargas

)) }
) } makeViewRedesSociales() { const { primaryColor, arrDatos,secundaryColor,checkedSecundaryColor,iconVersion } = this.props.initState const { facebook, instagram,linkedin,youtube,twitter,site,zoom,behance,blog,deviantart,discord,dribble,drive,dropbox,feed,flickr,foursquare,github,hangout,tarjetaid,kickstart,messenger,photos,pinterest,reddit,snapchat,soundcloud,spotify,tiktok,tumblr,twitch,vimeo } = arrDatos const viewFacebook = (facebook.checked) ? 'block' : 'none' ; const viewInstagram = (instagram.checked) ? 'block' : 'none' ; const viewLinkedin = (linkedin.checked) ? 'block' : 'none' ; const viewYoutube = (youtube.checked) ? 'block' : 'none' ; const viewTwitter = (twitter.checked) ? 'block' : 'none' ; const viewZoom = ( arrDatos.hasOwnProperty('zoom') ) ? (zoom.checked) ? 'block' : 'none' : 'none' ; const viewBehance = ( arrDatos.hasOwnProperty('behance') ) ? (behance.checked) ? 'block' : 'none' : 'none' ; const viewBlog = ( arrDatos.hasOwnProperty('blog') ) ? (blog.checked) ? 'block' : 'none' : 'none'; const viewDeviantart = ( arrDatos.hasOwnProperty('deviantart') ) ? (deviantart.checked) ? 'block' : 'none' : 'none' ; const viewDiscord = ( arrDatos.hasOwnProperty('discord') ) ? (discord.checked) ? 'block' : 'none' : 'none'; const viewDribble = ( arrDatos.hasOwnProperty('dribble') ) ? (dribble.checked) ? 'block' : 'none' : 'none' ; const viewDrive = ( arrDatos.hasOwnProperty('drive') ) ? (drive.checked) ? 'block' : 'none' : 'none'; const viewDropbox = ( arrDatos.hasOwnProperty('dropbox') ) ? (dropbox.checked) ? 'block' : 'none' : 'none'; const viewFeed = ( arrDatos.hasOwnProperty('feed') ) ? (feed.checked) ? 'block' : 'none' : 'none'; const viewFlickr = ( arrDatos.hasOwnProperty('flickr') ) ? (flickr.checked) ? 'block' : 'none' : 'none'; const viewFoursquare = ( arrDatos.hasOwnProperty('foursquare') ) ? (foursquare.checked) ? 'block' : 'none' : 'none'; const viewGithub = ( arrDatos.hasOwnProperty('github') ) ? (github.checked) ? 'block' : 'none' : 'none' ; const viewHangout = ( arrDatos.hasOwnProperty('hangout') ) ? (hangout.checked) ? 'block' : 'none' : 'none' ; const viewTarjetaid = ( arrDatos.hasOwnProperty('tarjetaid') ) ? (tarjetaid.checked) ? 'block' : 'none' : 'none'; const viewKickstart = ( arrDatos.hasOwnProperty('kickstart') ) ? (kickstart.checked) ? 'block' : 'none' : 'none' ; const viewMessenger = ( arrDatos.hasOwnProperty('messenger') ) ? (messenger.checked) ? 'block' : 'none' : 'none' ; const viewPhotos = ( arrDatos.hasOwnProperty('photos') ) ? (photos.checked) ? 'block' : 'none' : 'none'; const viewPinterest = ( arrDatos.hasOwnProperty('pinterest') ) ? (pinterest.checked) ? 'block' : 'none' : 'none'; const viewReddit = ( arrDatos.hasOwnProperty('reddit') ) ? (reddit.checked) ? 'block' : 'none' : 'none'; const viewSnapchat = ( arrDatos.hasOwnProperty('zoom') ) ? (zoom.checked) ? 'block' : 'none' : 'none'; const viewSoundcloud = ( arrDatos.hasOwnProperty('soundcloud') ) ? (soundcloud.checked) ? 'block' : 'none' : 'none'; const viewSpotify = ( arrDatos.hasOwnProperty('spotify') ) ? (spotify.checked) ? 'block' : 'none' : 'none'; const viewTiktok = ( arrDatos.hasOwnProperty('tiktok') ) ? (tiktok.checked) ? 'block' : 'none' : 'none'; const viewTumblr = ( arrDatos.hasOwnProperty('tumblr') ) ? (tumblr.checked) ? 'block' : 'none' : 'none'; const viewTwitch = ( arrDatos.hasOwnProperty('twitch') ) ? (twitch.checked) ? 'block' : 'none' : 'none'; const viewVimeo = ( arrDatos.hasOwnProperty('vimeo') ) ? (vimeo.checked) ? 'block' : 'none' : 'none'; const viewSite = (site.checked) ? 'block' : 'none' ; return (

MIS REDES SOCIALES

{/* #facebook */} {/* #instagram */} {/* #linkedin */} {/* #youtube */} {/* #twitter */} {/* #zoom */} {/* #behance */} {/* #blog */} {/* #deviantart */} {/* #discord */} {/* #dribble */} {/* #drive */} {/* #dropbox */} {/* #feed */} {/* #flickr */} {/* #foursquare */} {/* #github */} {/* #hangout */} {/* #tarjetaid */} {/* #kickstart */} {/* #messenger */} {/* #photos */} {/* #pinterest */} {/* #reddit */} {/* #snapchat */} {/* #soundcloud */} {/* #spotify */} {/* #tiktok */} {/* #tumblr */} {/* #twitch */} {/* #vimeo */} {/* btn-web */} {/* #call */} {/* #whatsapp */} {/* #email */}
) } makeViewShareQR() { const { primaryColor,checkedSecundaryColor,secundaryColor,arrDatos,iconVersion } = this.props.initState return (

COMPARTE Y ESCANEA CON CÓDIGO QR

{'Imagen'}

Compartir desde mi WhatsApp

) } makeViewFooter() { const { primaryColor,secundaryColor,checkedSecundaryColor } = this.props.initState const color = (checkedSecundaryColor) ? secundaryColor : primaryColor return ( <>
{'Imagen'}

Este contacto fue diseñado con tarjeta.id | El poder de la primera impresión

{/*¿Deseas una tarjeta como esta? Haz clic aquí.*/}

© 2020, All Rights Reserved, W Soft SA de CV.

) } onModalActionButton(opt,type) { let titleModal = '' const typeArr = type if( type === 'tel' ) titleModal = 'Llamar a:'; else if( type === 'whats' ) titleModal = 'Enviar Whatsapp a:'; else if( type === 'email' ) titleModal = 'Enviar Correo Electrónico a:'; this.setState({ isOpenModal: true, titleModal, typeArr, }) } onOpenURLShare(url) { window.open(url,'_blank'); } initsetState(param) { this.props.initsetState(param) return true } }; export default withRouter(PreviewPage)