diff --git a/.gitignore b/.gitignore index 6110525..0a8abad 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /typings/ /tasks/vendor/tmp-gamejolt.iss /build/ +debug.log diff --git a/.htmlhintrc b/.htmlhintrc new file mode 100644 index 0000000..8b90eae --- /dev/null +++ b/.htmlhintrc @@ -0,0 +1,10 @@ +{ + "attr-value-double-quotes": true, + "id-unique": true, + "src-not-empty": true, + "attr-no-duplication": true, + "tagname-lowercase": true, + "alt-require": true, + "id-class-value": "dash", + "space-tab-mixed-disabled": "true" +} diff --git a/debug.log b/debug.log deleted file mode 100644 index 88de5fd..0000000 --- a/debug.log +++ /dev/null @@ -1,8 +0,0 @@ -[1216/001553:ERROR:tcp_listen_socket.cc(76)] Could not bind socket to 127.0.0.1:6004 -[1216/001553:ERROR:node_debugger.cc(86)] Cannot start debugger server -[1216/155823:ERROR:tcp_listen_socket.cc(76)] Could not bind socket to 127.0.0.1:6004 -[1216/155823:ERROR:node_debugger.cc(86)] Cannot start debugger server -[1218/153400:ERROR:tcp_listen_socket.cc(76)] Could not bind socket to 127.0.0.1:6004 -[1218/153400:ERROR:node_debugger.cc(86)] Cannot start debugger server -[1220/142017:ERROR:tcp_listen_socket.cc(76)] Could not bind socket to 127.0.0.1:6004 -[1220/142017:ERROR:node_debugger.cc(86)] Cannot start debugger server diff --git a/gulpfile.js b/gulpfile.js index 0e56d3d..37af919 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -2,20 +2,24 @@ var gulp = require( 'gulp' ); var config = { staticCdn: 'http://sites.development.gamejolt.io', - extraBower: { - 'angular-bootstrap': [ - 'src/transition/transition.js', - 'src/position/position.js', - 'src/bindHtml/bindHtml.js', - 'src/tooltip/tooltip.js', - 'src/collapse/collapse.js', - 'src/modal/modal.js' - ], - }, + // extraBower: { + // 'angular-bootstrap': [ + // 'src/transition/transition.js', + // 'src/position/position.js', + // 'src/bindHtml/bindHtml.js', + // 'src/tooltip/tooltip.js', + // 'src/collapse/collapse.js', + // 'src/modal/modal.js' + // ], + // }, rollup: { vendor: { - 'ng-metadata/core': 'vendor.ngMetadata_core', - 'ng-metadata/platform': 'vendor.ngMetadata_platform', + '@angular/core': 'vendor.ng_core', + '@angular/common': 'vendor.ng_common', + '@angular/forms': 'vendor.ng_forms', + '@angular/platform-browser': 'vendor.ng_platformBrowser', + '@angular/platform-browser-dynamic': 'vendor.ng_platformBrowserDynamic', + '@angular/http': 'vendor.ng_http', }, }, extraStyles: [ diff --git a/index.d.ts b/index.d.ts index 7736823..66942c5 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,142 +1,18 @@ -/// - -// Since we don't import these through ES6. -// declare var oc = require( 'oc' ); - declare module "html!*" { const content: string; export default content; } -interface Window { - _: _.LoDashStatic; - moment: moment.MomentStatic; - _gjStartTime: number; - Stripe: StripeStatic; - gapi: any; -} +// interface Window { +// _: _.LoDashStatic; +// moment: moment.MomentStatic; +// _gjStartTime: number; +// Stripe: StripeStatic; +// gapi: any; +// } declare var global: any; +declare var process: any; declare var GJ_ENVIRONMENT: 'development' | 'production'; declare var GJ_BUILD_TYPE: 'development' | 'production'; - -// getString: function (string, scope, context) { -declare namespace angular.gettext { - interface gettextCatalog { - getString( string: string, scope: any, context: string ): string; - } -} - -// Have to add this in for the moment. -declare module angular { - interface IModule { - controller(...args: ProvideSpreadType[]): IModule; - } - - interface IDocumentService { - [k: number]: HTMLDocument; - } - - interface IAugmentedJQuery { - [k: number]: HTMLElement; - } -} - -// FROM NG-METADATA -declare type StringMap = {[key:string]:string}; -declare type Type = Function; -declare type ProvideSpreadType = string|Type; - -// @TODO add angular1 module overrides for proper ...provide handling -declare module angular { - interface IParseService{ - ( exp: string, interceptorFn?: Function, expensiveChecks?: boolean ): ng.ICompiledExpression - } - interface IModule { - value(...args: ProvideSpreadType[]): IModule; - constant(...args: ProvideSpreadType[]): IModule; - directive(...args: ProvideSpreadType[]): IModule; - filter(...args: ProvideSpreadType[]): IModule; - service(...args: ProvideSpreadType[]): IModule; - provider(...args: ProvideSpreadType[]): IModule; - } - /////////////////////////////////////////////////////////////////////////// - // AUTO module (angular.js) - /////////////////////////////////////////////////////////////////////////// - export module auto { - - /////////////////////////////////////////////////////////////////////// - // ProvideService - // see http://docs.angularjs.org/api/AUTO.$provide - /////////////////////////////////////////////////////////////////////// - interface IProvideService { - // Documentation says it returns the registered instance, but actual - // implementation does not return anything. - // constant(name: string, value: any): any; - /** - * Register a constant service, such as a string, a number, an array, an object or a function, with the $injector. Unlike value it can be injected into a module configuration function (see config) and it cannot be overridden by an Angular decorator. - */ - constant(...args: ProvideSpreadType[]): void; - - /** - * Register a service decorator with the $injector. A service decorator intercepts the creation of a service, allowing it to override or modify the behaviour of the service. The object returned by the decorator may be the original service, or a new service object which replaces or wraps and delegates to the original service. - * - * @param name The name of the service to decorate. - * @param decorator This function will be invoked when the service needs to be instantiated and should return the decorated service instance. The function is called using the injector.invoke method and is therefore fully injectable. Local injection arguments: - * - * $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to. - */ - //decorator(name: string, decorator: Function): void; - /** - * Register a service decorator with the $injector. A service decorator intercepts the creation of a service, allowing it to override or modify the behaviour of the service. The object returned by the decorator may be the original service, or a new service object which replaces or wraps and delegates to the original service. - * - * @param name The name of the service to decorate. - * @param inlineAnnotatedFunction This function will be invoked when the service needs to be instantiated and should return the decorated service instance. The function is called using the injector.invoke method and is therefore fully injectable. Local injection arguments: - * - * $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to. - */ - //decorator(name: string, inlineAnnotatedFunction: any[]): void; - factory(...args: ProvideSpreadType[]): IServiceProvider; - provider(...args: ProvideSpreadType[]): IServiceProvider; - service(...args: ProvideSpreadType[]): IServiceProvider; - value(...args: ProvideSpreadType[]): IServiceProvider; - } - - } - - /** - * $rootScope - $rootScopeProvider - service in module ng - * see https://docs.angularjs.org/api/ng/type/$rootScope.Scope and https://docs.angularjs.org/api/ng/service/$rootScope - */ - interface IRootScopeService { - - // private members - $$postDigest( callback: Function ): void, - $$postDigestQueue: Function[], - $$applyAsyncQueue: Function[], - $$asyncQueue: Function[], - $$watchers: Watchers[], - $$watchersCount: number, - $$listenerCount: Object, - $$listeners: Object, - $$destroyed: boolean, - $$childHead: IScope, - $$childTail: IScope, - $$prevSibling: IScope, - $$nextSibling: IScope, - - // ngMetadata private members - $$disconnected?: boolean, - - } - - /* @private */ - interface Watchers { - eq: boolean, - exp: ( s: any, l: any, a: any, i: any ) => any, - fn: ( newValue: any, oldValue: any ) => any, - get: ( s: any, l: any, a: any, i: any ) => any, - last: any - } -} diff --git a/package.json b/package.json index 30abaf8..172d4ce 100644 --- a/package.json +++ b/package.json @@ -3,18 +3,28 @@ "version": "0.0.1", "scripts": {}, "devDependencies": { - "@types/angular": "^1.5.7", - "@types/angular-hotkeys": "0.0.30", - "@types/angular-ui-router": "^1.1.30", + "@angular/common": "4.0.0-beta.1", + "@angular/compiler": "4.0.0-beta.1", + "@angular/core": "4.0.0-beta.1", + "@angular/forms": "4.0.0-beta.1", + "@angular/http": "4.0.0-beta.1", + "@angular/platform-browser": "4.0.0-beta.1", + "@angular/platform-browser-dynamic": "4.0.0-beta.1", + "@angular/platform-server": "4.0.0-beta.1", + "@angular/compiler-cli": "4.0.0-beta.1", + "@types/core-js": "^0.9.35", "@types/hammerjs": "^2.0.28", "@types/lodash": "0.0.27", + "@types/lodash-es": "^4.14.0", + "angular2-template-loader": "^0.6.0", + "awesome-typescript-loader": "^3.0.0-beta.17", "bootstrap": "^4.0.0-alpha.5", + "codelyzer": "2.0.0-beta.4", "concat-with-sourcemaps": "~1.0.2", "connect-history-api-fallback": "0.0.4", + "core-js": "2.4.1", "glob-expand": "~0.0.2", "gulp": "gulpjs/gulp#4.0", - "gulp-angular-embed-templates": "^2.1.0", - "gulp-angular-gettext": "^2.1.0", "gulp-autoprefixer": "~0.0.7", "gulp-clean": "~0.3.0", "gulp-concat": "~2.6.0", @@ -26,8 +36,6 @@ "gulp-load-plugins": "~0.5.1", "gulp-minify-css": "~0.3.4", "gulp-newer": "^0.5.0", - "gulp-ng-annotate": "~1.1.0", - "gulp-ng-html2js": "~0.1.7", "gulp-plumber": "~1.0.0", "gulp-rename": "~1.2.0", "gulp-replace": "^0.5.1", @@ -41,23 +49,30 @@ "gulp-uglify": "~1.2.0", "gulp-util": "~3.0.0", "gulp-wrapper": "^0.1.5", + "html-webpack-plugin": "^2.24.1", + "lodash-es": "4.17.3", "merge-stream": "^1.0.0", "minimist": "~0.2.0", "mv": "^2.1.1", - "ng-metadata": "gamejolt/ng-metadata#6cbaa679d2aa0bcfaa7c7b03cfe1991d279ac7b1", "pofile": "^1.0.2", "reflect-metadata": "^0.1.3", - "rollup": "0.33.0", - "rollup-plugin-commonjs": "^2.2.1", - "rollup-plugin-node-resolve": "^1.5.0", - "rollup-plugin-replace": "^1.1.0", - "rollup-plugin-string": "^2.0.0", - "rollup-plugin-typescript": "^0.7.5", + "rollup": "0.38.2", + "rollup-plugin-commonjs": "6.0.1", + "rollup-plugin-node-resolve": "2.0.0", + "rollup-plugin-replace": "1.1.1", + "rollup-plugin-string": "2.0.2", + "rollup-plugin-typescript": "0.8.1", + "rxjs": "5.0.2", "sanitize-html": "^1.11.3", + "script-ext-html-webpack-plugin": "^1.3.5", "streamqueue": "~0.1.1", "stylus": "0.53.0", "through2": "~0.5.1", - "typescript": "^2.1.0", - "undertaker-forward-reference": "^1.0.1" + "tslib": "^1.4.0", + "tslint": "4.2.0", + "typescript": "2.1.4", + "undertaker-forward-reference": "^1.0.1", + "webpack": "2.1.0-beta.25", + "zone.js": "0.7.4" } } diff --git a/src/app/app-service.ts b/src/app/app-service.ts deleted file mode 100644 index 016c326..0000000 --- a/src/app/app-service.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Injectable } from 'ng-metadata/core'; - -@Injectable() -export class App -{ - ver: number | null = null; -} diff --git a/src/app/app.component.html b/src/app/app.component.html index 7a97c9a..fac7ecc 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,14 +1,19 @@ - - +
+ -
- + - -
+
+ + +
diff --git a/src/app/app.component.ts b/src/app/app.component.ts index a1e9cf9..5480357 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,6 +1,19 @@ -import { Component, Inject } from 'ng-metadata/core'; +import { Location } from '@angular/common'; +import { Component, Inject } from '@angular/core'; +import { DomSanitizer } from '@angular/platform-browser'; + import { Meta } from '../lib/gj-lib-client/components/meta/meta-service'; +import { Api } from '../lib/gj-lib-client/components/api/api.service'; +import { GameScreenshot } from '../lib/gj-lib-client/components/game/screenshot/screenshot.model'; +import { GameVideo } from '../lib/gj-lib-client/components/game/video/video.model'; +import { GamePackage } from '../lib/gj-lib-client/components/game/package/package.model'; +import { GameRelease } from '../lib/gj-lib-client/components/game/release/release.model'; +import { Game } from '../lib/gj-lib-client/components/game/game.model'; import template from 'html!./app.component.html'; +import { GameBuild } from '../lib/gj-lib-client/components/game/build/build.model'; +import { GameBuildLaunchOption } from '../lib/gj-lib-client/components/game/build/launch-option/launch-option.model'; +import { Sellable } from '../lib/gj-lib-client/components/sellable/sellable.model'; +import { Site } from '../lib/gj-lib-client/components/site/site.model'; @Component( { selector: 'gj-app', @@ -10,68 +23,76 @@ export class AppComponent { isLoading = true; - site: any; - game: any; - mediaItems: any[]; - packages: any[]; + site: Site; + game: Game; + mediaItems: (GameScreenshot | GameVideo)[]; + packages: GamePackage[]; + releases: GameRelease[]; + builds: GameBuild[]; + launchOptions: GameBuildLaunchOption[]; + sellables: Sellable[]; // Gotta do this so that the injection process works and replaces with the // correct asset server. themes = {}; constructor( - @Inject( '$location' ) $location: ng.ILocationService, - @Inject( '$sce' ) $sce: ng.ISCEService, - @Inject( 'Meta' ) private metaService: Meta, - @Inject( 'Api' ) api: any, - @Inject( 'Game_Screenshot' ) private screenshotModel: any, - @Inject( 'Game_Video' ) private videoModel: any, - @Inject( 'Game_Package' ) private packageModel: any, + private location: Location, + private metaService: Meta, + private api: Api, + @Inject( Site ) private siteModel: typeof Site, + @Inject( Game ) private gameModel: typeof Game, + @Inject( GameScreenshot ) private screenshotModel: typeof GameScreenshot, + @Inject( GameVideo ) private videoModel: typeof GameVideo, + @Inject( GamePackage ) private packageModel: typeof GamePackage, + sanitizer: DomSanitizer, ) { - const user = window.location.host.substr( 0, window.location.host.indexOf( '.' ) ); - const url = $location.path().substr( 1 ); - this.themes = { - vash: { - style: $sce.trustAsResourceUrl( '/app/vash.css' ), - template: $sce.trustAsResourceUrl( '/app/themes/vash/vash.html' ), - }, - redux: { - style: $sce.trustAsResourceUrl( '/app/redux.css' ), - template: $sce.trustAsResourceUrl( '/app/themes/redux/redux.html' ), - }, - }; + vash: { + style: sanitizer.bypassSecurityTrustResourceUrl( '/app/vash.css' ), + template: sanitizer.bypassSecurityTrustResourceUrl( '/app/themes/vash/vash.html' ), + }, + redux: { + style: sanitizer.bypassSecurityTrustResourceUrl( '/app/redux.css' ), + template: sanitizer.bypassSecurityTrustResourceUrl( '/app/themes/redux/redux.html' ), + }, + }; - api.sendRequest( `/web/sites/${user}/${url}` ).then( ( response: any ) => this.bootstrap( response ) ); + this.init(); } - bootstrap( response: any ) + async init() { - this.isLoading = false; + // TODO: Check this? + // const user = window.location.host.substr( 0, window.location.host.indexOf( '.' ) ); + const user = 'cros'; + const url = this.location.path().substr( 1 ); - this.metaService.title = 'yo'; + const response = await this.api.sendRequest( `/web/sites/${user}/${url}` ); - this.site = response.site; - this.game = response.site.game; + this.metaService.title = 'yo'; - console.log( this.site ); + this.site = new this.siteModel( response.site ); + this.game = new this.gameModel( response.site.game ); this.mediaItems = []; if ( response.mediaItems && response.mediaItems.length ) { response.mediaItems.forEach( ( item: any ) => { - if ( item.media_type == 'image' ) { + if ( item.media_type === 'image' ) { this.mediaItems.push( new this.screenshotModel( item ) ); } - else if ( item.media_type == 'video' ) { + else if ( item.media_type === 'video' ) { this.mediaItems.push( new this.videoModel( item ) ); } } ); } const packageData = this.packageModel.processPackagePayload( response ); - angular.extend( this, packageData ); + Object.assign( this, packageData ); this.packages = this.packages || []; + + this.isLoading = false; } } diff --git a/src/app/app.module.ts b/src/app/app.module.ts new file mode 100644 index 0000000..565022f --- /dev/null +++ b/src/app/app.module.ts @@ -0,0 +1,77 @@ +import { BrowserModule } from '@angular/platform-browser'; +import { NgModule } from '@angular/core'; +import { Location, LocationStrategy, PathLocationStrategy } from '@angular/common'; +// import { FormsModule } from '@angular/forms'; +import { HttpModule } from '@angular/http'; + +import { AppModule as LibAppModule } from '../lib/gj-lib-client/components/app/app.module'; +import { EnvironmentModule } from '../lib/gj-lib-client/components/environment/environment.module'; +import { ApiModule } from '../lib/gj-lib-client/components/api/api.module'; +import { UserModule } from '../lib/gj-lib-client/components/user/user.module'; +import { MetaModule } from '../lib/gj-lib-client/components/meta/meta.module'; +import { MediaItemModule } from '../lib/gj-lib-client/components/media-item/media-item.module'; +import { GameScreenshotModule } from '../lib/gj-lib-client/components/game/screenshot/screenshot.module'; + +import { AppComponent } from './app.component'; +import { CoreModule } from './core/core.module'; +import { SharedModule } from './shared/shared.module'; +import { GameVideoModule } from '../lib/gj-lib-client/components/game/video/video.module'; +import { GameModule } from '../lib/gj-lib-client/components/game/game.module'; +import { SellableModule } from '../lib/gj-lib-client/components/sellable/sellable.module'; +import { SellablePricingModule } from '../lib/gj-lib-client/components/sellable/pricing/pricing.module'; +import { GameReleaseModule } from '../lib/gj-lib-client/components/game/release/release.module'; +import { GameBuildModule } from '../lib/gj-lib-client/components/game/build/build.module'; +import { GameBuildFileModule } from '../lib/gj-lib-client/components/game/build/file/file.module'; +import { GameBuildParamModule } from '../lib/gj-lib-client/components/game/build/param/param.module'; +import { GameBuildLaunchOptionModule } from '../lib/gj-lib-client/components/game/build/launch-option/launch-option.module'; +import { GamePackageModule } from '../lib/gj-lib-client/components/game/package/package.module'; +import { ModelModule } from '../lib/gj-lib-client/components/model/model.module'; +import { ThemesModule } from './themes/themes.module'; +import { WidgetCompilerModule } from '../lib/gj-lib-client/components/widget-compiler/widget-compiler.module'; +import { SiteModule } from '../lib/gj-lib-client/components/site/site.module'; +import { SiteThemeModule } from '../lib/gj-lib-client/components/site/theme/theme.module'; +import { SiteThemeDefinitionModule } from '../lib/gj-lib-client/components/site/theme-definition/theme-definition.module'; +import { SiteContentBlockModule } from '../lib/gj-lib-client/components/site/content-block/content-block.module'; + +@NgModule( { + imports: [ + BrowserModule, + // FormsModule, + HttpModule, + CoreModule, + SharedModule, + LibAppModule, + EnvironmentModule, + MetaModule, + ApiModule, + ModelModule, + SiteModule, + SiteThemeModule, + SiteThemeDefinitionModule, + SiteContentBlockModule, + UserModule, + GameModule, + SellableModule, + SellablePricingModule, + GameScreenshotModule, + GameVideoModule, + MediaItemModule, + GamePackageModule, + GameReleaseModule, + GameBuildModule, + GameBuildFileModule, + GameBuildParamModule, + GameBuildLaunchOptionModule, + WidgetCompilerModule.forRoot(), + + ThemesModule, + ], + declarations: [ + AppComponent, + ], + providers: [ + [ Location, { provide: LocationStrategy, useClass: PathLocationStrategy } ], + ], + bootstrap: [ AppComponent ] +}) +export class AppModule { } diff --git a/src/app/app.ts b/src/app/app.ts index dcf471e..c65088b 100644 --- a/src/app/app.ts +++ b/src/app/app.ts @@ -1,5 +1,5 @@ -import { bootstrap } from 'ng-metadata/platform'; -import { enableProdMode, provide } from 'ng-metadata/core'; +import { bootstrap } from '@angular/platform'; +import { enableProdMode, provide } from '@angular/core'; import ModelModule from './../lib/gj-lib-client/components/model/model'; import MetaModule from './../lib/gj-lib-client/components/meta/meta'; diff --git a/src/app/core/core.module.ts b/src/app/core/core.module.ts new file mode 100644 index 0000000..c3eebd1 --- /dev/null +++ b/src/app/core/core.module.ts @@ -0,0 +1,17 @@ +import { NgModule, Optional, SkipSelf } from '@angular/core'; + +@NgModule({ + imports: [], + exports: [], + declarations: [], + providers: [], +}) +export class CoreModule +{ + constructor( @Optional() @SkipSelf() parentModule: CoreModule ) + { + if ( parentModule ) { + throw new Error( 'CoreModule is already loaded. Import it in the AppModule only' ); + } + } +} diff --git a/src/app/main.prod.ts b/src/app/main.prod.ts new file mode 100644 index 0000000..0a35368 --- /dev/null +++ b/src/app/main.prod.ts @@ -0,0 +1,7 @@ +// import { platformBrowser } from '@angular/platform-browser'; +import { enableProdMode } from '@angular/core'; +// import { AppModuleNgFactory } from './ngfactory/tmp/app/app.module.ngfactory'; + +enableProdMode(); + +// platformBrowser().bootstrapModuleFactory(AppModuleNgFactory); diff --git a/src/app/main.ts b/src/app/main.ts new file mode 100644 index 0000000..29d6d7f --- /dev/null +++ b/src/app/main.ts @@ -0,0 +1,4 @@ +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; +import { AppModule } from './app.module'; + +platformBrowserDynamic().bootstrapModule( AppModule ); diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts new file mode 100644 index 0000000..8dde02a --- /dev/null +++ b/src/app/shared/shared.module.ts @@ -0,0 +1,22 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { WidgetCompilerModule } from '../../lib/gj-lib-client/components/widget-compiler/widget-compiler.module'; +import { ThemeInjectorModule } from '../../lib/gj-lib-client/components/theme/injector/injector.module'; + +const MODULES = [ + CommonModule, + WidgetCompilerModule, + ThemeInjectorModule, +]; + +@NgModule({ + imports: [ + ...MODULES, + ], + exports: [ + ...MODULES, + ], + declarations: [], + providers: [], +}) +export class SharedModule { } diff --git a/src/app/themes/redux/redux.html b/src/app/themes/redux/redux.component.html similarity index 89% rename from src/app/themes/redux/redux.html rename to src/app/themes/redux/redux.component.html index 14518ad..46e03fa 100644 --- a/src/app/themes/redux/redux.html +++ b/src/app/themes/redux/redux.component.html @@ -1,4 +1,4 @@ -
+ diff --git a/src/app/themes/redux/redux.component.ts b/src/app/themes/redux/redux.component.ts new file mode 100644 index 0000000..75338a6 --- /dev/null +++ b/src/app/themes/redux/redux.component.ts @@ -0,0 +1,21 @@ +import { Component, OnInit, Input } from '@angular/core'; +import { Game } from '../../../lib/gj-lib-client/components/game/game.model'; +import { GamePackage } from '../../../lib/gj-lib-client/components/game/package/package.model'; +import { GameScreenshot } from '../../../lib/gj-lib-client/components/game/screenshot/screenshot.model'; +import { GameVideo } from '../../../lib/gj-lib-client/components/game/video/video.model'; +import template from 'html!./redux.component.html'; + +@Component( { + selector: 'gj-theme-redux', + template, +}) +export class ThemeReduxComponent implements OnInit +{ + @Input() game: Game; + @Input() packages: GamePackage[]; + @Input() mediaItems: (GameScreenshot | GameVideo)[]; + + constructor() { } + + ngOnInit() { } +} diff --git a/src/app/themes/themes.module.ts b/src/app/themes/themes.module.ts new file mode 100644 index 0000000..1c118f9 --- /dev/null +++ b/src/app/themes/themes.module.ts @@ -0,0 +1,23 @@ +import { NgModule } from '@angular/core'; +import { ThemeVashComponent } from './vash/vash.component'; +import { ThemeReduxComponent } from './redux/redux.component'; +import { SharedModule } from '../shared/shared.module'; + +const THEMES: any[] = [ + ThemeVashComponent, + ThemeReduxComponent, +]; + +@NgModule({ + imports: [ + SharedModule, + ], + exports: [ + ...THEMES, + ], + declarations: [ + ...THEMES, + ], + providers: [], +}) +export class ThemesModule { } diff --git a/src/app/themes/vash/vash.component.html b/src/app/themes/vash/vash.component.html new file mode 100644 index 0000000..45acdce --- /dev/null +++ b/src/app/themes/vash/vash.component.html @@ -0,0 +1,45 @@ + + + + +testing this out, okay? +
+ +
+
+
+
+
+
+
+
+ +
+ + diff --git a/src/app/themes/vash/vash.component.ts b/src/app/themes/vash/vash.component.ts new file mode 100644 index 0000000..5b21450 --- /dev/null +++ b/src/app/themes/vash/vash.component.ts @@ -0,0 +1,21 @@ +import { Component, OnInit, Input } from '@angular/core'; +import { Game } from '../../../lib/gj-lib-client/components/game/game.model'; +import { GamePackage } from '../../../lib/gj-lib-client/components/game/package/package.model'; +import { GameScreenshot } from '../../../lib/gj-lib-client/components/game/screenshot/screenshot.model'; +import { GameVideo } from '../../../lib/gj-lib-client/components/game/video/video.model'; +import template from 'html!./vash.component.html'; + +@Component( { + selector: 'gj-theme-vash', + template, +}) +export class ThemeVashComponent implements OnInit +{ + @Input() game: Game; + @Input() packages: GamePackage[]; + @Input() mediaItems: (GameScreenshot | GameVideo)[]; + + constructor() { } + + ngOnInit() { } +} diff --git a/src/app/themes/vash/vash.html b/src/app/themes/vash/vash.html deleted file mode 100644 index 5dbe77f..0000000 --- a/src/app/themes/vash/vash.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - -
- -
-
-
-
-
-
-
-
- -
- -
-
-
- -
- - -
- -
-
-
diff --git a/src/index.html b/src/index.html index fd58d1b..6ef146a 100644 --- a/src/index.html +++ b/src/index.html @@ -57,7 +57,7 @@ -
+
@@ -68,7 +68,8 @@ ga('require', 'linkid', 'linkid.js'); - + + diff --git a/src/lib/gj-lib-client b/src/lib/gj-lib-client index e134ed2..334ed16 160000 --- a/src/lib/gj-lib-client +++ b/src/lib/gj-lib-client @@ -1 +1 @@ -Subproject commit e134ed2b532401eccabe7a29e7824406479b7017 +Subproject commit 334ed166903f4a21345ea37778148c22b6297da3 diff --git a/src/polyfill.ts b/src/polyfill.ts new file mode 100644 index 0000000..b126611 --- /dev/null +++ b/src/polyfill.ts @@ -0,0 +1,20 @@ +// This file includes polyfills needed by Angular 2 and is loaded before +// the app. You can add your own extra polyfills to this file. +import 'core-js/es6/symbol'; +import 'core-js/es6/object'; +import 'core-js/es6/function'; +import 'core-js/es6/parse-int'; +import 'core-js/es6/parse-float'; +import 'core-js/es6/number'; +import 'core-js/es6/math'; +import 'core-js/es6/string'; +import 'core-js/es6/date'; +import 'core-js/es6/array'; +import 'core-js/es6/regexp'; +import 'core-js/es6/map'; +import 'core-js/es6/set'; +import 'core-js/es6/reflect'; +import 'core-js/es6/promise'; + +import 'core-js/es7/reflect'; +import 'zone.js/dist/zone'; diff --git a/src/vendor.ts b/src/vendor.ts index 2a66e0b..b130da8 100644 --- a/src/vendor.ts +++ b/src/vendor.ts @@ -3,11 +3,13 @@ // It also means that changes to the app.js files won't change the vendor.js file // so that we can keep this in cache. -import 'reflect-metadata'; +import 'rxjs/add/operator/map'; +import 'rxjs/add/operator/toPromise'; + import { + NgModule, Inject, Injectable, - provide, Component, Directive, Input, @@ -20,13 +22,42 @@ import { Self, SkipSelf, ViewChild, -} from 'ng-metadata/core'; -import { bootstrap } from 'ng-metadata/platform'; + ElementRef, +} from '@angular/core'; + +import { + Location, + LocationStrategy, + PathLocationStrategy, + CommonModule, +} from '@angular/common'; + +import { + DomSanitizer, + BrowserModule, + Title, + Meta, + DOCUMENT, +} from '@angular/platform-browser'; -const ngMetadata_core = { +import { + platformBrowserDynamic, +} from '@angular/platform-browser-dynamic'; + +import { + FormsModule, +} from '@angular/forms'; + +import { + HttpModule, + Http, + RequestMethod, +} from '@angular/http'; + +const ng_core = { + NgModule, Inject, Injectable, - provide, Component, Directive, Input, @@ -39,13 +70,43 @@ const ngMetadata_core = { Self, SkipSelf, ViewChild, + ElementRef, +}; + +const ng_common = { + Location, + LocationStrategy, + PathLocationStrategy, + CommonModule, +}; + +const ng_platformBrowser = { + DomSanitizer, + BrowserModule, + Title, + Meta, + DOCUMENT, +}; + +const ng_platformBrowserDynamic = { + platformBrowserDynamic, +}; + +const ng_forms = { + FormsModule, }; -const ngMetadata_platform = { - bootstrap, +const ng_http = { + HttpModule, + Http, + RequestMethod, }; export default { - ngMetadata_core, - ngMetadata_platform, + ng_core, + ng_common, + ng_platformBrowser, + ng_platformBrowserDynamic, + ng_forms, + ng_http, }; diff --git a/todo.txt b/todo.txt new file mode 100644 index 0000000..0670593 --- /dev/null +++ b/todo.txt @@ -0,0 +1,10 @@ +$location.path() -> Location.path() + +Change directions from snake-case to camelCase + +TODO + +[ ] Replace App with new App service declarations +[ ] Remove @Inject calls +[ ] Create modules for everything. +[ ] Model isn't actually getting injected into models? diff --git a/tsconfig.json b/tsconfig.json index ea41106..50ed797 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,17 +2,15 @@ "compilerOptions": { "target": "es5", "moduleResolution": "node", - // Doesn't work with lazy loading and rollup. - // Can only turn it on when angular2 is in place. - // "emitDecoratorMetadata": true, + "emitDecoratorMetadata": true, "experimentalDecorators": true, - "removeComments": false, "noImplicitAny": true, "strictNullChecks": true, "noUnusedParameters": true, "noUnusedLocals": true, "allowJs": true, - "skipLibCheck": true + "skipLibCheck": true, + "importHelpers": true }, "exclude": [ "build", diff --git a/tsconfig.webpack.json b/tsconfig.webpack.json new file mode 100644 index 0000000..c3f02a4 --- /dev/null +++ b/tsconfig.webpack.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "target": "es5", + "module": "es2015", + "moduleResolution": "node", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "noEmit": true, + "noImplicitAny": true, + "strictNullChecks": true, + "noUnusedParameters": true, + "noUnusedLocals": true, + "skipLibCheck": true, + "lib": [ + "es2015", + "dom" + ] + }, + "exclude": [ + "build", + "node_modules", + "src/bower-lib" + ], + "awesomeTypescriptLoaderOptions": { + "forkChecker": true, + "useWebpackText": true + } +} diff --git a/tslint.json b/tslint.json index 3a36db4..0876737 100644 --- a/tslint.json +++ b/tslint.json @@ -1,33 +1,70 @@ { + "rulesDirectory": [ + "node_modules/codelyzer" + ], "rules": { - "no-inferrable-types": true, "class-name": true, "comment-format": [ true, "check-space" ], + "curly": true, + "eofline": true, + "forin": true, "indent": [ true, "tabs" ], - "eofline": true, - "no-duplicate-variable": true, - "no-eval": true, + "label-position": true, + "max-line-length": [ + true, + 140 + ], + "member-access": false, + "member-ordering": [ + true, + "variables-before-functions" + ], "no-arg": true, - "no-internal-module": true, - "no-trailing-whitespace": true, "no-bitwise": true, + "no-console": [ + true, + "debug", + "info", + "time", + "timeEnd", + "trace" + ], + "no-construct": true, + "no-debugger": true, + "no-duplicate-variable": true, + "no-empty": false, + "no-eval": true, + "no-inferrable-types": true, "no-shadowed-variable": true, + "no-string-literal": false, + "no-switch-case-fall-through": true, + "no-trailing-whitespace": true, "no-unused-expression": true, - "no-unused-variable": true, - + "no-use-before-declare": true, + "no-var-keyword": true, + "object-literal-sort-keys": false, + "one-line": [ + true, + "check-catch", + "check-whitespace" + ], "quotemark": [ true, - "single", - "avoid-escape" + "single" ], + "radix": true, "semicolon": [ - "always" + "always" + ], + "triple-equals": [ + true, + "allow-null-check" ], "typedef-whitespace": [ true, @@ -39,14 +76,7 @@ "variable-declaration": "nospace" } ], - "curly": true, - "variable-name": [ - false, - "ban-keywords", - "check-format", - "allow-trailing-underscore", - "allow-leading-underscore" - ], + "variable-name": false, "whitespace": [ true, "check-branch", @@ -54,6 +84,21 @@ "check-operator", "check-separator", "check-type" - ] + ], + + "directive-selector": [true, "attribute", "gj", "camelCase"], + "component-selector": [true, "element", "gj", "kebab-case"], + "use-input-property-decorator": true, + "use-output-property-decorator": true, + "use-host-property-decorator": true, + "no-input-rename": true, + "no-output-rename": true, + "use-life-cycle-interface": true, + "use-pipe-transform-interface": true, + "component-class-suffix": true, + "directive-class-suffix": true, + "no-access-missing-member": true, + "templates-use-public": true, + "invoke-injectable": true } } diff --git a/typings.json b/typings.json deleted file mode 100644 index 3132621..0000000 --- a/typings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "sites-io", - "version": false, - "globalDependencies": { - "angular": "registry:dt/angular#1.5.0+20160602160139", - "angular-animate": "registry:dt/angular-animate#1.5.0+20160614091201", - "angular-sanitize": "registry:dt/angular-sanitize#1.3.0+20160317120654", - "jquery": "registry:dt/jquery#1.10.0+20160704162008" - } -}