Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed url to wpsiteurl in mini-preview instead of dummy domain #538

Merged
merged 3 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
arunshenoy99 marked this conversation as resolved.
Show resolved Hide resolved

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
Loading