-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the "dashboard" list some dummy packages, which you can click through to build. Also: * Rename some files to be what they are * Add Redux and Immutable.js * Add tsd (to manage TypeScript type definitions) * Add sign up link in the header * Add clean npm tasks
- Loading branch information
Nathan L Smith
committed
Jan 21, 2016
1 parent
18418ba
commit 2012843
Showing
28 changed files
with
2,414 additions
and
938 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 |
---|---|---|
|
@@ -3,3 +3,5 @@ app/**/*.js.map | |
*.css | ||
*.css.map | ||
node_modules | ||
npm-debug.log | ||
typings |
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,48 @@ | ||
import {AppStore} from "./AppStore"; | ||
import {Component, Inject} from "angular2/core"; | ||
import {DashboardComponent} from "./dashboard/DashboardComponent"; | ||
import {HomeComponent} from "./home/HomeComponent"; | ||
import {PackageComponent} from "./package/PackageComponent"; | ||
import {Router, RouteConfig, ROUTER_DIRECTIVES} from "angular2/router"; | ||
import {SignInComponent} from "./sign-in/SignInComponent"; | ||
import {UserNavComponent} from "./user-nav/UserNavComponent"; | ||
import {routeChange} from "./actions"; | ||
|
||
@Component({ | ||
directives: [ROUTER_DIRECTIVES, UserNavComponent], | ||
selector: "bldr", | ||
template: ` | ||
<div class="bldr-container"> | ||
<header class="bldr-header"> | ||
<h1>bldr</h1> | ||
<nav class="bldr-header-user"> | ||
<user-nav></user-nav> | ||
</nav> | ||
</header> | ||
<section class="bldr-main"> | ||
<router-outlet></router-outlet> | ||
</section> | ||
<footer class="bldr-footer"> | ||
<p>© {{now}} Chef Software, Inc. All Rights Reserved.</p> | ||
</footer> | ||
</div> | ||
`, | ||
}) | ||
|
||
@RouteConfig([ | ||
{ path: "/", name: "Home", component: HomeComponent }, | ||
{ path: "/dashboard", name: "Dashboard", component: DashboardComponent }, | ||
{ path: "/sign-in", name: "Sign In", component: SignInComponent }, | ||
{ path: "/packages/:derivation/:id", name: "Package", component: PackageComponent }, | ||
]) | ||
|
||
export class AppComponent { | ||
constructor(private router: Router, private store: AppStore) { | ||
this.router.subscribe(value => this.store.dispatch(routeChange(value))); | ||
store.subscribe(state => console.log('new state received ', state.toObject())); | ||
} | ||
|
||
get now() { | ||
return this.store.getState().currentYear; | ||
} | ||
} |
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,22 @@ | ||
import {Injectable} from "angular2/core"; | ||
import {createStore} from "redux"; | ||
import {rootReducer} from "./rootReducer" | ||
|
||
const appStore = createStore(rootReducer); | ||
|
||
@Injectable() | ||
export class AppStore { | ||
private store = appStore; | ||
|
||
getState() { | ||
return this.store.getState(); | ||
} | ||
|
||
dispatch(action) { | ||
this.store.dispatch(action); | ||
} | ||
|
||
subscribe(listener: Function) { | ||
this.store.subscribe(() => listener(this.getState())); | ||
} | ||
} |
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,42 @@ | ||
export const ROUTE_CHANGE = "ROUTE_CHANGE"; | ||
export const SIGN_IN_ATTEMPT = "SIGN_IN_ATTEMPT"; | ||
export const SIGN_UP_ATTEMPT = "SIGN_UP_ATTEMPT"; | ||
export const SIGN_OUT = "SIGN_OUT"; | ||
export const TOGGLE_USER_NAV_MENU = "TOGGLE_USER_NAV_MENU"; | ||
|
||
export function attemptSignIn(username) { | ||
return { | ||
type: SIGN_IN_ATTEMPT, | ||
payload: { username: username }, | ||
}; | ||
} | ||
|
||
export function attemptSignUp(username, email, password) { | ||
return { | ||
type: SIGN_UP_ATTEMPT, | ||
payload: { | ||
username: username, | ||
email: email, | ||
password: password, | ||
} | ||
}; | ||
} | ||
|
||
export function routeChange(newRoute) { | ||
return { | ||
type: ROUTE_CHANGE, | ||
payload: newRoute, | ||
}; | ||
} | ||
|
||
export function toggleUserNavMenu() { | ||
return { | ||
type: TOGGLE_USER_NAV_MENU | ||
}; | ||
} | ||
|
||
export function signOut() { | ||
return { | ||
type: SIGN_OUT | ||
}; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import {AppComponent} from "./app.component"; | ||
import appState from "./app-state"; | ||
import {AppComponent} from "./AppComponent"; | ||
import {AppStore} from "./AppStore"; | ||
import {ROUTER_PROVIDERS} from "angular2/router"; | ||
import {bootstrap} from "angular2/platform/browser"; | ||
import {bootstrap} from "angular2/platform/browser"; | ||
|
||
// Expose the app state on the window so we can inspect it in a console. | ||
window["appState"] = appState; | ||
|
||
bootstrap(AppComponent, [ROUTER_PROVIDERS]); | ||
bootstrap(AppComponent, [ | ||
AppStore, | ||
ROUTER_PROVIDERS, | ||
]); |
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,41 @@ | ||
import {AppStore} from "../AppStore"; | ||
import {Component} from "angular2/core"; | ||
import {Router, RouterLink} from "angular2/router"; | ||
|
||
@Component({ | ||
directives: [RouterLink], | ||
template: ` | ||
<div class="bldr-dashboard"> | ||
<h2>Packages</h2> | ||
<ul class="bldr-dashboard-plan-list"> | ||
<li *ngIf="packages.length === 0"> | ||
You have no packages. Here's how to create one: … | ||
</li> | ||
<li *ngFor="#package of packages"> | ||
<a [routerLink]="['Package', { id: package.name, derivation: package.derivation }]"> | ||
{{index}} | ||
{{username}}/{{package.name}} | ||
</a> | ||
</li> | ||
</ul> | ||
</div> | ||
` | ||
}) | ||
|
||
export class DashboardComponent { | ||
constructor(private router: Router, private store: AppStore) {} | ||
|
||
get packages() { | ||
return this.store.getState().packages; | ||
} | ||
|
||
get username() { | ||
return this.store.getState().username; | ||
} | ||
|
||
ngOnInit() { | ||
if (!this.store.getState().isSignedIn) { | ||
this.router.navigate(["Home"]) | ||
} | ||
} | ||
} |
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,12 @@ | ||
.bldr-dashboard { | ||
&-plan-list { | ||
li { | ||
a { | ||
margin-bottom: 1em; | ||
padding: 1em; | ||
border: 1px solid; | ||
display: block; | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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,63 @@ | ||
import {AppStore} from "../AppStore"; | ||
import {Component} from "angular2/core"; | ||
import {Router, RouterLink} from "angular2/router"; | ||
|
||
@Component({ | ||
directives: [RouterLink], | ||
template: ` | ||
<div class="bldr-package"> | ||
<h2> | ||
<a [routerLink]="['Dashboard']">{{package.derivation}}</a> | ||
/ | ||
{{package.name}} | ||
</h2> | ||
<div class="bldr-package-info"> | ||
<dl> | ||
<dt>Maintainer</dt> | ||
<dd>{{package.maintainer}}</dd> | ||
<dt>License</dt> | ||
<dd>{{package.license}}</dd> | ||
<dt>Source URL</dt> | ||
<dd><a href="{{package.source}}">{{package.source}}</a></dd> | ||
</dl> | ||
</div> | ||
<div class="bldr-package-version-info"> | ||
<h3>Current Release</h3> | ||
<dl> | ||
<dt>Version</dt> | ||
<dd>{{package.version}}</dd> | ||
<dt>Release</dt> | ||
<dd>{{package.release}}</dd> | ||
<dt>SHA</dt> | ||
<dd>{{package.sha}}</dd> | ||
</dl> | ||
</div> | ||
<div class="bldr-package-deps"> | ||
<h3>Dependencies</h3> | ||
<div class="bldr-package-deps-build"> | ||
<h4>Build Dependencies</h4> | ||
<p>None</p> | ||
</div> | ||
<div class="bldr-package-deps-runtime"> | ||
<h4>Runtime Dependencies</h4> | ||
<p>None</p> | ||
</div> | ||
</div> | ||
</div> | ||
`, | ||
}) | ||
|
||
export class PackageComponent { | ||
constructor (private router: Router, private store: AppStore) {} | ||
|
||
get currentPackage() { | ||
let parts = window.location.pathname.split("/") | ||
return `${parts[2]}/${parts[3]}`; | ||
} | ||
|
||
get package () { | ||
return this.store.getState().packages.filter((pkg, index) => { | ||
return pkg.identifier === this.currentPackage; | ||
})[0]; | ||
} | ||
} |
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,15 @@ | ||
.bldr-package { | ||
&-info { | ||
} | ||
|
||
&-version-info { | ||
} | ||
|
||
&-deps { | ||
&-build { | ||
} | ||
|
||
&-runtime { | ||
} | ||
} | ||
} |
Oops, something went wrong.
2012843
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delivery Status: