[frontend] Add twitter public component
This commit is contained in:
parent
9fd29e5501
commit
c550ace4cc
|
@ -0,0 +1,32 @@
|
|||
<div *ngIf="twitters$ | async as twitters">
|
||||
<mat-card *ngIf="twitters.length !== 0">
|
||||
<mat-card-header>
|
||||
<div mat-card-avatar class="twitter"></div>
|
||||
<mat-card-title class="platform-title">
|
||||
Twitter
|
||||
<button mat-icon-button aria-label="How to use">
|
||||
<mat-icon
|
||||
matTooltip="How to send and receive hood broadcast messages with twitter"
|
||||
class="info-button"
|
||||
(click)="onInfoClick()"
|
||||
>info</mat-icon
|
||||
>
|
||||
</button>
|
||||
</mat-card-title>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<mat-selection-list [multiple]="false" class="list">
|
||||
<a
|
||||
*ngFor="let twitter of twitters"
|
||||
href="https://twitter.com/{{ twitter.username }}"
|
||||
routerLinkActive="router-link-active"
|
||||
>
|
||||
<mat-list-option>
|
||||
@{{ twitter.username }}
|
||||
<mat-divider></mat-divider>
|
||||
</mat-list-option>
|
||||
</a>
|
||||
</mat-selection-list>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</div>
|
|
@ -0,0 +1,11 @@
|
|||
.twitter {
|
||||
background-image: url("../../../../assets/twitter.png");
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.platform-title {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 40px;
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { TwitterBotCardComponent } from './twitter-bot-card.component';
|
||||
|
||||
describe('TwitterBotCardComponent', () => {
|
||||
let component: TwitterBotCardComponent;
|
||||
let fixture: ComponentFixture<TwitterBotCardComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [TwitterBotCardComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(TwitterBotCardComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
|
@ -0,0 +1,27 @@
|
|||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import { TwitterService } from 'src/app/core/api';
|
||||
import { TwitterBotInfoDialogComponent } from './twitter-bot-info-dialog/twitter-bot-info-dialog.component';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
|
||||
@Component({
|
||||
selector: 'app-twitter-bot-card',
|
||||
templateUrl: './twitter-bot-card.component.html',
|
||||
styleUrls: ['./twitter-bot-card.component.scss'],
|
||||
})
|
||||
export class TwitterBotCardComponent implements OnInit {
|
||||
@Input() hoodId;
|
||||
twitters$;
|
||||
|
||||
constructor(
|
||||
private twitterService: TwitterService,
|
||||
private dialog: MatDialog
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.twitters$ = this.twitterService.getTwittersPublic(this.hoodId);
|
||||
}
|
||||
|
||||
onInfoClick() {
|
||||
this.dialog.open(TwitterBotInfoDialogComponent);
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
<p>twitter-bot-info-dialog works!</p>
|
|
@ -0,0 +1,12 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-twitter-bot-info-dialog',
|
||||
templateUrl: './twitter-bot-info-dialog.component.html',
|
||||
styleUrls: ['./twitter-bot-info-dialog.component.scss'],
|
||||
})
|
||||
export class TwitterBotInfoDialogComponent implements OnInit {
|
||||
constructor() {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
}
|
BIN
kibicara-frontend/src/assets/twitter.png
Executable file
BIN
kibicara-frontend/src/assets/twitter.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 9.8 KiB |
Loading…
Reference in a new issue