Init bartinfo app

This commit is contained in:
ronreg-ribdev 2020-05-12 00:10:53 -07:00
parent 392ba83009
commit d79b7554bf
29 changed files with 165 additions and 313 deletions

View File

@ -1,5 +1,5 @@
module.exports = { module.exports = {
URBIT_PIERS: [ URBIT_PIERS: [
"%URBITPIER%", "../zod/home",
] ]
}; };

View File

@ -1,164 +0,0 @@
var gulp = require('gulp');
var cssimport = require('gulp-cssimport');
var rollup = require('gulp-better-rollup');
var cssnano = require('cssnano');
var postcss = require('gulp-postcss');
var sucrase = require('@sucrase/gulp-plugin');
var minify = require('gulp-minify');
var resolve = require('rollup-plugin-node-resolve');
var commonjs = require('rollup-plugin-commonjs');
var rootImport = require('rollup-plugin-root-import');
var globals = require('rollup-plugin-node-globals');
/***
Main config options
***/
var urbitrc = require('./.urbitrc');
/***
End main config options
***/
gulp.task('css-bundle', function() {
let plugins = [
cssnano()
];
return gulp
.src('src/index.css')
.pipe(cssimport())
.pipe(postcss(plugins))
.pipe(gulp.dest('./urbit/app/%APPNAME%/css'));
});
gulp.task('jsx-transform', function(cb) {
return gulp.src('src/**/*.js')
.pipe(sucrase({
transforms: ['jsx']
}))
.pipe(gulp.dest('dist'));
});
gulp.task('tile-jsx-transform', function(cb) {
return gulp.src('tile/**/*.js')
.pipe(sucrase({
transforms: ['jsx']
}))
.pipe(gulp.dest('dist'));
});
gulp.task('js-imports', function(cb) {
return gulp.src('dist/index.js')
.pipe(rollup({
plugins: [
commonjs({
namedExports: {
'node_modules/react/index.js': [ 'Component' ],
'node_modules/react-is/index.js': [ 'isValidElementType' ],
}
}),
rootImport({
root: `${__dirname}/dist/js`,
useEntry: 'prepend',
extensions: '.js'
}),
globals(),
resolve()
]
}, 'umd'))
.on('error', function(e){
console.log(e);
cb();
})
.pipe(gulp.dest('./urbit/app/%APPNAME%/js/'))
.on('end', cb);
});
gulp.task('tile-js-imports', function(cb) {
return gulp.src('dist/tile.js')
.pipe(rollup({
plugins: [
commonjs({
namedExports: {
'node_modules/react/index.js': [ 'Component' ],
}
}),
rootImport({
root: `${__dirname}/dist/js`,
useEntry: 'prepend',
extensions: '.js'
}),
globals(),
resolve()
]
}, 'umd'))
.on('error', function(e){
console.log(e);
cb();
})
.pipe(gulp.dest('./urbit/app/%APPNAME%/js/'))
.on('end', cb);
});
gulp.task('js-minify', function () {
return gulp.src('./urbit/app/%APPNAME%/js/index.js')
.pipe(minify())
.pipe(gulp.dest('./urbit/app/%APPNAME%/js/'));
});
gulp.task('tile-js-minify', function () {
return gulp.src('./urbit/app/%APPNAME%/js/tile.js')
.pipe(minify())
.pipe(gulp.dest('./urbit/app/%APPNAME%/js/'));
});
gulp.task('urbit-copy', function () {
let ret = gulp.src('urbit/**/*');
urbitrc.URBIT_PIERS.forEach(function(pier) {
ret = ret.pipe(gulp.dest(pier));
});
return ret;
});
gulp.task('js-bundle-dev', gulp.series('jsx-transform', 'js-imports'));
gulp.task('tile-js-bundle-dev', gulp.series('tile-jsx-transform', 'tile-js-imports'));
gulp.task('js-bundle-prod', gulp.series('jsx-transform', 'js-imports', 'js-minify'))
gulp.task('tile-js-bundle-prod',
gulp.series('tile-jsx-transform', 'tile-js-imports', 'tile-js-minify'));
gulp.task('bundle-dev',
gulp.series(
gulp.parallel(
'css-bundle',
'js-bundle-dev',
'tile-js-bundle-dev'
),
'urbit-copy'
)
);
gulp.task('bundle-prod',
gulp.series(
gulp.parallel(
'css-bundle',
'js-bundle-prod',
'tile-js-bundle-prod',
),
'urbit-copy'
)
);
gulp.task('default', gulp.series('bundle-dev'));
gulp.task('watch', gulp.series('default', function() {
gulp.watch('tile/**/*.js', gulp.parallel('tile-js-bundle-dev'));
gulp.watch('src/**/*.js', gulp.parallel('js-bundle-dev'));
gulp.watch('src/**/*.css', gulp.parallel('css-bundle'));
gulp.watch('urbit/**/*', gulp.parallel('urbit-copy'));
}));

