Commit 2840c9e48caac44fec4836e75b31d7e2d75039e0
add /shortcuts page
mixmix committed on 10/29/2018, 5:20:35 AMParent: a5b19e9a7af23f8f2cfcf33116137fad4143479b
Files changed
README.md | changed |
app/html/search-bar.js | changed |
app/page/SHORTCUTS.md | added |
app/page/shortcuts.js | added |
app/page/shortcuts.mcss | added |
router/sync/routes.js | changed |
README.md | ||
---|---|---|
@@ -25,35 +25,9 @@ | ||
25 | 25 … | If you'd like to hack on Patchbay, check out the Developer Install below. |
26 | 26 … | |
27 | 27 … | ## Keyboard shortcuts |
28 | 28 … | |
29 | -`CmdOrCtrl` is the `command` key on Apple keyboards or the `ctrl` key on PC keyboards. | |
30 | - | |
31 | -### Tabs and window | |
32 | - | |
33 | -- `h` / `CmdOrCtrl+Shift+]` : tabs left | |
34 | -- `j` / `CmdOrCtrl+Shift+[`: tabs right | |
35 | -- `x` / `CmdOrCtrl+w` : close tab | |
36 | -- `CmdOrCtrl+Shift+w` will close the current window | |
37 | - | |
38 | -### Message feeds | |
39 | - | |
40 | -`j` : next message (down) | |
41 | -`k` : previous message | |
42 | -`o` : open message thread (and scroll to position of this message in that thread) | |
43 | -` ` ` : toggle raw message view for currently selected message (` ` ` = backtick, lives on the same key as `~`) | |
44 | - | |
45 | -composing : cttrl + enter = post | |
46 | - | |
47 | -### Nav bar thing | |
48 | - | |
49 | -`@` : start a person query | |
50 | -`#` : start a channel query | |
51 | -`?` : start a search query | |
52 | -`/` : start a navigation (e.g. /public) - need to re-instate suggestions for this | |
53 | - | |
54 | -you can also paste a message id (starts with `%`) in here to navigate to it. Same with blobs (`&`) | |
55 | - | |
29 … | +[See here](./app/page/SHORTCUTS.md) or in patchbay for to the page `/shortcuts` | |
56 | 30 … | --- |
57 | 31 … | |
58 | 32 … | ## Developer Install |
59 | 33 … |
app/html/search-bar.js | ||
---|---|---|
@@ -72,9 +72,9 @@ | ||
72 | 72 … | |
73 | 73 … | // TODO extract |
74 | 74 … | function getPagesSuggestions (word) { |
75 | 75 … | const pages = [ |
76 | - 'blogs', 'calendar', 'posts', 'public', 'private', 'inbox', 'profile', 'notifications', 'settings', | |
76 … | + 'blogs', 'calendar', 'posts', 'public', 'private', 'inbox', 'profile', 'notifications', 'settings', 'shortcuts', | |
77 | 77 … | 'gatherings', 'chess', 'books', 'imageSearch', 'polls', 'query', 'dark-crystal', 'postRank', 'scry/new' |
78 | 78 … | ] |
79 | 79 … | |
80 | 80 … | return pages |
app/page/SHORTCUTS.md | ||
---|---|---|
@@ -1,0 +1,29 @@ | ||
1 … | +# Keyboard shortcuts | |
2 … | + | |
3 … | +`CmdOrCtrl` is the `command` key on Apple keyboards or the `ctrl` key on PC keyboards. | |
4 … | + | |
5 … | +## Tabs and window | |
6 … | + | |
7 … | +`h` / `CmdOrCtrl+Shift+]` : tabs left | |
8 … | +`j` / `CmdOrCtrl+Shift+[`: tabs right | |
9 … | +`x` / `CmdOrCtrl+w` : close tab | |
10 … | +`CmdOrCtrl+Shift+w` will close the current window | |
11 … | + | |
12 … | +## Message feeds | |
13 … | + | |
14 … | +`j` : next message (down) | |
15 … | +`k` : previous message | |
16 … | +`o` : open message thread (and scroll to position of this message in that thread) | |
17 … | +` ` ` : toggle raw message view for currently selected message (` ` ` = backtick, lives on the same key as `~`) | |
18 … | + | |
19 … | +composing : cttrl + enter = post | |
20 … | + | |
21 … | +## Nav bar thing | |
22 … | + | |
23 … | +`@` : start a person query | |
24 … | +`#` : start a channel query | |
25 … | +`?` : start a search query | |
26 … | +`/` : start a navigation (e.g. /public) - need to re-instate suggestions for this | |
27 … | + | |
28 … | +you can also paste a message id (starts with `%`) in here to navigate to it. Same with blobs (`&`) | |
29 … | + |
app/page/shortcuts.js | ||
---|---|---|
@@ -1,0 +1,38 @@ | ||
1 … | +const nest = require('depnest') | |
2 … | +const { h } = require('mutant') | |
3 … | +const fs = require('fs') | |
4 … | +const { join } = require('path') | |
5 … | + | |
6 … | +const rawMd = fs.readFileSync(join(__dirname, './SHORTCUTS.md'), 'utf8') | |
7 … | + | |
8 … | +exports.gives = nest({ | |
9 … | + 'app.html.menuItem': true, | |
10 … | + 'app.page.shortcuts': true | |
11 … | +}) | |
12 … | + | |
13 … | +exports.needs = nest({ | |
14 … | + 'app.sync.goTo': 'first', | |
15 … | + 'message.html.markdown': 'first' | |
16 … | +}) | |
17 … | + | |
18 … | +exports.create = function (api) { | |
19 … | + return nest({ | |
20 … | + 'app.html.menuItem': menuItem, | |
21 … | + 'app.page.shortcuts': shortcutsPage | |
22 … | + }) | |
23 … | + | |
24 … | + function menuItem () { | |
25 … | + return h('a', { | |
26 … | + 'ev-click': () => api.app.sync.goTo({ page: 'blogs' }) | |
27 … | + }, '/blogs') | |
28 … | + } | |
29 … | + | |
30 … | + function shortcutsPage (location) { | |
31 … | + const page = h('Shortcuts', [ | |
32 … | + api.message.html.markdown(rawMd) | |
33 … | + ]) | |
34 … | + | |
35 … | + page.title = '/shortcuts' | |
36 … | + return page | |
37 … | + } | |
38 … | +} |
app/page/shortcuts.mcss | ||
---|---|---|
@@ -1,0 +1,10 @@ | ||
1 … | +Shortcuts { | |
2 … | + width: 100% | |
3 … | + padding: 1rem | |
4 … | + | |
5 … | + display: grid | |
6 … | + justify-content: center | |
7 … | + | |
8 … | + div.Markdown { | |
9 … | + } | |
10 … | +} |
router/sync/routes.js | |||
---|---|---|---|
@@ -19,8 +19,9 @@ | |||
19 | 19 … | 'public': 'first', | |
20 | 20 … | 'query': 'first', | |
21 | 21 … | 'search': 'first', | |
22 | 22 … | 'settings': 'first', | |
23 … | + 'shortcuts': 'first', | ||
23 | 24 … | 'thread': 'first' | |
24 | 25 … | }, | |
25 | 26 … | 'keys.sync.id': 'first' | |
26 | 27 … | }) | |
@@ -44,8 +45,9 @@ | |||
44 | 45 … | [ loc => loc.page === 'profile', () => pages.profile({ feed: myId }) ], | |
45 | 46 … | [ loc => loc.page === 'query', pages.query ], | |
46 | 47 … | [ loc => loc.page === 'search' && loc.query, pages.search ], | |
47 | 48 … | [ loc => loc.page === 'settings', pages.settings ], | |
49 … | + [ loc => loc.page === 'shortcuts', pages.shortcuts ], | ||
48 | 50 … | ||
49 | 51 … | [ loc => loc.blob && isBlobLink(loc.blob), pages.blob ], | |
50 | 52 … | [ loc => isPresent(loc.channel), pages.channel ], | |
51 | 53 … | [ loc => isFeed(loc.feed), pages.profile ], |
Built with git-ssb-web