Skip to content

Commit 6fd994c

Browse files
committed
feat(wip): design changes
theme, color, layout updated rename of bucket implemented
1 parent 339ba42 commit 6fd994c

18 files changed

+996
-28
lines changed

log.txt

Lines changed: 866 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
<ng-container>
2-
<h4>{{data.name}}</h4>
3-
<ng-container *ngFor="let bucket of buckets|async">
4-
<inkapp-bucket [bucketData]="bucket"></inkapp-bucket>
5-
</ng-container>
1+
<!-- <h4>{{data.name}}</h4> -->
2+
<ng-container *ngFor="let bucket of buckets|async; index as i">
3+
<inkapp-bucket [bucketData]="bucket" [index]="i+1"></inkapp-bucket>
64
</ng-container>

src/app/components/board/board.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class BoardComponent implements OnInit {
1515
@Input() data: InkBoardMeta;
1616
constructor(private _store: Store, private _bucketService: BucketService) {}
1717

18-
ngOnInit() {
18+
ngOnInit() {
1919
this.buckets = this._store
2020
.select(s => s.bucket)
2121
.pipe(map(buckets => buckets.filter(s => s.boardId === this.data._id)));

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<h3>{{bucketData.name}}</h3>
1+
<inkapp-magic-title [title]="bucketData.name" (changed)="onTitleChange($event)">
2+
#{{index}}
3+
</inkapp-magic-title>
24
<div class="d-flex flex-wrap">
35
<ng-container *ngFor="let color of ink|async">
46
<inkapp-ink [inkData]="color"></inkapp-ink>

src/app/components/bucket/bucket.component.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,30 @@ import { InkBucket, Ink, InkBucketMeta } from '../../models';
44
import { Observable } from 'rxjs';
55
import { filter, tap, map } from 'rxjs/operators';
66
import { AddNewInk } from '../../store/actions/ink.action';
7+
import { BucketService } from '../../services/bucket.service';
8+
import { ENETDOWN } from 'constants';
9+
import { RenameBucket } from '../../store/actions/bucket.action';
710

811
@Component({
912
selector: 'inkapp-bucket',
1013
templateUrl: './bucket.component.html',
1114
styles: []
1215
})
1316
export class BucketComponent implements OnInit {
14-
@Input() boardId: number;
17+
@Input() index: number;
1518
@Input() bucketData: InkBucketMeta;
1619
ink: Observable<Ink>;
17-
constructor(private store: Store) {
18-
this.ink = this.store.select(s => s.ink).pipe(map(x => x.filter(y => y.bucketId === this.bucketData.id)));
20+
constructor(private _store: Store, private _bucketService: BucketService) {
21+
this.ink = this._store.select(s => s.ink).pipe(map(x => x.filter(y => y.bucketId === this.bucketData._id)));
1922
}
2023

2124
ngOnInit() {}
2225
addNewInk() {
23-
this.store.dispatch(new AddNewInk({ bucketId: this.bucketData.id, value: '#fff', meta: {} }));
26+
this._store.dispatch(new AddNewInk({ bucketId: this.bucketData._id, value: '#fff', meta: {} }));
27+
}
28+
onTitleChange(newTitle) {
29+
this._bucketService.changeBucketName(this.bucketData._id, newTitle).then(bucket => {
30+
this._store.dispatch(new RenameBucket(this.bucketData._id, bucket.name));
31+
});
2432
}
2533
}

src/app/components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ export { PromptComponent } from './prompt/prompt.component';
55
export { ColorPickerComponent } from './color-picker/color-picker.component';
66
export { ColorFormComponent } from './color-form/color-form.component';
77
export { InkComponent } from './ink/ink.component';
8+
export { MagicTitleComponent } from './magic-title/magic-title.component';
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<ng-container *ngIf="!editable else editableTpl">
2+
<h5>
3+
<span>
4+
<ng-content></ng-content>
5+
</span> {{title}}</h5>
6+
</ng-container>
7+
<ng-template #editableTpl>
8+
<input type="text" class="form-control" [(ngModel)]="newTitle" (keyup.enter)="done()" (keyup.esc)="cancel()">
9+
</ng-template>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { Component, OnInit, EventEmitter, Output, Input, HostListener } from '@angular/core';
2+
3+
@Component({
4+
selector: 'inkapp-magic-title',
5+
templateUrl: 'magic-title.component.html'
6+
})
7+
export class MagicTitleComponent implements OnInit {
8+
@Output() changed: EventEmitter<string> = new EventEmitter<string>();
9+
@Input() title: string;
10+
editable = false;
11+
newTitle: string;
12+
constructor() {}
13+
14+
ngOnInit() {
15+
this.newTitle = this.title;
16+
}
17+
18+
@HostListener('dblclick', ['$event.target'])
19+
onDblClick(e) {
20+
this.editable = true;
21+
}
22+
23+
done() {
24+
this.editable = false;
25+
this.changed.emit(this.newTitle);
26+
}
27+
cancel() {
28+
this.editable = false;
29+
this.newTitle = this.title;
30+
}
31+
}

src/app/components/navbar/navbar.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<nav class="navbar navbar-expand-lg navbar-light bg-transparent">
1+
<nav class="navbar navbar-expand-lg mb-5 navbar-dark bg-primary ink-header">
22
<div class="container">
33
<a class="navbar-brand" href="#">InkBucket</a>
44
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"

src/app/ink.module.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { NgModule } from '@angular/core';
2+
import { FormsModule } from '@angular/forms';
23
import { BrowserModule } from '@angular/platform-browser';
34
import { NgxsModule } from '@ngxs/store';
45
import { NgxsReduxDevtoolsPluginModule } from '@ngxs/devtools-plugin';
@@ -9,7 +10,8 @@ import {
910
ColorPickerComponent,
1011
InkComponent,
1112
NavbarComponent,
12-
PromptComponent
13+
PromptComponent,
14+
MagicTitleComponent
1315
} from './components';
1416
import { InkApp } from './ink.component';
1517
import { RoutingModule } from './ink.routing';
@@ -22,6 +24,7 @@ import { OverlayModule } from '@angular/cdk/overlay';
2224

2325
export const MODULES = [
2426
RoutingModule,
27+
FormsModule,
2528
NgxsModule.forRoot([SettingsState, BucketState, BoardState, InkState]),
2629
NgxsReduxDevtoolsPluginModule.forRoot(),
2730
ColorModule,
@@ -35,7 +38,8 @@ export const COMPONENTS = [
3538
PromptComponent,
3639
ColorPickerComponent,
3740
ColorFormComponent,
38-
InkComponent
41+
InkComponent,
42+
MagicTitleComponent
3943
];
4044
export const PAGES = [HomePage, SettingsPage];
4145

src/app/services/bucket.service.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,19 @@ export class BucketService {
2020
const db = await this._db.getDatabase();
2121
return db.bucket.find({ boardId }).exec();
2222
}
23+
24+
async changeBucketName(bucketId: string, newName: string) {
25+
const db = await this._db.getDatabase();
26+
return db.bucket
27+
.findOne(bucketId)
28+
.update({
29+
$set: {
30+
name: newName
31+
}
32+
})
33+
.catch(error => {
34+
console.error('Error while updating bucket name');
35+
return null;
36+
});
37+
}
2338
}

src/app/store/actions/bucket.action.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,8 @@ export class LoadBuckets {
1313
static readonly type = '[Bucket] Load all buckets';
1414
constructor(public buckets: InkBucketMeta[]) {}
1515
}
16+
17+
export class RenameBucket {
18+
static readonly type = '[Bucket] Change name';
19+
constructor(public id: string, public name: string) {}
20+
}

src/app/store/states/bucket.state.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { State, Action, StateContext } from '@ngxs/store';
22
import { InkAppSettings, InkBucket } from '../../models';
3-
import { CreateBucket, UpdateBucket, LoadBuckets } from '../actions/bucket.action';
3+
import { CreateBucket, UpdateBucket, LoadBuckets, RenameBucket } from '../actions/bucket.action';
44
import { DBService } from '../../services/db.service';
55
import { LoadInitialData } from '../actions/general.action';
66
import { UtilService } from '../../services/util.service';
@@ -36,4 +36,10 @@ export class BucketState {
3636
const state: any = ctx.getState();
3737
ctx.setState([...state, ...action.buckets]);
3838
}
39+
@Action(RenameBucket)
40+
renameBucket(ctx: StateContext<InkBucket>, action: RenameBucket) {
41+
const state: any = ctx.getState();
42+
state.filter(b => b._id === action.id).map(b => (b.name = action.name));
43+
ctx.setState([...state]);
44+
}
3945
}

src/styles/_config.scss

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,26 @@ $ink--app-name: 'INK BUCKET';
44
$ink--debug: false;
55
$ink--font-family: 'Rubik', 'Inter UI', 'Nunito Sans', 'Roboto';
66
$ink--font-family-asap: 'Asap', 'Roboto';
7+
$ink--font-family-roboto: 'Roboto', 'sans-serif';
8+
$ink--font-family-roboto: 'Roboto', 'sans-serif';
79
$ink--current-theme: 'DEFAULT';
810
$ink--themes: (
911
'default': 'DEFAULT',
1012
'jummy': 'JIMMY'
1113
);
1214
$ink--colors-basic: (
13-
'bg': #eff2f7,
15+
'bg': #fff,
16+
'bg2': #f3f3f7a6,
1417
'text': #aaaab1,
15-
'heading': #333,
18+
'heading': #35335a,
1619
'border': #cbcbcb,
1720
'para': #808080,
1821
'dark': #000,
1922
'shadow': #cbd3da
2023
);
2124

2225
$ink--colors-theme: (
23-
'primary': #f8768f,
26+
'primary': #6b66ca,
2427
'secondary': #41495d,
2528
'success': #3fc782,
2629
'warning': #f78f1e,

src/styles/components/__index.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
@import './ink-bucket';
33
@import './ink';
44
@import './color-sticker';
5+
@import './header';

src/styles/components/_color-sticker.scss

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ $size: 4rem;
1111
display: flex;
1212
width: $size;
1313
height: $size;
14-
border-radius: 100%;
14+
border-radius: 0.3rem;
1515
margin-bottom: 1rem;
16-
box-shadow: 0px 3px 13px clr('shadow');
16+
box-shadow: 0px 3px 5px clr('shadow');
1717
cursor: pointer;
1818
}
1919
&.-empty .ink-color {
@@ -23,7 +23,8 @@ $size: 4rem;
2323
.ink-name {
2424
text-transform: uppercase;
2525
font-weight: 500;
26-
color: transparentize($color: clr('dark'), $amount: 0.5);
26+
color: transparentize($color: clr('dark'), $amount: 0.62);
2727
font-size: 0.9rem;
28+
font-family: $ink--font-family-roboto;
2829
}
2930
}

src/styles/components/_header.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.navbar.ink-header {
2+
// box-shadow: 0 4px 6px #b7b7b7;
3+
padding: 0.57rem 1rem;
4+
}
Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
11
inkapp-bucket {
22
display: block;
33
background: #fff;
4-
padding: 2rem;
5-
border-radius: 3px;
6-
box-shadow: 0px 8px 13px clr('shadow');
4+
padding: 1rem;
5+
border-radius: 0;
6+
border-bottom: 1px dashed transparentize(clr('primary', 'theme'), 0.82);
7+
// box-shadow: 0px 8px 13px clr('shadow');
78
margin-bottom: 1rem;
8-
h3 {
9-
font-weight: 400;
10-
color: clr('dark', 'theme');
9+
h5 {
10+
color: clr('heading');
1111
}
12-
}
12+
13+
h5 > span {
14+
color: clr('primary', 'theme');
15+
}
16+
17+
input.form-control {
18+
color: clr('heading');
19+
font-weight: 500;
20+
font-size: 1.25rem;
21+
background: clr('bg2');
22+
border: 0;
23+
padding: 0.75rem 1rem;
24+
line-height: 1;
25+
}
26+
}

0 commit comments

Comments
 (0)