From 41c50c2e6f957fe4bc9628e3cda5d93bfa3c1e12 Mon Sep 17 00:00:00 2001 From: Galen Wolfe-Pauly Date: Tue, 5 Jul 2016 23:57:25 -0700 Subject: [PATCH] styling --- lib/womb.hoon | 30 ++++++++++----------- web/tree/main.css | 11 ++++++-- web/tree/main.js | 67 ++++++++++++++++++++++++++++++----------------- web/womb.hoon | 2 +- 4 files changed, 68 insertions(+), 42 deletions(-) diff --git a/lib/womb.hoon b/lib/womb.hoon index a2d53cc6f..2528a30d1 100644 --- a/lib/womb.hoon +++ b/lib/womb.hoon @@ -22,7 +22,7 @@ :: :: |% :: ++ managed :: managed plot - |* mold :: + |* mold :: %- unit :: unsplit %+ each +< :: subdivided mail :: delivered @@ -102,7 +102,7 @@ bureau/(map passcode balance) :: active invitations office/property :: properties managed hotel/(map (each ship mail) client) :: everyone we know - recycling/(map ship @) :: old ticket keys + recycling/(map ship @) :: old ticket keys == :: -- :: :: :: :: @@ -123,7 +123,7 @@ $% {$email mail tape wall} :: send email {$womb-do-ticket ship} :: request ticket {$womb-do-claim ship @p} :: issue ship - {$drum-put path @t} :: log transaction + {$drum-put path @t} :: log transaction == :: ++ gilt :: scry result $% {$ships (list ship)} :: @@ -218,7 +218,7 @@ ?> (fit a) =; adj adj(box (~(put by box) a b)) ?: (~(has in box) a) fin - ?: =(ctr a) new + ?: =(ctr a) new ?: (lth a ctr) ?. (~(has in und) a) fin fin(und (~(del in und) a)) @@ -263,7 +263,7 @@ :: ++ emit |=(card %_(+> moz [[ost +<] moz])) :: return card ++ emil :: return cards - |= (list card) + |= (list card) ^+ +> ?~(+< +> $(+< t.+<, +> (emit i.+<))) :: @@ -315,7 +315,7 @@ |= nth/@u ^- cursor =^ out nth %.(nth (available stars.office)) ?^ out [out nth] - %+ shop-star nth + %+ shop-star nth (responsive (issuing galaxies.office)) :: ++ shop-star :: star from galaxies @@ -329,7 +329,7 @@ =^ out nth %.(nth (available planets.office)) ?^ out [out nth] =^ out nth - %+ shop-planet nth + %+ shop-planet nth (responsive (issuing stars.office)) ?^ out [out nth] (shop-planet-gal nth (issuing galaxies.office)) @@ -344,7 +344,7 @@ |= {nth/@u lax/(list {who/@p * * r/(foil star)})} ^- cursor ?: =(~ lax) [~ nth] =^ sel nth (in-list lax nth) - %+ shop-planet nth + %+ shop-planet nth (responsive (issuing-under 3 who.sel box.r.sel)) :: ++ peek-x-shop :: available ships @@ -387,7 +387,7 @@ |= who/@p ^- planet =+ (~(get by planets.office) who) ?^ - u - ?: (~(has by galaxies.office) (sein who)) + ?: (~(has by galaxies.office) (sein who)) =+ gal=(get-managed-galaxy (sein who)) ?. ?=({$~ $& *} gal) ~|(unavailable-galaxy+(sein who) !!) (~(get fo q.p.u.gal) who) @@ -400,7 +400,7 @@ =+ pla=(mod (get-managed-planet who)) :: XX double traverse ?: (~(has by planets.office) who) +>.$(planets.office (~(put by planets.office) who pla)) - ?: (~(has by galaxies.office) (sein who)) + ?: (~(has by galaxies.office) (sein who)) %+ mod-managed-galaxy (sein who) |= gal/galaxy ^- galaxy ?> ?=({$~ $& *} gal) @@ -413,7 +413,7 @@ ++ get-live :: last-heard time ++live |= a/ship ^- live =+ rue=(ames-last-seen a) - ?~ rue %cold + ?~ rue %cold ?:((gth (sub now u.rue) ~m5) %seen %live) :: ++ stat-any :: unsplit status @@ -509,7 +509,7 @@ =(b `@p`(end 6 1 (shaf %tick (mix a (shax key))))) :: :: -++ peek-x-ticket +++ peek-x-ticket |= tyl/path ^- (unit (unit {$womb-ticket-info passcode ?($fail $good $used)})) ?. ?=({@ @ $~} tyl) ~|(bad-path+tyl !!) @@ -539,13 +539,13 @@ ?+ -.tyl ~ :: /shop/planets/@ud (list @p) up to 3 planets :: /shop/stars/@ud (list @p) up to 3 stars - :: /shop/galaxies/@ud (list @p) up to 3 galaxies + :: /shop/galaxies/@ud (list @p) up to 3 galaxies $shop (peek-x-shop +.tyl) :: /stats general stats dump :: /stats/@p what we know about @p $stats (peek-x-stats +.tyl) :: /balance all invitations - :: /balance/passcode invitation status + :: /balance/passcode invitation status $balance (peek-x-balance +.tyl) :: /ticket/ship/ticket check ticket usability $ticket (peek-x-ticket +.tyl) @@ -776,7 +776,7 @@ ++ poke-release :: release to subdivide |= {gal/@ud sta/@ud} :: =< abet ^+ +> - =. log-transaction (log-transaction %release +<) + =. log-transaction (log-transaction %release +<) ?> =(our src) :: privileged =. +> ?~ gal +> diff --git a/web/tree/main.css b/web/tree/main.css index 65980622d..1a439392f 100644 --- a/web/tree/main.css +++ b/web/tree/main.css @@ -7,6 +7,11 @@ margin-top: 0.9375rem; padding-left: 0.9375rem; } } +.label { + font-size: inherit; + font-weight: 500; + line-height: inherit; } + img.logo { height: 2rem; width: 2rem; } @@ -149,8 +154,10 @@ div.logo.inverse:before { #head { top: 0; z-index: 10; - width: 100%; - position: absolute; } + width: calc(100% - 1.875rem); + position: absolute; + transform: translateZ(0); + -webkit-transform: translateZ(0); } #head.m-down, #head.m-up { position: absolute; } diff --git a/web/tree/main.js b/web/tree/main.js index 69281b7a6..19c601af7 100644 --- a/web/tree/main.js +++ b/web/tree/main.js @@ -86,8 +86,11 @@ module.exports = { loc: loc }, "write-plan-info", "hood"); }, - setCurr: function(path) { - _initialLoad = false; + setCurr: function(path, init) { + if (init == null) { + init = true; + } + _initialLoad &= init; return TreeDispatcher.handleViewAction({ type: "setCurr", path: path @@ -1517,18 +1520,19 @@ module.exports = query({ TreeStore.addChangeListener(this._onChangeStore); _this = this; $('body').on('click', 'a', function(e) { - var href, url; + var basepath, href, url; href = $(this).attr('href'); if ((href != null ? href[0] : void 0) === "#") { return true; } if (href && !/^https?:\/\//i.test(href)) { - e.preventDefault(); url = new URL(this.href); if (!/http/.test(url.protocol)) { return; } - if (urb.util.basepath("", url.pathname) !== urb.util.basepath("", document.location.pathname)) { + e.preventDefault(); + basepath = urb.util.basepath; + if (basepath("", url.pathname) !== basepath("", document.location.pathname)) { document.location = this.href; return; } @@ -2500,7 +2504,7 @@ $(function() { window.tree.actions = require('./actions/TreeActions.coffee'); window.tree.actions.addVirtual(require('./components/Components.coffee')); frag = util.fragpath(window.location.pathname.replace(/\.[^\/]*$/, '')); - window.tree.actions.setCurr(frag); + window.tree.actions.setCurr(frag, true); window.tree.actions.loadPath(frag, window.tree.data); if (window.tree.sein != null) { window.tree.actions.loadSein(frag, window.tree.sein); @@ -2906,7 +2910,9 @@ module.exports = TreeStore; },{"../dispatcher/Dispatcher.coffee":24,"events":31}],28:[function(require,module,exports){ -var scroll; +var TreeActions, scroll; + +TreeActions = require('../actions/TreeActions.coffee'); scroll = { w: null, @@ -2915,6 +2921,8 @@ scroll = { nh: null, cs: null, ls: null, + cwh: null, + lwh: null, track: function() { this.w = $(window).width(); this.$n = $('#head'); @@ -2935,6 +2943,12 @@ scroll = { return; } this.cs = $(window).scrollTop(); + this.cwh = window.innerHeight; + if ((this.ls - this.cs) < 0 && this.cwh !== this.lwh) { + console.log('current scroll: ' + this.cs); + console.log('last scroll: ' + this.ls); + console.log('window.innerHeight: ' + window.innerHeight); + } if (this.w > 767) { this.clearNav(); } @@ -2966,27 +2980,30 @@ scroll = { } } if (dy < 0) { - if (!this.$n.hasClass('m-up')) { - this.$n.removeClass('m-down m-fixed').addClass('m-up'); - this.$d.removeClass('open'); - $('.menu.open').removeClass('open'); - top = this.cs < 0 ? 0 : this.cs; - ct = this.$n.offset().top; - if (top > ct && top < ct + this.nh) { - top = ct; + if (this.cwh === this.lwh) { + if (!this.$n.hasClass('m-up')) { + this.$n.removeClass('m-down m-fixed').addClass('m-up'); + TreeActions.closeNav(); + $('.menu.open').removeClass('open'); + top = this.cs < 0 ? 0 : this.cs; + ct = this.$n.offset().top; + if (top > ct && top < ct + this.nh) { + top = ct; + } + this.$n.offset({ + top: top + }); } - this.$n.offset({ - top: top - }); - } - if (this.$n.hasClass('m-up') && this.$d.hasClass('open')) { - if (this.cs > this.$n.offset().top + this.$n.height()) { - this.$d.removeClass('open'); + if (this.$n.hasClass('m-up') && this.$d.hasClass('open')) { + if (this.cs > this.$n.offset().top + this.$n.height()) { + TreeActions.closeNav(); + } } } } } - return this.ls = this.cs; + this.ls = this.cs; + return this.lwh = this.cwh; }, init: function() { setInterval(this.track.bind(this), 200); @@ -3002,7 +3019,7 @@ scroll.init(); module.exports = scroll; -},{}],29:[function(require,module,exports){ +},{"../actions/TreeActions.coffee":1}],29:[function(require,module,exports){ var _basepath; _basepath = window.urb.util.basepath("/"); @@ -3037,6 +3054,8 @@ module.exports = { } if (ship.length <= 13) { return ship; + } else if (ship.length === 27) { + return ship.slice(14, 20) + "^" + ship.slice(-6); } else { return ship.slice(0, 6) + "_" + ship.slice(-6); } diff --git a/web/womb.hoon b/web/womb.hoon index 9675dda8b..f79ef7391 100644 --- a/web/womb.hoon +++ b/web/womb.hoon @@ -2,7 +2,7 @@ :::: /hoon/womb/web :: /? 310 -;module(nav_title "Womb", nav_no-dpad "", nav_no-sibs "") +;module(nav_title "Hello", nav_no-dpad "", nav_no-sibs "") ;script@"/~/at/lib/js/urb.js"; :: ;link/"/womb/main.css"(rel "stylesheet"); ;script@"/womb/main.js";