Skip to content

Commit 09155b4

Browse files
committed
Refined UI.
1 parent b273471 commit 09155b4

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/app/home/components/book-list.component.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@
1717
onErrorSrc="assets/images/avatar.png"
1818
[src]="book.isFromMainstreamPlatform ? book.writer.avatarUrl : 'assets/images/avatar.png'"
1919
/>
20-
<mat-card-title>{{book.writer.fullName}}</mat-card-title>
20+
<mat-card-title>
21+
{{book.writer.fullName.length > 0 ? book.writer.fullName : book.writer.name}}
22+
</mat-card-title>
2123
<mat-card-subtitle>
22-
<ion-icon *ngIf="book.writer.location.length > 0" name="location-outline"></ion-icon>{{book.writer.location}}
23-
@{{book.website.uri}}
24+
<ion-icon *ngIf="book.writer.location.length > 0" name="location-outline"></ion-icon>
25+
{{book.writer.location}} @{{book.website.uri}}
2426
</mat-card-subtitle>
2527
</mat-card-header>
2628

src/app/home/services/writer.service.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export class WriterService {
6969

7070
_writer.platformId = rawWriterList[0]['id'] as number;
7171
_writer.avatarUrl = rawWriterList[0]['avatar_url'];
72-
_writer.fullName = rawWriterList[0]['name'];
72+
_writer.fullName = rawWriterList[0]['name'] ? rawWriterList[0]['name'] : '';
7373
_writer.htmlUrl = rawWriterList[0]['html_url'];
7474
_writer.desc = rawWriterList[0]['bio'] ? rawWriterList[0]['bio'] : '';
7575
}
@@ -81,10 +81,11 @@ export class WriterService {
8181

8282
_writer.platformId = rawWriter['id'] as number;
8383
_writer.avatarUrl = rawWriter['avatar_url'];
84-
_writer.fullName = rawWriter['name'];
84+
_writer.fullName = rawWriter['name'] ? rawWriter['name'] : '';
8585
_writer.htmlUrl = rawWriter['html_url'];
8686
_writer.desc = rawWriter['bio'] ? rawWriter['bio'] : '';
87-
if(/github/.test(newBook.website.uri))_writer.location = rawWriter['location'];
87+
if(/github/.test(newBook.website.uri))_writer.location = rawWriter['location']
88+
? rawWriter['location'] : '';
8889
}
8990

9091
const query: IQuery = {

0 commit comments

Comments
 (0)