added polls entries

This commit is contained in:
Nicolas Constant 2019-08-24 00:55:01 -04:00
parent caaa301349
commit 0d0ed5d318
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
12 changed files with 152 additions and 16 deletions

View File

@ -70,6 +70,7 @@ import { EmojiPickerComponent } from './components/create-status/emoji-picker/em
import { StatusUserContextMenuComponent } from './components/stream/status/action-bar/status-user-context-menu/status-user-context-menu.component';
import { StatusSchedulerComponent } from './components/create-status/status-scheduler/status-scheduler.component';
import { PollEditorComponent } from './components/create-status/poll-editor/poll-editor.component';
import { PollEntryComponent } from './components/create-status/poll-editor/poll-entry/poll-entry.component';
const routes: Routes = [
@ -126,7 +127,8 @@ const routes: Routes = [
EmojiPickerComponent,
StatusUserContextMenuComponent,
StatusSchedulerComponent,
PollEditorComponent
PollEditorComponent,
PollEntryComponent
],
entryComponents: [
EmojiPickerComponent

View File

@ -27,11 +27,13 @@
<div class="status-editor__footer" #footer>
<button type="submit" title="reply" class="status-editor__footer--send-button" *ngIf="statusReplyingToWrapper">
<span *ngIf="!isSending">REPLY!</span>
<span *ngIf="!isSending && !scheduleIsActive">REPLY!</span>
<span *ngIf="!isSending && scheduleIsActive">SAVE!</span>
<app-waiting-animation class="waiting-icon" *ngIf="isSending"></app-waiting-animation>
</button>
<button type="submit" title="post" class="status-editor__footer--send-button" *ngIf="!statusReplyingToWrapper">
<span *ngIf="!isSending">POST!</span>
<span *ngIf="!isSending && !scheduleIsActive">POST!</span>
<span *ngIf="!isSending && scheduleIsActive">SAVE!</span>
<app-waiting-animation class="waiting-icon" *ngIf="isSending"></app-waiting-animation>
</button>
<div class="status-editor__footer__counter">

View File

@ -1,3 +1,15 @@
<p>
poll-editor works!
</p>
<div class="poll-editor">
<div *ngFor="let e of entries">
<app-poll-entry class="poll-editor__entry" [entry]="e"></app-poll-entry>
</div>
<div class="poll-editor__footer">
<a href (click)="addEntry()">
Add entry
</a>
<select [(ngModel)]="selectedId">
<option *ngFor="let d of delayChoice" [ngValue]="d.id">{{d.label}}</option>
</select>
</div>
</div>

View File

@ -0,0 +1,17 @@
@import "variables";
.poll-editor {
background-color: $poll-editor-background;
border-top: 1px solid $poll-editor-separator;
min-height: 30px;
margin: 0 5px;
&__entry {
display: block;
}
&__footer {
border-top: 1px solid $poll-editor-separator;
min-height: 30px;
}
}

View File

@ -1,15 +1,49 @@
import { Component, OnInit } from '@angular/core';
import { PollEntry } from './poll-entry/poll-entry.component';
@Component({
selector: 'app-poll-editor',
templateUrl: './poll-editor.component.html',
styleUrls: ['./poll-editor.component.scss']
selector: 'app-poll-editor',
templateUrl: './poll-editor.component.html',
styleUrls: ['./poll-editor.component.scss']
})
export class PollEditorComponent implements OnInit {
constructor() { }
entries: PollEntry[] = [];
delayChoice: Delay[] = [];
selectedId: string;
ngOnInit() {
}
constructor() {
this.entries.push(new PollEntry());
this.entries.push(new PollEntry());
this.delayChoice.push(new Delay(60 * 5, "5 minutes"));
this.delayChoice.push(new Delay(60 * 30, "30 minutes"));
this.delayChoice.push(new Delay(60 * 60, "1 hour"));
this.delayChoice.push(new Delay(60 * 60 * 6, "6 hours"));
this.delayChoice.push(new Delay(60 * 60 * 24, "1 day"));
this.delayChoice.push(new Delay(60 * 60 * 24 * 3, "3 days"));
this.delayChoice.push(new Delay(60 * 60 * 24 * 7, "7 days"));
this.delayChoice.push(new Delay(60 * 60 * 24 * 15, "15 days"));
this.delayChoice.push(new Delay(60 * 60 * 24 * 30, "30 days"));
this.selectedId = this.delayChoice[4].id;
}
ngOnInit() {
}
addEntry(): boolean {
this.entries.push(new PollEntry());
return false;
}
}
class Delay {
constructor(public delayInSeconds: number, public label: string) {
this.id = delayInSeconds.toString();
}
id: string;
}

View File

@ -0,0 +1,3 @@
<p>
poll-entry works!
</p>

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { PollEntryComponent } from './poll-entry.component';
describe('PollEntryComponent', () => {
let component: PollEntryComponent;
let fixture: ComponentFixture<PollEntryComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ PollEntryComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(PollEntryComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,26 @@
import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'app-poll-entry',
templateUrl: './poll-entry.component.html',
styleUrls: ['./poll-entry.component.scss']
})
export class PollEntryComponent implements OnInit {
@Input() entry: PollEntry;
constructor() { }
ngOnInit() {
}
remove(): boolean {
return false;
}
}
export class PollEntry {
public isMulti: boolean;
public entry: string;
}

View File

@ -1,3 +1,3 @@
<p>
status-scheduler works!
</p>
<div class="scheduler">
</div>

View File

@ -0,0 +1,7 @@
@import "variables";
.scheduler {
background-color: $scheduler-background;
min-height: 30px;
margin: 0 5px;
}

View File

@ -80,4 +80,12 @@ $autosuggest-entry-color-hover: #e2e2e2;
$autosuggest-entry-handle-color-hover: #ffffff;
$scrollbar-color: #08090d;
$scrollbar-color-thumb: lighten($color-primary, 5);
$scrollbar-color-thumb: lighten($color-primary, 5);
$poll-editor-background: #3e455f;
$poll-editor-background: #32384d;
$poll-editor-background: #fff;
$poll-editor-separator: #e7e7e7;
$scheduler-background: #32384d;