Mercurial > hg > ugly-duckling
changeset 201:d179cf7df697
First attempt at the feed containing items. Currently breaks analyses into distinct, separated segments, based on each item marked as root.
author | Lucas Thompson <dev@lucas.im> |
---|---|
date | Fri, 24 Mar 2017 11:07:26 +0000 |
parents | d7e4bba39d20 |
children | 038d248602d5 |
files | src/app/notebook-feed/notebook-feed.component.css src/app/notebook-feed/notebook-feed.component.html src/app/notebook-feed/notebook-feed.component.ts |
diffstat | 3 files changed, 26 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/src/app/notebook-feed/notebook-feed.component.css Fri Mar 24 11:05:20 2017 +0000 +++ b/src/app/notebook-feed/notebook-feed.component.css Fri Mar 24 11:07:26 2017 +0000 @@ -0,0 +1,3 @@ +.break { + margin-bottom: 32px; +}
--- a/src/app/notebook-feed/notebook-feed.component.html Fri Mar 24 11:05:20 2017 +0000 +++ b/src/app/notebook-feed/notebook-feed.component.html Fri Mar 24 11:07:26 2017 +0000 @@ -1,14 +1,11 @@ -<ugly-analysis-item - [audioBuffer]="audioBuffer" - [timeline]="sharedTimeline" - [title]="'one'" - [description]="'Shared timeline'"></ugly-analysis-item> -<ugly-analysis-item - [audioBuffer]="audioBuffer" - [timeline]="sharedTimeline" - [title]="'two'" - [description]="'Shared timeline'"></ugly-analysis-item> -<ugly-analysis-item - [audioBuffer]="audioBuffer" - [title]="'three'" - [description]="'Independent timeline'"></ugly-analysis-item> + +<template ngFor let-item [ngForOf]="analyses"> + <div [class.break]="item.isRoot"> + <ugly-analysis-item + [timeline]="item.hasSharedTimeline ? sharedTimeline : undefined" + [title]="item.title" + [description]="item.description" + [isActive]="rootAudioUri === item.rootAudioUri" + [isRoot]="item.isRoot"></ugly-analysis-item> + </div> +</template>
--- a/src/app/notebook-feed/notebook-feed.component.ts Fri Mar 24 11:05:20 2017 +0000 +++ b/src/app/notebook-feed/notebook-feed.component.ts Fri Mar 24 11:07:26 2017 +0000 @@ -3,6 +3,7 @@ */ import {Component, Input} from "@angular/core"; import Waves from 'waves-ui'; +import {AnalysisItem} from "../analysis-item/analysis-item.component"; @Component({ selector: 'ugly-notebook-feed', @@ -10,23 +11,24 @@ styleUrls: ['./notebook-feed.component.css'] }) export class NotebookFeedComponent { - private _audioBuffer: AudioBuffer; sharedTimeline: Timeline; + @Input() analyses: AnalysisItem[]; + @Input() set rootAudioUri(uri: string) { + this._rootAudioUri = uri; - - @Input() - set audioBuffer(buffer: AudioBuffer) { - this._audioBuffer = buffer || undefined; - if (this.audioBuffer) { - - } + // TODO is this safe? will the fact references are held elsewhere + // keep the previous instance alive? Or will it get garbage collected in + // screw previous layers up? + this.sharedTimeline = new Waves.core.Timeline(); } - get audioBuffer(): AudioBuffer { - return this._audioBuffer; + get rootAudioUri(): string { + return this._rootAudioUri; } + private _rootAudioUri: string; constructor() { this.sharedTimeline = new Waves.core.Timeline(); + this.analyses = []; } }