-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
483 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,47 @@ | ||
import Ember from 'ember'; | ||
import firebase from 'firebase'; | ||
|
||
const { | ||
computed: { notEmpty } | ||
} = Ember; | ||
|
||
export default Ember.Component.extend({ | ||
classNames: ['row'], | ||
audioRecorder: Ember.inject.service(), | ||
hifi: Ember.inject.service(), | ||
|
||
hasAudio: notEmpty('model.audioUrl'), | ||
saving: false, | ||
|
||
init() { | ||
this._super(...arguments); | ||
this.get("audioRecorder").requestAccess(); | ||
}, | ||
|
||
mouseDown() { | ||
const recorder = this.get("audioRecorder").createRecorder(); | ||
this.set("recorder", recorder); | ||
Ember.run.later(recorder.start, 100); | ||
}, | ||
actions: { | ||
startRecording() { | ||
const recorder = this.get("audioRecorder").createRecorder(); | ||
this.set("recorder", recorder); | ||
Ember.run.later(recorder.start, 100); | ||
}, | ||
|
||
stopRecording() { | ||
this.set("saving", true); | ||
const recorder = this.get("recorder"); | ||
recorder | ||
.stop() | ||
.then(this.get("created")) | ||
.then(() => this.set("saving", false)); | ||
}, | ||
|
||
play() { | ||
const app = firebase.app(); | ||
var storageRef = app.storage().ref(); | ||
var audioRef = storageRef.child(this.get('model.audioUrl')); | ||
|
||
mouseUp() { | ||
const recorder = this.get("recorder"); | ||
recorder | ||
.stop() | ||
.then(this.get("created")); | ||
audioRef | ||
.getDownloadURL() | ||
.then(url => this.get("hifi").play(url)); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,20 @@ | ||
& | ||
border: none | ||
|
||
.btn | ||
margin: 0.25em | ||
display: block | ||
border-radius: 50% | ||
padding: 0.5em | ||
background: rgba(off-white, 0.8) | ||
height: 30px | ||
width: 30px | ||
transition: all 0.2s ease-in-out | ||
|
||
.btn:hover | ||
background: rgba(off-white, 1) | ||
|
||
.btn:active | ||
background: hot-pink | ||
opacity: 1 | ||
color: off-white |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
{{ui/icon-button | ||
label="Push & hold to record" | ||
loading=saving | ||
disabled=saving | ||
mouseDown=(action 'startRecording') | ||
mouseUp=(action 'stopRecording') | ||
leftIcon="microphone"}} | ||
|
||
{{#if hasAudio}} | ||
{{ui/icon-button | ||
click=(action "play") | ||
leftIcon="play"}} | ||
{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
<div class="previews"> | ||
<div class="previews row"> | ||
<div class="me"> | ||
|
||
</div> | ||
<div class="others"> | ||
|
||
</div> | ||
{{ui/icon-button | ||
class="start-video" | ||
rightIcon="video-camera" | ||
click=(action startVideo)}} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
& | ||
margin-top: 3em | ||
|
||
.create-conversation | ||
width: 100% | ||
padding: 1em | ||
color: dark-grey | ||
font-size: 1em | ||
opacity: 0.15 | ||
transition: all 0.2s ease-in-out | ||
|
||
.create-conversation:hover | ||
opacity: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,19 @@ | ||
<div class="col center flashCardContainer"> | ||
{{#if hasConversations}} | ||
{{#each sortedConversations as |conversation index|}} | ||
{{flash-card-group | ||
model=conversation | ||
onAudioCreated=onAudioCreated | ||
createFlashCard=createFlashCard | ||
destroyFlashCard=destroyFlashCard | ||
saveModel=saveModel}} | ||
{{/each}} | ||
{{else}} | ||
<h2>No conversations yet. Why not start one?</h2> | ||
{{/if}} | ||
<div class="col center conversation-container"> | ||
{{ui/icon-button | ||
class='create-conversation' | ||
click=(action createConversation 0) | ||
leftIcon="plus"}} | ||
{{#each sortedConversations as |conversation index|}} | ||
{{flash-card-group | ||
model=conversation | ||
index=(inc index) | ||
onAudioCreated=onAudioCreated | ||
createFlashCard=createFlashCard | ||
destroyFlashCard=destroyFlashCard | ||
saveModel=saveModel}} | ||
{{ui/icon-button | ||
class='create-conversation' | ||
click=(action createConversation (inc index)) | ||
leftIcon="plus"}} | ||
{{/each}} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,20 @@ | ||
import Ember from 'ember'; | ||
import computed from 'ember-computed-decorators'; | ||
|
||
const { isPresent, computed: { alias, sort, gt } } = Ember; | ||
|
||
export default Ember.Component.extend({ | ||
classNames: ['card-1'], | ||
|
||
sortAsc: ["position:asc"], | ||
sortedFlashCards: sort('model.activeFlashCards', 'sortAsc'), | ||
flashCardCount: alias("sortedFlashCards.length"), | ||
hasFlashCards: gt("flashCardCount", 0), | ||
|
||
actions: { | ||
handleUpdate(key, str) { | ||
this.get("model").set(key, str); | ||
this.get("saveModel")(this.get("model")); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
& | ||
width: 100% | ||
padding: 1em | ||
background: dope-blue | ||
height: 24em | ||
|
||
.conversation-header | ||
margin-left: calc(2em - 1em) | ||
color: off-white | ||
font-size: 1.5em | ||
align-items: baseline | ||
.index | ||
margin-right: 0.25em | ||
|
||
.conversation-title | ||
background: 0 | ||
border: 0 | ||
border-bottom: 1px dashed | ||
color: off-white | ||
font-size: 1.3em | ||
width: 16em | ||
|
||
.conversation-title::placeholder | ||
color: rgba(off-white, 0.5) | ||
|
||
.flash-card-container | ||
overflow-x: auto | ||
overflow-y: hidden | ||
margin: 1em 0 | ||
|
||
.create-flash-card | ||
color: white | ||
font-size: 1em | ||
padding: 1em | ||
opacity: 0.15 | ||
transition: all 0.2s ease-in-out | ||
|
||
.create-flash-card:hover | ||
opacity: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,31 @@ | ||
<div class="row"> | ||
{{#each model.flashCards as |flashCard|}} | ||
<header class="conversation-header row"> | ||
<span class="index"> | ||
{{index}}. | ||
</span> | ||
{{one-way-input model.title | ||
class='conversation-title' | ||
placeholder='What\'s this conversation about...' | ||
update=(action "handleUpdate" "title") | ||
autocomplete="off" | ||
autocorrect="off" | ||
autocapitalize="off" | ||
spellcheck=false}} | ||
</header> | ||
<div class="row flash-card-container"> | ||
{{ui/icon-button | ||
class="create-flash-card" | ||
leftIcon="plus" | ||
click=(action createFlashCard model 0)}} | ||
{{#each sortedFlashCards as |flashCard index|}} | ||
{{flash-card | ||
model=flashCard | ||
total=cardCount | ||
index=index | ||
index=(inc index) | ||
onAudioCreated=onAudioCreated | ||
destroyFlashCard=(action destroyFlashCard model) | ||
saveModel=saveModel}} | ||
{{ui/icon-button | ||
class="create-flash-card" | ||
leftIcon="plus" | ||
click=(action createFlashCard model (inc index))}} | ||
{{/each}} | ||
</div> | ||
|
||
{{ui/icon-button | ||
label="Create" | ||
leftIcon="add" | ||
click=(action createFlashCard model)}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.