View File

@ -1,20 +0,0 @@
import React, { Component } from 'react';
import _ from 'lodash';
export default class %APPNAME%Tile extends Component {
render() {
return (
<div className="w-100 h-100 relative bg-white bg-gray0-d ba b--black b--gray1-d">
<a className="w-100 h-100 db pa2 no-underline" href="/~%APPNAME%">
<p className="black white-d absolute f9" style={{ left: 8, top: 8 }}>%APPNAME%</p>
<img className="absolute" src="/~%APPNAME%/img/Tile.png" style={{top: 39, left: 39}}/>
</a>
</div>
);
}
}
window.%APPNAME%Tile = %APPNAME%Tile;

View File

@ -1,5 +1,8 @@
var gulp = require('gulp'); var gulp = require('gulp');
var cssimport = require('gulp-cssimport');
var rollup = require('gulp-better-rollup'); var rollup = require('gulp-better-rollup');
var cssnano = require('cssnano');
var postcss = require('gulp-postcss');
var sucrase = require('@sucrase/gulp-plugin'); var sucrase = require('@sucrase/gulp-plugin');
var minify = require('gulp-minify'); var minify = require('gulp-minify');
@ -18,6 +21,25 @@ var urbitrc = require('./.urbitrc');
End main config options End main config options
***/ ***/
gulp.task('css-bundle', function() {
let plugins = [
cssnano()
];
return gulp
.src('src/index.css')
.pipe(cssimport())
.pipe(postcss(plugins))
.pipe(gulp.dest('./urbit/app/bartinfo/css'));
});
gulp.task('jsx-transform', function(cb) {
return gulp.src('src/**/*.js')
.pipe(sucrase({
transforms: ['jsx']
}))
.pipe(gulp.dest('dist'));
});
gulp.task('tile-jsx-transform', function(cb) { gulp.task('tile-jsx-transform', function(cb) {
return gulp.src('tile/**/*.js') return gulp.src('tile/**/*.js')
.pipe(sucrase({ .pipe(sucrase({
@ -26,6 +48,32 @@ gulp.task('tile-jsx-transform', function(cb) {
.pipe(gulp.dest('dist')); .pipe(gulp.dest('dist'));
}); });
gulp.task('js-imports', function(cb) {
return gulp.src('dist/index.js')
.pipe(rollup({
plugins: [
commonjs({
namedExports: {
'node_modules/react/index.js': [ 'Component' ],
'node_modules/react-is/index.js': [ 'isValidElementType' ],
}
}),
rootImport({
root: `${__dirname}/dist/js`,
useEntry: 'prepend',
extensions: '.js'
}),
globals(),
resolve()
]
}, 'umd'))
.on('error', function(e){
console.log(e);
cb();
})
.pipe(gulp.dest('./urbit/app/bartinfo/js/'))
.on('end', cb);
});
gulp.task('tile-js-imports', function(cb) { gulp.task('tile-js-imports', function(cb) {
return gulp.src('dist/tile.js') return gulp.src('dist/tile.js')
@ -49,14 +97,21 @@ gulp.task('tile-js-imports', function(cb) {
console.log(e); console.log(e);
cb(); cb();
}) })
.pipe(gulp.dest('./urbit/app/%APPNAME%/js/')) .pipe(gulp.dest('./urbit/app/bartinfo/js/'))
.on('end', cb); .on('end', cb);
}); });
gulp.task('tile-js-minify', function () {
return gulp.src('./urbit/app/%APPNAME%/js/tile.js') gulp.task('js-minify', function () {
return gulp.src('./urbit/app/bartinfo/js/index.js')
.pipe(minify()) .pipe(minify())
.pipe(gulp.dest('./urbit/app/%APPNAME%/js/')); .pipe(gulp.dest('./urbit/app/bartinfo/js/'));
});
gulp.task('tile-js-minify', function () {
return gulp.src('./urbit/app/bartinfo/js/tile.js')
.pipe(minify())
.pipe(gulp.dest('./urbit/app/bartinfo/js/'));
}); });
gulp.task('urbit-copy', function () { gulp.task('urbit-copy', function () {
@ -69,14 +124,41 @@ gulp.task('urbit-copy', function () {
return ret; return ret;
}); });
gulp.task('js-bundle-dev', gulp.series('jsx-transform', 'js-imports'));
gulp.task('tile-js-bundle-dev', gulp.series('tile-jsx-transform', 'tile-js-imports')); gulp.task('tile-js-bundle-dev', gulp.series('tile-jsx-transform', 'tile-js-imports'));
gulp.task('tile-js-bundle-prod', gulp.task('js-bundle-prod', gulp.series('jsx-transform', 'js-imports', 'js-minify'))
gulp.task('tile-js-bundle-prod',
gulp.series('tile-jsx-transform', 'tile-js-imports', 'tile-js-minify')); gulp.series('tile-jsx-transform', 'tile-js-imports', 'tile-js-minify'));
gulp.task('bundle-prod', gulp.series('tile-js-bundle-prod', 'urbit-copy')); gulp.task('bundle-dev',
gulp.series(
gulp.parallel(
'css-bundle',
'js-bundle-dev',
'tile-js-bundle-dev'
),
'urbit-copy'
)
);
gulp.task('bundle-prod',
gulp.series(
gulp.parallel(
'css-bundle',
'js-bundle-prod',
'tile-js-bundle-prod',
),
'urbit-copy'
)
);
gulp.task('default', gulp.series('bundle-dev'));
gulp.task('default', gulp.series('tile-js-bundle-dev', 'urbit-copy'));
gulp.task('watch', gulp.series('default', function() { gulp.task('watch', gulp.series('default', function() {
gulp.watch('tile/**/*.js', gulp.parallel('tile-js-bundle-dev')); gulp.watch('tile/**/*.js', gulp.parallel('tile-js-bundle-dev'));
gulp.watch('src/**/*.js', gulp.parallel('js-bundle-dev'));
gulp.watch('src/**/*.css', gulp.parallel('css-bundle'));
gulp.watch('urbit/**/*', gulp.parallel('urbit-copy')); gulp.watch('urbit/**/*', gulp.parallel('urbit-copy'));
})); }));

52
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "create-landscape-app", "name": "create-landscape-app",
"version": "2.0.0", "version": "3.0.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -401,7 +401,8 @@
}, },
"kind-of": { "kind-of": {
"version": "6.0.2", "version": "6.0.2",
"resolved": "", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz",
"integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==",
"dev": true "dev": true
} }
} }
@ -1480,7 +1481,8 @@
}, },
"kind-of": { "kind-of": {
"version": "6.0.2", "version": "6.0.2",
"resolved": "", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz",
"integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==",
"dev": true "dev": true
} }
} }
@ -1643,7 +1645,8 @@
"ansi-regex": { "ansi-regex": {
"version": "2.1.1", "version": "2.1.1",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"aproba": { "aproba": {
"version": "1.2.0", "version": "1.2.0",
@ -1664,12 +1667,14 @@
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"brace-expansion": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"balanced-match": "^1.0.0", "balanced-match": "^1.0.0",
"concat-map": "0.0.1" "concat-map": "0.0.1"
@ -1684,17 +1689,20 @@
"code-point-at": { "code-point-at": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"concat-map": { "concat-map": {
"version": "0.0.1", "version": "0.0.1",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"console-control-strings": { "console-control-strings": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
@ -1811,7 +1819,8 @@
"inherits": { "inherits": {
"version": "2.0.3", "version": "2.0.3",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"ini": { "ini": {
"version": "1.3.5", "version": "1.3.5",
@ -1823,6 +1832,7 @@
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"number-is-nan": "^1.0.0" "number-is-nan": "^1.0.0"
} }
@ -1837,6 +1847,7 @@
"version": "3.0.4", "version": "3.0.4",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
} }
@ -1844,12 +1855,14 @@
"minimist": { "minimist": {
"version": "0.0.8", "version": "0.0.8",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"minipass": { "minipass": {
"version": "2.3.5", "version": "2.3.5",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"safe-buffer": "^5.1.2", "safe-buffer": "^5.1.2",
"yallist": "^3.0.0" "yallist": "^3.0.0"
@ -1868,6 +1881,7 @@
"version": "0.5.1", "version": "0.5.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"minimist": "0.0.8" "minimist": "0.0.8"
} }
@ -1948,7 +1962,8 @@
"number-is-nan": { "number-is-nan": {
"version": "1.0.1", "version": "1.0.1",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"object-assign": { "object-assign": {
"version": "4.1.1", "version": "4.1.1",
@ -1960,6 +1975,7 @@
"version": "1.4.0", "version": "1.4.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"wrappy": "1" "wrappy": "1"
} }
@ -2045,7 +2061,8 @@
"safe-buffer": { "safe-buffer": {
"version": "5.1.2", "version": "5.1.2",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"safer-buffer": { "safer-buffer": {
"version": "2.1.2", "version": "2.1.2",
@ -2081,6 +2098,7 @@
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"code-point-at": "^1.0.0", "code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0", "is-fullwidth-code-point": "^1.0.0",
@ -2100,6 +2118,7 @@
"version": "3.0.1", "version": "3.0.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"ansi-regex": "^2.0.0" "ansi-regex": "^2.0.0"
} }
@ -2143,12 +2162,14 @@
"wrappy": { "wrappy": {
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"yallist": { "yallist": {
"version": "3.0.3", "version": "3.0.3",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
} }
} }
}, },
@ -5185,7 +5206,8 @@
}, },
"kind-of": { "kind-of": {
"version": "6.0.2", "version": "6.0.2",
"resolved": "", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz",
"integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==",
"dev": true "dev": true
} }
} }

View File

@ -8,7 +8,7 @@ class UrbitApi {
this.bindPaths = []; this.bindPaths = [];
} }
bind(path, method, ship = this.authTokens.ship, appl = "%APPNAME%", success, fail) { bind(path, method, ship = this.authTokens.ship, appl = "bartinfo", success, fail) {
this.bindPaths = _.uniq([...this.bindPaths, path]); this.bindPaths = _.uniq([...this.bindPaths, path]);
window.subscriptionId = window.urb.subscribe(ship, appl, path, window.subscriptionId = window.urb.subscribe(ship, appl, path,
@ -29,8 +29,8 @@ class UrbitApi {
}); });
} }
%APPNAME%(data) { bartinfo(data) {
this.action("%APPNAME%", "json", data); this.action("bartinfo", "json", data);
} }
action(appl, mark, data) { action(appl, mark, data) {

View File

@ -6,7 +6,7 @@ export class IconHome extends Component {
return ( return (
<img <img
className={"invert-d " + classes} className={"invert-d " + classes}
src="/~%APPNAME%/img/Home.png" src="/~bartinfo/img/Home.png"
width={16} width={16}
height={16} height={16}
/> />

View File

@ -15,12 +15,12 @@ export class Root extends Component {
<BrowserRouter> <BrowserRouter>
<div className="absolute h-100 w-100 bg-gray0-d ph4-m ph4-l ph4-xl pb4-m pb4-l pb4-xl"> <div className="absolute h-100 w-100 bg-gray0-d ph4-m ph4-l ph4-xl pb4-m pb4-l pb4-xl">
<HeaderBar/> <HeaderBar/>
<Route exact path="/~%APPNAME%" render={ () => { <Route exact path="/~bartinfo" render={ () => {
return ( return (
<div className="cf w-100 flex flex-column pa4 ba-m ba-l ba-xl b--gray2 br1 h-100 h-100-minus-40-s h-100-minus-40-m h-100-minus-40-l h-100-minus-40-xl f9 white-d overflow-x-hidden"> <div className="cf w-100 flex flex-column pa4 ba-m ba-l ba-xl b--gray2 br1 h-100 h-100-minus-40-s h-100-minus-40-m h-100-minus-40-l h-100-minus-40-xl f9 white-d overflow-x-hidden">
<h1 className="mt0 f8 fw4">%APPNAME%</h1> <h1 className="mt0 f8 fw4">bartinfo</h1>
<p className="lh-copy measure pt3">Welcome to your Landscape application.</p> <p className="lh-copy measure pt3">Welcome to your Landscape application.</p>
<p className="lh-copy measure pt3">To get started, edit <code>src/index.js</code>, <code>tile/tile.js</code> or <code>urbit/app/%APPNAME%.hoon</code> and <code>|commit %home</code> on your Urbit ship to see your changes.</p> <p className="lh-copy measure pt3">To get started, edit <code>src/index.js</code>, <code>tile/tile.js</code> or <code>urbit/app/bartinfo.hoon</code> and <code>|commit %home</code> on your Urbit ship to see your changes.</p>
<a className="black no-underline db f8 pt3" href="https://urbit.org/docs">-> Read the docs</a> <a className="black no-underline db f8 pt3" href="https://urbit.org/docs">-> Read the docs</a>
</div> </div>
)}} )}}

View File

@ -3,7 +3,7 @@ import _ from 'lodash';
export class ConfigReducer { export class ConfigReducer {
reduce(json, state) { reduce(json, state) {
let data = _.get(json, '%APPNAME%', false); let data = _.get(json, 'bartinfo', false);
if (data) { if (data) {
state.inbox = data.inbox; state.inbox = data.inbox;
} }

View File

@ -7,14 +7,14 @@ import urbitOb from 'urbit-ob';
export class Subscription { export class Subscription {
start() { start() {
if (api.authTokens) { if (api.authTokens) {
// this.initialize%APPNAME%(); // this.initializebartinfo();
} else { } else {
console.error("~~~ ERROR: Must set api.authTokens before operation ~~~"); console.error("~~~ ERROR: Must set api.authTokens before operation ~~~");
} }
} }
// initialize%APPNAME%() { // initializebartinfo() {
// api.bind('/primary', 'PUT', api.authTokens.ship, '%APPNAME%', // api.bind('/primary', 'PUT', api.authTokens.ship, 'bartinfo',
// this.handleEvent.bind(this), // this.handleEvent.bind(this),
// this.handleError.bind(this)); // this.handleError.bind(this));
// } // }
@ -25,7 +25,7 @@ export class Subscription {
handleError(err) { handleError(err) {
console.error(err); console.error(err);
api.bind('/primary', 'PUT', api.authTokens.ship, '%APPNAME%', api.bind('/primary', 'PUT', api.authTokens.ship, 'bartinfo',
this.handleEvent.bind(this), this.handleEvent.bind(this),
this.handleError.bind(this)); this.handleError.bind(this));
} }

View File

@ -2,16 +2,19 @@ import React, { Component } from 'react';
import _ from 'lodash'; import _ from 'lodash';
export default class %APPNAME%Tile extends Component { export default class bartinfoTile extends Component {
render() { render() {
return ( return (
<div className="w-100 h-100 relative bg-white bg-gray0-d ba b--black b--gray1-d"> <div className="w-100 h-100 relative bg-white bg-gray0-d ba b--black b--gray1-d">
<p className="black white-d absolute f9" style={{ left: 8, top: 8 }}>%APPNAME%</p> <a className="w-100 h-100 db pa2 no-underline" href="/~bartinfo">
<p className="black white-d absolute f9" style={{ left: 8, top: 8 }}>bartinfo</p>
<img className="absolute" src="/~bartinfo/img/Tile.png" style={{top: 39, left: 39}}/>
</a>
</div> </div>
); );
} }
} }
window.%APPNAME%Tile = %APPNAME%Tile; window.bartinfoTile = bartinfoTile;

View File

@ -2,34 +2,34 @@
/= index /= index
/^ octs /^ octs
/; as-octs:mimes:html /; as-octs:mimes:html
/: /===/app/%APPNAME%/index /: /===/app/bartinfo/index
/| /html/ /| /html/
/~ ~ /~ ~
== ==
/= tile-js /= tile-js
/^ octs /^ octs
/; as-octs:mimes:html /; as-octs:mimes:html
/: /===/app/%APPNAME%/js/tile /: /===/app/bartinfo/js/tile
/| /js/ /| /js/
/~ ~ /~ ~
== ==
/= script /= script
/^ octs /^ octs
/; as-octs:mimes:html /; as-octs:mimes:html
/: /===/app/%APPNAME%/js/index /: /===/app/bartinfo/js/index
/| /js/ /| /js/
/~ ~ /~ ~
== ==
/= style /= style
/^ octs /^ octs
/; as-octs:mimes:html /; as-octs:mimes:html
/: /===/app/%APPNAME%/css/index /: /===/app/bartinfo/css/index
/| /css/ /| /css/
/~ ~ /~ ~
== ==
/= %APPNAME%-png /= bartinfo-png
/^ (map knot @) /^ (map knot @)
/: /===/app/%APPNAME%/img /_ /png/ /: /===/app/bartinfo/img /_ /png/
:: ::
|% |%
+$ card card:agent:gall +$ card card:agent:gall
@ -38,16 +38,16 @@
=< =<
|_ bol=bowl:gall |_ bol=bowl:gall
+* this . +* this .
%APPNAME%-core +> bartinfo-core +>
cc ~(. %APPNAME%-core bol) cc ~(. bartinfo-core bol)
def ~(. (default-agent this %|) bol) def ~(. (default-agent this %|) bol)
:: ::
++ on-init ++ on-init
^- (quip card _this) ^- (quip card _this)
=/ launcha [%launch-action !>([%add %%APPNAME% / '/~%APPNAME%/js/tile.js'])] =/ launcha [%launch-action !>([%add %bartinfo / '/~bartinfo/js/tile.js'])]
:_ this :_ this
:~ [%pass / %arvo %e %connect [~ /'~%APPNAME%'] %%APPNAME%] :~ [%pass / %arvo %e %connect [~ /'~bartinfo'] %bartinfo]
[%pass /%APPNAME% %agent [our.bol %launch] %poke launcha] [%pass /bartinfo %agent [our.bol %launch] %poke launcha]
== ==
++ on-poke ++ on-poke
|= [=mark =vase] |= [=mark =vase]
@ -96,18 +96,18 @@
^- simple-payload:http ^- simple-payload:http
=+ url=(parse-request-line url.request.inbound-request) =+ url=(parse-request-line url.request.inbound-request)
?+ site.url not-found:gen ?+ site.url not-found:gen
[%'~%APPNAME%' %css %index ~] (css-response:gen style) [%'~bartinfo' %css %index ~] (css-response:gen style)
[%'~%APPNAME%' %js %tile ~] (js-response:gen tile-js) [%'~bartinfo' %js %tile ~] (js-response:gen tile-js)
[%'~%APPNAME%' %js %index ~] (js-response:gen script) [%'~bartinfo' %js %index ~] (js-response:gen script)
:: ::
[%'~%APPNAME%' %img @t *] [%'~bartinfo' %img @t *]
=/ name=@t i.t.t.site.url =/ name=@t i.t.t.site.url
=/ img (~(get by %APPNAME%-png) name) =/ img (~(get by bartinfo-png) name)
?~ img ?~ img
not-found:gen not-found:gen
(png-response:gen (as-octs:mimes:html u.img)) (png-response:gen (as-octs:mimes:html u.img))
:: ::
[%'~%APPNAME%' *] (html-response:gen index) [%'~bartinfo' *] (html-response:gen index)
== ==
:: ::
-- --

View File

Before

Width:  |  Height:  |  Size: 679 B

After

Width:  |  Height:  |  Size: 679 B

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -1,16 +1,16 @@
<!doctype html> <!doctype html>
<html> <html>
<head> <head>
<title>%APPNAME%</title> <title>bartinfo</title>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" <meta name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"/> content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
<link rel="stylesheet" href="/~%APPNAME%/css/index.css" /> <link rel="stylesheet" href="/~bartinfo/css/index.css" />
</head> </head>
<body> <body>
<div id="root" /> <div id="root" />
<script src="/~/channel/channel.js"></script> <script src="/~/channel/channel.js"></script>
<script src="/~modulo/session.js"></script> <script src="/~modulo/session.js"></script>
<script src="/~%APPNAME%/js/index.js"></script> <script src="/~bartinfo/js/index.js"></script>
</body> </body>
</html> </html>

View File

@ -1,71 +0,0 @@
/+ *server, default-agent, verb
/= tile-js
/^ octs
/; as-octs:mimes:html
/: /===/app/%APPNAME%/js/tile
/| /js/
/~ ~
==
=, format
::
%+ verb |
^- agent:gall
|_ =bowl:gall
+* this .
def ~(. (default-agent this %|) bowl)
::
++ on-init
^- (quip card:agent:gall _this)
=/ launcha
[%launch-action !>([%add %%APPNAME% /%APPNAME%tile '/~%APPNAME%/js/tile.js'])]
:_ this
:~ [%pass / %arvo %e %connect [~ /'~%APPNAME%'] %%APPNAME%]
[%pass /%APPNAME% %agent [our.bowl %launch] %poke launcha]
==
++ on-save on-save:def
++ on-load on-load:def
++ on-poke
|= [=mark =vase]
^- (quip card:agent:gall _this)
?. ?=(%handle-http-request mark)
(on-poke:def mark vase)
=+ !<([eyre-id=@ta =inbound-request:eyre] vase)
:_ this
%+ give-simple-payload:app eyre-id
%+ require-authorization:app inbound-request
|= =inbound-request:eyre
=/ request-line (parse-request-line url.request.inbound-request)
=/ back-path (flop site.request-line)
=/ name=@t
=/ back-path (flop site.request-line)
?~ back-path
''
i.back-path
::
?~ back-path
not-found:gen
?: =(name 'tile')
(js-response:gen tile-js)
not-found:gen
::
++ on-watch
|= =path
^- (quip card:agent:gall _this)
?: ?=([%http-response *] path)
`this
?. =([/%APPNAME%tile *] path)
(on-watch:def path)
[[%give %fact ~ %json !>(*json)]~ this]
::
++ on-leave on-leave:def
++ on-peek on-peek:def
++ on-agent on-agent:def
++ on-arvo
|= [=wire =sign-arvo]
^- (quip card:agent:gall _this)
?. ?=(%bound +<.sign-arvo)
(on-arvo:def wire sign-arvo)
[~ this]
::
++ on-fail on-fail:def
--