Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lesson 27 #21

Open
wants to merge 144 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
144 commits
Select commit Hold shift + click to select a range
66b13a2
lesson-2
iamshaunjp May 1, 2019
4dfb614
lesson-3
iamshaunjp May 1, 2019
619cb26
lesson-5
iamshaunjp May 1, 2019
9674986
lesson-9
iamshaunjp May 1, 2019
56c444f
lesson-11
iamshaunjp May 1, 2019
13798bb
lesson-12
iamshaunjp May 1, 2019
7872e21
lesson-15
iamshaunjp May 1, 2019
1f02758
lesson-16a
iamshaunjp May 2, 2019
99da081
lesson-16
iamshaunjp May 2, 2019
40cc6de
lesson-18
iamshaunjp May 2, 2019
4d77ca5
lesson-18
iamshaunjp May 2, 2019
c3603e5
lesson-19
iamshaunjp May 2, 2019
59a0584
lesson-20
iamshaunjp May 2, 2019
c431325
lesson-21
iamshaunjp May 2, 2019
135fd24
lesson-23
iamshaunjp May 2, 2019
90b1923
lesson-24
iamshaunjp May 2, 2019
73647ce
lesson-25
iamshaunjp May 2, 2019
421c359
lesson-26
iamshaunjp May 2, 2019
422cf58
lesson-27a
iamshaunjp May 2, 2019
3ad1db5
lesson-27
iamshaunjp May 2, 2019
1edb350
lesson-27
iamshaunjp May 2, 2019
ebc6ee1
change db config
James007wang Feb 4, 2022
756424f
change title
James007wang Feb 9, 2022
ad29dca
Update index.html
James007wang Feb 9, 2022
18c8a42
Update index.html
James007wang Feb 9, 2022
96922d2
Update index.html
James007wang Feb 9, 2022
2d3a826
change title in vscode
James007wang Feb 10, 2022
d3eceeb
PR
James007wang Feb 10, 2022
99e9550
change...
James007wang Feb 10, 2022
fe68199
4
James007wang Mar 31, 2022
639848c
c
James007wang Mar 31, 2022
3d12201
c
James007wang Mar 31, 2022
03380a5
c
James007wang Mar 31, 2022
36a5f7f
c
James007wang Mar 31, 2022
872da8d
c
James007wang Mar 31, 2022
41310c7
c
James007wang Mar 31, 2022
14acc93
c
James007wang Mar 31, 2022
ba8c352
c
James007wang Mar 31, 2022
35ebc9e
c
James007wang Apr 4, 2022
e0ffc56
c
James007wang Apr 4, 2022
2af38d3
c
James007wang Apr 4, 2022
ac3b1a3
v
James007wang Apr 4, 2022
eb1aebb
c
James007wang Apr 4, 2022
ea848a0
c
James007wang Apr 4, 2022
746953b
c
James007wang Apr 4, 2022
daba545
c
James007wang Apr 4, 2022
5448c85
c
James007wang Apr 4, 2022
af81357
c
James007wang Apr 4, 2022
4783ca6
v
James007wang Apr 4, 2022
87d5f1e
c
James007wang Apr 4, 2022
7b294cb
c
James007wang Apr 4, 2022
315119e
c
James007wang Apr 4, 2022
c53f339
c
James007wang Apr 4, 2022
43a5698
c
James007wang Apr 4, 2022
33b74f3
c
James007wang Apr 4, 2022
e29940d
c
James007wang Apr 4, 2022
546b5ca
c
James007wang Apr 4, 2022
612dafd
c
James007wang Apr 4, 2022
284315d
c
James007wang Apr 5, 2022
e8d2045
c
James007wang Apr 5, 2022
8bb1037
c
James007wang Apr 5, 2022
ce2e19d
c
James007wang Apr 5, 2022
f9dc02f
c
James007wang Apr 5, 2022
f307d61
c
James007wang Apr 5, 2022
d66cccf
c
James007wang Apr 5, 2022
3b878bd
c
James007wang Apr 5, 2022
bb61195
c
James007wang Apr 5, 2022
00497a0
v
James007wang Apr 5, 2022
cfdf44e
c
James007wang Apr 5, 2022
0297efe
c
James007wang Apr 5, 2022
91b44aa
c
James007wang Apr 5, 2022
87a6671
c
James007wang Apr 5, 2022
8c6664b
c
James007wang Apr 5, 2022
2ec1352
c
James007wang Apr 5, 2022
0911415
c
James007wang Apr 5, 2022
39456c1
c
James007wang Apr 5, 2022
02621cb
c
James007wang Apr 5, 2022
ddfa24a
c
James007wang Apr 5, 2022
d0a59fd
c
James007wang Apr 5, 2022
ce98e9e
c
James007wang Apr 5, 2022
ddffcee
c
James007wang Apr 5, 2022
c3d161f
c
James007wang Apr 5, 2022
2403de6
c
James007wang Apr 5, 2022
ae01667
c
James007wang Apr 5, 2022
dc40748
c
James007wang Apr 5, 2022
a6e0984
c
James007wang Apr 5, 2022
89a299a
c
James007wang Apr 5, 2022
13cf714
c
James007wang Apr 5, 2022
24b1779
c
James007wang Apr 5, 2022
ad627de
c
James007wang Apr 5, 2022
49b2872
c
James007wang Apr 5, 2022
32eb590
c
James007wang Apr 5, 2022
1bf3d9f
c
James007wang Apr 6, 2022
513a13e
c
James007wang Apr 6, 2022
b3ef5d1
3
James007wang Apr 6, 2022
88c859a
c
James007wang Apr 6, 2022
f1061f0
c
James007wang Apr 6, 2022
fcbc7b7
c
James007wang Apr 6, 2022
cf04788
c
James007wang Apr 6, 2022
84cd473
c
James007wang Apr 6, 2022
d3557c6
c
James007wang Apr 6, 2022
273d3b8
c
James007wang Apr 6, 2022
7db3c26
c
James007wang Apr 6, 2022
eace059
c
James007wang Apr 6, 2022
715690b
c
James007wang Apr 6, 2022
1a3fd9a
c
James007wang Apr 6, 2022
cd16e56
v
James007wang Apr 6, 2022
cd93967
v
James007wang Apr 6, 2022
e5ef94a
v
James007wang Apr 6, 2022
a6b2a6f
v
James007wang Apr 6, 2022
c6d6bee
c
James007wang Apr 6, 2022
326426f
v
James007wang Apr 6, 2022
d82f691
c
James007wang Apr 6, 2022
2dd1621
v
James007wang Apr 6, 2022
a60c50a
c
James007wang Apr 6, 2022
1a7d06e
v
James007wang Apr 6, 2022
b4fde53
c
James007wang Apr 6, 2022
1529132
c
James007wang Apr 6, 2022
4de68bc
c
James007wang Apr 6, 2022
f65c81d
c
James007wang Apr 6, 2022
ed168db
c
James007wang Apr 6, 2022
5f57862
c
James007wang Apr 6, 2022
dae027b
c
James007wang Apr 6, 2022
3bdc321
v
James007wang Apr 6, 2022
c24cbec
v
James007wang Apr 6, 2022
980c259
c
James007wang Apr 6, 2022
3b1f595
c
James007wang Apr 6, 2022
3887e34
c
James007wang Apr 6, 2022
fb81f5a
c
James007wang Apr 6, 2022
7bb03c8
c
James007wang Apr 6, 2022
074f31d
c
James007wang Apr 7, 2022
74c8242
c
James007wang Apr 7, 2022
d0fef0c
c
James007wang Apr 7, 2022
f32ab9d
c
James007wang Apr 7, 2022
ee90bdf
c
James007wang Apr 7, 2022
88bcb51
c
James007wang Apr 7, 2022
c7813c5
c
James007wang Apr 7, 2022
109b186
self.addEventListener('message', (event) => {
James007wang Apr 7, 2022
44ace62
c
James007wang Apr 7, 2022
da93e9c
c
James007wang Apr 7, 2022
85588ec
c
James007wang Apr 7, 2022
a1d4602
c
James007wang Apr 7, 2022
05ac722
c
James007wang Apr 7, 2022
c8fafca
c
James007wang Apr 7, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions README.md

This file was deleted.

1 change: 1 addition & 0 deletions ServiceWorkerUpdateListener.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions _headers
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/*
cache-control: max-age=0
cache-control: no-cache
cache-control: no-store
cache-control: must-revalidate
177 changes: 177 additions & 0 deletions afterLogin.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Firebase Store and auth PWA </title>
<!-- <script src="https://www.gstatic.com/firebasejs/9.1.3/firebase-app-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/9.1.3/firebase-auth-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/9.1.3/firebase-store-compat.js"></script> -->
<!-- *******************************************************************************************
* TODO(DEVELOPER): Paste the initialization snippet from:
* Firebase Console > Overview > Add Firebase to your web app. *
***************************************************************************************** -->
<title>Firebase PWA</title>
<!-- materialize icons, css & js -->
<link type="text/css" href="/css/materialize.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link type="text/css" href="/css/styles.css" rel="stylesheet">
<script type="text/javascript" src="/js/materialize.min.js"></script>
<link rel="manifest" href="/manifest.json">
<!-- ios support -->
<link rel="apple-touch-icon" href="/img/icons/icon-96x96.png">
<meta name="apple-mobile-web-app-status-bar" content="#FFE1C4">
<meta name="theme-color" content="#FFE1C4">

</head>
<body class="grey lighten-4">
<!-- top nav -->
<nav class="z-depth-0">
<div class="nav-wrapper container">
<a href="/">Firebase PWA</a>
<span class="right grey-text text-darken-1">
<i class="material-icons sidenav-trigger" data-target="side-menu">menu</i>
</span>
</div>
</nav>

<!-- side nav -->
<ul id="side-menu" class="sidenav side-menu">
<li><a class="subheader">Firebase PWA</a></li>
<li><a href="" class="waves-effect" id="sign-out">Sign out</a></li>
<li><a href="/" class="waves-effect">Home</a></li>
<li><a href="/pages/about.html" class="waves-effect">About</a></li>
<li><div class="divider"></div></li>
<li><a href="/pages/contact.html" class="waves-effect">
<i class="material-icons">mail_outline</i>Contact</a>
</li>
</ul>

<!-- recipes -->
<div class="recipes container grey-text text-darken-1">

</div>

<div class="center">
<a class="btn-floating btn-small btn-large add-btn sidenav-trigger" data-target="side-form">
<i class="material-icons">add</i>
</a>
</div>

<!-- add recipe side nav -->
<div id="side-form" class="sidenav side-form">
<form class="add-recipe container section">
<h6 >New Recipe</h6>
<div class="divider"></div>
<div class="input-field">
<input placeholder="e.g. Ninja soup" id="title" type="text" class="validate">
<label for="title">Recipe Title</label>
</div>
<div class="input-field">
<input placeholder="e.g. Tofu, mushroom, garlic" id="ingredients" type="text" class="validate">
<label for="ingredients">Ingredients</label>
</div>
<div class="input-field center">
<button class="btn-small">Add</button>
</div>
</form>
</div>



<!-- <div id="sign-in-status"></div>
<div id="sign-in"></div>

<pre id="account-details"></pre> -->
<!-- <button class="btn yellow darken-2 z-depth-0" id="sign-out">Sign Out</button> -->
<script src="https://www.gstatic.com/firebasejs/8.0.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.0.1/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.0.1/firebase-firestore.js"></script>
<script>
// Initialize Firebase
var config = {
apiKey: "AIzaSyDuJe2w5Ptc1AwM-Us-kWb2jYJuCr6UTOw",
authDomain: "angularfire-54a57.firebaseapp.com",
databaseURL: "https://angularfire-54a57.firebaseio.com",
projectId: "angularfire-54a57",
storageBucket: "angularfire-54a57.appspot.com",
messagingSenderId: "160774038322",
appId: "1:160774038322:web:5325bf8caa01ee62cfad2b"
};
firebase.initializeApp(config);

// make auth and firestore references
//const auth = firebase.auth();
const db = firebase.firestore();

// update firestore settings
//db.settings({ timestampsInSnapshots: true });
</script>
<script src="/js/app.js"></script>
<script src="/js/db.js"></script>
<script src="/js/ui.js"></script>

<script type="text/javascript">
initApp = function() {
firebase.auth().onAuthStateChanged(function(user) {
if (user) {

// User is signed in.
//document.getElementById('sign-out').style.display = 'block';
/* var displayName = user.displayName;
var email = user.email;
var emailVerified = user.emailVerified;
var photoURL = user.photoURL;
var uid = user.uid;
var phoneNumber = user.phoneNumber;
var providerData = user.providerData;
user.getIdToken().then(function(accessToken) {
document.getElementById('sign-in-status').textContent = 'Signed in';
document.getElementById('sign-in').textContent = 'Sign out';
document.getElementById('account-details').textContent = JSON.stringify({
displayName: displayName,
email: email,
emailVerified: emailVerified,
phoneNumber: phoneNumber,
photoURL: photoURL,
uid: uid,
accessToken: accessToken,
providerData: providerData
}, null, ' ');
}); */


} else {
// User is signed out.
window.location.replace("https://majestic-sable-521f65.netlify.app");
/* document.getElementById('sign-in-status').textContent = 'Signed out';
document.getElementById('sign-in').textContent = 'Sign in';
//document.getElementById('sign-out').style.display = 'null';
document.getElementById('account-details').textContent = 'null'; */
}
}, function(error) {
console.log(error);
});
};

