Skip to content

Commit

Permalink
feat: docs app
Browse files Browse the repository at this point in the history
  • Loading branch information
yggg committed Aug 21, 2020
1 parent 249ea42 commit b6b0c63
Show file tree
Hide file tree
Showing 203 changed files with 15,927 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# compiled output
/dist
/docs/dist
/tmp
/out-tsc

Expand Down Expand Up @@ -30,7 +31,6 @@
npm-debug.log
testem.log
/typings
/docs

# e2e
/e2e/*.js
Expand Down
119 changes: 119 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,125 @@
}
}
}
},
"docs": {
"root": "",
"sourceRoot": "docs",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "docs/dist",
"index": "docs/index.html",
"main": "docs/main.ts",
"tsConfig": "docs/tsconfig.app.json",
"polyfills": "docs/polyfills.ts",
"assets": [
"docs/assets",
"docs/404.html",
"docs/favicon.png",
"docs/google46533d2e7a851062.html"
],
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.css",
"node_modules/nebular-icons/scss/nebular-icons.scss",
"node_modules/swiper/dist/css/swiper.min.css",
"node_modules/highlight.js/styles/dracula.css",
"docs/app/@theme/styles/styles.scss"
]
},
"configurations": {
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "docs/environments/environment.ts",
"with": "docs/environments/environment.prod.ts"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "docs:build"
},
"configurations": {
"production": {
"browserTarget": "docs:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "docs:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "docs/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "docs/polyfills.ts",
"tsConfig": "docs/tsconfig.spec.json",
"scripts": [
],
"styles": [
"node_modules/nebular-icons/scss/nebular-icons.scss",
"docs/app/@theme/styles/styles.scss"
],
"assets": [
"docs/assets",
"docs/favicon.ico",
"docs/favicon.png",
"docs/google46533d2e7a851062.html"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"docs/tsconfig.spec.json",
"docs/tsconfig.app.json"
],
"exclude": []
}
}
}
},
"docs-e2e": {
"root": "",
"sourceRoot": "",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "docs:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"e2e/tsconfig.e2e.json"],
"exclude": []
}
}
}
}
},
"defaultProject": "ngx-admin-demo",
Expand Down
20 changes: 20 additions & 0 deletions docs/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8" />
<title>404</title>

<base href="/nebular/">

<script type="text/javascript" src="assets/ghspa.js"></script>
</head>

<body>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</body>

</html>
40 changes: 40 additions & 0 deletions docs/app/@core/core.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* @license
* Copyright Akveo. All Rights Reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/

import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';
import { CommonModule } from '@angular/common';

import { throwIfAlreadyLoaded } from './module-import-guard';
import { DataModule } from './data/data.module';

const PIPES = [
];

const NB_CORE_PROVIDERS = [
...DataModule.forRoot().providers,
];

@NgModule({
imports: [
CommonModule,
],
exports: [...PIPES],
declarations: [...PIPES],
})
export class CoreModule {
constructor(@Optional() @SkipSelf() parentModule: CoreModule) {
throwIfAlreadyLoaded(parentModule, 'CoreModule');
}

static forRoot(): ModuleWithProviders {
return <ModuleWithProviders>{
ngModule: CoreModule,
providers: [
...NB_CORE_PROVIDERS,
],
};
}
}
39 changes: 39 additions & 0 deletions docs/app/@core/data/data.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* @license
* Copyright Akveo. All Rights Reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/

import { NgModule, ModuleWithProviders } from '@angular/core';
import { CommonModule } from '@angular/common';

import { HeaderMenuService } from './service/header-menu.service';
import { ReviewsService } from './service/reviews.service';
import { DescriptionsService } from './service/descriptions.service';
import { BundlesService } from './service/bundles.service';

const SERVICES = [
HeaderMenuService,
ReviewsService,
DescriptionsService,
BundlesService,
];

@NgModule({
imports: [
CommonModule,
],
providers: [
...SERVICES,
],
})
export class DataModule {
static forRoot(): ModuleWithProviders {
return <ModuleWithProviders>{
ngModule: DataModule,
providers: [
...SERVICES,
],
};
}
}
121 changes: 121 additions & 0 deletions docs/app/@core/data/service/bundles.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
import { Injectable } from '@angular/core';
import { of as observableOf, Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { HttpClient } from '@angular/common/http';

export interface Product {
id: string;
imageUrl: string;
storeUrl: string;
tags: string[];
title: string;
description: string;
variants: ProductVariant[];
}

export interface ProductVariant {
available: boolean;
compare_at_price: string;
price: string;
title: string;
}

export const BUNDLE_LICENSE = {
single: 'single',
multi: 'multi',
};

export class Feature {
text: string;
availableInPersonalLicence: boolean;
availableInCommercialLicence: boolean;
}

@Injectable()
export class BundlesService {

private readonly STORE_PRODUCTS: string = 'https://store.akveo.com/collections/frontpage/products.json';
private readonly STORE: string = 'https://store.akveo.com/collections/all/products';

private features: Feature[] = [
{
text: 'ngx-admin template with 100+ UI components integrated with Backend Services',
availableInPersonalLicence: true,
availableInCommercialLicence: true,
},
{
text: 'Backend Services and Repository layers with data access',
availableInPersonalLicence: true,
availableInCommercialLicence: true,
},
{
text: 'JWT Authentication setup for UI and Backend',
availableInPersonalLicence: true,
availableInCommercialLicence: true,
},
{
text: 'Running instructions and code documentation',
availableInPersonalLicence: true,
availableInCommercialLicence: true,
},
{
text: 'Commercial Usage',
availableInPersonalLicence: true,
availableInCommercialLicence: true,
},
{
text: 'Create multiple end products using bundle',
availableInPersonalLicence: false,
availableInCommercialLicence: true,
},
{
text: 'Bug fixes and questions according to license terms',
availableInPersonalLicence: false,
availableInCommercialLicence: true,
},
];

constructor(private http: HttpClient) {}

getFeatures(): Observable<Feature[]> {
return observableOf(this.features);
}

getProducts(): Observable<Product[]> {
return this.http.get(this.STORE_PRODUCTS)
.pipe(map((result: any) => {
return result.products.map((item: any) => {
return {
id: item.id,
imageUrl: this.getDefaultImage(item.images),
storeUrl: `${this.STORE}/${item.handle}`,
tags: item.tags,
title: item.title,
description: (item.body_html as string).trim().replace(/^<p>/, '').replace(/<\/p>$/, ''),
variants: item.variants.map(variant => {
return {
available: variant.available,
compare_at_price: variant.compare_at_price,
price: variant.price,
title: variant.title,
};
}),
};
});
}));
}

getDefaultImage(images: any[]): any {
const defaultImage = images.reduce((value, current) => {
if (!value) {
value = current;
}
return value;
});
return defaultImage ? this.trimImageUrl(defaultImage.src) : undefined;
}

trimImageUrl(url: string): string {
return url.substring(0, url.indexOf('?'));
}
}
Loading

0 comments on commit b6b0c63

Please sign in to comment.