File size: 6,999 Bytes
1e92f2d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | import { useTranslate } from 'i18n-calypso';
import { useMemo } from 'react';
import {
HOME_PAGE,
BLOG_PAGE,
CONTACT_PAGE,
ABOUT_PAGE,
PHOTO_GALLERY_PAGE,
VIDEO_GALLERY_PAGE,
PORTFOLIO_PAGE,
FAQ_PAGE,
SERVICES_PAGE,
TESTIMONIALS_PAGE,
PRICING_PAGE,
TEAM_PAGE,
SHOP_PAGE,
CUSTOM_PAGE,
CAREERS_PAGE,
CASE_STUDIES_PAGE,
DONATE_PAGE,
EVENTS_PAGE,
NEWSLETTER_PAGE,
} from 'calypso/signup/difm/constants';
import type { PageId } from 'calypso/signup/difm/constants';
import type { TranslateResult } from 'i18n-calypso';
/**
* Provides the universal translated set of page titles available for DIFM
* @returns
*/
export function useTranslatedPageTitles() {
const translate = useTranslate();
return useMemo( () => {
const pages: Record< PageId, TranslateResult > = {
[ HOME_PAGE ]: translate( 'Home' ),
[ BLOG_PAGE ]: translate( 'Blog' ),
[ CONTACT_PAGE ]: translate( 'Contact' ),
[ ABOUT_PAGE ]: translate( 'About' ),
[ PHOTO_GALLERY_PAGE ]: translate( 'Photo Gallery' ),
[ VIDEO_GALLERY_PAGE ]: translate( 'Video Gallery' ),
[ PORTFOLIO_PAGE ]: translate( 'Portfolio' ),
[ FAQ_PAGE ]: translate( 'FAQ' ),
[ SERVICES_PAGE ]: translate( 'Services' ),
[ TESTIMONIALS_PAGE ]: translate( 'Testimonials' ),
[ PRICING_PAGE ]: translate( 'Pricing' ),
[ TEAM_PAGE ]: translate( 'Team' ),
[ SHOP_PAGE ]: translate( 'Shop' ),
[ CUSTOM_PAGE ]: translate( 'Custom Page' ),
[ CAREERS_PAGE ]: translate( 'Careers' ),
[ EVENTS_PAGE ]: translate( 'Events' ),
[ DONATE_PAGE ]: translate( 'Donate' ),
[ NEWSLETTER_PAGE ]: translate( 'Newsletter' ),
[ CASE_STUDIES_PAGE ]: translate( 'Case Studies' ),
};
return pages;
}, [ translate ] );
}
// Requesting Contexts
export const BBE_ONBOARDING_PAGE_PICKER_STEP = 'BBE_ONBOARDING_PAGE_PICKER_STEP';
export const BBE_STORE_ONBOARDING_PAGE_PICKER_STEP = 'BBE_STORE_ONBOARDING_PAGE_PICKER_STEP';
export const BBE_WEBSITE_CONTENT_FILLING_STEP = 'BBE_WEBSITE_CONTENT_FILLING_STEP';
export const BBE_STORE_WEBSITE_CONTENT_FILLING_STEP = 'BBE_STORE_WEBSITE_CONTENT_FILLING_STEP';
export type BBETranslationContext =
| typeof BBE_ONBOARDING_PAGE_PICKER_STEP
| typeof BBE_STORE_ONBOARDING_PAGE_PICKER_STEP
| typeof BBE_WEBSITE_CONTENT_FILLING_STEP
| typeof BBE_STORE_WEBSITE_CONTENT_FILLING_STEP;
export function useTranslatedPageDescriptions(
pageId: PageId,
context?: BBETranslationContext
): TranslateResult {
const translate = useTranslate();
const defaultDescriptions: Record< PageId, TranslateResult > = {
[ HOME_PAGE ]: translate(
'Introduce your business, writing, or yourself. Highlight what visitors can expect on your site.'
),
[ ABOUT_PAGE ]: translate(
'Share your story or business background. Explain why you created this website.'
),
[ CONTACT_PAGE ]: translate(
'Provide ways for visitors to contact you. Highlight your preferred contact methods: telephone, email, etc'
),
[ BLOG_PAGE ]: translate(
"Share news, journal entries, or recipes! We'll set up three posts to get you started."
),
[ PHOTO_GALLERY_PAGE ]: translate(
'Showcase creative work or memories. Perfect for photographers, artists, or for visual storytelling.'
),
[ SERVICES_PAGE ]: translate(
'Describe your skills and services to potential clients, highlighting what sets you apart.'
),
[ VIDEO_GALLERY_PAGE ]: translate(
'Show videos of your work or business. Include a description to guide your visitors.'
),
[ PRICING_PAGE ]: translate(
'List what you sell: food, services, books, etc. Highlight pricing details.'
),
[ PORTFOLIO_PAGE ]: translate(
'Display your completed projects, photos, artwork, or articles. Let your work shine.'
),
[ FAQ_PAGE ]: translate(
'Answer common questions from customers or readers. Offer quick information access.'
),
[ TESTIMONIALS_PAGE ]: translate(
'Build trust with reviews or quotes about your work or business. Share success stories.'
),
[ TEAM_PAGE ]: translate(
'Profile your team members with pictures, names, and roles or job titles. Introduce the people behind your business.'
),
[ SHOP_PAGE ]: translate(
'Your shop page will display all the products you have for sale. We will set up the shop page and explain how you can add products to your new site.'
),
[ CUSTOM_PAGE ]: translate(
"Craft a page that's perfect for anything you have in mind. You decide the title and content, and we'll create a custom layout."
),
[ CAREERS_PAGE ]: translate(
"Attract top talent with a page dedicated to job opportunities. Showcase your team's culture."
),
[ EVENTS_PAGE ]: translate(
"Show your upcoming events or gatherings. Keep visitors updated on what's happening."
),
[ DONATE_PAGE ]: translate(
'Simplify the donation process for supporters. Help them easily contribute to your mission.'
),
[ NEWSLETTER_PAGE ]: translate(
'Connect with your community through regular updates. Let visitors subscribe to stay in touch with news and events.'
),
[ CASE_STUDIES_PAGE ]: translate(
'Demonstrate your expertise with real-world examples. Show your methods and results.'
),
};
const contextualDescriptions: Record< BBETranslationContext, typeof defaultDescriptions > = {
[ BBE_ONBOARDING_PAGE_PICKER_STEP ]: {
...defaultDescriptions,
},
[ BBE_WEBSITE_CONTENT_FILLING_STEP ]: {
...defaultDescriptions,
[ BLOG_PAGE ]: translate(
"Describe the type of blog posts you'll feature, and we'll set up the page with this description. If there are no existing posts, we'll create three to get you started."
),
[ CONTACT_PAGE ]: translate(
'This page includes a contact form. You may also include other contact methods as well.'
),
[ SHOP_PAGE ]: translate(
'Add a short description to explain what type of products will appear on your site. We will set up the page so this description appears above your products; you can add the products later with the editor.'
),
[ CUSTOM_PAGE ]: translate(
"Provide the title and content for this page, and we'll create a custom layout."
),
[ DONATE_PAGE ]: translate(
"This page includes a Donations Form block, which you can connect to your bank account later using the editor. Provide details about your cause, which we'll include on the page."
),
[ NEWSLETTER_PAGE ]: translate(
'This page includes a Newsletter Subscription block, enabling visitors to subscribe via email. Provide details about the kind of updates they can expect to receive by subscribing.'
),
},
[ BBE_STORE_ONBOARDING_PAGE_PICKER_STEP ]: {
...defaultDescriptions,
// Add customized text for page descriptions for the page picker step in the store flow here.
},
[ BBE_STORE_WEBSITE_CONTENT_FILLING_STEP ]: {
...defaultDescriptions,
// Add customized text for page descriptions for the website content form here.
},
};
if ( ! context ) {
return defaultDescriptions[ pageId ];
}
return contextualDescriptions[ context ][ pageId ];
}
|