This repository has been archived by the owner on Jan 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* choo v5 * fix choo-persist usage * send -> emit * standard * fix models/main-view (now models/welcome) * fix removing a dat * fix models/window * rename models/window -> models/drag-drop * refactor welcome screen into its own element * refactor empty state into its own element * models/repos: fix missing .ready state * fix header * decouble dat-manager from choo * move {pause,resume} from model to dat-manager * move togglePause from model to dat-manager * move dbPaused logic to dat-manager completely * move more logic from model to dat-manager * standard * fix bugs found in qa (mostly event names) * move test monkey patching to lib/ * use choo-* dependencies from npm * lib/monkeypatch: docs * style * style * fix: properly clean up on app quit #311 (cherry-picked) * standard (cherry-picked) * the next release is really going to be 1.1.0 (cherry-picked) * fix progress indicator in case of 0 incopmlete dats #311 (cherry-picked) * set a max-width on error modal and fix misaligned checkmark icon (#314) * bump version number * fix app starting before the bundle has been written (#313) * fix metadata not always being updated. closes #233 (#316) (cherry-picked) * standard
- Loading branch information
1 parent
f59f164
commit d91e0f4
Showing
17 changed files
with
466 additions
and
555 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,34 @@ | ||
const persist = require('choo-persist') | ||
const mount = require('choo/mount') | ||
const log = require('choo-log') | ||
const css = require('sheetify') | ||
const xtend = require('xtend') | ||
const choo = require('choo') | ||
const xtend = Object.assign | ||
|
||
const params = require('./lib/param-router') | ||
require('./lib/monkeypatch') | ||
|
||
css('dat-colors') | ||
css('tachyons') | ||
css('./public/css/base.css') | ||
css('./public/css/colors.css') | ||
|
||
const opts = { | ||
filter: (state) => { | ||
state = xtend(state) | ||
delete state.repos | ||
return state | ||
const app = choo() | ||
|
||
app.use(persist({ | ||
filter: function (state) { | ||
return xtend({}, state, { repos: {} }) | ||
} | ||
})) | ||
|
||
if (process.env.NODE_ENV === 'development') { | ||
app.use(log()) | ||
} | ||
|
||
persist(opts, (p) => { | ||
const app = choo() | ||
app.use(onError('error:display')) | ||
app.use(p) | ||
app.use(require('./models/welcome')) | ||
app.use(require('./models/drag-drop')) | ||
app.use(require('./models/repos')) | ||
app.use(require('./models/error')) | ||
|
||
if (process.env.NODE_ENV === 'development') { | ||
app.use(log()) | ||
} | ||
app.route('/', require('./pages/main')) | ||
|
||
app.mount('body div') | ||
|
||
app.model(require('./models/main-view')()) | ||
app.model(require('./models/window')()) | ||
app.model(require('./models/repos')()) | ||
app.model(require('./models/error')()) | ||
|
||
app.router([ | ||
['/', params({ | ||
default: require('./pages/main') | ||
})] | ||
]) | ||
|
||
mount('body div', app.start()) | ||
}) | ||
|
||
function onError (action) { | ||
return { | ||
onError: function (err, state, createSend) { | ||
var send = createSend('handleError') | ||
send(action, err.message, function (err) { | ||
// if we hit this point the error handler has failed and we should crash | ||
if (err) throw err | ||
}) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
var html = require('choo/html') | ||
var css = require('sheetify') | ||
|
||
var icon = require('../elements/icon') | ||
|
||
module.exports = EmptyState | ||
|
||
const skeleton = css` | ||
:host { | ||
position: relative; | ||
.skeleton { | ||
position: fixed; | ||
top: 3.5rem; | ||
left: 1.25rem; | ||
width: 232px; | ||
max-width: 100vw; | ||
} | ||
.dotted-lines { | ||
position: absolute; | ||
top: .25rem; | ||
right: 5.5rem; | ||
width: 17rem; | ||
z-index: 3; | ||
} | ||
.create-new-dat, | ||
.link { | ||
position: absolute; | ||
width: 15rem; | ||
} | ||
.create-new-dat { | ||
top: 14.5rem; | ||
right: 4rem; | ||
svg { | ||
display: inline-block; | ||
width: 2rem; | ||
height: 2rem; | ||
} | ||
} | ||
.link { | ||
top: 6rem; | ||
right: 8.5rem; | ||
color: red; | ||
svg { | ||
display: inline-block; | ||
width: 2rem; | ||
height: 2rem; | ||
margin-bottom: -.75rem; | ||
} | ||
} | ||
} | ||
` | ||
|
||
function EmptyState () { | ||
return html` | ||
<main class="${skeleton}"> | ||
<img src="./public/img/table-skeleton.svg" alt="" class="skeleton"> | ||
<div class="tutorial"> | ||
<img src="./public/img/dotted-lines.svg" alt="" class="dotted-lines"> | ||
<div class="link"> | ||
${icon('link', { class: 'color-blue-disabled' })} | ||
<h3 class="f4 ttu mt0 mb0 color-blue-disabled"> | ||
Import Dat | ||
</h3> | ||
<p class="f7 color-neutral-40"> | ||
Download an existing dataset | ||
<br> | ||
by entering its dat link… | ||
</p> | ||
</div> | ||
<div class="tr create-new-dat"> | ||
${icon('create-new-dat', { class: 'color-green-disabled' })} | ||
<h3 class="f4 ttu mt0 mb0 color-green-disabled">Create New Dat</h3> | ||
<p class="f7 color-neutral-40"> | ||
… or select one of your local | ||
<br> | ||
datasets and start sharing it. | ||
</p> | ||
</div> | ||
</div> | ||
</main> | ||
` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
var html = require('choo/html') | ||
var css = require('sheetify') | ||
|
||
var button = require('./button') | ||
|
||
module.exports = WelcomeScreen | ||
|
||
const welcome = css` | ||
:host { | ||
height: 100vh; | ||
background-color: var(--color-neutral); | ||
color: var(--color-white); | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
text-align: center; | ||
-webkit-app-region: drag; | ||
} | ||
` | ||
|
||
function WelcomeScreen (methods) { | ||
const onexit = methods.onexit | ||
const onLoad = methods.onload | ||
|
||
return html` | ||
<main class="${welcome}" onload=${onLoad}> | ||
<img src="./public/img/logo-dat-desktop.svg" alt="" class=""> | ||
<p class="mv4"> | ||
Share data on the distributed web. | ||
</p> | ||
${button.green('Get Started', { onclick: onexit })} | ||
</main> | ||
` | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.