Feature/add logo endpoint (#1506)
* Add logo endpoint * Update changelog
This commit is contained in:
@@ -10,9 +10,9 @@
|
||||
<th *matHeaderCellDef class="px-1" mat-header-cell></th>
|
||||
<td *matCellDef="let element" class="px-1 text-center" mat-cell>
|
||||
<gf-symbol-icon
|
||||
*ngIf="element.url"
|
||||
[dataSource]="element.dataSource"
|
||||
[symbol]="element.symbol"
|
||||
[tooltip]="element.name"
|
||||
[url]="element.url"
|
||||
></gf-symbol-icon>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
@@ -1,6 +1,7 @@
|
||||
<img
|
||||
*ngIf="url"
|
||||
src="https://www.google.com/s2/favicons?domain={{ url }}&sz=64"
|
||||
*ngIf="src"
|
||||
onerror="this.style.display='none'"
|
||||
[ngClass]="{ large: size === 'large' }"
|
||||
[src]="src"
|
||||
[title]="tooltip ? tooltip : ''"
|
||||
/>
|
||||
|
@@ -2,8 +2,9 @@ import {
|
||||
ChangeDetectionStrategy,
|
||||
Component,
|
||||
Input,
|
||||
OnInit
|
||||
OnChanges
|
||||
} from '@angular/core';
|
||||
import { DataSource } from '@prisma/client';
|
||||
|
||||
@Component({
|
||||
selector: 'gf-symbol-icon',
|
||||
@@ -11,12 +12,22 @@ import {
|
||||
templateUrl: './symbol-icon.component.html',
|
||||
styleUrls: ['./symbol-icon.component.scss']
|
||||
})
|
||||
export class SymbolIconComponent implements OnInit {
|
||||
export class SymbolIconComponent implements OnChanges {
|
||||
@Input() dataSource: DataSource;
|
||||
@Input() size: 'large';
|
||||
@Input() symbol: string;
|
||||
@Input() tooltip: string;
|
||||
@Input() url: string;
|
||||
|
||||
public src: string;
|
||||
|
||||
public constructor() {}
|
||||
|
||||
public ngOnInit() {}
|
||||
public ngOnChanges() {
|
||||
if (this.dataSource && this.symbol) {
|
||||
this.src = `../api/v1/logo/${this.dataSource}/${this.symbol}`;
|
||||
} else if (this.url) {
|
||||
this.src = `../api/v1/logo?url=${this.url}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user