Skip to content

Commit

Permalink
Merge pull request #538 from newfold-labs/PRESS0-879-dummy-domain
Browse files Browse the repository at this point in the history
changed url to wpsiteurl in mini-preview instead of dummy domain
  • Loading branch information
arunshenoy99 authored May 2, 2024
2 parents 8004f63 + 97c1468 commit e233877
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
3 changes: 1 addition & 2 deletions src/OnboardingSPA/components/MiniPreview/contents.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { __, sprintf } from '@wordpress/i18n';

import { translations } from '../../utils/locales/translations';

const getContents = ( brandUrl = '' ) => {
const getContents = () => {
return {
heading: __( 'Preview', 'wp-module-onboarding' ),
defaultTitle: sprintf(
Expand All @@ -15,7 +15,6 @@ const getContents = ( brandUrl = '' ) => {
__( 'Just another WordPress %s', 'wp-module-onboarding' ),
translations( 'Site' )
),
defaultUrl: brandUrl,
};
};

Expand Down
18 changes: 5 additions & 13 deletions src/OnboardingSPA/components/MiniPreview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { memo, useState, useEffect } from '@wordpress/element';
import { useSelect } from '@wordpress/data';

import { store as nfdOnboardingStore } from '../../store';
import { wpSiteUrl } from '../../../constants';

import getContents from './contents';

Expand All @@ -12,18 +13,16 @@ const MiniPreview = ( {
isSocialFormOpen,
setIsSocialFormOpen,
} ) => {
const { socialDataStore, brandUrl } = useSelect( ( select ) => {
const { socialDataStore } = useSelect( ( select ) => {
return {
socialDataStore:
select( nfdOnboardingStore ).getOnboardingSocialData(),
brandUrl: select( nfdOnboardingStore ).getNewfoldBrandUrl(),
};
}, [] );

const content = getContents( brandUrl );
const content = getContents();
const titlePreview = title === '' ? content.defaultTitle : title;
const descPreview = desc === '' ? content.defaultDesc : desc;
const urlPreview = title === '' ? content.defaultUrl : titleToUrl();

const [ facebook, setFacebook ] = useState( '' );
const [ twitter, setTwitter ] = useState( '' );
Expand Down Expand Up @@ -78,13 +77,6 @@ const MiniPreview = ( {
{ url: tiktok, image: 'var(--tiktok-icon)' },
];

function titleToUrl() {
return `https://${ title
?.toLowerCase()
.replace( /\s/g, '' )
.replace( /\W/g, '' ) }.com`;
}

function socialIconList() {
return socialDataset.map( ( socialInfo, idx ) => {
return (
Expand Down Expand Up @@ -180,7 +172,7 @@ const MiniPreview = ( {
className="browser-row-search__search-box_input"
type="text"
onChange={ () => {} }
value={ urlPreview }
value={ wpSiteUrl }
></input>
</div>
<div className="browser-row-search__more">
Expand All @@ -196,7 +188,7 @@ const MiniPreview = ( {
{ titlePreview }
</h4>
<span className="browser-content_top-row-link">
{ urlPreview }
{ wpSiteUrl }
</span>
</div>
<h5 className="browser-content_desc">{ descPreview }</h5>
Expand Down

0 comments on commit e233877

Please sign in to comment.