|
@ -1,12 +1,15 @@ |
|
|
<app> |
|
|
<app> |
|
|
<div class="header"> |
|
|
<div |
|
|
<section style={{"margin-top" : "0px"}} class="text-center nav navbar centered page-top navbar-section"> |
|
|
style={{"border-bottom" : showBorder ? "solid 1px" : "none" }} |
|
|
|
|
|
class="header" |
|
|
|
|
|
> |
|
|
|
|
|
<section style={{"margin-top" : "0px"}} class="text-center nav navbar centered navbar-section"> |
|
|
<h4 class="blog-title">{ currentPage }</h4> |
|
|
<h4 class="blog-title">{ currentPage }</h4> |
|
|
</section> |
|
|
</section> |
|
|
</div> |
|
|
</div> |
|
|
<div class="app-body"> |
|
|
<div class="app-body"> |
|
|
<div class=""> |
|
|
|
|
|
<section class="text-center nav navbar centered page-top navbar-section"> |
|
|
<section class="text-center nav navbar centered navbar-section"> |
|
|
<sidebar |
|
|
<sidebar |
|
|
if={this.active.get("posts")} |
|
|
if={this.active.get("posts")} |
|
|
name="Filter By Category" |
|
|
name="Filter By Category" |
|
@ -14,70 +17,67 @@ |
|
|
</sidebar> |
|
|
</sidebar> |
|
|
</section> |
|
|
</section> |
|
|
|
|
|
|
|
|
<div class=""> |
|
|
<div class={"show-md show-sm show-xs navigate-small dropdown dropdown-right " + (menuActive ? "active" : "")}> |
|
|
<div class="show-md show-sm show-xs navigate-small dropdown dropdown-right"> |
|
|
<button onclick={menuOn} class="mobile-navigate btn btn-link navigate-item dropdown-toggle" tabindex="0"> |
|
|
<button onclick={this.menuOn} class="mobile-navigate btn btn-link navigate-item dropdown-toggle" tabindex="0"> |
|
|
<i class="bar-menu fa fa-bars" aria-hidden="true"></i> |
|
|
<i class="bar-menu fa fa-bars" aria-hidden="true"></i> |
|
|
</button> |
|
|
</button> |
|
|
<!-- menu component --> |
|
|
<!-- menu component --> |
|
|
<ul |
|
|
<ul |
|
|
show={menuActive} |
|
|
if={this.menuActive} |
|
|
class="mobile-menu tab tab-block menu"> |
|
|
class="mobile-menu tab tab-block menu"> |
|
|
<li |
|
|
<li |
|
|
each="{page in ['posts', 'projects', 'links', 'about']}" |
|
|
each="{page in ['posts', 'projects', 'links', 'about']}" |
|
|
class={"navigate-tab tab-item animated fadeIn " + (this.parent.active.get(page) ? "active" : "")} |
|
|
class={"navigate-tab tab-item animated fadeIn " + (this.parent.active.get(page) ? "active" : "")} |
|
|
data-is="navtab" |
|
|
data-is="navtab" |
|
|
active={this.parent.active.get(page)} |
|
|
active={this.parent.active.get(page)} |
|
|
to={this.parent.to(page)} |
|
|
to={this.parent.to(page)} |
|
|
title={page} |
|
|
title={page} |
|
|
onclick={this.parent.menuOff} |
|
|
onclick={this.menuOff} |
|
|
> |
|
|
> |
|
|
</li> |
|
|
</li> |
|
|
</ul> |
|
|
</ul> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<ul class="hide-md hide-sm hide-xs navigate tab tab-block"> |
|
|
<ul class="hide-md hide-sm hide-xs navigate tab tab-block"> |
|
|
<li |
|
|
<li |
|
|
each="{page in ['posts', 'projects', 'links', 'about']}" |
|
|
each="{page in ['posts', 'projects', 'links', 'about']}" |
|
|
class={"navigate-tab tab-item animated fadeIn " + (this.parent.active.get(page) ? "active" : "")} |
|
|
class={"navigate-tab tab-item animated fadeIn " + (this.parent.active.get(page) ? "active" : "")} |
|
|
data-is="navtab" |
|
|
data-is="navtab" |
|
|
active={this.parent.active.get(page)} |
|
|
active={this.parent.active.get(page)} |
|
|
to={this.parent.to(page)} |
|
|
to={this.parent.to(page)} |
|
|
title={page} |
|
|
title={page} |
|
|
> |
|
|
> |
|
|
</li> |
|
|
</li> |
|
|
</ul> |
|
|
</ul> |
|
|
<div class="projects-content"> |
|
|
<div class="projects-content"> |
|
|
<loading if={!this.state.loaded}></loading> |
|
|
<loading if={!this.state.loaded}></loading> |
|
|
<projectsview |
|
|
<projectsview |
|
|
class="animated fadeInDown" |
|
|
class="animated fadeInDown" |
|
|
if={this.active.get("projects") && this.state.loaded} |
|
|
if={this.active.get("projects") && this.state.loaded} |
|
|
state={this.state} |
|
|
state={this.state} |
|
|
ref="projectsview" |
|
|
ref="projectsview" |
|
|
> |
|
|
> |
|
|
</projectsview> |
|
|
</projectsview> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div class="content"> |
|
|
<div class="content"> |
|
|
<postsview |
|
|
<postsview |
|
|
cached={this.cached} |
|
|
cached={this.cached} |
|
|
state={this.state} |
|
|
state={this.state} |
|
|
if={this.active.get("posts")} |
|
|
if={this.active.get("posts")} |
|
|
ref="postsview" |
|
|
ref="postsview" |
|
|
> |
|
|
> |
|
|
</postsview> |
|
|
</postsview> |
|
|
<about |
|
|
<about |
|
|
if={this.active.get("about")} |
|
|
if={this.active.get("about")} |
|
|
> |
|
|
> |
|
|
</about> |
|
|
</about> |
|
|
<links |
|
|
<links |
|
|
cached={this.cached} |
|
|
cached={this.cached} |
|
|
state={this.state} |
|
|
state={this.state} |
|
|
if={this.active.get("links")} |
|
|
if={this.active.get("links")} |
|
|
> |
|
|
> |
|
|
</links> |
|
|
</links> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<script> |
|
|
<script> |
|
@ -91,14 +91,26 @@ import './loading.tag'; |
|
|
|
|
|
|
|
|
import fetchCached from 'fetch-cached'; |
|
|
import fetchCached from 'fetch-cached'; |
|
|
import Z from './zipper.js'; |
|
|
import Z from './zipper.js'; |
|
|
import {default as R} from 'ramda'; |
|
|
import pathEq from 'ramda/src/pathEq'; |
|
|
import route from 'riot-route'; |
|
|
import route from 'riot-route'; |
|
|
import lens from './lenses.js'; |
|
|
import lens from './lenses.js'; |
|
|
|
|
|
import { throttle } from 'lodash-es'; |
|
|
|
|
|
|
|
|
var self = this; |
|
|
var self = this; |
|
|
|
|
|
|
|
|
self.cache = {}; |
|
|
self.cache = {}; |
|
|
|
|
|
|
|
|
|
|
|
self.throttle = throttle; |
|
|
|
|
|
|
|
|
|
|
|
self.showBorder = false; |
|
|
|
|
|
|
|
|
|
|
|
window.addEventListener("scroll", |
|
|
|
|
|
throttle((ev) => { |
|
|
|
|
|
self.update({"showBorder" : ev.pageY != 0}); |
|
|
|
|
|
}, |
|
|
|
|
|
500) |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
self.cached = fetchCached({ |
|
|
self.cached = fetchCached({ |
|
|
fetch: fetch, |
|
|
fetch: fetch, |
|
|
cache: { |
|
|
cache: { |
|
@ -111,7 +123,6 @@ self.cached = fetchCached({ |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
self.R = R; |
|
|
|
|
|
self.route = route; |
|
|
self.route = route; |
|
|
self.riot = riot; |
|
|
self.riot = riot; |
|
|
self.menuActive = false; |
|
|
self.menuActive = false; |
|
@ -128,18 +139,10 @@ RiotControl.on("postswitch", |
|
|
|
|
|
|
|
|
self.route.base('#!') |
|
|
self.route.base('#!') |
|
|
|
|
|
|
|
|
function PostUpdated() { |
|
|
|
|
|
riot.observable(this); |
|
|
|
|
|
this.on("postupdated", () => { console.log("caught event"); }); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var postObserver = new PostUpdated(); |
|
|
|
|
|
|
|
|
|
|
|
this.state = { |
|
|
this.state = { |
|
|
"_id" : false, |
|
|
"_id" : false, |
|
|
"projects" : Z.empty, |
|
|
"projects" : Z.empty, |
|
|
"loaded" : false, |
|
|
"loaded" : false |
|
|
"postupdate" : postObserver |
|
|
|
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
this.active = lens.actives({ |
|
|
this.active = lens.actives({ |
|
@ -149,26 +152,25 @@ this.active = lens.actives({ |
|
|
"about" : false |
|
|
"about" : false |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
toggleMenu(ev) { |
|
|
|
|
|
ev.preventDefault(); |
|
|
|
|
|
self.update({"menuActive" : !self.menuActive}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
menuOn(ev) { |
|
|
menuOn(ev) { |
|
|
ev.preventDefault(); |
|
|
ev.preventDefault(); |
|
|
self.update({"menuActive" : true}); |
|
|
console.log("clicked it"); |
|
|
|
|
|
self.menuActive = true; |
|
|
|
|
|
self.update(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
menuOff(ev) { |
|
|
menuOff(ev) { |
|
|
ev.preventDefault(); |
|
|
ev.preventDefault(); |
|
|
self.update({"menuActive" : false}); |
|
|
console.log("trying to close it"); |
|
|
|
|
|
self.menuActive = false; |
|
|
|
|
|
self.update(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function activate(page) { |
|
|
function activate(page) { |
|
|
return function() { |
|
|
return function() { |
|
|
if (page !== "posts") { |
|
|
if (page !== "posts") { |
|
|
document.title = `${page.slice(0,1).toUpperCase()}${page.slice(1,page.length)}`; |
|
|
document.title = `${page.slice(0,1).toUpperCase()}${page.slice(1,page.length)}`; |
|
|
self.currentPage = `Wes Kerfoot ${document.title}`; |
|
|
self.currentPage = document.title; |
|
|
} |
|
|
} |
|
|
console.log(`activating ${page}`); |
|
|
console.log(`activating ${page}`); |
|
|
self.active = lens.setActive(self.active, page); |
|
|
self.active = lens.setActive(self.active, page); |
|
@ -214,11 +216,12 @@ this.on("mount", () => { |
|
|
|
|
|
|
|
|
function loaduser() { |
|
|
function loaduser() { |
|
|
/* https://api.github.com/users/${self.username}/repos?sort=updated&direction=desc */ |
|
|
/* https://api.github.com/users/${self.username}/repos?sort=updated&direction=desc */ |
|
|
axios.get(`/blog/projects`) |
|
|
self.cached(`/blog/projects`) |
|
|
.then(function(resp) { |
|
|
.then((resp) => resp.json()) |
|
|
|
|
|
.then((resp) => { |
|
|
self.state.projects = Z.fromList( |
|
|
self.state.projects = Z.fromList( |
|
|
resp.data.filter( |
|
|
resp.filter( |
|
|
R.pathEq(["fork"], false))); |
|
|
pathEq(["fork"], false))); |
|
|
|
|
|
|
|
|
self.state.loaded = true; |
|
|
self.state.loaded = true; |
|
|
self.update(); |
|
|
self.update(); |
|
|