git ssb

16+

Dominic / patchbay



Commit fa8ed712ab5bde9f525c730497fbd46de5a352c9

Merge pull request #223 from ssbc/dark_crystal

Dark crystal
mix irving authored on 8/10/2018, 10:34:35 AM
GitHub committed on 8/10/2018, 10:34:35 AM
Parent: cab191d64bed1ac52369366942b9d15937f5d785
Parent: 9929e33226632ad0d354876b6c73513d1e305a25

Files changed

app/html/modal.mcsschanged
app/html/scroller.jschanged
app/html/search-bar.jschanged
app/page/imageSearch.jschanged
app/page/imageSearch.mcsschanged
app/page/query.jschanged
app/styles/css/global.jschanged
app/styles/mcss/button.mcsschanged
app/styles/mcss/hypertabs.mcsschanged
app/sync/catch-keyboard-shortcut.jschanged
main.jschanged
package-lock.jsonchanged
package.jsonchanged
app/html/modal.mcssView
@@ -2,13 +2,13 @@
22 display: flex
33 flex-direction: row
44 position: fixed
55 z-index: 90
6- text-align: center
7- top: 2.5rem
8- right: 0
9- bottom: 0
10- left: 0
6 +
7 + top: var(--app-border-width)
8 + bottom: var(--app-border-width)
9 + left: var(--app-border-width)
10 + right: var(--app-border-width)
1111 background: rgba(15, 0, 25, 0.78)
1212
1313 div.content {
1414 max-width: 90vw
@@ -18,27 +18,8 @@
1818 $backgroundPrimary
1919 box-shadow: rgba(0,0,0,.34) 2px 6px 10px
2020 margin: auto
2121 $dontSelect
22-
23- div.dialog {
24- div.message {
25- $colorFontPrimary
26- }
27-
28- div.actions {
29- display: flex
30- padding-top: 15px
31-
32- button {
33- margin: auto
34-
35- -primary {
36- $backgroundPrimary
37- }
38- }
39- }
40- }
4122 }
4223
4324 -open {
4425 display: flex
app/html/scroller.jsView
@@ -8,9 +8,9 @@
88
99 function Scroller (opts = {}) {
1010 const { prepend = [], content = null, append = [], classList = [], className = '', title = '' } = opts
1111
12- const contentSection = h('section.content', content)
12 + const contentSection = h('section.content', { title: '' }, content)
1313
1414 const container = h('Scroller',
1515 { classList, className, title, style: { 'overflow-y': 'scroll', 'overflow-x': 'auto' } },
1616 [
app/html/search-bar.jsView
@@ -73,9 +73,9 @@
7373 // TODO extract
7474 function getPagesSuggestions (word) {
7575 const pages = [
7676 'blogs', 'calendar', 'posts', 'public', 'private', 'inbox', 'profile', 'notifications', 'settings',
77- 'gatherings', 'chess', 'books', 'imageSearch', 'polls', 'query'
77 + 'gatherings', 'chess', 'books', 'imageSearch', 'polls', 'query', 'dark-crystal'
7878 ]
7979
8080 return pages
8181 .filter(page => ~page.indexOf(word))
app/page/imageSearch.jsView
@@ -102,9 +102,9 @@
102102 })
103103
104104 const imageName = Value('CHOOSE YOUR OWN NAME')
105105
106- return [
106 + return h('ImageSearchDetails', [
107107 h('img', { src: blobUrl(blob) }),
108108 h('div.md', [
109109 'Copy markdown: ',
110110 h('pre', ['![', imageName, '](', blob, ')'])
@@ -122,9 +122,9 @@
122122 focusedBlob.set()
123123 isOpen.set(false)
124124 }
125125 }, 'Close')
126- ]
126 + ])
127127 })
128128 return createModal(modalContent, { isOpen })
129129 }
130130
app/page/imageSearch.mcssView
@@ -6,49 +6,8 @@
66 grid-template-rows: 5rem auto
77 justify-content: center
88 align-items: start
99
10- div.Modal {
11- div.content {
12- display: grid
13- justify-items: center
14-
15- img {
16- max-width: 90vw
17- max-height: 80vh
18-
19- margin-bottom: 1rem
20- }
21-
22- div.md {
23- pre {
24- user-select: all
25- padding: .2rem
26- padding-right: 2rem
27- min-width: 39rem
28- background-color: rgba(0,0,0,.1)
29-
30- text-align: right
31- margin-top: .2rem
32- display: inline-block
33- }
34- }
35-
36- table {
37- tr {
38- td {
39- text-align: left
40- padding-right: .5rem
41- }
42-
43- td.msg {
44- font-family: monospace
45- }
46- }
47- }
48- }
49- }
50-
5110 section.settings {
5211 padding: 1rem 0
5312 input {
5413 min-width: 20rem
@@ -81,4 +40,45 @@
8140 margin: 0 1rem 1rem 0
8241 }
8342 }
8443 }
44 +
45 +ImageSearchDetails {
46 + padding: 1rem
47 +
48 + display: grid
49 + justify-items: center
50 +
51 + img {
52 + max-width: 90vw
53 + max-height: 80vh
54 +
55 + margin-bottom: 1rem
56 + }
57 +
58 + div.md {
59 + pre {
60 + user-select: all
61 + padding: .2rem
62 + padding-right: 2rem
63 + min-width: 39rem
64 + background-color: rgba(0,0,0,.1)
65 +
66 + text-align: right
67 + margin-top: .2rem
68 + display: inline-block
69 + }
70 + }
71 +
72 + table {
73 + tr {
74 + td {
75 + text-align: left
76 + padding-right: .5rem
77 + }
78 +
79 + td.msg {
80 + font-family: monospace
81 + }
82 + }
83 + }
84 +}
app/page/query.jsView
@@ -37,19 +37,19 @@
3737 } catch (err) {
3838 // console.error(err)
3939 return err
4040 }
41- if (!Array.isArray(query)) return
42- if (!query.map(q => Object.keys(q)[0]).every(q => ['$filter', '$map', '$reduce'].includes(q))) return
43- activateQuery()
41 + if (isValidQuery(query)) activateQuery()
4442 })
45- const query = Value(json5.parse(initial()))
4643
44 + const { initialQuery, initialValue } = getInitialState(location)
45 + const query = Value(initialQuery)
46 +
4747 const activateQuery = () => query.set(json5.parse(input()))
4848
4949 return h('Query', { title: '/query' }, [
5050 h('section.query', [
51- h('textarea', { 'ev-input': ev => input.set(ev.target.value), value: initial() }),
51 + h('textarea', { 'ev-input': ev => input.set(ev.target.value), value: initialValue }),
5252 h('button', {
5353 className: when(error, '', '-primary'),
5454 disabled: when(error, 'disabled'),
5555 'ev-click': activateQuery
@@ -82,10 +82,18 @@
8282 })
8383 }
8484 }
8585
86-function initial () {
87- return `[{
86 +function getInitialState (location) {
87 + const { initialQuery, initialValue } = location
88 + if (isValidQuery(initialQuery)) {
89 + return {
90 + initialQuery,
91 + initialValue: initialValue || json5.stringify(initialQuery, null, 2)
92 + }
93 + }
94 +
95 + const defaultValue = `[{
8896 $filter: {
8997 value: {
9098 timestamp: {$gt: 0},
9199 content: {
@@ -107,5 +115,16 @@
107115 // $filter - used to prune down results. This must be the first entry, as ssb-query uses it to determine the most optimal index for fast lookup.
108116
109117 // $map - optional, can be used to pluck data you want out. Doing this reduces the amount of data sent over muxrpc, which speeds up loading
110118 `
119 + return {
120 + initialQuery: json5.parse(defaultValue),
121 + initialValue: defaultValue
122 + }
111123 }
124 +
125 +function isValidQuery (query) {
126 + if (!Array.isArray(query)) return false
127 + if (!query.map(q => Object.keys(q)[0]).every(q => ['$filter', '$map', '$reduce'].includes(q))) return false
128 +
129 + return true
130 +}
app/styles/css/global.jsView
@@ -32,10 +32,8 @@
3232 }
3333
3434 input:focus, .compose:focus {
3535 outline: none;
36- border-color: #0088cc;
37- box-shadow: 0 0 4px #0088cc;
3836 }
3937
4038 input, textarea {
4139 border: 1px solid gainsboro;
app/styles/mcss/button.mcssView
@@ -35,8 +35,21 @@
3535 border: 1px solid #15d6b4
3636 outline: none
3737 }
3838
39 + :disabled {
40 + color: grey
41 + background: #fff
42 +
43 + cursor: initial
44 +
45 + :hover {
46 + color: grey
47 + background: #fff
48 + border: 1px #b9b9b9 solid
49 + }
50 + }
51 +
3952 -subtle {
4053 color: #b9b9b9
4154 border: 1px solid rgba(0,0,0,0)
4255 background: none
app/styles/mcss/hypertabs.mcssView
@@ -9,12 +9,14 @@
99
1010 height: initial
1111
1212 nav {
13- display: flex
14-
13 + height: 2.3rem
14 + min-height: 2.3rem
1515 background: none
1616
17 + display: flex
18 +
1719 section.tabs {
1820 min-width: 0
1921
2022 flex-grow: 1
@@ -22,8 +24,9 @@
2224
2325 div.tab {
2426 flex-grow: 1
2527
28 + z-index: 1000
2629 min-width: 3.5rem
2730 font-size: .9rem
2831 background: rgba(0, 0, 0, 0)
2932
@@ -84,8 +87,9 @@
8487 transition: all .2s ease-in
8588 }
8689
8790 -selected {
91 + z-index: 0
8892 color: var(--page-color)
8993 background: var(--page-background)
9094
9195 a.link {
@@ -117,9 +121,10 @@
117121
118122 }
119123
120124 div.navExtra {
121- padding-bottom: var(--app-border-width)
125 + z-index: 1000
126 + padding-bottom: calc(var(--app-border-width)/2)
122127 display: flex
123128 align-items: center
124129 }
125130 }
app/sync/catch-keyboard-shortcut.jsView
@@ -43,8 +43,10 @@
4343 }
4444 }
4545
4646 function genericShortcuts (ev, { tabs, search, goTo, back }) {
47 + const scroll = tabs.currentPage().scroll || function () {}
48 +
4749 // Messages
4850 if (ev.keyCode === 71) { // gg = scroll to top
4951 if (!gPressed) {
5052 gPressed = true
@@ -52,18 +54,18 @@
5254 gPressed = false
5355 }, 3000)
5456 return
5557 }
56- tabs.currentPage().scroll('first')
58 + scroll('first')
5759 }
5860 gPressed = false
5961
6062 switch (ev.keyCode) {
6163 // Messages (cont'd)
6264 case 74: // j = older
63- return tabs.currentPage().scroll(1)
65 + return scroll(1)
6466 case 75: // k = newer
65- return tabs.currentPage().scroll(-1)
67 + return scroll(-1)
6668 case 13: // enter = open
6769 return goToMessage(ev, { goTo })
6870 case 79: // o = open
6971 return goToMessage(ev, { goTo })
main.jsView
@@ -37,8 +37,9 @@
3737 const sockets = combine(
3838 require('ssb-horcrux'),
3939 // require('patch-hub'),
4040
41 + require('patchbay-dark-crystal'),
4142 require('patchbay-poll'),
4243 require('ssb-chess'),
4344 require('patchbay-gatherings'),
4445 require('patchbay-book'),
package-lock.jsonView
The diff is too large to show. Use a local git client to view these changes.
Old file size: 293309 bytes
New file size: 307487 bytes
package.jsonView
@@ -66,8 +66,9 @@
6666 "patch-inbox": "^1.1.6",
6767 "patch-settings": "^1.1.2",
6868 "patch-suggest": "^2.0.2",
6969 "patchbay-book": "^1.0.8",
70 + "patchbay-dark-crystal": "^1.0.1",
7071 "patchbay-gatherings": "^2.0.2",
7172 "patchbay-poll": "^1.0.5",
7273 "patchcore": "^1.28.0",
7374 "pull-abortable": "^4.1.1",

Built with git-ssb-web