Skip to content

Commit

Permalink
feat: separate CLI Tutor Mode helptext (#1700)
Browse files Browse the repository at this point in the history
* Separates i18n keys
* Remove extraneous import
* chore: fix help test
* Refer to more specific i18n key names

Co-authored-by: Rafael Ramalho <rafazelramalho19@gmail.com>
Co-authored-by: Marcin Rataj <lidel@lidel.org>
  • Loading branch information
3 people authored Jan 5, 2021
1 parent 1b0bbdb commit 91e2f36
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
3 changes: 1 addition & 2 deletions public/locales/en/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
"unselectAll": "Unselect all"
},
"cliModal": {
"description": "Paste the following into your terminal to do this task in IPFS via the command line. Remember that you'll need to replace placeholders with your specific parameters.",
"extraNotes": "If you've made changes to the config in this page's code editor that you'd like to save, click the download icon next to the copy button to download it as a JSON file."
"description": "Paste the following into your terminal to do this task in IPFS via the command line. Remember that you'll need to replace placeholders with your specific parameters."
},
"nav": {
"bugsLink": "Report a bug",
Expand Down
3 changes: 3 additions & 0 deletions public/locales/en/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
"copyHash": "Copy CID",
"share": "Share link"
},
"cliModal": {
"extraNotesPinning": "This command is only for local pinning/unpinning. If you want to use a remote pinning service, consult that service's documentation to learn how to pin/unpin from the command line."
},
"shareModal": {
"title": "Share files",
"description": "Copy the link below and share it with your friends."
Expand Down
3 changes: 3 additions & 0 deletions public/locales/en/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
},
"apiDescription": "<0>If your node is configured with a <1>custom API address</1>, including a port other than the default 5001, enter it here.</0>",
"cliDescription": "<0>Enable this option to display a \"view code\" <1></1> icon next to common IPFS commands. Clicking it opens a modal with that command's CLI code, so you can paste it into the IPFS command-line interface in your terminal.</0>",
"cliModal": {
"extraNotesJsonConfig": "If you've made changes to the config in this page's code editor that you'd like to save, click the download icon next to the copy button to download it as a JSON file."
},
"pinningModal": {
"title": "Select a pinning service provider.",
"description": "Don’t see your pinning service provider? <1>Add a custom one.<1>"
Expand Down
6 changes: 5 additions & 1 deletion src/bundles/files/consts.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ export const cliCmdKeys = {
ADD_NEW_PEER: 'addNewPeer'
}

export const cliCmdPrefixes = {
PIN_OBJECT: 'ipfs pin'
}

export const cliCommandList = {
[cliCmdKeys.UPDATE_IPFS_CONFIG]: () => 'ipfs config replace <path-to-settings.json>',
/**
Expand All @@ -99,7 +103,7 @@ export const cliCommandList = {
* @param {string} cid
* @param {string} op
*/
[cliCmdKeys.PIN_OBJECT]: (cid, op) => `ipfs pin ${op} ${cid}`,
[cliCmdKeys.PIN_OBJECT]: (cid, op) => `${cliCmdPrefixes.PIN_OBJECT} ${op} ${cid}`,
/**
* @param {string} filePath
* @param {string} fileName
Expand Down
5 changes: 3 additions & 2 deletions src/components/cli-tutor-mode/CliTutorMode.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Button from '../button/Button'
import Overlay from '../overlay/Overlay'
import Shell from '../shell/Shell'
import StrokeDownload from '../../icons/StrokeDownload'
import { cliCmdKeys, cliCommandList } from '../../bundles/files/consts'
import { cliCmdKeys, cliCommandList, cliCmdPrefixes } from '../../bundles/files/consts'

export const CliTutorialModal = ({ command, t, onLeave, className, downloadConfig, ...props }) => {
const onClickCopyToClipboard = (cmd) => {
Expand All @@ -25,7 +25,8 @@ export const CliTutorialModal = ({ command, t, onLeave, className, downloadConfi
{t('app:cliModal.description')}
</p>
<p className='charcoal-muted w-90 center'>
{ command && command === cliCommandList[cliCmdKeys.UPDATE_IPFS_CONFIG]() ? t('app:cliModal.extraNotes') : ''}
{ command && command === cliCommandList[cliCmdKeys.UPDATE_IPFS_CONFIG]() ? t('settings:cliModal.extraNotesJsonConfig') : ''}
{ command && command.startsWith(cliCmdPrefixes.PIN_OBJECT) ? t('files:cliModal.extraNotesPinning') : ''}
</p>
<div>
<Shell className='tl' title="Shell">
Expand Down

0 comments on commit 91e2f36

Please sign in to comment.