diff --git a/.vscode/launch.json b/.vscode/launch.json
index 6545395..59da6a4 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -6,7 +6,7 @@
"type": "firefox",
"request": "launch",
"reAttach": true,
- "url": "http://localhost:4200/",
+ "url": "http://127.0.0.1:4200/",
"pathMappings": [
{
"url": "webpack:///projects/budgetkey/src/",
diff --git a/Dockerfile b/Dockerfile
index 68740dd..0e644fc 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -21,4 +21,6 @@ RUN npm install
COPY --from=build /app/dist dist
+ENV NODE_ENV=production
+
ENTRYPOINT [ "node", "/app/dist/budgetkey/server/main.js" ]
diff --git a/angular.json b/angular.json
index c842db9..dba615e 100644
--- a/angular.json
+++ b/angular.json
@@ -89,7 +89,10 @@
"browserTarget": "budgetkey:build:development"
}
},
- "defaultConfiguration": "development"
+ "defaultConfiguration": "development",
+ "options": {
+ "host": "127.0.0.1"
+ }
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
diff --git a/projects/budgetkey/src/app/about/about.module.ts b/projects/budgetkey/src/app/about/about.module.ts
index e92cdb2..c7903d6 100644
--- a/projects/budgetkey/src/app/about/about.module.ts
+++ b/projects/budgetkey/src/app/about/about.module.ts
@@ -5,6 +5,7 @@ import { AboutRoutingModule } from './about-routing.module';
import { AboutPageComponent } from './about-page/about-page.component';
import { CommonComponentsModule } from '../common-components/common-components.module';
import { HttpClientModule } from '@angular/common/http';
+import { ListComponentsModule } from '../list-components/list-components.module';
@NgModule({
@@ -14,6 +15,7 @@ import { HttpClientModule } from '@angular/common/http';
imports: [
CommonModule,
CommonComponentsModule,
+ ListComponentsModule,
HttpClientModule,
AboutRoutingModule
]
diff --git a/projects/budgetkey/src/app/app-routing.module.ts b/projects/budgetkey/src/app/app-routing.module.ts
index f2fcac9..9fab5b6 100644
--- a/projects/budgetkey/src/app/app-routing.module.ts
+++ b/projects/budgetkey/src/app/app-routing.module.ts
@@ -8,6 +8,7 @@ const routes: Routes = [
{ path: 'i', loadChildren: () => import('./item/item.module').then(m => m.ItemModule) },
{ path: 'about', loadChildren: () => import('./about/about.module').then(m => m.AboutModule) },
{ path: 'p', loadChildren: () => import('./profile/profile.module').then(m => m.ProfileModule) },
+ { path: 'l', loadChildren: () => import('./list-page/list-page.module').then(m => m.ListPageModule) },
{ path: 'not-found', component: PageNotFoundComponent },
{ path: '**', pathMatch: 'full', component: PageNotFoundComponent },
];
@@ -16,6 +17,7 @@ const routes: Routes = [
imports: [RouterModule.forRoot(routes, {
initialNavigation: 'enabledBlocking',
anchorScrolling: 'enabled',
+ // enableTracing: true,
})],
exports: [RouterModule]
})
diff --git a/projects/budgetkey/src/app/app.module.ts b/projects/budgetkey/src/app/app.module.ts
index b802da8..956fe7f 100644
--- a/projects/budgetkey/src/app/app.module.ts
+++ b/projects/budgetkey/src/app/app.module.ts
@@ -7,6 +7,9 @@ import { CommonComponentsModule } from './common-components/common-components.mo
import { NGX_SEO_CONFIG_TOKEN, NgxSeoModule } from '@avivharuzi/ngx-seo';
import { PageNotFoundComponent } from './page-not-found/page-not-found.component';
import { AppErrorHandler } from './app-error-handler';
+import { ListComponentsModule } from './list-components/list-components.module';
+import { provideRouter, withDebugTracing } from '@angular/router';
+import { ListPageModule } from './list-page/list-page.module';
@NgModule({
declarations: [
@@ -17,11 +20,13 @@ import { AppErrorHandler } from './app-error-handler';
BrowserModule,
AppRoutingModule,
CommonComponentsModule,
+ ListComponentsModule,
NgxSeoModule.forRoot(),
+ ListPageModule,
],
providers: [
provideClientHydration(),
- {provide: ErrorHandler, useClass: AppErrorHandler},
+ // {provide: ErrorHandler, useClass: AppErrorHandler},
{provide: NGX_SEO_CONFIG_TOKEN, useValue: {
changeTitle: (title: any) => title,
preserve: true,
diff --git a/projects/budgetkey/src/app/charts/chart-plotly/chart-plotly.component.ts b/projects/budgetkey/src/app/charts/chart-plotly/chart-plotly.component.ts
index 6062054..4393768 100644
--- a/projects/budgetkey/src/app/charts/chart-plotly/chart-plotly.component.ts
+++ b/projects/budgetkey/src/app/charts/chart-plotly/chart-plotly.component.ts
@@ -60,7 +60,6 @@ export class ChartPlotlyComponent implements OnChanges, AfterViewInit {
}
el.innerHTML = '';
- console.log('plotly new plot', this.data, layout, this.config);
this.plotly.newPlot(el, this.data, layout, Object.assign({responsive: true}, this.config));
el.querySelectorAll('svg').forEach((svg) => {
svg.setAttribute('alt', this.data.title || 'diagram');
diff --git a/projects/budgetkey/src/app/common-components/auth/auth.component.html b/projects/budgetkey/src/app/common-components/auth/auth.component.html
index d1d2b74..a8f4aa3 100644
--- a/projects/budgetkey/src/app/common-components/auth/auth.component.html
+++ b/projects/budgetkey/src/app/common-components/auth/auth.component.html
@@ -16,8 +16,9 @@
diff --git a/projects/budgetkey/src/app/common-components/auth/auth.component.less b/projects/budgetkey/src/app/common-components/auth/auth.component.less
index deb48d1..36de826 100644
--- a/projects/budgetkey/src/app/common-components/auth/auth.component.less
+++ b/projects/budgetkey/src/app/common-components/auth/auth.component.less
@@ -46,7 +46,7 @@
background-color: #FFFFFF;
box-shadow: 0 2px 10px 0 rgba(0,0,0,0.1);
display: none;
- z-index: 10;
+ z-index: 100;
}
.widget:hover .menu, .widget:focus-within .menu {
diff --git a/projects/budgetkey/src/app/common-components/auth/auth.component.ts b/projects/budgetkey/src/app/common-components/auth/auth.component.ts
index 27d6dff..5cf68c2 100644
--- a/projects/budgetkey/src/app/common-components/auth/auth.component.ts
+++ b/projects/budgetkey/src/app/common-components/auth/auth.component.ts
@@ -1,34 +1,36 @@
import {
+ AfterViewInit,
Component, Input, OnInit
} from '@angular/core';
import { AuthService } from './auth.service';
import { Observable } from 'rxjs';
import { PlatformService } from '../platform.service';
+import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
+import { Router } from '@angular/router';
+import { ListsService } from '../services/lists.service';
-
+@UntilDestroy()
@Component({
selector: 'app-auth',
templateUrl: './auth.component.html',
styleUrls: ['./auth.component.less']
})
-export class AuthComponent implements OnInit {
+export class AuthComponent implements AfterViewInit {
public user: any;
- private next: string;
@Input() theme: any;
- constructor(private auth: AuthService, private ps: PlatformService) {}
-
- ngOnInit() {
- this.ps.browser(() => {
- this.next = document.location.href;
- this.setUser(this.auth.check(this.next));
+ constructor(private auth: AuthService, private ps: PlatformService, private router: Router, public lists: ListsService) {
+ this.auth.getUser().pipe(
+ untilDestroyed(this)
+ ).subscribe((user) => {
+ this.user = user;
});
}
- setUser(o: Observable) {
- o.subscribe((user: any) => {
- this.user = user;
+ ngAfterViewInit() {
+ this.ps.browser(() => {
+ this.auth.check().subscribe();
});
}
@@ -36,11 +38,10 @@ export class AuthComponent implements OnInit {
if (this.user && this.user.providers) {
const href = this.user.providers.google || this.user.providers.github;
if (href && href.url) {
- if (document.location.href === this.next) {
+ if (document.location.href === this.auth.getNext()) {
window.location.href = href.url;
} else {
- this.next = document.location.href;
- this.auth.check(this.next)
+ this.auth.check()
.subscribe((user) => {
this.user = user;
this.login();
@@ -51,16 +52,22 @@ export class AuthComponent implements OnInit {
}
logout() {
- this.auth.logout(document.location.href);
+ this.auth.logout().subscribe((user) => {
+ console.log('logged out!');
+ });
}
+ get hasProfile() {
+ return this.auth?.authConfig?.profilePagePath || null;
+ }
+
profile() {
if (this.auth.authConfig.profilePagePath) {
- let params = '';
- if (this.theme && this.theme.themeId) {
- params = '?theme=' + this.theme.themeId;
- }
- window.location.href = this.auth.authConfig.profilePagePath + params;
+ this.router.navigate(this.auth.authConfig.profilePagePath, { queryParamsHandling: 'preserve' });
}
}
+
+ myLists() {
+ this.router.navigate(['/l', this.user.profile.id], { queryParamsHandling: 'preserve' });
+ }
}
diff --git a/projects/budgetkey/src/app/common-components/auth/auth.service.ts b/projects/budgetkey/src/app/common-components/auth/auth.service.ts
index aa9bb65..9899677 100644
--- a/projects/budgetkey/src/app/common-components/auth/auth.service.ts
+++ b/projects/budgetkey/src/app/common-components/auth/auth.service.ts
@@ -1,7 +1,9 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
-import { Observable, ReplaySubject, tap } from 'rxjs';
+import { Observable, ReplaySubject, tap, timer } from 'rxjs';
import { filter, first, switchMap } from 'rxjs/operators';
+import { Location } from '@angular/common';
+import { PlatformService } from '../platform.service';
@Injectable()
export class AuthService {
@@ -10,15 +12,16 @@ export class AuthService {
private jwtQueryParam: string;
private user = new ReplaySubject();
private jwt = new ReplaySubject();
+ private next: string | null = null;
public authConfig = {
authServerUrl: 'https://next.obudget.org',
jwtLocalStorageKey: 'jwt',
jwtQueryParam: 'jwt',
- profilePagePath: '/p/'
+ profilePagePath: ['/p']
};
- constructor(private http: HttpClient) {
+ constructor(private http: HttpClient, private platform: PlatformService) {
this.authServerUrl = this.authConfig.authServerUrl;
this.jwtLocalStorageKey = this.authConfig.jwtLocalStorageKey;
this.jwtQueryParam = this.authConfig.jwtQueryParam;
@@ -78,30 +81,41 @@ export class AuthService {
return this.jwt;
}
- check(next: string): Observable {
+ public getNext(): string | null {
+ return this.next;
+ }
+
+ check(next_?: string): Observable {
+ const next = next_ || window.location.href;
const jwt = this.resolveToken();
+ const headers: any = {};
if (jwt) {
this.setToken(jwt);
+ headers['auth-token'] = jwt;
}
return this.http
- .get(this.authServerUrl + '/auth/check?jwt=' + (jwt ? jwt : '') + '&next=' + encodeURIComponent(next))
+ .get(`${this.authServerUrl}/auth/check?next=${encodeURIComponent(next)}`, { headers })
.pipe(
- tap((user) => this.user.next(user)),
+ tap((user) => {
+ this.next = next;
+ this.user.next(user);
+ }),
);
}
- logout(next: string): Observable {
+ logout(): Observable {
this.deleteToken();
- return this.check(next);
+ return this.check();
}
permission(service: string): Observable {
return this.jwt
.pipe(
filter((token) => token !== null),
- switchMap((token) =>
- this.http.get(this.authServerUrl + '/auth/authorize?service=' + service + '&jwt=' + token)
- ),
+ switchMap((token) => {
+ const headers = { 'auth-token': token };
+ return this.http.get(`${this.authServerUrl}/auth/authorize?service=${service}`, { headers });
+ }),
first()
);
}
diff --git a/projects/budgetkey/src/app/common-components/bk-tooltip.less b/projects/budgetkey/src/app/common-components/bk-tooltip.less
index 505e96b..dca9649 100644
--- a/projects/budgetkey/src/app/common-components/bk-tooltip.less
+++ b/projects/budgetkey/src/app/common-components/bk-tooltip.less
@@ -1,3 +1,5 @@
+@import '../../common.less';
+
.bk-tooltip-anchor {
position: relative;
display: inline;
@@ -8,21 +10,31 @@
span.bk-tooltip {
position: absolute;
display: none;
- width: 300px;
+ width: max-content;
+ max-width: 300px;
color: #FFFFFF;
- background: #434343;
+ background: @color-gray-700;
line-height: 18px;
- text-align: center;
visibility: hidden;
- border-radius: 3px;
+ border-radius: 4px;
+
+ text-align: right;
font-size: 14px;
+ line-height: 17x;
font-weight: 300;
- padding: 10px;
- text-align: justify;
- font-family: "Abraham TRIAL", "Alef Hebrew", "Helvetica Neue", Helvetica, Arial, sans-serif !important;
+
+ &.bk-bigger {
+ text-align: center;
+ font-size: 16px;
+ line-height: 20px;
+ font-weight: 400;
+ }
+ padding: 4px 8px;
+
+ .font-abraham;
@media only screen and (max-width: 600px) {
- width: 150px;
+ max-width: 150px;
font-size: 10px;
line-height: 12px;
padding: 5px;
@@ -31,11 +43,10 @@
&:after {
content: '';
position: absolute;
- bottom: 100%;
- left: 95%;
- margin-left: -5px;
+ top: -5px;
+ right: 5px;
width: 0; height: 0;
- border-bottom: 5px solid #434343;
+ border-bottom: 5px solid @color-gray-700;
border-right: 5px solid transparent;
border-left: 5px solid transparent;
@@ -46,26 +57,37 @@
&.bk-align-left {
&:after {
- left: 5%;
+ left: 5px;
+ right: auto;
}
}
+ &.bk-align-top {
+ &:after {
+ bottom: -5px;
+ top: auto;
+ transform: rotate(180deg);
+ }
+ }
}
&:hover .bk-tooltip {
visibility: visible;
display: inherit;
- top: ~"calc(100% + 5px)";
- left: 50%;
- margin-left: -280px;
+ bottom: -4px;
+ right: calc(50% ~'-' 10px);
+ transform: translateY(100%);
z-index: 999;
- @media only screen and (max-width: 600px) {
- margin-left: -75px;
+ &.bk-align-left {
+ left: 4px;
+ right: auto;
}
- &.bk-align-left {
- margin-left: -10px;
+ &.bk-align-top {
+ top: -4px;
+ bottom: auto;
+ transform: translateY(-100%);
}
}
@@ -76,8 +98,8 @@
position: relative;
}
- &.img:hover .bk-tooltip {
- top: ~"calc(100% + 0.75em)";
- left: ~"calc(50% - 0.32em)";
- }
+ // &.img:hover .bk-tooltip {
+ // top: ~"calc(100% + 0.75em)";
+ // left: ~"calc(50% - 0.32em)";
+ // }
}
\ No newline at end of file
diff --git a/projects/budgetkey/src/app/common-components/common-components.module.ts b/projects/budgetkey/src/app/common-components/common-components.module.ts
index 64fc633..a8bddf1 100644
--- a/projects/budgetkey/src/app/common-components/common-components.module.ts
+++ b/projects/budgetkey/src/app/common-components/common-components.module.ts
@@ -2,7 +2,6 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
-import { AppContainerComponent } from './components/app-container/app-container.component';
import { BkHeaderComponent } from './components/header/bk-header.component';
import { BkFooterComponent } from './components/footer/bk-footer.component';
import { BkSearchBar } from './components/searchbar/bk-search-bar.component';
@@ -20,6 +19,8 @@ import { AuthComponent } from './auth/auth.component';
import { AuthService } from './auth/auth.service';
import { RouterModule } from '@angular/router';
import { SeoService } from './seo.service';
+import { LayoutService } from './layout.service';
+import { WindowService } from './window.service';
/**
* Created by adam on 27/12/2016.
@@ -32,7 +33,6 @@ import { SeoService } from './seo.service';
RouterModule
],
declarations: [
- AppContainerComponent,
BkHeaderComponent,
BkFooterComponent,
BkSearchBar,
@@ -41,17 +41,18 @@ import { SeoService } from './seo.service';
BkSubscriptionManager,
ModalComponent,
ClickOnReturnDirective,
- AuthComponent
+ AuthComponent,
],
providers: [
ListsService,
GlobalSettingsService,
PlatformService,
AuthService,
- SeoService
+ SeoService,
+ LayoutService,
+ WindowService
],
exports: [
- AppContainerComponent,
BkHeaderComponent,
BkFooterComponent,
BkSearchBar,
diff --git a/projects/budgetkey/src/app/common-components/common.less b/projects/budgetkey/src/app/common-components/common.less
deleted file mode 100644
index edd0169..0000000
--- a/projects/budgetkey/src/app/common-components/common.less
+++ /dev/null
@@ -1,4 +0,0 @@
-@headerHeight: 56px;
-@footerHeight: 333px;
-
-@textColor: #3C4948;
diff --git a/projects/budgetkey/src/app/common-components/components/app-container/app-container.component.html b/projects/budgetkey/src/app/common-components/components/app-container/app-container.component.html
deleted file mode 100644
index 2dcb2f8..0000000
--- a/projects/budgetkey/src/app/common-components/components/app-container/app-container.component.html
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
diff --git a/projects/budgetkey/src/app/common-components/components/app-container/app-container.component.less b/projects/budgetkey/src/app/common-components/components/app-container/app-container.component.less
deleted file mode 100644
index 148268c..0000000
--- a/projects/budgetkey/src/app/common-components/components/app-container/app-container.component.less
+++ /dev/null
@@ -1,24 +0,0 @@
-@import '../../common.less';
-
-:host {
- display: flex;
- flex-flow: column;
- min-height: 100vh;
-
- app-bk-header {
- flex: 0 0 auto;
- }
-
- .app {
- flex: 1 0 auto;
- direction: rtl;
- min-height: ~"calc(100vh - 333px - 64px)";
- margin-top: 9px; //calc(9 - @headerHeight);
- margin-bottom: 6px;
- width: 100%;
- display: flex;
- flex-flow: column;
- align-items: center;
- }
-
-}
\ No newline at end of file
diff --git a/projects/budgetkey/src/app/common-components/components/app-container/app-container.component.ts b/projects/budgetkey/src/app/common-components/components/app-container/app-container.component.ts
deleted file mode 100644
index 5e6af6e..0000000
--- a/projects/budgetkey/src/app/common-components/components/app-container/app-container.component.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-import { HttpClient } from '@angular/common/http';
-import {Component, ViewEncapsulation, Input} from '@angular/core';
-import { ActivatedRoute } from '@angular/router';
-import { GlobalSettingsService } from '../../global-settings.service';
-import { distinct, distinctUntilChanged, map, switchMap } from 'rxjs';
-import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
-import { PlatformService } from '../../platform.service';
-
-@UntilDestroy()
-@Component({
- selector: 'app-container',
- templateUrl: './app-container.component.html',
- styleUrls: ['./app-container.component.less'],
-})
-export class AppContainerComponent {
- @Input() showHeader = true;
- @Input() showFooter = true;
- @Input() showSearchBar = false;
- @Input() showLanguages = false;
- @Input() helpWidget = true;
-
- configured = false;
-
- constructor(private http: HttpClient, private route: ActivatedRoute, private globalSettings: GlobalSettingsService, private ps: PlatformService) {
- globalSettings.ready.subscribe(() => {
- this.configured = true;
- });
- globalSettings.init(this, route);
- }
-}
diff --git a/projects/budgetkey/src/app/common-components/components/header/bk-header.component.html b/projects/budgetkey/src/app/common-components/components/header/bk-header.component.html
index dea0f49..6b26e31 100644
--- a/projects/budgetkey/src/app/common-components/components/header/bk-header.component.html
+++ b/projects/budgetkey/src/app/common-components/components/header/bk-header.component.html
@@ -1,13 +1,14 @@