diff --git a/electron.js b/electron.js index bdd34ce4e6..d31b563143 100644 --- a/electron.js +++ b/electron.js @@ -288,16 +288,16 @@ function menuInit () { label: 'Help', submenu: [ { - label: 'Table of contents', - click: function () { win.webContents.send('route', '/help/index'); } + label: 'Status', + click: function () { win.webContents.send('popupHelp', 'status'); } }, { - label: 'Keyboard & Shortcuts', - click: function () { win.webContents.send('route', '/help/shortcuts'); } + label: 'Keyboard Shortcuts', + click: function () { win.webContents.send('popupHelp', 'shortcuts'); } }, { label: 'What\'s new', - click: function () { win.webContents.send('route', '/help/new'); } + click: function () { win.webContents.send('popupHelp', 'whatsNew'); } }, { label: 'Check for updates', diff --git a/src/json/url.json b/src/json/url.json index 582cd8bc62..69d466da9b 100644 --- a/src/json/url.json +++ b/src/json/url.json @@ -1,5 +1,4 @@ { - "feature": "mailto:hello@anytype.io", "community": "https://t.me/anytype", "telegram": "https://t.me/anytype", "twitter": "https://twitter.com/AnytypeLabs", diff --git a/src/scss/page/help.scss b/src/scss/page/help.scss deleted file mode 100644 index ca8643c3c3..0000000000 --- a/src/scss/page/help.scss +++ /dev/null @@ -1,5 +0,0 @@ -@import "~scss/_vars"; - -.pageHelp { - .wrapper { width: 704px; margin: 0px auto; padding: 100px 0px; } -} \ No newline at end of file diff --git a/src/scss/popup/new.scss b/src/scss/popup/help.scss similarity index 97% rename from src/scss/popup/new.scss rename to src/scss/popup/help.scss index e67284345e..bfef019fa1 100644 --- a/src/scss/popup/new.scss +++ b/src/scss/popup/help.scss @@ -1,7 +1,7 @@ @import "~scss/_vars"; .popups { - .popup.popupNew { + .popup.popupHelp { .innerWrap { width: 864px; padding: 80px 0px 0px 0px; } .head { display: flex; position: absolute; top: 0px; left: 0px; width: 100%; padding: 10px 20px; color: $colorDarkGrey; } diff --git a/src/ts/app.tsx b/src/ts/app.tsx index 75fe655c01..1311621bf0 100644 --- a/src/ts/app.tsx +++ b/src/ts/app.tsx @@ -43,7 +43,6 @@ import 'scss/component/pin.scss'; import 'scss/page/auth.scss'; import 'scss/page/main/index.scss'; import 'scss/page/main/edit.scss'; -import 'scss/page/help.scss'; import 'scss/block/common.scss'; import 'scss/block/dataview.scss'; @@ -69,7 +68,7 @@ import 'scss/popup/archive.scss'; import 'scss/popup/navigation.scss'; import 'scss/popup/prompt.scss'; import 'scss/popup/preview.scss'; -import 'scss/popup/new.scss'; +import 'scss/popup/help.scss'; import 'scss/popup/feedback.scss'; import 'scss/popup/confirm.scss'; import 'scss/popup/editor/page.scss'; @@ -256,6 +255,12 @@ class App extends React.Component { ipcRenderer.on('route', (e: any, route: string) => { history.push(route); }); + + ipcRenderer.on('popupHelp', (e: any, document: string) => { + commonStore.popupOpen('help', { + data: { document: document }, + }); + }); ipcRenderer.on('message', (e: any, text: string) => { console.log('[Message]', text); diff --git a/src/ts/component/page/help/item/icon.tsx b/src/ts/component/block/help/icon.tsx similarity index 100% rename from src/ts/component/page/help/item/icon.tsx rename to src/ts/component/block/help/icon.tsx diff --git a/src/ts/component/page/help/item/block.tsx b/src/ts/component/block/help/index.tsx similarity index 95% rename from src/ts/component/page/help/item/block.tsx rename to src/ts/component/block/help/index.tsx index 246a94271d..8ae9039223 100644 --- a/src/ts/component/page/help/item/block.tsx +++ b/src/ts/component/block/help/index.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; import { RouteComponentProps } from 'react-router'; -import { Smile } from 'ts/component'; -import { I, Util, DataUtil } from 'ts/lib'; +import { I, DataUtil } from 'ts/lib'; interface Props extends RouteComponentProps { type: I.BlockType; diff --git a/src/ts/component/page/help/item/link.tsx b/src/ts/component/block/help/link.tsx similarity index 100% rename from src/ts/component/page/help/item/link.tsx rename to src/ts/component/block/help/link.tsx diff --git a/src/ts/component/page/help/item/text.tsx b/src/ts/component/block/help/text.tsx similarity index 100% rename from src/ts/component/page/help/item/text.tsx rename to src/ts/component/block/help/text.tsx diff --git a/src/ts/component/page/help/item/title.tsx b/src/ts/component/block/help/title.tsx similarity index 83% rename from src/ts/component/page/help/item/title.tsx rename to src/ts/component/block/help/title.tsx index dd50bb2040..693223105d 100644 --- a/src/ts/component/page/help/item/title.tsx +++ b/src/ts/component/block/help/title.tsx @@ -1,6 +1,4 @@ import * as React from 'react'; -import { Icon } from 'ts/component'; -import { I } from 'ts/lib'; interface Props { text?: string; diff --git a/src/ts/component/header/help/index.tsx b/src/ts/component/header/help/index.tsx index 791dbe09ed..fe3cfde7e3 100644 --- a/src/ts/component/header/help/index.tsx +++ b/src/ts/component/header/help/index.tsx @@ -63,7 +63,7 @@ class HeaderHelpIndex extends React.Component { if (authStore.account) { this.props.history.push('/main/index'); } else { - DataUtil.onAuth(); + DataUtil.onAuth(); }; }; diff --git a/src/ts/component/menu/help.tsx b/src/ts/component/menu/help.tsx index 7e2c66fce9..de30697489 100644 --- a/src/ts/component/menu/help.tsx +++ b/src/ts/component/menu/help.tsx @@ -24,11 +24,11 @@ class MenuHelp extends React.Component { render () { const items: any[] = [ - { id: 'help', name: 'Help & support' }, - { id: 'shortcuts', name: 'Shortcuts' }, + { id: 'help', name: 'What\'s new', document: 'whatsNew' }, + { id: 'help', name: 'Status', document: 'status' }, + { id: 'help', name: 'Shortcuts', document: 'shortcuts' }, { id: 'feedback', name: 'Give feedback' }, { id: 'community', name: 'Join community' }, - //{ id: 'feature', icon: 'feature', name: 'Suggest a Feature' }, ]; return ( @@ -47,23 +47,15 @@ class MenuHelp extends React.Component { switch (item.id) { case 'help': - history.push('/help/index'); + commonStore.popupOpen('help', { + data: { document: item.document }, + }); break; - case 'shortcuts': - history.push('/help/shortcuts'); - break; - case 'feedback': commonStore.popupOpen('feedback', {}); break; - /* - case 'feature': - ipcRenderer.send('urlOpen', Url.feature); - break; - */ - case 'community': ipcRenderer.send('urlOpen', Url.community); break; diff --git a/src/ts/component/page/auth/pin/check.tsx b/src/ts/component/page/auth/pin/check.tsx index 1a6ef9c924..6d4b160f22 100644 --- a/src/ts/component/page/auth/pin/check.tsx +++ b/src/ts/component/page/auth/pin/check.tsx @@ -60,7 +60,9 @@ class PageAuthPinCheck extends React.Component { history.push('/main/index'); if (!Storage.get('popupNewBlock')) { - commonStore.popupOpen('new', {}); + commonStore.popupOpen('help', { + data: { document: 'whatsNew' }, + }); }; }; }; diff --git a/src/ts/component/page/help/index.tsx b/src/ts/component/page/help/index.tsx deleted file mode 100644 index 86c7586709..0000000000 --- a/src/ts/component/page/help/index.tsx +++ /dev/null @@ -1,68 +0,0 @@ -import * as React from 'react'; -import * as ReactDOM from 'react-dom'; -import { RouteComponentProps } from 'react-router'; -import { HeaderHelpIndex as Header } from 'ts/component'; -import { I, Docs } from 'ts/lib'; -import { commonStore } from 'ts/store'; - -import Block from './item/block'; - -interface Props extends RouteComponentProps {}; - -const $ = require('jquery'); -const { app } = window.require('electron').remote; -const { ipcRenderer } = window.require('electron'); -const path = app.getPath('userData'); - -class PageHelpIndex extends React.Component { - - render () { - const path: any[] = [ - { icon: '🔮', name: 'Help', contentId: 'index' } - ]; - - return ( -
-
- -
-
- {Docs.Help.Index.map((item: any, i: number) => ( - - ))} -
-
-
- ); - }; - - componentDidMount () { - const node = $(ReactDOM.findDOMNode(this)); - const help = node.find('#button-menu-help'); - const path = node.find('#button-path'); - - help.unbind('click').on('click', (e: any) => { this.onHelp(); }); - path.unbind('click').on('click', (e: any) => { this.onPath(); }); - }; - - onHelp () { - const node = $(ReactDOM.findDOMNode(this)); - const btn = node.find('#button-menu-help'); - - commonStore.menuOpen('help', { - type: I.MenuType.Vertical, - element: btn, - offsetX: 0, - offsetY: 4, - vertical: I.MenuDirection.Bottom, - horizontal: I.MenuDirection.Center, - }); - }; - - onPath () { - ipcRenderer.send('pathOpen', path); - }; - -}; - -export default PageHelpIndex; diff --git a/src/ts/component/page/help/new.tsx b/src/ts/component/page/help/new.tsx deleted file mode 100644 index 58560b1fe2..0000000000 --- a/src/ts/component/page/help/new.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import * as React from 'react'; -import * as ReactDOM from 'react-dom'; -import { RouteComponentProps } from 'react-router'; -import { HeaderHelpIndex as Header } from 'ts/component'; -import { I, Docs, Util } from 'ts/lib'; - -interface Props extends RouteComponentProps {}; - -import Block from './item/block'; - -class PageHelpNew extends React.Component { - - render () { - const path: any[] = [ - { icon: '🔮', name: 'Help', contentId: 'index' }, - { icon: '👋', name: 'What\'s new', contentId: 'new' }, - ]; - - return ( -
-
- -
-
- {Docs.New.map((item: any, i: number) => ( - - ))} -
-
-
- ); - }; - -}; - -export default PageHelpNew; diff --git a/src/ts/component/page/help/shortcuts.tsx b/src/ts/component/page/help/shortcuts.tsx deleted file mode 100644 index 15dd3b00ae..0000000000 --- a/src/ts/component/page/help/shortcuts.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import * as React from 'react'; -import * as ReactDOM from 'react-dom'; -import { RouteComponentProps } from 'react-router'; -import { HeaderHelpIndex as Header } from 'ts/component'; -import { I, Docs, Util } from 'ts/lib'; - -interface Props extends RouteComponentProps {}; - -import Block from './item/block'; - -class PageHelpShortcuts extends React.Component { - - render () { - const path: any[] = [ - { icon: '🔮', name: 'Help', contentId: 'index' }, - { icon: '⌨️', name: 'Keyboard & Shortcuts', contentId: 'shortcuts' }, - ]; - - return ( -
-
- -
-
- {Docs.Help.Shortcuts.map((item: any, i: number) => ( - - ))} -
-
-
- ); - }; - -}; - -export default PageHelpShortcuts; diff --git a/src/ts/component/page/index.tsx b/src/ts/component/page/index.tsx index 7c02772667..ced7cd19fd 100644 --- a/src/ts/component/page/index.tsx +++ b/src/ts/component/page/index.tsx @@ -19,10 +19,6 @@ import PageAuthSuccess from './auth/success'; import PageMainIndex from './main/index'; import PageMainEdit from './main/edit'; -import PageHelpIndex from './help/index'; -import PageHelpShortcuts from './help/shortcuts'; -import PageHelpNew from './help/new'; - const $ = require('jquery'); const raf = require('raf'); const Components: any = { @@ -40,10 +36,6 @@ const Components: any = { 'main/index': PageMainIndex, 'main/edit': PageMainEdit, - - 'help/index': PageHelpIndex, - 'help/shortcuts': PageHelpShortcuts, - 'help/new': PageHelpNew, }; interface Props extends RouteComponentProps {}; @@ -107,7 +99,9 @@ class Page extends React.Component { keyboard.setMatch(match); if (!popupNewBlock && isMain) { - commonStore.popupOpen('new', {}); + commonStore.popupOpen('help', { + data: { document: 'whatsNew' }, + }); }; $(window).on('resize.page', () => { this.resize(); }); diff --git a/src/ts/component/popup/help.tsx b/src/ts/component/popup/help.tsx new file mode 100644 index 0000000000..78d7501d47 --- /dev/null +++ b/src/ts/component/popup/help.tsx @@ -0,0 +1,65 @@ +import * as React from 'react'; +import { RouteComponentProps } from 'react-router'; +import { Label, Icon } from 'ts/component'; +import { I, Docs, Storage, Util } from 'ts/lib'; +import Block from 'ts/component/block/help'; + +interface Props extends I.Popup, RouteComponentProps { + history: any; +}; + +const Url = require('json/url.json'); +const { ipcRenderer } = window.require('electron'); + +class PopupHelp extends React.Component { + + render () { + const { param } = this.props; + const { data } = param; + const { document } = data; + const doc = Docs.Help[Util.toUpperCamelCase(document)] || []; + const title = doc.find((it: any) => { return it.type == I.BlockType.Title; }); + + return ( +
+
+
+ {title ?
+ {document == 'whatsNew' ? ( +
+
+ ) : ''} +
+ +
+
+ {doc.map((item: any, i: number) => ( + + ))} +
+
+
+ ); + }; + + componentDidMount () { + const { param } = this.props; + const { data } = param; + const { document } = data; + + if (document == 'whatsNew') { + Storage.set('popupNewBlock', 1); + }; + }; + + onUrl (url: string) { + ipcRenderer.send('urlOpen', url); + }; + +}; + +export default PopupHelp; \ No newline at end of file diff --git a/src/ts/component/popup/index.tsx b/src/ts/component/popup/index.tsx index 36f9b8d732..f2a757dc94 100644 --- a/src/ts/component/popup/index.tsx +++ b/src/ts/component/popup/index.tsx @@ -7,7 +7,7 @@ import { commonStore } from 'ts/store'; import PopupSettings from './settings'; import PopupArchive from './archive'; import PopupNavigation from './navigation'; -import PopupNew from './new'; +import PopupHelp from './help'; import PopupPrompt from './prompt'; import PopupPreview from './preview'; import PopupEditorPage from './editor/page'; @@ -41,7 +41,7 @@ class Popup extends React.Component { navigation: PopupNavigation, confirm: PopupConfirm, prompt: PopupPrompt, - new: PopupNew, + help: PopupHelp, preview: PopupPreview, editorPage: PopupEditorPage, feedback: PopupFeedback, diff --git a/src/ts/component/popup/new.tsx b/src/ts/component/popup/new.tsx deleted file mode 100644 index 9e5d8dc373..0000000000 --- a/src/ts/component/popup/new.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import * as React from 'react'; -import { RouteComponentProps } from 'react-router'; -import { Label, Icon } from 'ts/component'; -import { I, Docs, Storage } from 'ts/lib'; -import { commonStore } from 'ts/store'; - -import Block from 'ts/component/page/help/item/block'; - -interface Props extends I.Popup, RouteComponentProps { - history: any; -}; - -const Url = require('json/url.json'); -const { ipcRenderer } = window.require('electron'); - -class PopupNew extends React.Component { - - render () { - return ( -
-
-
-
-
-
-
- -
-
- {Docs.New.map((item: any, i: number) => ( - - ))} -
-
-
- ); - }; - - componentDidMount () { - Storage.set('popupNewBlock', 1); - }; - - onUrl (url: string) { - ipcRenderer.send('urlOpen', url); - }; - -}; - -export default PopupNew; \ No newline at end of file diff --git a/src/ts/docs/help/index.tsx b/src/ts/docs/help/index.tsx index d6c0a64b86..4f721f0789 100644 --- a/src/ts/docs/help/index.tsx +++ b/src/ts/docs/help/index.tsx @@ -3,12 +3,9 @@ import { I } from 'ts/lib'; const { app } = window.require('electron').remote; const path = app.getPath('userData'); -const Index = [ +const Status = [ { type: I.BlockType.IconPage, icon: '🔮' }, - { type: I.BlockType.Title, text: 'Help' }, - - { type: I.BlockType.Link, icon: '⌨️', name: 'Keyboard & Shortcuts', contentId: 'shortcuts' }, - { type: I.BlockType.Link, icon: '👋', name: 'What\'s new', contentId: 'new' }, + { type: I.BlockType.Title, text: 'Status' }, { style: I.TextStyle.Header2, text: 'About' }, { text: 'You can use Anytype to create documents, tools, and organize it in a way you want.
Anytype is free for you without any storage or upload limits.' }, @@ -31,8 +28,10 @@ const Index = [ ]; import Shortcuts from './shortcuts'; +import WhatsNew from './whatsNew'; export { - Index, + Status, Shortcuts, + WhatsNew, }; diff --git a/src/ts/docs/help/shortcuts.tsx b/src/ts/docs/help/shortcuts.tsx index 01ee9244f3..65324fc3c8 100644 --- a/src/ts/docs/help/shortcuts.tsx +++ b/src/ts/docs/help/shortcuts.tsx @@ -2,7 +2,7 @@ import { I } from 'ts/lib'; export default [ { type: I.BlockType.IconPage, icon: '⌨️' }, - { type: I.BlockType.Title, text: 'Keyboard & Shortcuts' }, + { type: I.BlockType.Title, text: 'Keyboard Shortcuts' }, { style: I.TextStyle.Header1, text: 'Application' }, diff --git a/src/ts/docs/new.tsx b/src/ts/docs/help/whatsNew.tsx similarity index 100% rename from src/ts/docs/new.tsx rename to src/ts/docs/help/whatsNew.tsx diff --git a/src/ts/docs/index.tsx b/src/ts/docs/index.tsx index e1d19944f4..f9af473ddd 100644 --- a/src/ts/docs/index.tsx +++ b/src/ts/docs/index.tsx @@ -1,7 +1,5 @@ -import New from './new'; import * as Help from './help'; export { - New, Help, }; \ No newline at end of file