diff --git a/.DS_Store b/.DS_Store index 9a685a5..d3c48e5 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/css/profile.css b/css/profile.css index 0c1d389..2785a4d 100644 --- a/css/profile.css +++ b/css/profile.css @@ -1,3 +1,8 @@ +body{ + font-family: 'Josefin Sans', sans-serif; + background-color: #eee; +} + header{ background-color: #3e2fae; min-height: 40vh @@ -18,4 +23,58 @@ header p{ color: white; font-family: Arial, Helvetica, sans-serif; font-size: 20px; -} \ No newline at end of file +} + +.input{ + text-align: center; +} + +#usernameDisplay{ + text-align: center; + color: white; + font-size: 30px; + font-weight: bold; +} + +#userStatusDisplay{ + text-align: center; + color: white; + font-size: 20px; + +} + +.profile{ + display: flex; + flex-direction: column; + align-items: center; +} + +#userProfilePicDisplay{ + width: 80px; + height: 80px; + border-radius: 50px;; +} +#usernameInput{ + border-radius: 10px; + border: 2px solid #f9d861; + padding: 5px; +} +#statusInput{ + border-radius: 10px; + border: 2px solid #f9d861; + padding: 5px; +} +#profileSaveInput{ + border-radius: 10px; + font-family: 'Josefin Sans', sans-serif; + background-color: #f9d861; + padding: 10px; + + +} +#prifilePicInput{ + border-radius: 10px; + font-family: 'Josefin Sans', sans-serif; + background-color: #f9d861; + padding: 10px; +} diff --git a/firebase-chat-functions.js b/firebase-chat-functions.js new file mode 100644 index 0000000..f633293 --- /dev/null +++ b/firebase-chat-functions.js @@ -0,0 +1,29 @@ +function saveMessageToFirebase(msg) { + db.collection("messages").add(msg) +} + +function getAllMessagesFromFirebase() { + let allMsgs = []; + db.collection("messages").orderBy('dateStamp', 'asc').limit(200).get().then(function(querySnapshot) { + querySnapshot.forEach(function(doc) { + // doc.data() is never undefined for query doc snapshots + allMsgs.push(doc.data()) + }); + }); + + return allMsgs; +} + +function watchFirebaseForChanges(callBack) { + db.collection("messages").orderBy('dateStamp','asc').onSnapshot(function(querySnapshot) { + querySnapshot.docChanges().forEach(function(change) { + if (change.type === "added") { + callBack(change.doc); + } + }); + }); +} + + +//getAllMessagesFromFirebase(); +//watchFirebaseForChanges(function(msg){displayNewMessage(msg.data())}) \ No newline at end of file diff --git a/firebase-config.js b/firebase-config.js new file mode 100644 index 0000000..ac528cc --- /dev/null +++ b/firebase-config.js @@ -0,0 +1,12 @@ +var firebaseConfig = { + apiKey: "AIzaSyAbh39Rb-F9_PO8lpAoob_qA1dYUVNYAkg", + authDomain: "dmd-3440-pwa-demo.firebaseapp.com", + databaseURL: "https://dmd-3440-pwa-demo.firebaseio.com", + projectId: "dmd-3440-pwa-demo", + storageBucket: "dmd-3440-pwa-demo.appspot.com", + messagingSenderId: "239477441112", + appId: "1:239477441112:web:0dcd3f94fe067b09ac402d" + }; + // Initialize Firebase + firebase.initializeApp(firebaseConfig); + var db = firebase.firestore(); diff --git a/index.html b/index.html index 7abd210..fdb603b 100644 --- a/index.html +++ b/index.html @@ -7,12 +7,18 @@
Welcome to Chatmate!  {UserName}
++ Welcome to Chatmate!   + + {UserName} + {Status} +