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

done #13

Open
wants to merge 1 commit into
base: lesson-21
Choose a base branch
from
Open

done #13

Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "food-ninja-pwa-13cac"
}
}
21 changes: 21 additions & 0 deletions .github/workflows/firebase-hosting-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on merge
'on':
push:
branches:
- master
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_FOOD_NINJA_PWA_13CAC }}'
channelId: live
projectId: food-ninja-pwa-13cac
env:
FIREBASE_CLI_PREVIEWS: hostingchannels
17 changes: 17 additions & 0 deletions .github/workflows/firebase-hosting-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on PR
'on': pull_request
jobs:
build_and_preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_FOOD_NINJA_PWA_13CAC }}'
projectId: food-ninja-pwa-13cac
env:
FIREBASE_CLI_PREVIEWS: hostingchannels
66 changes: 66 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
firebase-debug.log*
firebase-debug.*.log*

# Firebase cache
.firebase/

# Firebase config

# Uncomment this if you'd like others to create their own Firebase project.
# For a team working on the same Firebase project(s), it is recommended to leave
# it commented so all members can deploy to the same project(s) in .firebaserc.
# .firebaserc

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
10 changes: 10 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
}
212 changes: 106 additions & 106 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,113 +1,113 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Food Ninja</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="/">Food<span>Ninja</span></a>
<span class="right grey-text text-darken-1">
<i class="material-icons sidenav-trigger" data-target="side-menu">menu</i>
</span>
</div>
</nav>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Food Ninja</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="/">Food<span>Ninja</span></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">FOODNINJA</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>
<!-- side nav -->
<ul id="side-menu" class="sidenav side-menu">
<li><a class="subheader">FOODNINJA</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 class="card-panel recipe white row">
<img src="/img/dish.png" alt="recipe thumb">
<div class="recipe-details">
<div class="recipe-title">Edame Noodles</div>
<div class="recipe-ingredients">Edame Beans, Noodels, Garlic oil</div>
</div>
<div class="recipe-delete">
<i class="material-icons">delete_outline</i>
</div>
<!-- recipes -->
<div class="recipes container grey-text text-darken-1">
<h6 class="center">William's Recipes</h6>
</div>
<div class="card-panel recipe white row">
<img src="/img/dish.png" alt="recipe thumb">
<div class="recipe-details">
<div class="recipe-title">Edame Noodles</div>
<div class="recipe-ingredients">Edame Beans, Noodels, Garlic oil</div>
</div>
<div class="recipe-delete">
<i class="material-icons">delete_outline</i>
</div>
</div>
<div class="card-panel recipe white row">
<img src="/img/dish.png" alt="recipe thumb">
<div class="recipe-details">
<div class="recipe-title">Edame Noodles</div>
<div class="recipe-ingredients">Edame Beans, Noodels, Garlic oil</div>
</div>
<div class="recipe-delete">
<i class="material-icons">delete_outline</i>
</div>
</div>
<div class="card-panel recipe white row">
<img src="/img/dish.png" alt="recipe thumb">
<div class="recipe-details">
<div class="recipe-title">Edame Noodles</div>
<div class="recipe-ingredients">Edame Beans, Noodels, Garlic oil</div>
</div>
<div class="recipe-delete">
<i class="material-icons">delete_outline</i>
</div>
</div>
</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>
<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>
<!-- 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>
<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="https://www.gstatic.com/firebasejs/8.3.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.3.0/firebase-firestore.js"></script>

<script src="/js/app.js"></script>
<script src="/js/ui.js"></script>
</body>
</html>
<script>
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
var firebaseConfig = {
apiKey: 'AIzaSyAXYHHBywaAkqiBJHQ28SL-I5h7GJ0veK0',
authDomain: 'food-ninja-pwa-13cac.firebaseapp.com',
projectId: 'food-ninja-pwa-13cac',
storageBucket: 'food-ninja-pwa-13cac.appspot.com',
messagingSenderId: '21895641390',
appId: '1:21895641390:web:864e503e19630364eea2bf',
measurementId: 'G-JRWQ62XPNL',
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
const db = firebase.firestore();
</script>
<script src="/js/app.js"></script>
<script src="/js/db.js"></script>
<script src="/js/ui.js"></script>
</body>
</html>
11 changes: 6 additions & 5 deletions js/app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
if('serviceWorker' in navigator){
navigator.serviceWorker.register('/sw.js')
.then(reg => console.log('service worker registered'))
.catch(err => console.log('service worker not registered', err));
}
if ('serviceWorker' in navigator) {
navigator.serviceWorker
.register('/sw.js')
.then((reg) => console.log('service worker registered'))
.catch((err) => console.log('service worker not registered', err));
}
Loading