git ssb

16+

Dominic / patchbay



Commit 2840c9e48caac44fec4836e75b31d7e2d75039e0

add /shortcuts page

mixmix committed on 10/29/2018, 5:20:35 AM
Parent: a5b19e9a7af23f8f2cfcf33116137fad4143479b

Files changed

README.mdchanged
app/html/search-bar.jschanged
app/page/SHORTCUTS.mdadded
app/page/shortcuts.jsadded
app/page/shortcuts.mcssadded
router/sync/routes.jschanged
README.mdView
@@ -25,35 +25,9 @@
2525 If you'd like to hack on Patchbay, check out the Developer Install below.
2626
2727 ## Keyboard shortcuts
2828
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`
5630 ---
5731
5832 ## Developer Install
5933
app/html/search-bar.jsView
@@ -72,9 +72,9 @@
7272
7373 // TODO extract
7474 function getPagesSuggestions (word) {
7575 const pages = [
76- 'blogs', 'calendar', 'posts', 'public', 'private', 'inbox', 'profile', 'notifications', 'settings',
76 + 'blogs', 'calendar', 'posts', 'public', 'private', 'inbox', 'profile', 'notifications', 'settings', 'shortcuts',
7777 'gatherings', 'chess', 'books', 'imageSearch', 'polls', 'query', 'dark-crystal', 'postRank', 'scry/new'
7878 ]
7979
8080 return pages
app/page/SHORTCUTS.mdView
@@ -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.jsView
@@ -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.mcssView
@@ -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.jsView
@@ -19,8 +19,9 @@
1919 'public': 'first',
2020 'query': 'first',
2121 'search': 'first',
2222 'settings': 'first',
23 + 'shortcuts': 'first',
2324 'thread': 'first'
2425 },
2526 'keys.sync.id': 'first'
2627 })
@@ -44,8 +45,9 @@
4445 [ loc => loc.page === 'profile', () => pages.profile({ feed: myId }) ],
4546 [ loc => loc.page === 'query', pages.query ],
4647 [ loc => loc.page === 'search' && loc.query, pages.search ],
4748 [ loc => loc.page === 'settings', pages.settings ],
49 + [ loc => loc.page === 'shortcuts', pages.shortcuts ],
4850
4951 [ loc => loc.blob && isBlobLink(loc.blob), pages.blob ],
5052 [ loc => isPresent(loc.channel), pages.channel ],
5153 [ loc => isFeed(loc.feed), pages.profile ],

Built with git-ssb-web