Skip to content

Commit

Permalink
fix: pr review
Browse files Browse the repository at this point in the history
  • Loading branch information
fsdiogo committed Sep 13, 2018
1 parent 357a678 commit 932084a
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 56 deletions.
68 changes: 34 additions & 34 deletions add-on/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -451,82 +451,82 @@
"message": "Deny",
"description": "Button text for denying a permission (page_proxyAccessDialog_allowButton_text)"
},
"page_landingWelcome_renderLogo_title": {
"page_landingWelcome_logo_title": {
"message": "IPFS Companion",
"description": "Extension name after the IPFS logo (page_landingWelcome_renderLogo_title)"
"description": "Extension name after the IPFS logo (page_landingWelcome_logo_title)"
},
"page_landingWelcome_renderWelcome_title": {
"page_landingWelcome_welcome_title": {
"message": "You are all set!",
"description": "Ready message title (page_landingWelcome_renderWelcome_title)"
"description": "Ready message title (page_landingWelcome_welcome_title)"
},
"page_landingWelcome_renderWelcome_copy_peers": {
"page_landingWelcome_welcome_peers": {
"message": "Right now your node is connected to <span>$PEERS$</span> peers.",
"description": "Ready message copy (page_landingWelcome_renderWelcome_copy_peers)",
"description": "Ready message copy (page_landingWelcome_welcome_peers)",
"placeholders": {
"peers": {
"content": "$1",
"example": "350"
}
}
},
"page_landingWelcome_renderWelcome_copy_discover": {
"page_landingWelcome_welcome_discover": {
"message": "Discover what you <0>can do with Companion</0> and dive into the distributed web with IPFS!",
"description": "Ready message copy (page_landingWelcome_renderWelcome_copy_discover)"
"description": "Ready message copy (page_landingWelcome_welcome_discover)"
},
"page_landingWelcome_installSteps_title": {
"message": "Is your IPFS daemon running?",
"description": "Install steps title (page_landingWelcome_installSteps_title)"
},
"page_landingWelcome_installSteps_copy_install": {
"page_landingWelcome_installSteps_install": {
"message": "If you haven't installed IPFS please do so <0>with these instructions</0>.",
"description": "Install steps copy (page_landingWelcome_installSteps_copy_install)"
"description": "Install steps copy (page_landingWelcome_installSteps_install)"
},
"page_landingWelcome_installSteps_copy_run": {
"page_landingWelcome_installSteps_run": {
"message": "Then make sure to have an IPFS daemon running in your terminal:",
"description": "Install steps run message (page_landingWelcome_installSteps_copy_run)"
"description": "Install steps run message (page_landingWelcome_installSteps_run)"
},
"page_landingWelcome_renderResources_title_new_ipfs": {
"page_landingWelcome_resources_title_new_ipfs": {
"message": "New to IPFS?",
"description": "Resources title (page_landingWelcome_renderResources_title_new_ipfs)"
"description": "Resources title (page_landingWelcome_resources_title_new_ipfs)"
},
"page_landingWelcome_renderResources_copy_new_ipfs": {
"page_landingWelcome_resources_new_ipfs": {
"message": "Read the <0>documentation</0> to learn about the basic <1>concepts</1> and working with IPFS.",
"description": "Resources copy (page_landingWelcome_renderResources_copy_new_ipfs)"
"description": "Resources copy (page_landingWelcome_resources_new_ipfs)"
},
"page_landingWelcome_renderResources_title_discover": {
"page_landingWelcome_resources_title_discover": {
"message": "Discover!",
"description": "Resources title (page_landingWelcome_renderResources_title_discover)"
"description": "Resources title (page_landingWelcome_resources_title_discover)"
},
"page_landingWelcome_renderResources_copy_discover": {
"page_landingWelcome_resources_discover": {
"message": "Find <0>useful resources</0> for using IPFS and <1>building things</1> on top of it.",
"description": "Resources copy (page_landingWelcome_renderResources_copy_discover)"
"description": "Resources copy (page_landingWelcome_resources_discover)"
},
"page_landingWelcome_renderResources_title_got_questions": {
"page_landingWelcome_resources_title_got_questions": {
"message": "Got questions?",
"description": "Resources title (page_landingWelcome_renderResources_title_got_questions)"
"description": "Resources title (page_landingWelcome_resources_title_got_questions)"
},
"page_landingWelcome_renderResources_copy_got_questions": {
"page_landingWelcome_resources_got_questions": {
"message": "Visit the <0>Discussion and Support Forum</0>.",
"description": "Resources copy (page_landingWelcome_renderResources_copy_got_questions)"
"description": "Resources copy (page_landingWelcome_resources_got_questions)"
},
"page_landingWelcome_renderResources_title_want_to_help": {
"page_landingWelcome_resources_title_want_to_help": {
"message": "Want to help?",
"description": "Resources title (page_landingWelcome_renderResources_title_want_to_help)"
"description": "Resources title (page_landingWelcome_resources_title_want_to_help)"
},
"page_landingWelcome_renderResources_copy_want_to_help": {
"page_landingWelcome_resources_want_to_help": {
"message": "Join the <0>IPFS Community</0>! Contribute with <1>code</1>, <2>documentation</2>, <3>translations</3> or help by <4>supporting other users</4>.",
"description": "Resources copy (page_landingWelcome_renderResources_copy_want_to_help)"
"description": "Resources copy (page_landingWelcome_resources_want_to_help)"
},
"page_landingWelcome_renderVideos_alpha_demo": {
"page_landingWelcome_videos_alpha_demo": {
"message": "IPFS Alpha Demo",
"description": "Videos section title (page_landingWelcome_renderVideos_alpha_demo)"
"description": "Videos section title (page_landingWelcome_videos_alpha_demo)"
},
"page_landingWelcome_renderVideos_permanent_web": {
"page_landingWelcome_videos_permanent_web": {
"message": "The Permanent Web",
"description": "Videos section title (page_landingWelcome_renderVideos_permanent_web)"
"description": "Videos section title (page_landingWelcome_videos_permanent_web)"
},
"page_landingWelcome_renderProjects_title": {
"page_landingWelcome_projects_title": {
"message": "Related Projects",
"description": "Projects section title (page_landingWelcome_renderProjects_title)"
"description": "Projects section title (page_landingWelcome_projects_title)"
}
}
40 changes: 20 additions & 20 deletions add-on/src/landing-pages/welcome/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const html = require('choo/html')
const logo = require('../../popup/logo')
const { renderTranslatedLink, renderTranslatedDynamicSpan } = require('../../utils/i18n')
const { renderTranslatedLinks, renderTranslatedDynamicSpan } = require('../../utils/i18n')

// Assets
const libp2pLogo = '../../../images/libp2p.svg'
Expand Down Expand Up @@ -46,7 +46,7 @@ const renderCompanionLogo = (i18n, isIpfsOnline) => {
return html`
<div class="mt4 mb5 flex flex-column justify-center items-center">
${logo({ path: logoPath, size: logoSize, isIpfsOnline: isIpfsOnline })}
<p class="montserrat mt3 mb0 f2">${i18n.getMessage('page_landingWelcome_renderLogo_title')}</p>
<p class="montserrat mt3 mb0 f2">${i18n.getMessage('page_landingWelcome_logo_title')}</p>
</div>
`
}
Expand Down Expand Up @@ -76,10 +76,10 @@ const renderWelcome = (i18n, peerCount) => {
<div class="w-80 flex flex-column justify-center">
<div class="mb4 flex flex-column justify-center items-center">
${checkmarkSvg()}
<p class="mt2 mb0 f3">${i18n.getMessage('page_landingWelcome_renderWelcome_title')}</p>
<p class="mt2 mb0 f3">${i18n.getMessage('page_landingWelcome_welcome_title')}</p>
</div>
<p class="${copyClass}">${renderTranslatedDynamicSpan('page_landingWelcome_renderWelcome_copy_peers', peerCount, 'class="aqua fw6"')}</p>
<p class="${copyClass} mb4">${renderTranslatedLink('page_landingWelcome_renderWelcome_copy_discover', ['https://github.com/ipfs-shipyard/ipfs-companion#features'], `target="_blank" class="${anchorClass}"`)}</p>
<p class="${copyClass}">${renderTranslatedDynamicSpan('page_landingWelcome_welcome_peers', peerCount, 'class="aqua fw6"')}</p>
<p class="${copyClass} mb4">${renderTranslatedLinks('page_landingWelcome_welcome_discover', ['https://github.com/ipfs-shipyard/ipfs-companion#features'], `target="_blank" class="${anchorClass}"`)}</p>
</div>
`
}
Expand All @@ -91,8 +91,8 @@ const renderInstallSteps = (i18n) => {
return html`
<div class="w-80 mv4 flex flex-column">
<p class="mt0 mb2 yellow f4 lh-title">${i18n.getMessage('page_landingWelcome_installSteps_title')}</p>
<p class="${copyClass}">${renderTranslatedLink('page_landingWelcome_installSteps_copy_install', ['https://docs.ipfs.io/introduction/install/'], `target="_blank" class="${anchorClass}"`)}</p>
<p class="${copyClass}">${i18n.getMessage('page_landingWelcome_installSteps_copy_run')}</p>
<p class="${copyClass}">${renderTranslatedLinks('page_landingWelcome_installSteps_install', ['https://docs.ipfs.io/introduction/install/'], `target="_blank" class="${anchorClass}"`)}</p>
<p class="${copyClass}">${i18n.getMessage('page_landingWelcome_installSteps_run')}</p>
<div className='db w-100 mt3 pa3 bg-black-70 bt bw4 br2 snow f7'>
<code className='db'>$ ipfs daemon</code>
<code className='db'>Initializing daemon...</code>
Expand All @@ -113,17 +113,17 @@ const renderResources = (i18n) => {

return html`
<div class="w-80 mv4 navy f5">
<p class="${labelClass}">${i18n.getMessage('page_landingWelcome_renderResources_title_new_ipfs')}</p>
<p class="${copyClass}">${renderTranslatedLink('page_landingWelcome_renderResources_copy_new_ipfs', ['https://docs.ipfs.io', 'https://docs.ipfs.io/guides/concepts'], `target="_blank" class="${anchorClass}"`)}</p>
<p class="${labelClass}">${i18n.getMessage('page_landingWelcome_resources_title_new_ipfs')}</p>
<p class="${copyClass}">${renderTranslatedLinks('page_landingWelcome_resources_new_ipfs', ['https://docs.ipfs.io', 'https://docs.ipfs.io/guides/concepts'], `target="_blank" class="${anchorClass}"`)}</p>
<p class="${labelClass}">${i18n.getMessage('page_landingWelcome_renderResources_title_discover')}</p>
<p class="${copyClass}">${renderTranslatedLink('page_landingWelcome_renderResources_copy_discover', ['https://awesome.ipfs.io', 'https://github.com/ipfs/ipfs#project-links'], `target="_blank" class="${anchorClass}"`)}</p>
<p class="${labelClass}">${i18n.getMessage('page_landingWelcome_resources_title_discover')}</p>
<p class="${copyClass}">${renderTranslatedLinks('page_landingWelcome_resources_discover', ['https://awesome.ipfs.io', 'https://github.com/ipfs/ipfs#project-links'], `target="_blank" class="${anchorClass}"`)}</p>
<p class="${labelClass}">${i18n.getMessage('page_landingWelcome_renderResources_title_got_questions')}</p>
<p class="${copyClass}">${renderTranslatedLink('page_landingWelcome_renderResources_copy_got_questions', ['https://discuss.ipfs.io'], `target="_blank" class="${anchorClass}"`)}</p>
<p class="${labelClass}">${i18n.getMessage('page_landingWelcome_resources_title_got_questions')}</p>
<p class="${copyClass}">${renderTranslatedLinks('page_landingWelcome_resources_got_questions', ['https://discuss.ipfs.io'], `target="_blank" class="${anchorClass}"`)}</p>
<p class="${labelClass}">${i18n.getMessage('page_landingWelcome_renderResources_title_want_to_help')}</p>
<p class="${copyClass} mv0">${renderTranslatedLink('page_landingWelcome_renderResources_copy_want_to_help', ['https://github.com/ipfs/community/#community', 'https://github.com/ipfs/ipfs#project-links', 'https://github.com/ipfs/docs', 'https://www.transifex.com/ipfs/public', 'https://discuss.ipfs.io/c/help'], `target="_blank" class="${anchorClass}"`)}</p>
<p class="${labelClass}">${i18n.getMessage('page_landingWelcome_resources_title_want_to_help')}</p>
<p class="${copyClass} mv0">${renderTranslatedLinks('page_landingWelcome_resources_want_to_help', ['https://github.com/ipfs/community/#community', 'https://github.com/ipfs/ipfs#project-links', 'https://github.com/ipfs/docs', 'https://www.transifex.com/ipfs/public', 'https://discuss.ipfs.io/c/help'], `target="_blank" class="${anchorClass}"`)}</p>
</div>
`
}
Expand All @@ -148,18 +148,18 @@ const renderVideos = (i18n) => {
return html`
<div class="w-80 flex flex-column flex-row-ns justify-between-ns aqua f5">
<div class="flex flex-column mr1">
<p>${i18n.getMessage('page_landingWelcome_renderVideos_alpha_demo')}</p>
<p>${i18n.getMessage('page_landingWelcome_videos_alpha_demo')}</p>
<a class="${anchorClass}" style="height: ${videoHeight}px" href="https://www.youtube.com/watch?feature=player_embedded&v=8CMxDNuuAiQ" target="_blank">
<img width="${videoWidth}" height="${videoHeight}" src="https://img.youtube.com/vi/8CMxDNuuAiQ/0.jpg" alt="${i18n.getMessage('page_landingWelcome_renderVideos_alpha_demo')}" />
<img width="${videoWidth}" height="${videoHeight}" src="https://img.youtube.com/vi/8CMxDNuuAiQ/0.jpg" alt="${i18n.getMessage('page_landingWelcome_videos_alpha_demo')}" />
${overlayDiv()}
${playSvg()}
</a>
</div>
<div class="flex flex-column">
<p>${i18n.getMessage('page_landingWelcome_renderVideos_permanent_web')}</p>
<p>${i18n.getMessage('page_landingWelcome_videos_permanent_web')}</p>
<a class="${anchorClass}" style="height: ${videoHeight}px" href="https://www.youtube.com/watch?feature=player_embedded&v=HUVmypx9HGI" target="_blank">
<img width="${videoWidth}" height="${videoHeight}" src="https://img.youtube.com/vi/HUVmypx9HGI/0.jpg" alt="${i18n.getMessage('page_landingWelcome_renderVideos_permanent_web')}" />
<img width="${videoWidth}" height="${videoHeight}" src="https://img.youtube.com/vi/HUVmypx9HGI/0.jpg" alt="${i18n.getMessage('page_landingWelcome_videos_permanent_web')}" />
${overlayDiv()}
${playSvg()}
</a>
Expand All @@ -174,7 +174,7 @@ const renderProjects = (i18n) => {

return html`
<div class="w-80 mv4 navy f6">
<p class="mb4 aqua f5">${i18n.getMessage('page_landingWelcome_renderProjects_title')}</p>
<p class="mb4 aqua f5">${i18n.getMessage('page_landingWelcome_projects_title')}</p>
<div class="flex justify-between-ns">
<a class="${anchorClass}" href="https://multiformats.io/" target="_blank">
Expand Down
4 changes: 2 additions & 2 deletions add-on/src/utils/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const browser = require('webextension-polyfill')
* @param {Object} attributes HTML attributes to put in the anchor.
* @return {html} An HTML node with the translated string with anchors.
*/
const renderTranslatedLink = (message, links, attributes) => {
const renderTranslatedLinks = (message, links, attributes) => {
const regexLink = /<\d>(.+?)<\/\d>/mg
const regexIndex = /<(\d)>/mg
const str = browser.i18n.getMessage(message)
Expand Down Expand Up @@ -57,6 +57,6 @@ const renderTranslatedDynamicSpan = (message, dynamicData, attributes) => {
}

module.exports = {
renderTranslatedLink,
renderTranslatedLinks,
renderTranslatedDynamicSpan
}

0 comments on commit 932084a

Please sign in to comment.