Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Firebase #24

Closed
wants to merge 129 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
9d58326
Basic init
mattbloomfield Nov 30, 2020
b1cd506
build fixes
mattbloomfield Nov 30, 2020
8883207
Fixing titles
mattbloomfield Nov 30, 2020
331beb0
Update recipe names
mattbloomfield Nov 30, 2020
049538e
Adds potential for manual added recipes
mattbloomfield Nov 30, 2020
15900a6
Update from Forestry.io - Updated Forestry configuration
mattbloomfield Nov 30, 2020
9695d56
Update from Forestry.io - Updated Forestry configuration
mattbloomfield Nov 30, 2020
26a35dc
Update from Forestry.io - Updated Forestry configuration
mattbloomfield Nov 30, 2020
30946f7
Update from Forestry.io - Updated Forestry configuration
mattbloomfield Nov 30, 2020
0464f56
new recipe:
mattbloomfield Nov 30, 2020
d6db921
Merge branch 'master' of github.com:mattbloomfield/adfreemeals
mattbloomfield Nov 30, 2020
771531a
removing inline images
mattbloomfield Nov 30, 2020
caaf9fb
New recipe
mattbloomfield Dec 1, 2020
9fab653
Update from Forestry.io
mattbloomfield Dec 1, 2020
8924617
Update from Forestry.io
mattbloomfield Dec 1, 2020
91dc941
Update from Forestry.io
mattbloomfield Dec 1, 2020
e07fa8e
Update from Forestry.io - Updated Forestry configuration
mattbloomfield Dec 1, 2020
16af036
Update from Forestry.io - Updated Forestry configuration
mattbloomfield Dec 1, 2020
f999a70
Update from Forestry.io - Updated Forestry configuration
mattbloomfield Dec 1, 2020
871882e
Update from Forestry.io
mattbloomfield Dec 1, 2020
71ffff6
Update from Forestry.io - Updated Forestry configuration
mattbloomfield Dec 1, 2020
e6db519
Update from Forestry.io - Updated Forestry configuration
mattbloomfield Dec 1, 2020
057d518
Update from Forestry.io - Updated Forestry configuration
mattbloomfield Dec 1, 2020
320a2f3
updating user upload file structure
mattbloomfield Dec 1, 2020
a11d938
Merge branch 'master' of github.com:mattbloomfield/adfreemeals
mattbloomfield Dec 1, 2020
2f893d8
Update from Forestry.io - Updated Forestry configuration
mattbloomfield Dec 1, 2020
f1f9c21
Update from Forestry.io - Updated Forestry configuration
mattbloomfield Dec 1, 2020
2959039
Update from Forestry.io
mattbloomfield Dec 1, 2020
6d0bf57
Update from Forestry.io - Updated Forestry configuration
mattbloomfield Dec 1, 2020
1f59a10
Update from Forestry.io - Updated Forestry configuration
mattbloomfield Dec 1, 2020
5e15536
Update from Forestry.io - Updated Forestry configuration
mattbloomfield Dec 1, 2020
5e2e643
Update from Forestry.io - Updated Forestry configuration
mattbloomfield Dec 1, 2020
c030431
merging in user-edited stuff
mattbloomfield Dec 1, 2020
8499f54
Merge branch 'master' of github.com:mattbloomfield/adfreemeals
mattbloomfield Dec 1, 2020
ec41deb
trying new approach
mattbloomfield Dec 1, 2020
402f075
Update from Forestry.io
mattbloomfield Dec 1, 2020
3e5b4f4
caches local files, allows total edits
mattbloomfield Dec 1, 2020
46aaac6
Update from Forestry.io - Updated Forestry configuration
mattbloomfield Dec 1, 2020
36756ba
Update from Forestry.io
mattbloomfield Dec 1, 2020
2313063
Caching working
mattbloomfield Dec 1, 2020
ffa0c03
Update from Forestry.io
mattbloomfield Dec 1, 2020
44a1a27
Update from Forestry.io
mattbloomfield Dec 1, 2020
94aa6a2
Update from Forestry.io - Updated Forestry configuration
mattbloomfield Dec 1, 2020
95874db
Update from Forestry.io - Updated Forestry configuration
mattbloomfield Dec 1, 2020
c06582a
Update from Forestry.io - Updated Forestry configuration
mattbloomfield Dec 1, 2020
796f43c
Update from Forestry.io - Updated Forestry configuration
mattbloomfield Dec 1, 2020
cb7babe
Adding original URL to recipe
mattbloomfield Dec 1, 2020
22b298c
Update from Forestry.io - Updated Forestry configuration
mattbloomfield Dec 1, 2020
9acc8a2
Update from Forestry.io
mattbloomfield Dec 6, 2020
6f02fee
Update from Forestry.io
mattbloomfield Dec 6, 2020
2dafba1
Update from Forestry.io
mattbloomfield Dec 7, 2020
c18da61
Adding a fallback parser and a new error class for better debugging
mattbloomfield Dec 7, 2020
da431ac
Update from Forestry.io
mattbloomfield Dec 9, 2020
fe5f4cc
Update from Forestry.io
mattbloomfield Dec 9, 2020
4212281
Update from Forestry.io
Dec 16, 2020
a7b7aa9
Update from Forestry.io
Dec 28, 2020
3ed202d
Update from Forestry.io
mattbloomfield Jan 4, 2021
57c1055
Update from Forestry.io
mattbloomfield Jan 4, 2021
31f5501
Update from Forestry.io
mattbloomfield Jan 4, 2021
b7b038c
Update from Forestry.io
mattbloomfield Jan 4, 2021
283dfd4
Update from Forestry.io
mattbloomfield Jan 4, 2021
9bcaec1
Update from Forestry.io
mattbloomfield Jan 4, 2021
8335154
Update from Forestry.io
mattbloomfield Jan 4, 2021
73d86e3
Visible Errors
mattbloomfield Jan 4, 2021
ad37f21
Merge branch 'master' of github.com:mattbloomfield/adfreemeals
mattbloomfield Jan 4, 2021
bb21aec
Merge conflicts
mattbloomfield Jan 4, 2021
8ef5f37
Update from Forestry.io
mattbloomfield Jan 4, 2021
02490f6
Update from Forestry.io
mattbloomfield Jan 4, 2021
64bb258
Update from Forestry.io
Jan 4, 2021
7cf0e5b
Update from Forestry.io
Jan 5, 2021
0cd04be
Update from Forestry.io
Jan 5, 2021
18b6607
Update from Forestry.io
Jan 5, 2021
a9a7e44
Update from Forestry.io
Jan 5, 2021
02f71af
Update from Forestry.io
Jan 5, 2021
5ba2ae7
Update from Forestry.io
Jan 5, 2021
d6faea5
Update from Forestry.io
Jan 5, 2021
db32665
Update from Forestry.io
Jan 5, 2021
c3cd6e4
Update from Forestry.io
Jan 5, 2021
c001308
Update from Forestry.io
Jan 5, 2021
0d26748
Update from Forestry.io
Jan 5, 2021
f0c9f29
Update from Forestry.io
Jan 5, 2021
c113904
Update from Forestry.io
Jan 5, 2021
34221a4
Update from Forestry.io
Jan 5, 2021
a024513
Update from Forestry.io
Jan 5, 2021
7ec37bb
Update from Forestry.io
Jan 5, 2021
04dfb43
Update from Forestry.io
Jan 5, 2021
4bceedf
Update from Forestry.io
Jan 5, 2021
0248054
Update from Forestry.io
Jan 5, 2021
f8f6f6c
Update from Forestry.io
Jan 5, 2021
014e189
Update from Forestry.io
Jan 5, 2021
75668f5
Update from Forestry.io
Jan 5, 2021
5841aaf
Update from Forestry.io
Jan 5, 2021
1662a00
Update from Forestry.io
Jan 5, 2021
db02499
Update from Forestry.io
Jan 5, 2021
cbf980f
Update from Forestry.io
Jan 5, 2021
6432c8d
Update from Forestry.io
Jan 14, 2021
4790114
Update from Forestry.io
Jan 31, 2021
8926ae0
Update from Forestry.io
Feb 1, 2021
065eff9
Adding new recipes
Feb 1, 2021
dff65ae
Update from Forestry.io
mattbloomfield Feb 1, 2021
1a7e349
adding new fallback for tasty recipes
Feb 1, 2021
c705288
Merge branch 'master' of github.com:mattbloomfield/adfreemeals
Feb 1, 2021
eb1421b
Update from Forestry.io
mattbloomfield Feb 15, 2021
c8b1def
Update from Forestry.io
Mar 14, 2021
7583ae8
Update from Forestry.io
Mar 16, 2021
16fdcb6
Update from Forestry.io
mattbloomfield Mar 17, 2021
1371aea
Update from Forestry.io
mattbloomfield Mar 17, 2021
687ae79
Update from Forestry.io
Sep 20, 2021
ffd2133
Update from Forestry.io
Sep 20, 2021
ab38678
Update from Forestry.io
mattbloomfield Oct 19, 2021
31996cb
Adding in a form and add page
mattbloomfield Oct 23, 2021
a75059f
Update from Forestry.io
mattbloomfield Oct 24, 2021
d75ba4d
Update from Forestry.io
mattbloomfield Oct 24, 2021
689aefb
better errors, fallbacks, and parsing
mattbloomfield Nov 7, 2021
bb9bd69
Merge branch 'master' of github.com:mattbloomfield/adfreemeals
mattbloomfield Nov 7, 2021
fc0fe84
Refactors the display and adds a function that is triggered by form s…
mattbloomfield Nov 7, 2021
deb5b56
Changing function name
mattbloomfield Nov 7, 2021
e609168
Fixing some display issues
mattbloomfield Nov 7, 2021
b846cf7
removing token
mattbloomfield Nov 7, 2021
1fc0d95
fixing the function forrmat
mattbloomfield Nov 7, 2021
2bb5b69
changing to a post
mattbloomfield Nov 7, 2021
5f723f2
Changing the way CSS is compiled
mattbloomfield Nov 23, 2021
eb91236
Updating build, adding recipes
mattbloomfield Nov 23, 2021
fed759a
Fixing most errored recipe problems, trying to make the dev env better
mattbloomfield Nov 23, 2021
d164021
updating the way slugs are created
mattbloomfield Nov 25, 2021
b063f3a
Updating slug formatting
mattbloomfield Nov 25, 2021
71cb73c
Update from Forestry.io
mattbloomfield Nov 28, 2021
1cf3c87
Update from Forestry.io
Nov 28, 2021
751a876
Update from Forestry.io
mattbloomfield Jan 11, 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
13 changes: 0 additions & 13 deletions .editorconfig

