From e36dbee1fa9b6dc139090acaa6d3f00f0fff136a Mon Sep 17 00:00:00 2001 From: komura Date: Thu, 3 Sep 2020 01:09:22 +0900 Subject: [PATCH 01/20] =?UTF-8?q?feat(emulater):=20firestore,functions?= =?UTF-8?q?=E3=82=A8=E3=83=9F=E3=83=A5=E3=83=AC=E3=83=BC=E3=82=BF=E3=82=92?= =?UTF-8?q?=E8=A8=AD=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- firebase.json | 9 +++++++-- functions/.gitignore | 5 +++++ src/app/app.module.ts | 14 +++++++++++--- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/firebase.json b/firebase.json index 00a56f63..21ed6bcc 100644 --- a/firebase.json +++ b/firebase.json @@ -1,7 +1,11 @@ { "hosting": { "public": "dist/musil", - "ignore": ["firebase.json", "**/.*", "**/node_modules/**"], + "ignore": [ + "firebase.json", + "**/.*", + "**/node_modules/**" + ], "rewrites": [ { "source": "/**/n/**", @@ -21,7 +25,8 @@ "predeploy": [ "npm --prefix \"$RESOURCE_DIR\" run lint", "npm --prefix \"$RESOURCE_DIR\" run build" - ] + ], + "source": "functions" }, "storage": { "rules": "storage.rules" diff --git a/functions/.gitignore b/functions/.gitignore index 9d7b336d..a1f8593d 100644 --- a/functions/.gitignore +++ b/functions/.gitignore @@ -7,3 +7,8 @@ typings/ node_modules/ lib/ +.runtimeconfig.json + +firebase-debug.log +firestore-debug.log +ui-debug.log diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 1ce41cff..73a18980 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -15,9 +15,9 @@ import { import { FooterComponent } from './footer/footer.component'; import { AngularFireModule } from '@angular/fire'; import { AngularFireAnalyticsModule } from '@angular/fire/analytics'; -import { AngularFirestoreModule } from '@angular/fire/firestore'; +import { AngularFirestoreModule, SETTINGS as FIRESTORE_SETTINGS } from '@angular/fire/firestore'; import { AngularFireStorageModule } from '@angular/fire/storage'; -import { AngularFireFunctionsModule, REGION } from '@angular/fire/functions'; +import { AngularFireFunctionsModule, REGION, ORIGIN } from '@angular/fire/functions'; import { AngularFireAuthModule } from '@angular/fire/auth'; import { environment } from '../environments/environment'; import { FroalaEditorModule, FroalaViewModule } from 'angular-froala-wysiwyg'; @@ -75,7 +75,15 @@ import { MatPaginatorIntlJaModule } from './mat-paginator-intl-ja/mat-paginator- { provide: REGION, useValue: 'asia-northeast1' }, { provide: MAT_SNACK_BAR_DEFAULT_OPTIONS, useValue: { duration: 4000 } }, { provide: MatPaginatorIntl, useClass: MatPaginatorIntlJaModule }, + { + provide: ORIGIN, + useValue: environment.production ? undefined : 'http://localhost:5001', + }, + { + provide: FIRESTORE_SETTINGS, + useFactory: () => !environment.production ? { host: 'localhost:8080', ssl: false } : {} + } ], bootstrap: [AppComponent], }) -export class AppModule {} +export class AppModule { } From 6babc2059c120f682ad537620049de29a67c56f6 Mon Sep 17 00:00:00 2001 From: komura Date: Thu, 3 Sep 2020 01:48:04 +0900 Subject: [PATCH 02/20] =?UTF-8?q?fix(emulater):=20app.module=E8=A8=AD?= =?UTF-8?q?=E5=AE=9A=E3=81=AE=E5=88=86=E5=B2=90=E3=82=92=E7=B5=B1=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app.module.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 73a18980..3056ff0e 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -81,7 +81,7 @@ import { MatPaginatorIntlJaModule } from './mat-paginator-intl-ja/mat-paginator- }, { provide: FIRESTORE_SETTINGS, - useFactory: () => !environment.production ? { host: 'localhost:8080', ssl: false } : {} + useFactory: () => environment.production ? {} : { host: 'localhost:8080', ssl: false } } ], bootstrap: [AppComponent], From 49c0fbaa19179318ea3f455bb6a16496d1a8c0ee Mon Sep 17 00:00:00 2001 From: komura Date: Thu, 3 Sep 2020 01:49:41 +0900 Subject: [PATCH 03/20] =?UTF-8?q?fix(#112):=20stringToLink=E3=82=92Pipe?= =?UTF-8?q?=E3=81=AB=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/mypage/mypage.module.ts | 4 +++- src/app/mypage/mypage/mypage.component.html | 2 +- src/app/mypage/mypage/mypage.component.ts | 12 +----------- src/app/mypage/note/note.component.html | 2 +- src/app/mypage/note/note.component.ts | 16 +--------------- src/app/pipes/string-to-link.pipe.spec.ts | 8 ++++++++ src/app/pipes/string-to-link.pipe.ts | 15 +++++++++++++++ 7 files changed, 30 insertions(+), 29 deletions(-) create mode 100644 src/app/pipes/string-to-link.pipe.spec.ts create mode 100644 src/app/pipes/string-to-link.pipe.ts diff --git a/src/app/mypage/mypage.module.ts b/src/app/mypage/mypage.module.ts index a2f3960e..f223f2cf 100644 --- a/src/app/mypage/mypage.module.ts +++ b/src/app/mypage/mypage.module.ts @@ -15,6 +15,7 @@ import { ClipboardModule } from '@angular/cdk/clipboard'; import { MyArticlesComponent } from './my-articles/my-articles.component'; import { LikedArticlesComponent } from './liked-articles/liked-articles.component'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; +import { StringToLinkPipe } from '../pipes/string-to-link.pipe'; @NgModule({ declarations: [ @@ -22,6 +23,7 @@ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; NoteComponent, MyArticlesComponent, LikedArticlesComponent, + StringToLinkPipe, ], imports: [ CommonModule, @@ -37,4 +39,4 @@ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; MatProgressSpinnerModule, ], }) -export class MypageModule {} +export class MypageModule { } diff --git a/src/app/mypage/mypage/mypage.component.html b/src/app/mypage/mypage/mypage.component.html index f30dde97..12914e5a 100644 --- a/src/app/mypage/mypage/mypage.component.html +++ b/src/app/mypage/mypage/mypage.component.html @@ -22,7 +22,7 @@

{{ user.userName }}

@{{ user.screenName }}

$1"; - const link = description.replace(linkReg, toATag); - return link; - } - - ngOnInit(): void {} + ngOnInit(): void { } } diff --git a/src/app/mypage/note/note.component.html b/src/app/mypage/note/note.component.html index 063ab840..96123938 100644 --- a/src/app/mypage/note/note.component.html +++ b/src/app/mypage/note/note.component.html @@ -178,7 +178,7 @@

{{ article.title }}

> $1"; - const link = description.replace(linkReg, toATag); - return link; - } else { - return description; - } - } - clickedLike(articleId: string) { if (this.authService.uid && !this.isLiked) { this.likeService.likeArticle(articleId, this.authService.uid); @@ -180,7 +166,7 @@ export class NoteComponent implements OnInit, OnDestroy { this.snackBar.open('URLがコピーされました!', '閉じる'); } - ngOnInit(): void {} + ngOnInit(): void { } ngOnDestroy(): void { this.scrollService.saveScrollPosition(this.articleId); diff --git a/src/app/pipes/string-to-link.pipe.spec.ts b/src/app/pipes/string-to-link.pipe.spec.ts new file mode 100644 index 00000000..d0054179 --- /dev/null +++ b/src/app/pipes/string-to-link.pipe.spec.ts @@ -0,0 +1,8 @@ +import { StringToLinkPipe } from './string-to-link.pipe'; + +describe('StringToLinkPipe', () => { + it('create an instance', () => { + const pipe = new StringToLinkPipe(); + expect(pipe).toBeTruthy(); + }); +}); diff --git a/src/app/pipes/string-to-link.pipe.ts b/src/app/pipes/string-to-link.pipe.ts new file mode 100644 index 00000000..12639005 --- /dev/null +++ b/src/app/pipes/string-to-link.pipe.ts @@ -0,0 +1,15 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'stringToLink' +}) +export class StringToLinkPipe implements PipeTransform { + transform(text: string): string { + const linkReg = new RegExp( + /(http(s)?:\/\/[a-zA-Z0-9-.!'()*;/?:@&=+$,%#]+)/gi + ); + const toATag = + '$1'; + return text.replace(linkReg, toATag); + } +} From 3ce2e85212801c75f14e4825319a6b44c7b0e5ee Mon Sep 17 00:00:00 2001 From: komura Date: Thu, 3 Sep 2020 14:57:22 +0900 Subject: [PATCH 04/20] =?UTF-8?q?fix(#100):=20=E3=82=BF=E3=83=96=E5=88=87?= =?UTF-8?q?=E3=82=8A=E6=9B=BF=E3=81=88=E3=81=A7=E4=B8=8A=E3=81=AB=E6=88=BB?= =?UTF-8?q?=E3=82=89=E3=81=AA=E3=81=84=E3=82=88=E3=81=86=E3=81=AB=E3=82=B9?= =?UTF-8?q?=E3=82=AF=E3=83=AD=E3=83=BC=E3=83=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../liked-articles.component.ts | 19 ++++++++++++----- .../my-articles/my-articles.component.ts | 21 +++++++++++++------ src/app/mypage/note/note.component.ts | 2 +- src/app/services/scroll.service.ts | 7 +++++-- 4 files changed, 35 insertions(+), 14 deletions(-) diff --git a/src/app/mypage/liked-articles/liked-articles.component.ts b/src/app/mypage/liked-articles/liked-articles.component.ts index 8fdec2b4..d784ecb3 100644 --- a/src/app/mypage/liked-articles/liked-articles.component.ts +++ b/src/app/mypage/liked-articles/liked-articles.component.ts @@ -1,16 +1,18 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, OnDestroy } from '@angular/core'; import { ArticleWithAuthor } from '@interfaces/article-with-author'; import { Observable } from 'rxjs'; import { tap, take } from 'rxjs/operators'; import { ArticleService } from 'src/app/services/article.service'; import { UserService } from 'src/app/services/user.service'; +import { ScrollService } from 'src/app/services/scroll.service'; @Component({ selector: 'app-liked-articles', templateUrl: './liked-articles.component.html', styleUrls: ['./liked-articles.component.scss'], }) -export class LikedArticlesComponent implements OnInit { +export class LikedArticlesComponent implements OnInit, OnDestroy { + private uid = this.userService.mypageUser?.uid; articles$: Observable< ArticleWithAuthor[] > = this.articleService @@ -26,8 +28,15 @@ export class LikedArticlesComponent implements OnInit { constructor( private userService: UserService, - private articleService: ArticleService - ) {} + private articleService: ArticleService, + private scrollService: ScrollService + ) { + this.scrollService.restoreScrollPosition(this.uid); + } - ngOnInit(): void {} + ngOnInit(): void { } + + ngOnDestroy(): void { + this.scrollService.saveScrollPosition(this.uid); + } } diff --git a/src/app/mypage/my-articles/my-articles.component.ts b/src/app/mypage/my-articles/my-articles.component.ts index 99a150ef..504e77c4 100644 --- a/src/app/mypage/my-articles/my-articles.component.ts +++ b/src/app/mypage/my-articles/my-articles.component.ts @@ -1,20 +1,22 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, OnDestroy } from '@angular/core'; import { ArticleWithAuthor } from '@interfaces/article-with-author'; import { Observable } from 'rxjs'; import { tap, take } from 'rxjs/operators'; import { ArticleService } from 'src/app/services/article.service'; import { UserService } from 'src/app/services/user.service'; +import { ScrollService } from 'src/app/services/scroll.service'; @Component({ selector: 'app-my-articles', templateUrl: './my-articles.component.html', styleUrls: ['./my-articles.component.scss'], }) -export class MyArticlesComponent implements OnInit { +export class MyArticlesComponent implements OnInit, OnDestroy { + private uid = this.userService.mypageUser?.uid; articles$: Observable< ArticleWithAuthor[] > = this.articleService - .getMyArticlesPublic(this.userService.mypageUser.uid) + .getMyArticlesPublic(this.uid) .pipe( take(1), tap(() => { @@ -26,8 +28,15 @@ export class MyArticlesComponent implements OnInit { constructor( private userService: UserService, - private articleService: ArticleService - ) {} + private articleService: ArticleService, + private scrollService: ScrollService + ) { + this.scrollService.restoreScrollPosition(this.uid); + } - ngOnInit(): void {} + ngOnInit(): void { } + + ngOnDestroy(): void { + this.scrollService.saveScrollPosition(this.uid); + } } diff --git a/src/app/mypage/note/note.component.ts b/src/app/mypage/note/note.component.ts index c9e0a18d..9e51203b 100644 --- a/src/app/mypage/note/note.component.ts +++ b/src/app/mypage/note/note.component.ts @@ -124,7 +124,7 @@ export class NoteComponent implements OnInit, OnDestroy { const rectTop = document.getElementById(id).getBoundingClientRect().top; const position = window.pageYOffset; const top = rectTop + position - this.headerHeight; - window.scrollTo({ + window.scroll({ top, behavior: 'smooth', }); diff --git a/src/app/services/scroll.service.ts b/src/app/services/scroll.service.ts index 2f0736fb..20a25947 100644 --- a/src/app/services/scroll.service.ts +++ b/src/app/services/scroll.service.ts @@ -6,7 +6,7 @@ import { Injectable } from '@angular/core'; export class ScrollService { scrollPosYs: { [key: string]: number } = {}; - constructor() {} + constructor() { } saveScrollPosition(id: string): void { if (id) { @@ -17,7 +17,10 @@ export class ScrollService { restoreScrollPosition(id: string): void { if (id) { setTimeout(() => { - window.scrollTo(0, this.scrollPosYs[id]); + window.scroll({ + top: this.scrollPosYs[id], + behavior: 'smooth', + }); }, 100); } } From c94588c25429d0f694c419c2689d476fe46c1d3f Mon Sep 17 00:00:00 2001 From: komura Date: Thu, 3 Sep 2020 17:22:59 +0900 Subject: [PATCH 05/20] =?UTF-8?q?feat(mypage):=20mypage=E3=81=AEsp?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/mypage/mypage/mypage.component.scss | 22 +++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/app/mypage/mypage/mypage.component.scss b/src/app/mypage/mypage/mypage.component.scss index 633b1c3b..bb392d5f 100644 --- a/src/app/mypage/mypage/mypage.component.scss +++ b/src/app/mypage/mypage/mypage.component.scss @@ -21,23 +21,39 @@ height: 120px; border-radius: 50%; margin: 16px 0px; + @include sp { + width: 100px; + height: 100px; + } } &__user-name { font-size: 20px; font-weight: bold; margin: 0 0 8px; + @include sp { + font-size: 18px; + } } &__user-screen-name { font-size: 16px; margin: 0 0 8px; + @include sp { + font-size: 14px; + } } &__user-description { font-size: 16px; margin: 0 0 16px; + @include sp { + font-size: 14px; + } } &__twitter { text-decoration: none; background-color: $color-twitter; + @include sp { + font-size: 14px; + } } &__menu { max-width: 600px; @@ -51,9 +67,15 @@ .edit-profile { margin-left: auto; + @include sp { + font-size: 14px; + } } .mat-tab-link { font-size: 16px; text-decoration: none; + @include sp { + font-size: 14px; + } } From fb88c5326b10af3675b537db43c319f2b469036b Mon Sep 17 00:00:00 2001 From: komura Date: Thu, 3 Sep 2020 17:23:22 +0900 Subject: [PATCH 06/20] =?UTF-8?q?feat(footer):=20footer=E3=81=AEsp?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/footer/footer.component.scss | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/app/footer/footer.component.scss b/src/app/footer/footer.component.scss index 8edb27f0..1a2770ab 100644 --- a/src/app/footer/footer.component.scss +++ b/src/app/footer/footer.component.scss @@ -1,3 +1,5 @@ +@import 'mixins'; + .footer { background-color: inherit; padding: 16px 0 32px; @@ -8,6 +10,9 @@ a { margin: 0 8px 8px; text-align: center; + @include sp { + font-size: 14px; + } } } } @@ -17,4 +22,7 @@ mat-icon { .copyright { text-align: center; margin: 8px 0px; + @include sp { + font-size: 14px; + } } From 4cba850db188d05c63e22c3207b66da92abb1cb8 Mon Sep 17 00:00:00 2001 From: komura Date: Thu, 3 Sep 2020 17:53:13 +0900 Subject: [PATCH 07/20] =?UTF-8?q?fix(#111):=20=E3=83=97=E3=83=AD=E3=83=95?= =?UTF-8?q?=E3=82=A3=E3=83=BC=E3=83=AB=E3=81=AE=E3=82=A2=E3=82=A4=E3=82=B3?= =?UTF-8?q?=E3=83=B3=E5=B0=91=E3=81=97=E5=B0=8F=E3=81=95=E3=81=8F=E3=81=99?= =?UTF-8?q?=E3=82=8B(SP)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/mypage/note/note.component.scss | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/app/mypage/note/note.component.scss b/src/app/mypage/note/note.component.scss index cbaa24a0..4a4129fc 100644 --- a/src/app/mypage/note/note.component.scss +++ b/src/app/mypage/note/note.component.scss @@ -139,15 +139,25 @@ height: 80px; border-radius: 50%; max-width: 80px; + @include sp { + width: 60px; + height: 60px; + } } &__user-name { display: block; font-weight: bold; font-size: 18px; margin-bottom: 8px; + @include sp { + font-size: 16px; + } } &__user-description { margin: 0 0 8px 0; + @include sp { + font-size: 14px; + } } &__twitter { .mat-icon { From 7d65cd2abcb4dad736f474797b514763180f4a7f Mon Sep 17 00:00:00 2001 From: komura Date: Fri, 4 Sep 2020 00:21:46 +0900 Subject: [PATCH 08/20] =?UTF-8?q?fix(#99):=20=E6=A4=9C=E7=B4=A2=E3=83=90?= =?UTF-8?q?=E3=83=BC=E4=BB=A5=E5=A4=96=E3=82=92=E3=82=AF=E3=83=AA=E3=83=83?= =?UTF-8?q?=E3=82=AF=E3=81=A7=E6=A4=9C=E7=B4=A2=E3=83=90=E3=83=BC=E3=82=92?= =?UTF-8?q?=E9=96=89=E3=81=98=E3=82=8B=E3=82=88=E3=81=86=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../search-input/search-input.component.html | 25 +++++++++++-------- .../search-input/search-input.component.scss | 15 ++++++++--- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/app/search-input/search-input.component.html b/src/app/search-input/search-input.component.html index 3396cdb9..cc14d2bf 100644 --- a/src/app/search-input/search-input.component.html +++ b/src/app/search-input/search-input.component.html @@ -31,14 +31,17 @@ - + +
diff --git a/src/app/search-input/search-input.component.scss b/src/app/search-input/search-input.component.scss index 0a4bbe9e..22074978 100644 --- a/src/app/search-input/search-input.component.scss +++ b/src/app/search-input/search-input.component.scss @@ -45,15 +45,22 @@ } } -.smart-search { +.sp-search { display: none; @include sp { display: block; } } +.overlay { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + display: none; +} + .active { - @include sp { - display: block; - } + display: block; } From 705c9e1cafb74269db8ed689ebd729b50e8db1cd Mon Sep 17 00:00:00 2001 From: komura Date: Fri, 4 Sep 2020 12:01:05 +0900 Subject: [PATCH 09/20] =?UTF-8?q?feat(color):=20=E3=82=A2=E3=82=AF?= =?UTF-8?q?=E3=82=BB=E3=83=B3=E3=83=88=E3=82=AB=E3=83=A9=E3=83=BC=E3=82=92?= =?UTF-8?q?indigo=E3=81=AB=E3=81=97=E3=80=81form=E3=81=AB=E9=81=A9?= =?UTF-8?q?=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/notes/create/create.component.html | 7 +++++-- src/app/notes/tag-form/tag-form.component.html | 2 +- src/styles/_material-custom.scss | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/app/notes/create/create.component.html b/src/app/notes/create/create.component.html index 49c4cd6f..48cc3b83 100644 --- a/src/app/notes/create/create.component.html +++ b/src/app/notes/create/create.component.html @@ -1,7 +1,7 @@
- +
- 公開