Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.

Commit 4b83d79

Browse files
author
Joe Hand
authored
Merge pull request #609 from datproject/hypertracker
datBase
2 parents 7fb4744 + f22e22e commit 4b83d79

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1180
-4968
lines changed

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ after_success:
2727
- if [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then
2828
if [[ "$TRAVIS_BRANCH" == "master" || "$TRAVIS_BRANCH" == "beta" || "$TRAVIS_BRANCH" == "released" ]]; then
2929
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
30-
docker tag datproject/datfolder:travis-${TRAVIS_BUILD_NUMBER} datproject/datfolder:$TRAVIS_BRANCH;
31-
docker push datproject/datfolder:$TRAVIS_BRANCH;
30+
docker tag datproject/datbase:travis-${TRAVIS_BUILD_NUMBER} datproject/datbase:$TRAVIS_BRANCH;
31+
docker push datproject/datbase:$TRAVIS_BRANCH;
3232
fi; fi

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Dat Registry
1+
# datBase
22

3-
A web registry for the dat network. Hosted at [http://datproject.org](http://datproject.org).
3+
Open data powered by Dat. Future-friendly apps for your research data pipeline. Hosted at [http://datbase.org](http://datbase.org).
44

5-
[![Build Status](https://travis-ci.org/datproject/datproject.org.svg?branch=master)](https://travis-ci.org/datproject/datproject.org)
5+
[![Build Status](https://travis-ci.org/datproject/datbase.svg?branch=master)](https://travis-ci.org/datproject/datbase)
66

77
## Features
88

client/js/app.js

+8-16
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,31 @@
11
const choo = require('choo')
22
const persist = require('choo-persist')
3-
const app = choo()
4-
const defaults = require('./models/defaults')
3+
const logger = require('choo-log')
54
const css = require('sheetify')
5+
const defaults = require('./models/defaults')
6+
const app = choo()
67

78
// define models:
89
var key = module.parent ? '' : window.location.origin
9-
app.use(persist({name: 'choo-datproject.org:' + key}))
10-
app.use(logger)
10+
app.use(persist({name: 'choo-hypertracker' + key}))
11+
app.use(logger())
1112
app.use(require('./defaults')(defaults))
1213
app.use(require('./models/archive'))
1314
app.use(require('./models/township'))
14-
app.use(require('./models/explore'))
1515
app.use(require('./models/profile'))
1616
app.use(require('./models/message'))
1717
app.use(require('./models/preview'))
18+
app.use(require('./plugins/analytics'))
1819

19-
function logger (state, emitter) {
20-
emitter.on('*', function (messageName, data) {
21-
console.log('event', messageName, data)
22-
})
23-
}
24-
20+
css('tachyons')
2521
css('dat-colors')
2622

2723
// define routes:
28-
app.route('/install', require('./pages/install'))
2924
app.route('/publish', require('./pages/publish'))
30-
app.route('/explore', require('./pages/explore'))
3125
app.route('/register', require('./pages/auth/register'))
3226
app.route('/login', require('./pages/auth/login'))
3327
app.route('/reset-password', require('./pages/auth/reset-password'))
3428
app.route('/404', require('./pages/fourohfour'))
35-
app.route('/team', require('./pages/landing/team'))
36-
app.route('/about', require('./pages/landing/about'))
3729
app.route('/view', require('./pages/archive'))
3830
app.route('/download/:archiveKey', require('./pages/download'))
3931
app.route('/profile/edit', require('./pages/auth/edit-profile'))
@@ -44,7 +36,7 @@ app.route('/dat://:archiveKey/contents/*', require('./pages/archive'))
4436
app.route('/:username/:dataset', require('./pages/archive'))
4537
app.route('/:username/:dataset/*', require('./pages/archive'))
4638
app.route('/:username', require('./pages/auth/profile'))
47-
app.route('/', require('./pages/landing/splash'))
39+
app.route('/', require('./pages/landing'))
4840

4941
app.defaults = defaults
5042

client/js/components/auth/user-panel.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ const prefix = css`
7777
module.exports = function (state, emit) {
7878
if (!state.township.username) return
7979

80-
return html`<div class="user-panel ${prefix} ${state.township.sidePanel}">
80+
return html`<div class="user-panel tl mr2 mr4-l ${prefix} ${state.township.sidePanel}">
8181
<a class="close-button" title="Close" href="#" onclick=${() => emit('township:sidePanel')}>
8282
<svg>
8383
<use xlink:href="#daticon-cross" />
@@ -88,11 +88,11 @@ module.exports = function (state, emit) {
8888
Signed in as <b>${state.township.profile.username}</b>
8989
</div>
9090
</div>
91-
<ul>
91+
<ul class="list mb0">
9292
<li><a href="/${state.township.username}" data-no-routing>View Profile</a></li>
9393
<li><a href="/profile/edit" data-no-routing>Edit Profile</a></li>
94-
<li><a href="http://github.com/datproject/datproject.org/issues" target="_blank" class="color-neutral-50 hover-color-neutral-70">Report Bug</a></li>
95-
<li><a href="#" onclick=${() => emit('township:logout', {})}>Logout</a></li>
94+
<li><a href="http://github.com/datproject/datbase/issues" target="_blank" class="color-neutral-50 hover-color-neutral-70">Report Bug</a></li>
95+
<li class="mb0"><a href="#" onclick=${() => emit('township:logout', {})}>Logout</a></li>
9696
</ul>
9797
</div>`
9898
}

client/js/components/header.js

+29-34
Original file line numberDiff line numberDiff line change
@@ -5,47 +5,42 @@ const importButton = require('../elements/import-button')
55
const loginButton = require('../components/login-button')
66
const message = require('../elements/message')
77

8-
var headerStyles = css`
9-
:host {
10-
height: var(--site-header-height);
11-
background-color: var(--color-white);
12-
border-bottom: 1px solid var(--color-neutral-10);
13-
}
14-
`
15-
16-
var navStyles = css`
8+
const logoCss = css`
179
:host {
18-
display: flex;
19-
height: var(--site-header-height);
20-
align-items: center;
10+
img {
11+
transition: transform .5s ease-in-out;
12+
width: inherit;
13+
}
14+
&:hover, &:focus {
15+
img {
16+
transform: rotate(360deg);
17+
}
18+
}
2119
}
2220
`
2321

24-
const header = (state, emit) => {
25-
return html`<div>
26-
<header class="relative ${headerStyles}">
22+
module.exports = function (state, emit) {
23+
return html`
24+
<header>
2725
${message(state.message)}
28-
<div class="container container--top-bar">
29-
<div class="flex justify-between items-center relative">
30-
${panel(state, emit)}
31-
<nav class="flex items-center ${navStyles}">
32-
<a href="/" data-no-routing class="dat-logo">
33-
<img src="/public/img/dat-hexagon.svg" />
34-
<span class="dat-logo__word">Dat</span>
35-
</a>
36-
${importButton(emit)}
37-
<a href="https://docs.datproject.org" data-no-routing class="header-nav-link">Docs</a>
38-
<a href="/explore" class="header-nav-link">Explore</a>
39-
<a href="/install" class="header-nav-link">Install</a>
40-
</nav>
41-
<div>
42-
${state.township.email ? html`<a href="/publish" class="btn btn--green">Publish</a>` : ''}
26+
<nav class="bg-white bb b--neutral-10 dt w-100 border-box pa2 ph4-l">
27+
<div class="dtc v-mid w-75">
28+
<a class="${logoCss} v-mid dib link dim mr2 w2 h2" href="/" title="DatBase">
29+
<img src="/public/img/dat-hexagon.svg" alt="Dat Logo">
30+
</a>
31+
<a class="mr3 v-mid link dim color-neutral hover-color-neutral b f5 f3-ns dib-ns dn" href="/" title="datBase">dat<span class="color-neutral-60">Base</span></a>
32+
${importButton(emit)}
33+
<a href="http://docs.datproject.org" class="ml3 link dim color-neutral ttu tracked f6 f5-ns dib">Docs</a>
34+
<a href="http://chat.datproject.org" class="ml3 link dim color-neutral ttu tracked f6 f5-ns dib-l dn">Chat</a>
35+
</div>
36+
<div class="dtc v-mid w-25 tr">
37+
${state.township.email ? html`<a href="/publish" class="dib-ns dn btn btn--green">Publish</a>` : ''}
38+
<div class="dib">
4339
${loginButton(state, emit)}
4440
</div>
41+
${panel(state, emit)}
4542
</div>
46-
</div>
43+
</nav>
4744
</header>
48-
</div>`
45+
`
4946
}
50-
51-
module.exports = header

client/js/elements/footer/index.js

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
const html = require('choo/html')
2+
const css = require('sheetify')
3+
4+
module.exports = function () {
5+
return html`
6+
<footer class="pv2 bg-neutral white w-100">
7+
<section class="ph2 ph4-m mw8-ns center-ns">
8+
<div class="pt3">
9+
<div class="mb2 lh-copy">
10+
<a class="f4 b white dib dim link hover-color-white mr3 mt1" href="/" title="Dat Project">
11+
<img src="/public/img/dat-hexagon.svg" class="dib w2 h2 mr2 v-mid mb1" alt="Dat Project">
12+
datBase
13+
</a>
14+
<a class="f4 link white hover-color-neutral-40 b dib mr3 mb3" href="http://blog.datproject.org" title="Blog - Dat Project">
15+
Blog
16+
</a>
17+
</div>
18+
<div class="mt3">
19+
<a class="white hover-color-white ba b--green no-underline grow b inline-flex items-center mr3 mb3 pv2 ph3" href="https://datproject.org" title="Dat Project Home">
20+
<div class="color-green dib mr2"><svg class="w2 h2"><use xlink:href="#daticon-happy-dat"/></svg></div>
21+
<span>Dat Project Home</span>
22+
</a>
23+
<a class="white hover-color-white ba b--green no-underline grow b inline-flex items-center mr3 mb3 pv2 ph3" href="http://chat.datproject.org" title="Join our Chat">
24+
<div class="color-green dib mr2"><svg class="w2 h2"><use xlink:href="#daticon-question"/></svg></div>
25+
<span>
26+
Curious? Join Our Chat
27+
</span>
28+
</a>
29+
<a class="white hover-color-white ba b--green no-underline grow b inline-flex items-center mb3 pv2 ph3" href="https://donate.datproject.org" title="Donate to Code for Science & Society">
30+
<div class="color-green dib mr2"><svg class="w2 h2"><use xlink:href="#daticon-star-dat"/></svg></div>
31+
<span>Donate to Support Public Data</span>
32+
</a>
33+
</div>
34+
<p class="f6 measure copy lh-copy">
35+
Have questions? Join our chat or ask on <a href="http://twitter.com/dat_project" class="color-blue no-underline underline-hover">Twitter</a> or <a href="http://github.com/datproject" class="color-pink no-underline underline-hover color-green">Github</a>.
36+
</p>
37+
</div>
38+
<p class="bt b--dat-neutral-80 color-neutral-50 tc f7 pv2">
39+
<strong>Dat</strong> 2017 • Page source on <a class="color-neutral-50 hover-color-pink" href="https://github.com/datproject/datbase.org">github</a>
40+
</p>
41+
</section>
42+
</footer>
43+
`
44+
}
+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
const html = require('choo/html')
2+
3+
/*
4+
Options:
5+
6+
{
7+
bgColor: 'bg-white',
8+
color: 'neutral',
9+
title: 'Section',
10+
subtitle: 'Subtitle for this section',
11+
sections: [
12+
{
13+
title: 'First section',
14+
text: 'lorem bacon some things'
15+
},
16+
{
17+
title: 'Second section',
18+
text: 'lorem bacon some things'
19+
},
20+
{
21+
title: 'Third section',
22+
text: 'lorem bacon some things'
23+
}
24+
],
25+
cta: {
26+
link: '#',
27+
text: 'Learn More'
28+
}
29+
}
30+
*/
31+
32+
module.exports = function (props) {
33+
props = Object.assign({
34+
bgColor: 'bg-white'
35+
}, props)
36+
37+
if (!props.color && props.bgColor === 'bg-neutral') props.color = 'white'
38+
39+
// Allow html
40+
const subtitle = html`<p class="f4 mt1 ${props.bgColor !== 'bg-neutral' ? 'color-neutral-70' : 'color-neutral-30'} horizontal-rule"></p>`
41+
subtitle.innerHTML = props.subtitle
42+
43+
return html`
44+
<section class="pv4 ${props.bgColor} ${props.color ? props.color : ''}">
45+
<div class="pv2 ph3 pa4-m mw8-ns center-ns">
46+
<header>
47+
<h2 class="f2 mb0">${props.title}</h2>
48+
${subtitle}
49+
</header>
50+
<div class="pt3 cf">
51+
${props.sections.map((section) => {
52+
return textSection(section)
53+
})}
54+
</div>
55+
${cta()}
56+
</div>
57+
</section>
58+
`
59+
60+
function cta () {
61+
if (!props.cta) return
62+
return html`
63+
<p class="pt4">
64+
<a href="${props.cta.link}" class="f5 white bg-animate hover-color-white bg-green hover-bg-dark-green pa3 link">${props.cta.text}</a>
65+
</p>
66+
`
67+
}
68+
69+
function textSection (item) {
70+
const text = html`<p class="lh-copy ${props.bgColor === 'bg-neutral' ? 'color-neutral-30' : 'color-neutral-80'} pr4"></p>`
71+
text.innerHTML = item.text
72+
return html`
73+
<div class="fl w-third-ns w-100">
74+
<h3 class="f3">${item.title}</h3>
75+
${text}
76+
</div>
77+
`
78+
}
79+
}

client/js/elements/import-button/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module.exports = function (emit) {
99
}
1010
}
1111
return html`<label for="import-dat" class="dat-input">
12-
<input name="import-dat" type="text" placeholder="Search" onkeydown=${keydown} class="dat-input__input dat-input__input--icon">
12+
<input name="import-dat" type="text" placeholder="view dat://" onkeydown=${keydown} class="dat-input__input dat-input__input--icon">
1313
<svg class="dat-input__icon pa1">
1414
<use xlink:href="#daticon-search" />
1515
</svg>

client/js/models/explore.js

-16
This file was deleted.

client/js/models/township.js

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ module.exports = function (state, emitter) {
5050
api.logout(data, function (err, resp, data) {
5151
if (err) return emitter.emit('township:update', {error: err.message})
5252
emitter.emit('township:update', defaults.township)
53+
emitter.emit('message:success', 'Successfully Logged Out')
5354
})
5455
})
5556

client/js/pages/archive/index.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
const html = require('choo/html')
2+
const wrapper = require('../wrapper')
23
const hyperdrive = require('../../components/hyperdrive')
34
const hyperhealth = require('../../components/health')
45
const copyButton = require('../../components/copy-button')
5-
const header = require('../../components/header')
66
const preview = require('../../components/preview')
77
const fourohfour = require('../../elements/404')
88
const error = require('../../elements/error')
@@ -22,14 +22,14 @@ const archivePage = (state, emit) => {
2222
var err = state.archive.error
2323
if (!module.parent && state.archive.retries < 3) emit('archive:getMetadata', {timeout: 3000})
2424
if (err) {
25+
emit(state.events.DOMTITLECHANGE, 'Error Loading Dat | datBase')
2526
if (err.message === 'Block not downloaded') err.message = 'timed out'
2627
if (!state.archive.entries.length) {
2728
if (state.archive.retries >= 3) err = {message: 'too many retries'}
2829
var props = ARCHIVE_ERRORS[err.message]
2930
if (props) {
3031
return html`
31-
<div>
32-
${header(state, emit)}
32+
<div class="">
3333
${fourohfour(props)}
3434
</div>
3535
`
@@ -40,6 +40,9 @@ const archivePage = (state, emit) => {
4040
var meta = state.archive.metadata
4141
var title = meta && meta.title || meta.shortname || state.archive.key
4242
var description = meta && meta.description
43+
44+
emit(state.events.DOMTITLECHANGE, `${title} | DatBase`)
45+
4346
var styles = css`
4447
:host {
4548
.dat-header {
@@ -100,7 +103,6 @@ const archivePage = (state, emit) => {
100103

101104
return html`
102105
<div class="${styles}">
103-
${header(state, emit)}
104106
<div id="dat-info" class="dat-header">
105107
<div class="container">
106108
<div class="dat-header-actions-wrapper">
@@ -137,4 +139,4 @@ const archivePage = (state, emit) => {
137139
</div>`
138140
}
139141

140-
module.exports = archivePage
142+
module.exports = wrapper(archivePage)

client/js/pages/auth/edit-profile.js

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ var prefix = css`
1212
`
1313

1414
module.exports = (state, emit) => {
15+
emit(state.events.DOMTITLECHANGE, 'Edit Profile | datBase')
16+
1517
function onSubmit (e) {
1618
const data = form(e.target)
1719
data.id = state.township.profile.id

0 commit comments

Comments
 (0)