This file contains hidden or 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
import React, { Component } from 'react'; | |
import './App.css'; | |
import AssignmentListings from './AssignmentListings'; | |
class AssignmentForm extends Component { | |
constructor(props) { | |
super(props); | |
this.state ={ | |
assignmentArray: [] | |
}; |
This file contains hidden or 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
import React from 'react'; | |
export default function AssignmentListings(props){ | |
return ( | |
<div> | |
{props.assignmentItems.map((item, index) => ( | |
<ul key={index}> | |
<li>Assignment Name : {item.assignmentName}</li> | |
<li>Grade : {item.grade}</li> | |
</ul> |
This file contains hidden or 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
import React, { Component } from 'react'; | |
import './App.css'; | |
class AssignmentForm extends Component { | |
constructor(props) { | |
super(props); | |
this.state ={ | |
assignmentArray: [] | |
}; |
This file contains hidden or 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
import { Component, OnInit } from '@angular/core'; | |
import { ChatService } from '../services/chat.service'; | |
@Component({ | |
selector: 'app-user-list', | |
templateUrl: './user-list.component.html', | |
styleUrls: ['./user-list.component.css'] | |
}) | |
export class UserListComponent implements OnInit { | |
users: Array<any>; |
This file contains hidden or 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
export class ChatMessage { | |
$key?: string; | |
userName?: string; | |
email?: string; | |
message?: string; | |
file?: any; | |
profilePhoto?: any; | |
timeSent?: any; | |
} |
This file contains hidden or 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
import { Injectable } from '@angular/core'; | |
import { AngularFireDatabase, AngularFireList } from 'angularfire2/database'; | |
import { AngularFireAuth } from 'angularfire2/auth'; | |
import { Observable } from 'rxjs/Observable'; | |
import * as firebase from 'firebase/app'; | |
import { ChatMessage } from '../models/chat-message.model'; | |
@Injectable({ | |
providedIn: 'root' | |
}) |
This file contains hidden or 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
import { Component, OnInit } from '@angular/core'; | |
import {ChatService} from '../services/chat.service'; | |
@Component({ | |
selector: 'app-chat-form', | |
templateUrl: './chat-form.component.html', | |
styleUrls: ['./chat-form.component.css'] | |
}) | |
export class ChatFormComponent implements OnInit { |
This file contains hidden or 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
getAllMessages(): AngularFireList<ChatMessage> { | |
return this.db.list('messages', ref => ref.limitToLast(25).orderByKey() | |
); | |
} |
This file contains hidden or 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
import { Component, OnInit, OnChanges } from '@angular/core'; | |
import { ChatService } from '../services/chat.service'; | |
import { ChatMessage } from '../models/chat-message.model'; | |
import { AuthService } from '../services/auth.service'; | |
@Component({ | |
selector: 'app-feed', | |
templateUrl: './feed.component.html', | |
styleUrls: ['./feed.component.css'] |
This file contains hidden or 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
saveProfileSettings(newPhoto: string, userId: string) { | |
const path = `users/${userId}`; | |
const data = { | |
profilePhoto: newPhoto | |
}; | |
this.db.object(path).update(data); | |
this.router.navigate(['chat']); | |
} |