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

feat: separate CLI Tutor Mode helptext #1700

Merged
merged 8 commits into from
Jan 5, 2021
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 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