This file was deleted.

45 changes: 37 additions & 8 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,41 @@
module.exports = function(eleventyConfig) {

module.exports = function (eleventyConfig) {
require("dotenv").config();

const { initializeApp, cert } = require("firebase-admin/app");
const { getFirestore } = require("firebase-admin/firestore");

initializeApp({
credential: cert({
privateKey: process.env.GOOGLE_API_KEY?.replace(/\\n/g, "\n"),
clientEmail: process.env.GOOGLE_EMAIL,
projectId: process.env.GOOGLE_PROJECT_ID,
}),
});

const db = getFirestore();

/* Pass through - stop eleventy touching */
eleventyConfig.addPassthroughCopy('src/images')
eleventyConfig.addPassthroughCopy("src/images");

eleventyConfig.addShortcode(
"recipeList",
require("./.eleventy/shortcodes/recipeList")
);

eleventyConfig.addGlobalData("recipes", async () => {
const ref = db.collection("recipes");
const snapshot = await ref.get();
const recipes = [];
snapshot.forEach((doc) => {
recipes.push(doc.data());
});
return Promise.resolve(recipes);
});

return {
dir: { input: 'src', output: 'dist', data: '_data' },
dir: { input: "src", output: "dist", data: "_data" },
passthroughFileCopy: true,
templateFormats: ['njk', 'md', 'css', 'html', 'yml'],
htmlTemplateEngine: 'njk'
}
}
templateFormats: ["njk", "md", "css", "html", "yml"],
htmlTemplateEngine: "njk",
};
};
61 changes: 61 additions & 0 deletions .eleventy/shortcodes/recipeList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
const sentenceCase = require("to-title-case");
module.exports = function (recipes, type, search) {
// get the tags
let tags = [];
let dedupedTags = [];
for (let i = 0; i < recipes.length; i++) {
const recipe = recipes[i];
recipe.tags.forEach((tag) => {
if (!dedupedTags.includes(tag.toLowerCase())) {
dedupedTags.push(tag.toLowerCase());
tags.push({
id: tag.toLowerCase(),
label: sentenceCase(tag),
});
}
});
}

let html = `<input type="text" name="Search" placeholder="Search..." id="SearchInput" class="my-2 bg-white text-gray-800 py-2 px-4 border-2 border-gray-400">`;
html += `<div id="RecipeList"><ul class="list my-8 px-8">`;
tags.forEach((tag) => {
html += `<h3 class="mt-4 mb-1">${tag.label}</h3>`;
for (let i = 0; i < recipes.length; i++) {
const recipe = recipes[i];
let included = false;
recipe.tags.forEach((t) => {
if (t.toLowerCase() == tag.id) {
included = true;
}
});
if (included) {
html += `
<li>
<a href="/recipes/${recipe.slug}/">${recipe.name}</a>
</li>
`;
}
}
});

html += `<h3 class="mt-4 mb-1">Untagged</h3>`;
for (let i = 0; i < recipes.length; i++) {
const recipe = recipes[i];
if (!recipe.tags.length) {
html += `
<li>
<a href="/recipes/${recipe.slug}/">${recipe.name}</a>
</li>
`;
}
}
html += `</ul></div>`;

html += `
<script>
const recipes = ${JSON.stringify(recipes)};
const tags = ${JSON.stringify(tags)};
</script>`;

return html;
};
11 changes: 11 additions & 0 deletions .forestry/front_matter/templates/recipe-urls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
label: Recipe URLs
hide_body: true
fields:
- name: urls
type: list
config:
use_select: false
min:
max:
label: URLs
74 changes: 74 additions & 0 deletions .forestry/front_matter/templates/recipe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
label: Recipe
hide_body: true
fields:
- type: text
name: name
label: Name
description: Paste in the name of the recipe
- type: list
name: ingredients
label: Ingredients
description: Add the ingredients one at a time
- type: list
name: instructions
label: Instructions
description: Add the instructions one line at a time
- type: list
name: tags
label: Tags
description: Tags are made to group recipes by type or ingredient
config:
use_select: false
- type: text
name: servings
label: Servings
description: How many people does it serve or how large is the yield in cups, feet,
meters, stones, etc.
- name: image
type: file
config:
maxSize: 64
label: Image
description: Optionally, upload an image representing your recipe.
- type: field_group
name: time
label: Times
fields:
- type: text
name: prep
label: Prep
description: How long to prepare the recipe?
- type: text
name: cook
label: Cook
description: How long is spent cooking the recipe?
- type: text
name: active
label: Active
description: How much time is spent actively working on the recipe?
- type: text
name: inactive
label: Inactive
description: How much time is spent inactive? e.g. letting the dough rise, chill,
etc.
- type: text
name: ready
label: Ready
description: 'How long until it''s ready? '
- type: text
name: total
label: Total
description: 'What is the total time spent? '
description: Add any of the available times below
- name: url
type: text
config:
required: false
label: Original Recipe URL
description: Paste in the source of the URL if it exists
pages:
- src/_data/recipes/banana-bread.json
- src/_data/recipes/brownie-pudding.json
- src/_data/recipes/dads-biscuits.json
- src/_data/recipes/sweet-potato-souffle.json
28 changes: 28 additions & 0 deletions .forestry/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
new_page_extension: md
auto_deploy: false
admin_path: ''
webhook_url:
sections:
- type: document
path: build/urls.json
label: URL List
- type: directory
path: src/_data/recipes
label: Recipes
create: all
match: "**/*"
new_doc_ext: json
templates:
- recipe
upload_dir: uploads
public_path: "/uploads"
front_matter_path: ''
use_front_matter_path: false
file_template: ":filename:"
build:
install_dependencies_command: npm install
preview_docker_image: forestryio/node:12
mount_path: "/srv"
working_dir: "/srv"
instant_preview_command: npm run develop
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,7 @@ typings/
dist

#OSX
.DS_Store
.DS_Store
# Local Netlify folder
.netlify
food-not-frenzy-f28f8715ef3a.json
2 changes: 1 addition & 1 deletion .lightserverrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"port": 8080,
"port": 4000,
"serve": "dist",
"bind": "0.0.0.0",
"delay": 100,
Expand Down
20 changes: 20 additions & 0 deletions .netlify/functions/submission-created/submission-created.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const fetch = require("node-fetch");

const API_ENDPOINT = 'https://api.netlify.com/build_hooks/61883da143db9fcf939555f6';

exports.handler = async (event, context) => {
try {
const response = await fetch(API_ENDPOINT, {
method: "POST",
});
const data = await response.json();
return { statusCode: 200, body: JSON.stringify({ data }) };
} catch (error) {
console.log(error);
return {
statusCode: 500,
body: JSON.stringify({ error: 'Failed fetching data' }),
};
}
};

23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

Loading