Skip to content

Commit 830e83b

Browse files
authored
feat: firebase integrated
Replace rxdb with firebase to support save color and access is across the devices
1 parent 415a9f5 commit 830e83b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+13252
-17152
lines changed

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
{
1717
"name": "feature/travis-sematic-renovate-setup",
1818
"base": "develop"
19+
},
20+
{
21+
"name": "feature/firebase-integration",
22+
"base": "develop"
1923
}
2024
],
2125
"gitflow4code.releases": [

config.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

config/env.secrets.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ require('dotenv').config();
55

66
const targetPath = `./src/environments/secrets.ts`;
77
const envConfigFile = `
8-
export const githubClientSecret= '${process.env.GITHUB_CLIENT_SECRET}';
9-
export const githubClientID= '${process.env.GITHUB_CLIENT_ID}';
8+
export const githubClientSecret = '${process.env.GITHUB_CLIENT_SECRET}';
9+
export const githubClientID = '${process.env.GITHUB_CLIENT_ID}';
10+
export const firebaseApiKey = '${process.env.FIREBASE_API_KEY}';
1011
`;
1112
writeFile(targetPath, envConfigFile, function(err) {
1213
if (err) {

log.txt

Lines changed: 0 additions & 4817 deletions
This file was deleted.

package.json

Lines changed: 72 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ink-bucket",
3-
"version": "1.0.0",
3+
"version": "0.0.0-development",
44
"main": "main.js",
55
"scripts": {
66
"ng": "ng",
@@ -15,7 +15,6 @@
1515
"lint": "ng lint",
1616
"e2e": "ng e2e",
1717
"commitmsg": "commitlint -e $GIT_PARAMS",
18-
"db": "pouchdb-server --host 0.0.0.0 -p 10101 -m -d /tmp/pouchdb-server/ -n true",
1918
"electron": "electron .",
2019
"electron-build": "ng build --prod && electron .",
2120
"server:prod": "http-server dist/ink-bucket -p 1234 -s -o --cors",
@@ -26,92 +25,94 @@
2625
},
2726
"private": true,
2827
"dependencies": {
29-
"@angular/animations": "6.0.5",
30-
"@angular/cdk": "6.2.1",
31-
"@angular/common": "6.0.5",
32-
"@angular/compiler": "6.0.5",
33-
"@angular/core": "6.0.5",
34-
"@angular/forms": "6.0.5",
35-
"@angular/http": "6.0.5",
36-
"@angular/material": "6.2.1",
37-
"@angular/platform-browser": "6.0.5",
38-
"@angular/platform-browser-dynamic": "6.0.5",
39-
"@angular/pwa": "0.6.8",
40-
"@angular/router": "6.0.5",
41-
"@angular/service-worker": "6.0.5",
28+
"@angular/animations": "6.1.10",
29+
"@angular/cdk": "6.4.7",
30+
"@angular/common": "6.1.10",
31+
"@angular/compiler": "6.1.10",
32+
"@angular/core": "6.1.10",
33+
"@angular/fire": "5.1.0",
34+
"@angular/forms": "6.1.10",
35+
"@angular/http": "6.1.10",
36+
"@angular/material": "6.4.7",
37+
"@angular/platform-browser": "6.1.10",
38+
"@angular/platform-browser-dynamic": "6.1.10",
39+
"@angular/pwa": "0.10.5",
40+
"@angular/router": "6.1.10",
41+
"@angular/service-worker": "6.1.10",
4242
"@auth0/angular-jwt": "2.0.0",
43-
"@ctrl/tinycolor": "2.0.0",
44-
"@ngxs/devtools-plugin": "3.1.4",
45-
"@ngxs/store": "3.1.4",
46-
"@types/nedb": "1.8.5",
47-
"@types/pouchdb-core": "6.4.0",
48-
"@types/pouchdb-find": "6.3.2",
49-
"a-color-picker": "1.0.6",
43+
"@ctrl/tinycolor": "2.2.1",
44+
"@ngxs/devtools-plugin": "3.2.0",
45+
"@ngxs/store": "3.2.0",
46+
"@types/nedb": "1.8.6",
47+
"@types/pouchdb-core": "6.4.3",
48+
"@types/pouchdb-find": "6.3.3",
49+
"a-color-picker": "1.1.4",
5050
"babel-polyfill": "6.26.0",
51-
"bootstrap": "4.1.1",
51+
"bootstrap": "4.1.3",
5252
"core-js": "2.5.7",
5353
"deep-freeze-strict": "1.1.1",
54-
"deepmerge": "2.1.1",
55-
"fuse.js": "3.2.1",
56-
"gun": "0.9.9991",
54+
"deepmerge": "2.2.1",
55+
"firebase": "5.5.8",
56+
"fuse.js": "3.3.0",
57+
"gun": "0.9.99997",
5758
"keypress.js": "2.1.5",
58-
"lodash-es": "4.17.10",
59+
"lodash-es": "4.17.11",
5960
"nedb": "1.8.0",
60-
"ngx-clipboard": "11.1.1",
61-
"ngx-color": "1.5.2",
62-
"ngx-smart-modal": "6.0.3",
63-
"ngx-toastr": "8.8.0",
64-
"pouchdb": "6.4.3",
65-
"pouchdb-adapter-idb": "6.4.3",
66-
"pouchdb-find": "6.4.3",
61+
"ngx-clipboard": "11.1.9",
62+
"ngx-color": "2.0.5",
63+
"ngx-smart-modal": "6.0.4",
64+
"ngx-toastr": "8.10.2",
65+
"pouchdb": "7.0.0",
66+
"pouchdb-adapter-idb": "7.0.0",
67+
"pouchdb-find": "7.0.0",
6768
"pretty-checkbox": "3.0.3",
68-
"relational-pouch": "3.0.1",
69-
"rxdb": "7.6.0",
70-
"rxjs": "6.1.0",
69+
"relational-pouch": "3.1.0",
70+
"rxdb": "7.7.1",
71+
"rxjs": "6.3.3",
7172
"zone.js": "0.8.26"
7273
},
7374
"devDependencies": {
74-
"@angular-devkit/build-angular": "0.6.8",
75-
"@angular/cli": "6.0.8",
76-
"@angular/compiler-cli": "6.0.5",
77-
"@angular/language-service": "6.0.5",
78-
"@commitlint/cli": "6.2.0",
79-
"@commitlint/config-conventional": "6.1.3",
80-
"@commitlint/travis-cli": "6.2.0",
81-
"@semantic-release/changelog": "2.0.2",
82-
"@semantic-release/exec": "2.2.4",
83-
"@semantic-release/git": "5.0.0",
84-
"@semantic-release/github": "4.2.17",
85-
"@types/jasmine": "2.8.8",
86-
"@types/jasminewd2": "2.0.3",
87-
"@types/node": "8.10.20",
75+
"@angular-devkit/build-angular": "0.10.5",
76+
"@angular/cli": "6.2.7",
77+
"@angular/compiler-cli": "6.1.10",
78+
"@angular/language-service": "6.1.10",
79+
"@commitlint/cli": "7.2.1",
80+
"@commitlint/config-conventional": "7.1.2",
81+
"@commitlint/travis-cli": "7.2.1",
82+
"@semantic-release/changelog": "2.1.2",
83+
"@semantic-release/exec": "2.3.0",
84+
"@semantic-release/git": "6.0.2",
85+
"@semantic-release/github": "4.4.2",
86+
"@types/jasmine": "2.8.11",
87+
"@types/jasminewd2": "2.0.6",
88+
"@types/node": "8.10.37",
8889
"@types/pouchdb": "6.3.2",
8990
"babel-core": "6.26.3",
90-
"babel-jest": "23.0.1",
91-
"codelyzer": "4.3.0",
92-
"conventional-changelog": "2.0.1",
93-
"dotenv": "5.0.1",
94-
"electron": "2.0.2",
95-
"github-release-notes": "0.16.0",
91+
"babel-jest": "23.6.0",
92+
"codelyzer": "4.5.0",
93+
"conventional-changelog": "2.0.3",
94+
"dotenv": "6.1.0",
95+
"electron": "2.0.13",
96+
"github-release-notes": "0.17.0",
9697
"husky": "0.14.3",
97-
"jest": "23.1.0",
98-
"jest-preset-angular": "5.2.2",
99-
"pouchdb-adapter-http": "6.4.3",
100-
"pouchdb-server": "4.0.1",
101-
"protractor": "5.3.2",
102-
"release-it": "7.4.7",
103-
"semantic-release": "15.5.4",
104-
"stylelint": "9.3.0",
98+
"jest": "23.6.0",
99+
"jest-preset-angular": "5.2.3",
100+
"pouchdb-adapter-http": "7.0.0",
101+
"pouchdb-server": "4.1.0",
102+
"protractor": "5.4.1",
103+
"release-it": "7.6.3",
104+
"semantic-release": "15.11.0",
105+
"stylelint": "9.8.0",
105106
"stylelint-config-recommended-scss": "3.2.0",
106-
"stylelint-scss": "3.1.3",
107-
"travis-deploy-once": "5.0.0",
108-
"ts-node": "5.0.1",
109-
"tslint": "5.10.0",
107+
"stylelint-scss": "3.4.0",
108+
"travis-deploy-once": "5.0.9",
109+
"ts-node": "7.0.1",
110+
"tslint": "5.11.0",
110111
"typescript": "2.9.2",
111112
"validate-npm-package-name": "3.0.0",
112-
"write": "^1.0.3"
113+
"write": "1.0.3"
113114
},
114115
"engines": {
115-
"npm": "5.10.0"
116+
"npm": "6.4.1"
116117
}
117118
}

src/app/ink.component.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, OnInit, NgZone } from '@angular/core';
1+
import { Component } from '@angular/core';
22

33
@Component({
44
selector: 'inkapp-root',
@@ -7,7 +7,4 @@ import { Component, OnInit, NgZone } from '@angular/core';
77
<router-outlet></router-outlet>
88
`
99
})
10-
export class InkApp implements OnInit {
11-
constructor() {}
12-
ngOnInit() {}
13-
}
10+
export class InkApp {}

src/app/ink.config.ts

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,12 @@
1-
export const DB_CONFIG = {
2-
name: 'inkdb',
3-
adapter: 'idb',
4-
password: 'supercoolpassword',
5-
multiInstance: true
6-
};
7-
8-
export const DB_REMOTE_SYNC_URL = `http://${window.location.hostname}:10101/`;
9-
101
export const BOARD_DEFAULT_NAME = 'Beautiful';
112
export const BOARD_DEFAULT_DESC = 'Default Board';
123

13-
export const DEFAULT_BUCKET_NAME = `Bucket #`;
14-
15-
export const GITHUB_ACCESS_TOKEN_NAME = 'inkapp_access_token';
16-
export const GIST_NAME = 'INKAPP :: SYNC SETTINGS';
4+
export const BUCKET_DEFAULT_NAME = `Bucket #`;
175

186
export const DEFAULT_COLOR = '#ffffff';
19-
207
export const DEFAULT_SETTINGS = [
218
{
229
key: 'view',
2310
value: 'default'
24-
},
25-
{
26-
key: 'gist',
27-
value: null
2811
}
2912
];

src/app/ink.module.ts

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,41 @@
1+
import { OverlayModule } from '@angular/cdk/overlay';
2+
import { HttpClientModule } from '@angular/common/http';
13
import { NgModule } from '@angular/core';
4+
import { AngularFireModule } from '@angular/fire';
5+
import { AngularFireAuthModule } from '@angular/fire/auth';
6+
import { AngularFirestoreModule } from '@angular/fire/firestore';
27
import { FormsModule } from '@angular/forms';
3-
import { HttpClientModule } from '@angular/common/http';
48
import { BrowserModule } from '@angular/platform-browser';
5-
import { NgxsModule } from '@ngxs/store';
6-
import { JwtModule } from '@auth0/angular-jwt';
7-
import { ClipboardModule } from 'ngx-clipboard';
8-
import { NgxsReduxDevtoolsPluginModule } from '@ngxs/devtools-plugin';
9-
import { OverlayModule } from '@angular/cdk/overlay';
109
import { ServiceWorkerModule } from '@angular/service-worker';
1110
import { BoardComponent, BucketComponent, DropComponent, HeaderComponent } from '@lib/components';
12-
import { ActionItemElement, EditableTitleElement, UserCardElement, BillboardElement } from '@lib/elements';
13-
import { ExportPage, HomePage, NotFoundPage, RedirectPage, SettingsPage } from './pages';
14-
import { BoardsState, BucketsState, DropsState, SettingsState } from '@lib/store/states';
15-
import { InkApp } from './ink.component';
11+
import { ActionItemElement, BillboardElement, EditableTitleElement } from '@lib/elements';
1612
import { ColorModule } from '@lib/modules/color/color.module';
17-
import { RoutingModule } from './ink.routing';
13+
import { BoardsState, BucketsState, DropsState, SettingsState, UserState } from '@lib/store/states';
14+
import { NgxsReduxDevtoolsPluginModule } from '@ngxs/devtools-plugin';
15+
import { NgxsModule } from '@ngxs/store';
16+
import { ClipboardModule } from 'ngx-clipboard';
1817
import { environment } from '../environments/environment';
19-
import { GITHUB_ACCESS_TOKEN_NAME } from './ink.config';
20-
21-
export function tokenGetter() {
22-
return localStorage.getItem(GITHUB_ACCESS_TOKEN_NAME);
23-
}
18+
import { InkApp } from './ink.component';
19+
import { RoutingModule } from './ink.routing';
20+
import { ExportPage, HomePage, NotFoundPage, RedirectPage, SettingsPage } from './pages';
2421

2522
export const MODULES = [
2623
BrowserModule,
2724
RoutingModule,
2825
HttpClientModule,
2926
FormsModule,
30-
NgxsModule.forRoot([SettingsState, BoardsState, BucketsState, DropsState]),
27+
AngularFireModule.initializeApp(environment.firebase),
28+
AngularFireAuthModule,
29+
AngularFirestoreModule,
30+
NgxsModule.forRoot([UserState, SettingsState, BoardsState, BucketsState, DropsState]),
3131
NgxsReduxDevtoolsPluginModule.forRoot(),
3232
ColorModule,
3333
ClipboardModule,
3434
OverlayModule,
35-
ServiceWorkerModule.register('/ngsw-worker.js', { enabled: environment.production }),
36-
JwtModule.forRoot({
37-
config: {
38-
tokenGetter: tokenGetter,
39-
whitelistedDomains: ['api.github.com']
40-
}
41-
})
35+
ServiceWorkerModule.register('/ngsw-worker.js', { enabled: environment.production })
4236
];
4337
export const COMPONENTS = [InkApp, HeaderComponent, BoardComponent, BucketComponent, DropComponent];
44-
export const ELEMENTS = [ActionItemElement, EditableTitleElement, UserCardElement, BillboardElement];
38+
export const ELEMENTS = [ActionItemElement, EditableTitleElement, BillboardElement];
4539
export const PAGES = [HomePage, SettingsPage, ExportPage, RedirectPage, NotFoundPage];
4640

4741
@NgModule({

src/app/ink.routing.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { NgModule } from '@angular/core';
2-
import { Routes, RouterModule } from '@angular/router';
3-
import { NotFoundPage, RedirectPage, ExportPage, SettingsPage, HomePage } from '@root/pages';
2+
import { RouterModule, Routes } from '@angular/router';
3+
import { ExportPage, HomePage, NotFoundPage, RedirectPage, SettingsPage } from '@root/pages';
44

55
const routes: Routes = [
66
{ path: '', component: HomePage },
Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
import { Component, OnInit, Input } from '@angular/core';
2-
import { Store, Select } from '@ngxs/store';
3-
import { Observable } from 'rxjs';
4-
import { map, filter, tap } from 'rxjs/operators';
5-
import { InkBoardMeta, InkBucketMeta, InkBuckets, InkAppSettings, InkAppSettingsItem } from '@lib/models';
6-
import { InkBucketsService } from '@lib/services';
7-
import { BucketsState, SettingsState } from '@store/states';
1+
import { Component, Input, OnInit } from '@angular/core';
2+
import { InkBoardMeta, InkBuckets } from '@lib/models';
83
import { children } from '@lib/operators';
4+
import { Select, Store } from '@ngxs/store';
5+
import { BUCKET_DEFAULT_NAME } from '@root/ink.config';
96
import { CreateBucket } from '@store/actions';
10-
import { DEFAULT_BUCKET_NAME } from '@root/ink.config';
7+
import { SettingsState } from '@store/states';
8+
import { Observable } from 'rxjs';
119

1210
@Component({
1311
selector: 'inkapp-board',
@@ -20,10 +18,10 @@ export class BoardComponent implements OnInit {
2018
constructor(private _store: Store) {}
2119

2220
ngOnInit() {
23-
this.buckets$ = this._store.select(s => s.buckets).pipe(children(this.data._id, 'boardId'));
21+
this.buckets$ = this._store.select(s => s.buckets).pipe(children(this.data.id, 'boardId'));
2422
}
2523

2624
createBucket() {
27-
this._store.dispatch(new CreateBucket({ name: DEFAULT_BUCKET_NAME, boardId: this.data._id }));
25+
this._store.dispatch(new CreateBucket({ name: BUCKET_DEFAULT_NAME, boardId: this.data.id}));
2826
}
2927
}

src/app/library/components/bucket/bucket.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
</inkapp-editable-title-el>
33
<div class="d-flex flex-wrap">
44
<ng-container *ngFor="let color of drops$|async as drops">
5-
<inkapp-drop [data]="color" [bucketId]="data._id"></inkapp-drop>
5+
<inkapp-drop [data]="color" [bucketId]="data.id"></inkapp-drop>
66
</ng-container>
77
<span class="ink-color-sticker -empty" (click)="newDrop()">
88
<div class="ink-color">
@@ -12,4 +12,4 @@
1212
Add new
1313
</div>
1414
</span>
15-
</div>
15+
</div>

0 commit comments

Comments
 (0)