window.addEventListener('load', function() {
initApp()
});

const sign_out = document.getElementById("sign-out");
sign_out.addEventListener('click', () => {
firebase.auth().signOut().then(() => {
// Sign-out successful./
console.log('Sign out.'+window.location.origin);
window.location.replace("https://majestic-sable-521f65.netlify.app");

}).catch((error) => {
// An error happened.
console.log(error);
});
});
</script>



</body>
</html>
13 changes: 13 additions & 0 deletions css/materialize.min.css

Large diffs are not rendered by default.

75 changes: 75 additions & 0 deletions css/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/* colours */
:root{
--primary: #FFE9D2;
--secondary: #FFE1C4;
--title: #FF8816;
}

/* layout styles */
nav{
background: var(--primary);
border-bottom: 10px solid var(--secondary);
}
nav a{
text-transform: uppercase;
color: var(--title);
}
nav a span{
font-weight: bold;
}
nav .sidenav-trigger{
margin: 0;
}

/* recipe styles */
.recipes{
margin-top: 20px;
}
.card-panel.recipe{
border-radius: 8px;
padding: 10px;
box-shadow: 0px 1px 3px rgba(90,90,90,0.1);
display: grid;
grid-template-columns: 2fr 6fr 1fr;
grid-template-areas: "image details delete";
position: relative;
}
.recipe img{
grid-area: image;
max-width: 60px;
}
.recipe-details{
grid-area: details;
margin-top: 6px;
}
.recipe-delete{
grid-area: delete;
position: absolute;
bottom: 0px;
right: 0px;
}
.recipe-delete i{
font-size: 18px;
}
.recipe-title{
font-weight: bold;
}
.recipe-ingredients{
font-size: 0.8em;
}

/* form-styles */
.add-btn{
background: var(--title) !important;
}
input{
box-shadow: none !important;
-webkit-box-shadow: none !important;
}
.side-form button{
background: var(--title);
box-shadow: 1px 1px 3px rgba(90,90,90,0.2);
}
form .input-field{
margin-top: 30px;
}
Binary file added img/dish.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/icons/icon-128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/icons/icon-144x144.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/icons/icon-152x152.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/icons/icon-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/icons/icon-384x384.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/icons/icon-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/icons/icon-72x72.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/icons/icon-96x96.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading