Skip to content
This repository has been archived by the owner on Oct 10, 2022. It is now read-only.

Commit

Permalink
Merge pull request #12 from SmartStockTz/csb-twokej
Browse files Browse the repository at this point in the history
update core libs and change publish configuration to npm
  • Loading branch information
joshuamshana authored Jun 25, 2022
2 parents 397a005 + f3898f0 commit 5a40493
Show file tree
Hide file tree
Showing 32 changed files with 516 additions and 354 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

name: Publish to npm

on:
release:
types:
- published

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: '16.x'
- run: npm install --location=global @angular/cli
- run: npm install --location=global yarn
- run: npm install -f
- run: npm config set //registry.npmjs.org/:_authToken=${NPM_TOKEN}
- run: npm run publish
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.0",
"scripts": {
"ng": "ng",
"box":"yarn install && yarn start",
"box": "yarn install && yarn start",
"start": "ng serve",
"build": "ng build",
"publish": "ng build -c production && cd dist/web && npm publish --ignore-scripts",
Expand All @@ -23,16 +23,16 @@
"@angular/platform-browser": "~13.0.1",
"@angular/platform-browser-dynamic": "~13.0.1",
"@angular/router": "~13.0.1",
"smartstock-accounts": "^1.0.0",
"smartstock-core": "^1.0.0",
"smartstock-shop": "^1.0.0",
"bfast": "^6.0.0-alpha.17",
"bfast": "6.0.1",
"comlink": "^4.3.1",
"masonry-layout": "^4.2.2",
"moment": "^2.29.2",
"ngx-infinite-scroll": "^10.0.1",
"ngx-masonry": "^12.0.0",
"masonry-layout": "4.2.2",
"moment": "2.29.3",
"ngx-infinite-scroll": "13.0.2",
"ngx-masonry": "13.0.0",
"rxjs": "~7.4.0",
"smartstock-accounts": "1.0.0",
"smartstock-core": "1.0.1",
"smartstock-shop": "1.0.0",
"tslib": "^2.0.0",
"zone.js": "~0.11.4"
},
Expand All @@ -57,4 +57,4 @@
"tslint": "~6.1.0",
"typescript": "~4.4.4"
}
}
}
56 changes: 29 additions & 27 deletions projects/web-mock/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,41 @@
import {BrowserModule} from '@angular/platform-browser';
import {NgModule} from '@angular/core';
import { BrowserModule } from "@angular/platform-browser";
import { NgModule } from "@angular/core";

import {AppComponent} from './app.component';
import {RouterModule, Routes} from '@angular/router';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {MatCardModule} from '@angular/material/card';
import {ReactiveFormsModule} from '@angular/forms';
import {MatFormFieldModule} from '@angular/material/form-field';
import {MatProgressSpinnerModule} from '@angular/material/progress-spinner';
import {MatButtonModule} from '@angular/material/button';
import {MatInputModule} from '@angular/material/input';
import {MatDialogModule} from '@angular/material/dialog';
import {MatBottomSheetModule} from '@angular/material/bottom-sheet';
import {init} from 'bfast';
import {MatSnackBarModule} from '@angular/material/snack-bar';
import {HttpClientModule} from '@angular/common/http';
import {SmartstockHttpAdapter} from '@smartstocktz/core-libs';
import {environment} from '../environments/environment';
import { AppComponent } from "./app.component";
import { RouterModule, Routes } from "@angular/router";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { MatCardModule } from "@angular/material/card";
import { ReactiveFormsModule } from "@angular/forms";
import { MatFormFieldModule } from "@angular/material/form-field";
import { MatProgressSpinnerModule } from "@angular/material/progress-spinner";
import { MatButtonModule } from "@angular/material/button";
import { MatInputModule } from "@angular/material/input";
import { MatDialogModule } from "@angular/material/dialog";
import { MatBottomSheetModule } from "@angular/material/bottom-sheet";
import { init } from "bfast";
import { MatSnackBarModule } from "@angular/material/snack-bar";
import { HttpClientModule } from "@angular/common/http";
import { SmartstockHttpAdapter } from "smartstock-core";
import { environment } from "../environments/environment";

const routes: Routes = [
{
path: '', loadChildren: () => import('../../../web/src/public-api').then(mod => mod.WebModule)
path: "",
loadChildren: () =>
import("../../../web/src/public-api").then((mod) => mod.WebModule)
},
{
path: 'account', loadChildren: () => import('@smartstocktz/accounts').then(mod => mod.AccountModule)
path: "account",
loadChildren: () =>
import("smartstockt-accounts").then((mod) => mod.AccountModule)
}
];

@NgModule({
declarations: [
AppComponent
],
declarations: [AppComponent],
imports: [
BrowserModule,
RouterModule.forRoot(routes, {relativeLinkResolution: 'legacy'}),
RouterModule.forRoot(routes, { relativeLinkResolution: "legacy" }),
RouterModule,
BrowserAnimationsModule,
MatCardModule,
Expand All @@ -53,12 +55,12 @@ const routes: Routes = [
export class AppModule {
constructor(private readonly smartstockHttp: SmartstockHttpAdapter) {
init({
applicationId: 'smartstock_lb',
projectId: 'smartstock',
applicationId: "smartstock_lb",
projectId: "smartstock",
databaseURL: environment.baseDaasUrl,
functionsURL: environment.baseFaasUrl,
adapters: {
http: _ => this.smartstockHttp
http: (_) => this.smartstockHttp
}
});
}
Expand Down
62 changes: 38 additions & 24 deletions projects/web-mock/src/app/guards/auth.guard.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,53 @@
import {Injectable} from '@angular/core';
import {ActivatedRouteSnapshot, CanActivate, Route, Router, RouterStateSnapshot, UrlTree} from '@angular/router';
import {Observable} from 'rxjs';
import {init, auth} from 'bfast';
import {getDaasAddress, getFaasAddress} from '@smartstocktz/core-libs';
import {environment} from '../../environments/environment';
import { Injectable } from "@angular/core";
import {
ActivatedRouteSnapshot,
CanActivate,
Route,
Router,
RouterStateSnapshot,
UrlTree
} from "@angular/router";
import { Observable } from "rxjs";
import { init, auth } from "bfast";
import { getDaasAddress, getFaasAddress } from "smartstock-core";
import { environment } from "../../environments/environment";

@Injectable({
providedIn: 'root'
providedIn: "root"
})
export class AuthGuard implements CanActivate {
constructor(private readonly router: Router) {
}
constructor(private readonly router: Router) {}

canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot)
: Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
canActivate(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot
):
| Observable<boolean | UrlTree>
| Promise<boolean | UrlTree>
| boolean
| UrlTree {
return new Promise(async (resolve, reject) => {
const user = await auth().currentUser();
if (user && user.role) {
init({
applicationId: user.applicationId,
projectId: user.projectId,
databaseURL: getDaasAddress(user, environment.baseFaasUrl),
functionsURL: getFaasAddress(user, environment.baseFaasUrl),
adapters: {
auth: 'DEFAULT',
cache: 'DEFAULT',
http: 'DEFAULT'
}
}, user.projectId);
init(
{
applicationId: user.applicationId,
projectId: user.projectId,
databaseURL: getDaasAddress(user, environment.baseFaasUrl),
functionsURL: getFaasAddress(user, environment.baseFaasUrl),
adapters: {
auth: "DEFAULT",
cache: "DEFAULT",
http: "DEFAULT"
}
},
user.projectId
);
resolve(true);
} else {
this.router.navigateByUrl('/').catch();
this.router.navigateByUrl("/").catch();
resolve(false);
}
});
}

}
Binary file modified projects/web-mock/src/assets/img/customisable_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified projects/web-mock/src/assets/img/everyWhere_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified projects/web-mock/src/assets/img/google_play_badge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified projects/web-mock/src/assets/img/header.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified projects/web-mock/src/assets/img/ios_download.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified projects/web-mock/src/assets/img/microsoft_download.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified projects/web-mock/src/assets/img/person.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified projects/web-mock/src/assets/img/receipt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified projects/web-mock/src/assets/img/snap-store-badge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified projects/web-mock/src/assets/img/snap_download.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified projects/web-mock/src/assets/img/sslogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified projects/web-mock/src/assets/img/window_badge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified projects/web-mock/src/assets/img/“99.9%”.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified projects/web-mock/src/favicon.ico
Binary file not shown.
83 changes: 59 additions & 24 deletions projects/web/src/componets/mall-drawer.component.ts
Original file line number Diff line number Diff line change
@@ -1,50 +1,87 @@
import {Component, Input, OnInit} from '@angular/core';
import {UserService} from '@smartstocktz/core-libs';
import { Component, Input, OnInit } from "@angular/core";
import { UserService } from "smartstock-core";

@Component({
selector: 'app-mall-drawer',
selector: "app-mall-drawer",
template: `
<div class="drawer">
<mat-toolbar class="brand">
<img class="logo" src="assets/img/sslogo.png">
<img class="logo" src="assets/img/sslogo.png" />
<span class="logo-text">SmartStock</span>
</mat-toolbar>
<p class="menu-title">Menu</p>
<button routerLink="/" mat-button [class]="currentMenu==='mall'?'menu-selected':'menu-not-selected'">
<button
routerLink="/"
mat-button
[class]="currentMenu === 'mall' ? 'menu-selected' : 'menu-not-selected'"
>
<mat-icon color="primary">home</mat-icon>
<span class="menu-text">Home</span>
</button>
<button routerLink="/shops" mat-button [class]="currentMenu==='shops'?'menu-selected':'menu-not-selected'">
<button
routerLink="/shops"
mat-button
[class]="
currentMenu === 'shops' ? 'menu-selected' : 'menu-not-selected'
"
>
<mat-icon color="primary">business</mat-icon>
<span class="menu-text">Shops</span>
</button>
<button routerLink="/shops/default/cart" mat-button [class]="currentMenu==='cart'?'menu-selected':'menu-not-selected'">
<button
routerLink="/shops/default/cart"
mat-button
[class]="currentMenu === 'cart' ? 'menu-selected' : 'menu-not-selected'"
>
<mat-icon color="primary">shopping_cart</mat-icon>
<span class="menu-text">Cart</span>
</button>
<button routerLink="/shops/default/orders" mat-button [class]="currentMenu==='orders'?'menu-selected':'menu-not-selected'">
<button
routerLink="/shops/default/orders"
mat-button
[class]="
currentMenu === 'orders' ? 'menu-selected' : 'menu-not-selected'
"
>
<mat-icon color="primary">receipt</mat-icon>
<span class="menu-text">Orders</span>
</button>
<!-- <button routerLink="/account/shop" *ngIf="isBusiness" mat-button-->
<!-- [class]="currentMenu==='shops'?'menu-selected':'menu-not-selected'">-->
<!-- <mat-icon color="primary">business</mat-icon>-->
<!-- <span class="menu-text">Your Shops</span>-->
<!-- </button>-->
<button routerLink="/pricing" mat-button [class]="currentMenu==='pricing'?'menu-selected':'menu-not-selected'">
<!-- <button routerLink="/account/shop" *ngIf="isBusiness" mat-button-->
<!-- [class]="currentMenu==='shops'?'menu-selected':'menu-not-selected'">-->
<!-- <mat-icon color="primary">business</mat-icon>-->
<!-- <span class="menu-text">Your Shops</span>-->
<!-- </button>-->
<button
routerLink="/pricing"
mat-button
[class]="
currentMenu === 'pricing' ? 'menu-selected' : 'menu-not-selected'
"
>
<mat-icon color="primary">money</mat-icon>
<span class="menu-text">Pricing</span>
</button>
<!-- <button routerLink="/features" mat-button [class]="currentMenu==='features'?'menu-selected':'menu-not-selected'">-->
<!-- <mat-icon color="primary">widgets</mat-icon>-->
<!-- <span class="menu-text">Features</span>-->
<!-- </button>-->
<button routerLink="/downloads" mat-button
[class]="currentMenu==='downloads'?'menu-selected':'menu-not-selected'">
<button
routerLink="/downloads"
mat-button
[class]="
currentMenu === 'downloads' ? 'menu-selected' : 'menu-not-selected'
"
>
<mat-icon color="primary">get_app</mat-icon>
<span class="menu-text">Downloads</span>
</button>
<button routerLink="/privacy" mat-button [class]="currentMenu==='privacy'?'menu-selected':'menu-not-selected'">
<button
routerLink="/privacy"
mat-button
[class]="
currentMenu === 'privacy' ? 'menu-selected' : 'menu-not-selected'
"
>
<mat-icon color="primary">security</mat-icon>
<span class="menu-text">Privacy</span>
</button>
Expand All @@ -54,22 +91,20 @@ import {UserService} from '@smartstocktz/core-libs';
<!-- </button>-->
</div>
`,
styleUrls: ['../styles/mall-drawer.style.scss']
styleUrls: ["../styles/mall-drawer.style.scss"]
})

export class MallDrawerComponent implements OnInit {
logIn = false;
@Input() currentMenu = '';
@Input() currentMenu = "";
isBusiness = false;

constructor(private readonly userService: UserService) {
}
constructor(private readonly userService: UserService) {}

ngOnInit(): void {
this.userService.currentUser().then(value => {
this.userService.currentUser().then((value) => {
setTimeout(() => {
this.logIn = !!(value && value.id);
this.isBusiness = !!(value && value.role !== 'online');
this.isBusiness = !!(value && value.role !== "online");
}, 100);
});
}
Expand Down
20 changes: 9 additions & 11 deletions projects/web/src/componets/mall-filters-drawer.component.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
import {Component, OnInit} from '@angular/core';
import {UserService} from '@smartstocktz/core-libs';
import { Component, OnInit } from "@angular/core";
import { UserService } from "smartstock-core";

@Component({
selector: 'app-mall-filters-drawer',
selector: "app-mall-filters-drawer",
template: `
<div class="filter-drawer">
<mat-toolbar class="filter-container">
<span style="flex: 1 1 auto"></span>
<!-- <button *ngIf="!isLogIn" routerLink="/account/login" mat-button color="primary" class="button">Login</button>-->
<!-- <button *ngIf="!isLogIn" routerLink="/account/register" mat-button color="primary" class="button">Register-->
<!-- </button>-->
<!-- <button *ngIf="!isLogIn" routerLink="/account/login" mat-button color="primary" class="button">Login</button>-->
<!-- <button *ngIf="!isLogIn" routerLink="/account/register" mat-button color="primary" class="button">Register-->
<!-- </button>-->
</mat-toolbar>
</div>
`,
styleUrls: ['../styles/mall-filter.style.scss']
styleUrls: ["../styles/mall-filter.style.scss"]
})

export class MallFiltersDrawerComponent implements OnInit {
isLogIn = true;

constructor(private readonly userService: UserService) {
}
constructor(private readonly userService: UserService) {}

ngOnInit(): void {
this.userService.currentUser().then(value => {
this.userService.currentUser().then((value) => {
this.isLogIn = value && value.id;
});
}
Expand Down
Loading

0 comments on commit 5a40493

Please sign in to comment.