Skip to content

Instantly share code, notes, and snippets.

View Saima-Chaity's full-sized avatar

Saima-Chaity

View GitHub Profile
import React, { Component } from 'react';
import './App.css';
import AssignmentListings from './AssignmentListings';
class AssignmentForm extends Component {
constructor(props) {
super(props);
this.state ={
assignmentArray: []
};
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>
import React, { Component } from 'react';
import './App.css';
class AssignmentForm extends Component {
constructor(props) {
super(props);
this.state ={
assignmentArray: []
};
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>;
export class ChatMessage {
$key?: string;
userName?: string;
email?: string;
message?: string;
file?: any;
profilePhoto?: any;
timeSent?: any;
}
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'
})
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 {
getAllMessages(): AngularFireList<ChatMessage> {
return this.db.list('messages', ref => ref.limitToLast(25).orderByKey()
);
}
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']
saveProfileSettings(newPhoto: string, userId: string) {
const path = `users/${userId}`;
const data = {
profilePhoto: newPhoto
};
this.db.object(path).update(data);
this.router.navigate(['chat']);
}