Compare commits
12 Commits
b00404125c
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| e9965c38ff | |||
| b1d95ea785 | |||
| bf5d2f24c2 | |||
| 6145f14df0 | |||
| 0b1334d508 | |||
| 26cab10c14 | |||
| db6df2053a | |||
| c12a4ab1aa | |||
| 3c0e9dc0dd | |||
| b8de3e82e9 | |||
| c1910a71c6 | |||
| 5c099f5b49 |
@@ -1,4 +1,4 @@
|
||||
PB_ADMIN_EMAIL=admin@example.com
|
||||
PB_ADMIN_PASSWORD=secret-password
|
||||
PUBLIC_PB_URL=http://pb:8080
|
||||
PUBLIC_URL=http://your.domain.tld/
|
||||
PB_DATA_DIR=/pb/pb_data
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -6,9 +6,10 @@ node_modules
|
||||
.netlify
|
||||
.wrangler
|
||||
/.astro
|
||||
/dist
|
||||
/build
|
||||
/data
|
||||
|
||||
/api/pb_data
|
||||
# OS
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
@@ -4,8 +4,10 @@ COPY package*.json ./
|
||||
RUN npm i
|
||||
COPY . .
|
||||
ENV PUBLIC_PB_URL=http://pb:8080
|
||||
ENV PUBLIC_URL=http://localhost:4321
|
||||
|
||||
RUN npm run build
|
||||
|
||||
EXPOSE 4173
|
||||
CMD ["npm", "run", "preview", "--", "--host"]
|
||||
EXPOSE 4321
|
||||
# CMD ["npm", "run", "dev", "--", "--host"]
|
||||
CMD [ "npm", "run", "preview", "--", "--host" ]
|
||||
|
||||
@@ -12,6 +12,7 @@ set -e
|
||||
|
||||
# if there are no users yet, create the superuser
|
||||
# we check the sqlite file for any existing record in the users table
|
||||
/pb/pocketbase superuser create "${PB_ADMIN_EMAIL}" "${PB_ADMIN_PASSWORD}"
|
||||
if [ ! -f "${PB_DATA_DIR}/pb_data.db" ] \
|
||||
! sqlite3 "${PB_DATA_DIR}/data.db" \
|
||||
"SELECT id FROM _superusers WHERE email='${PB_ADMIN_EMAIL}' LIMIT 1;" \
|
||||
|
||||
71
api/pb_migrations/1754995770_created_images.js
Normal file
71
api/pb_migrations/1754995770_created_images.js
Normal file
@@ -0,0 +1,71 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = new Collection({
|
||||
"createRule": null,
|
||||
"deleteRule": null,
|
||||
"fields": [
|
||||
{
|
||||
"autogeneratePattern": "[a-z0-9]{15}",
|
||||
"hidden": false,
|
||||
"id": "text3208210256",
|
||||
"max": 15,
|
||||
"min": 15,
|
||||
"name": "id",
|
||||
"pattern": "^[a-z0-9]+$",
|
||||
"presentable": false,
|
||||
"primaryKey": true,
|
||||
"required": true,
|
||||
"system": true,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "file3309110367",
|
||||
"maxSelect": 1,
|
||||
"maxSize": 0,
|
||||
"mimeTypes": [],
|
||||
"name": "image",
|
||||
"presentable": false,
|
||||
"protected": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"thumbs": [],
|
||||
"type": "file"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate2990389176",
|
||||
"name": "created",
|
||||
"onCreate": true,
|
||||
"onUpdate": false,
|
||||
"presentable": false,
|
||||
"system": false,
|
||||
"type": "autodate"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate3332085495",
|
||||
"name": "updated",
|
||||
"onCreate": true,
|
||||
"onUpdate": true,
|
||||
"presentable": false,
|
||||
"system": false,
|
||||
"type": "autodate"
|
||||
}
|
||||
],
|
||||
"id": "pbc_3607937828",
|
||||
"indexes": [],
|
||||
"listRule": null,
|
||||
"name": "images",
|
||||
"system": false,
|
||||
"type": "base",
|
||||
"updateRule": null,
|
||||
"viewRule": null
|
||||
});
|
||||
|
||||
return app.save(collection);
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_3607937828");
|
||||
|
||||
return app.delete(collection);
|
||||
})
|
||||
122
api/pb_migrations/1754995772_created_recipes.js
Normal file
122
api/pb_migrations/1754995772_created_recipes.js
Normal file
@@ -0,0 +1,122 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = new Collection({
|
||||
"createRule": null,
|
||||
"deleteRule": null,
|
||||
"fields": [
|
||||
{
|
||||
"autogeneratePattern": "[a-z0-9]{15}",
|
||||
"hidden": false,
|
||||
"id": "text3208210256",
|
||||
"max": 15,
|
||||
"min": 15,
|
||||
"name": "id",
|
||||
"pattern": "^[a-z0-9]+$",
|
||||
"presentable": false,
|
||||
"primaryKey": true,
|
||||
"required": true,
|
||||
"system": true,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text1579384326",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "name",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text1843675174",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "description",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "number1239158968",
|
||||
"max": null,
|
||||
"min": null,
|
||||
"name": "servings",
|
||||
"onlyInt": false,
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "number3632866850",
|
||||
"max": null,
|
||||
"min": null,
|
||||
"name": "rating",
|
||||
"onlyInt": false,
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"cascadeDelete": false,
|
||||
"collectionId": "pbc_3607937828",
|
||||
"hidden": false,
|
||||
"id": "relation3760176746",
|
||||
"maxSelect": 1,
|
||||
"minSelect": 0,
|
||||
"name": "images",
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "relation"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate2990389176",
|
||||
"name": "created",
|
||||
"onCreate": true,
|
||||
"onUpdate": false,
|
||||
"presentable": false,
|
||||
"system": false,
|
||||
"type": "autodate"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate3332085495",
|
||||
"name": "updated",
|
||||
"onCreate": true,
|
||||
"onUpdate": true,
|
||||
"presentable": false,
|
||||
"system": false,
|
||||
"type": "autodate"
|
||||
}
|
||||
],
|
||||
"id": "pbc_842702175",
|
||||
"indexes": [],
|
||||
"listRule": null,
|
||||
"name": "recipes",
|
||||
"system": false,
|
||||
"type": "base",
|
||||
"updateRule": null,
|
||||
"viewRule": null
|
||||
});
|
||||
|
||||
return app.save(collection);
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_842702175");
|
||||
|
||||
return app.delete(collection);
|
||||
})
|
||||
28
api/pb_migrations/1754995890_updated_recipes.js
Normal file
28
api/pb_migrations/1754995890_updated_recipes.js
Normal file
@@ -0,0 +1,28 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_842702175")
|
||||
|
||||
// update collection data
|
||||
unmarshal({
|
||||
"createRule": "",
|
||||
"deleteRule": "",
|
||||
"listRule": "",
|
||||
"updateRule": "",
|
||||
"viewRule": ""
|
||||
}, collection)
|
||||
|
||||
return app.save(collection)
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_842702175")
|
||||
|
||||
// update collection data
|
||||
unmarshal({
|
||||
"createRule": null,
|
||||
"deleteRule": null,
|
||||
"listRule": null,
|
||||
"updateRule": null,
|
||||
"viewRule": null
|
||||
}, collection)
|
||||
|
||||
return app.save(collection)
|
||||
})
|
||||
28
api/pb_migrations/1754995898_updated_images.js
Normal file
28
api/pb_migrations/1754995898_updated_images.js
Normal file
@@ -0,0 +1,28 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_3607937828")
|
||||
|
||||
// update collection data
|
||||
unmarshal({
|
||||
"createRule": "",
|
||||
"deleteRule": "",
|
||||
"listRule": "",
|
||||
"updateRule": "",
|
||||
"viewRule": ""
|
||||
}, collection)
|
||||
|
||||
return app.save(collection)
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_3607937828")
|
||||
|
||||
// update collection data
|
||||
unmarshal({
|
||||
"createRule": null,
|
||||
"deleteRule": null,
|
||||
"listRule": null,
|
||||
"updateRule": null,
|
||||
"viewRule": null
|
||||
}, collection)
|
||||
|
||||
return app.save(collection)
|
||||
})
|
||||
40
api/pb_migrations/1754996268_updated_recipes.js
Normal file
40
api/pb_migrations/1754996268_updated_recipes.js
Normal file
@@ -0,0 +1,40 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_842702175")
|
||||
|
||||
// update field
|
||||
collection.fields.addAt(5, new Field({
|
||||
"cascadeDelete": false,
|
||||
"collectionId": "pbc_3607937828",
|
||||
"hidden": false,
|
||||
"id": "relation3760176746",
|
||||
"maxSelect": 999,
|
||||
"minSelect": 0,
|
||||
"name": "images",
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "relation"
|
||||
}))
|
||||
|
||||
return app.save(collection)
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_842702175")
|
||||
|
||||
// update field
|
||||
collection.fields.addAt(5, new Field({
|
||||
"cascadeDelete": false,
|
||||
"collectionId": "pbc_3607937828",
|
||||
"hidden": false,
|
||||
"id": "relation3760176746",
|
||||
"maxSelect": 1,
|
||||
"minSelect": 0,
|
||||
"name": "images",
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "relation"
|
||||
}))
|
||||
|
||||
return app.save(collection)
|
||||
})
|
||||
71
api/pb_migrations/1754996900_created_tags.js
Normal file
71
api/pb_migrations/1754996900_created_tags.js
Normal file
@@ -0,0 +1,71 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = new Collection({
|
||||
"createRule": null,
|
||||
"deleteRule": null,
|
||||
"fields": [
|
||||
{
|
||||
"autogeneratePattern": "[a-z0-9]{15}",
|
||||
"hidden": false,
|
||||
"id": "text3208210256",
|
||||
"max": 15,
|
||||
"min": 15,
|
||||
"name": "id",
|
||||
"pattern": "^[a-z0-9]+$",
|
||||
"presentable": false,
|
||||
"primaryKey": true,
|
||||
"required": true,
|
||||
"system": true,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text1579384326",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "name",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate2990389176",
|
||||
"name": "created",
|
||||
"onCreate": true,
|
||||
"onUpdate": false,
|
||||
"presentable": false,
|
||||
"system": false,
|
||||
"type": "autodate"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate3332085495",
|
||||
"name": "updated",
|
||||
"onCreate": true,
|
||||
"onUpdate": true,
|
||||
"presentable": false,
|
||||
"system": false,
|
||||
"type": "autodate"
|
||||
}
|
||||
],
|
||||
"id": "pbc_1219621782",
|
||||
"indexes": [],
|
||||
"listRule": null,
|
||||
"name": "tags",
|
||||
"system": false,
|
||||
"type": "base",
|
||||
"updateRule": null,
|
||||
"viewRule": null
|
||||
});
|
||||
|
||||
return app.save(collection);
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_1219621782");
|
||||
|
||||
return app.delete(collection);
|
||||
})
|
||||
28
api/pb_migrations/1754996921_updated_recipes.js
Normal file
28
api/pb_migrations/1754996921_updated_recipes.js
Normal file
@@ -0,0 +1,28 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_842702175")
|
||||
|
||||
// add field
|
||||
collection.fields.addAt(6, new Field({
|
||||
"cascadeDelete": false,
|
||||
"collectionId": "pbc_1219621782",
|
||||
"hidden": false,
|
||||
"id": "relation1874629670",
|
||||
"maxSelect": 999,
|
||||
"minSelect": 0,
|
||||
"name": "tags",
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "relation"
|
||||
}))
|
||||
|
||||
return app.save(collection)
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_842702175")
|
||||
|
||||
// remove field
|
||||
collection.fields.removeById("relation1874629670")
|
||||
|
||||
return app.save(collection)
|
||||
})
|
||||
28
api/pb_migrations/1754997089_updated_tags.js
Normal file
28
api/pb_migrations/1754997089_updated_tags.js
Normal file
@@ -0,0 +1,28 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_1219621782")
|
||||
|
||||
// update collection data
|
||||
unmarshal({
|
||||
"createRule": "",
|
||||
"deleteRule": "",
|
||||
"listRule": "",
|
||||
"updateRule": "",
|
||||
"viewRule": ""
|
||||
}, collection)
|
||||
|
||||
return app.save(collection)
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_1219621782")
|
||||
|
||||
// update collection data
|
||||
unmarshal({
|
||||
"createRule": null,
|
||||
"deleteRule": null,
|
||||
"listRule": null,
|
||||
"updateRule": null,
|
||||
"viewRule": null
|
||||
}, collection)
|
||||
|
||||
return app.save(collection)
|
||||
})
|
||||
28
api/pb_migrations/1755039357_updated_steps.js
Normal file
28
api/pb_migrations/1755039357_updated_steps.js
Normal file
@@ -0,0 +1,28 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_4284789913")
|
||||
|
||||
// remove field
|
||||
collection.fields.removeById("relation3666391351")
|
||||
|
||||
return app.save(collection)
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_4284789913")
|
||||
|
||||
// add field
|
||||
collection.fields.addAt(3, new Field({
|
||||
"cascadeDelete": false,
|
||||
"collectionId": "pbc_842702175",
|
||||
"hidden": false,
|
||||
"id": "relation3666391351",
|
||||
"maxSelect": 1,
|
||||
"minSelect": 0,
|
||||
"name": "recipe",
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "relation"
|
||||
}))
|
||||
|
||||
return app.save(collection)
|
||||
})
|
||||
97
api/pb_migrations/1755041844_created_ingredients.js
Normal file
97
api/pb_migrations/1755041844_created_ingredients.js
Normal file
@@ -0,0 +1,97 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = new Collection({
|
||||
"createRule": null,
|
||||
"deleteRule": null,
|
||||
"fields": [
|
||||
{
|
||||
"autogeneratePattern": "[a-z0-9]{15}",
|
||||
"hidden": false,
|
||||
"id": "text3208210256",
|
||||
"max": 15,
|
||||
"min": 15,
|
||||
"name": "id",
|
||||
"pattern": "^[a-z0-9]+$",
|
||||
"presentable": false,
|
||||
"primaryKey": true,
|
||||
"required": true,
|
||||
"system": true,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text1579384326",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "name",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "number2683508278",
|
||||
"max": null,
|
||||
"min": null,
|
||||
"name": "quantity",
|
||||
"onlyInt": false,
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text3703245907",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "unit",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate2990389176",
|
||||
"name": "created",
|
||||
"onCreate": true,
|
||||
"onUpdate": false,
|
||||
"presentable": false,
|
||||
"system": false,
|
||||
"type": "autodate"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate3332085495",
|
||||
"name": "updated",
|
||||
"onCreate": true,
|
||||
"onUpdate": true,
|
||||
"presentable": false,
|
||||
"system": false,
|
||||
"type": "autodate"
|
||||
}
|
||||
],
|
||||
"id": "pbc_3146854971",
|
||||
"indexes": [],
|
||||
"listRule": null,
|
||||
"name": "ingredients",
|
||||
"system": false,
|
||||
"type": "base",
|
||||
"updateRule": null,
|
||||
"viewRule": null
|
||||
});
|
||||
|
||||
return app.save(collection);
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_3146854971");
|
||||
|
||||
return app.delete(collection);
|
||||
})
|
||||
28
api/pb_migrations/1755041886_updated_recipes.js
Normal file
28
api/pb_migrations/1755041886_updated_recipes.js
Normal file
@@ -0,0 +1,28 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_842702175")
|
||||
|
||||
// add field
|
||||
collection.fields.addAt(8, new Field({
|
||||
"cascadeDelete": false,
|
||||
"collectionId": "pbc_3146854971",
|
||||
"hidden": false,
|
||||
"id": "relation1264587087",
|
||||
"maxSelect": 999,
|
||||
"minSelect": 0,
|
||||
"name": "ingredients",
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "relation"
|
||||
}))
|
||||
|
||||
return app.save(collection)
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_842702175")
|
||||
|
||||
// remove field
|
||||
collection.fields.removeById("relation1264587087")
|
||||
|
||||
return app.save(collection)
|
||||
})
|
||||
28
api/pb_migrations/1755042306_updated_ingredients.js
Normal file
28
api/pb_migrations/1755042306_updated_ingredients.js
Normal file
@@ -0,0 +1,28 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_3146854971")
|
||||
|
||||
// update collection data
|
||||
unmarshal({
|
||||
"createRule": "",
|
||||
"deleteRule": "",
|
||||
"listRule": "",
|
||||
"updateRule": "",
|
||||
"viewRule": ""
|
||||
}, collection)
|
||||
|
||||
return app.save(collection)
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_3146854971")
|
||||
|
||||
// update collection data
|
||||
unmarshal({
|
||||
"createRule": null,
|
||||
"deleteRule": null,
|
||||
"listRule": null,
|
||||
"updateRule": null,
|
||||
"viewRule": null
|
||||
}, collection)
|
||||
|
||||
return app.save(collection)
|
||||
})
|
||||
28
api/pb_migrations/1755045585_updated_steps.js
Normal file
28
api/pb_migrations/1755045585_updated_steps.js
Normal file
@@ -0,0 +1,28 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_4284789913")
|
||||
|
||||
// add field
|
||||
collection.fields.addAt(3, new Field({
|
||||
"cascadeDelete": false,
|
||||
"collectionId": "pbc_3146854971",
|
||||
"hidden": false,
|
||||
"id": "relation1264587087",
|
||||
"maxSelect": 999,
|
||||
"minSelect": 0,
|
||||
"name": "ingredients",
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "relation"
|
||||
}))
|
||||
|
||||
return app.save(collection)
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_4284789913")
|
||||
|
||||
// remove field
|
||||
collection.fields.removeById("relation1264587087")
|
||||
|
||||
return app.save(collection)
|
||||
})
|
||||
44
api/pb_migrations/1755056714_updated_recipes.js
Normal file
44
api/pb_migrations/1755056714_updated_recipes.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_842702175")
|
||||
|
||||
// add field
|
||||
collection.fields.addAt(9, new Field({
|
||||
"hidden": false,
|
||||
"id": "number1485952547",
|
||||
"max": null,
|
||||
"min": null,
|
||||
"name": "worktime",
|
||||
"onlyInt": true,
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "number"
|
||||
}))
|
||||
|
||||
// add field
|
||||
collection.fields.addAt(10, new Field({
|
||||
"hidden": false,
|
||||
"id": "number2198822773",
|
||||
"max": null,
|
||||
"min": null,
|
||||
"name": "waittime",
|
||||
"onlyInt": true,
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "number"
|
||||
}))
|
||||
|
||||
return app.save(collection)
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_842702175")
|
||||
|
||||
// remove field
|
||||
collection.fields.removeById("number1485952547")
|
||||
|
||||
// remove field
|
||||
collection.fields.removeById("number2198822773")
|
||||
|
||||
return app.save(collection)
|
||||
})
|
||||
@@ -3,10 +3,22 @@ import { defineConfig } from 'astro/config';
|
||||
|
||||
import node from '@astrojs/node';
|
||||
|
||||
import tailwindcss from '@tailwindcss/vite';
|
||||
|
||||
import { loadEnv } from "vite";
|
||||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
output: 'server',
|
||||
adapter: node({
|
||||
mode: 'standalone'
|
||||
})
|
||||
output: 'server',
|
||||
|
||||
adapter: node({
|
||||
mode: 'standalone'
|
||||
}),
|
||||
|
||||
vite: {
|
||||
plugins: [tailwindcss()],
|
||||
server: {
|
||||
cors: false
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -3,14 +3,14 @@ services:
|
||||
build: .
|
||||
env_file: .env
|
||||
ports:
|
||||
- "4173:4173"
|
||||
- "4321:4321"
|
||||
|
||||
pb:
|
||||
build: api
|
||||
env_file: .env
|
||||
volumes:
|
||||
- ./data/data:/pb/pb_data
|
||||
- ./data/migrations:/pb/pb_migrations
|
||||
- ./data/hooks:/pb/pb_hooks
|
||||
- ./api/pb_data:/pb/pb_data
|
||||
- ./api/pb_migrations:/pb/pb_migrations
|
||||
- ./api/pb_hooks:/pb/pb_hooks
|
||||
ports:
|
||||
- "8080:8080"
|
||||
663
package-lock.json
generated
663
package-lock.json
generated
@@ -9,8 +9,23 @@
|
||||
"version": "0.0.1",
|
||||
"dependencies": {
|
||||
"@astrojs/node": "^9.4.0",
|
||||
"@tailwindcss/vite": "^4.1.11",
|
||||
"astro": "^5.12.9",
|
||||
"pocketbase": "^0.26.2"
|
||||
"pocketbase": "^0.26.2",
|
||||
"tailwindcss": "^4.1.11"
|
||||
}
|
||||
},
|
||||
"node_modules/@ampproject/remapping": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz",
|
||||
"integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@jridgewell/gen-mapping": "^0.3.5",
|
||||
"@jridgewell/trace-mapping": "^0.3.24"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@astrojs/compiler": {
|
||||
@@ -942,12 +957,53 @@
|
||||
"url": "https://opencollective.com/libvips"
|
||||
}
|
||||
},
|
||||
"node_modules/@isaacs/fs-minipass": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz",
|
||||
"integrity": "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"minipass": "^7.0.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/gen-mapping": {
|
||||
"version": "0.3.12",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.12.tgz",
|
||||
"integrity": "sha512-OuLGC46TjB5BbN1dH8JULVVZY4WTdkF7tV9Ys6wLL1rubZnCMstOhNHueU5bLCrnRuDhKPDM4g6sw4Bel5Gzqg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jridgewell/sourcemap-codec": "^1.5.0",
|
||||
"@jridgewell/trace-mapping": "^0.3.24"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/resolve-uri": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
|
||||
"integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/sourcemap-codec": {
|
||||
"version": "1.5.4",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.4.tgz",
|
||||
"integrity": "sha512-VT2+G1VQs/9oz078bLrYbecdZKs912zQlkelYpuf+SXF+QvZDYJlbx/LSx+meSAwdDFnF8FVXW92AVjjkVmgFw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@jridgewell/trace-mapping": {
|
||||
"version": "0.3.29",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.29.tgz",
|
||||
"integrity": "sha512-uw6guiW/gcAGPDhLmd77/6lW8QLeiV5RUTsAX46Db6oLhGaVj4lhnPwb184s1bkc8kdVg/+h988dro8GRDpmYQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jridgewell/resolve-uri": "^3.1.0",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.14"
|
||||
}
|
||||
},
|
||||
"node_modules/@oslojs/encoding": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@oslojs/encoding/-/encoding-1.1.0.tgz",
|
||||
@@ -1318,6 +1374,268 @@
|
||||
"tslib": "^2.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/node": {
|
||||
"version": "4.1.11",
|
||||
"resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.1.11.tgz",
|
||||
"integrity": "sha512-yzhzuGRmv5QyU9qLNg4GTlYI6STedBWRE7NjxP45CsFYYq9taI0zJXZBMqIC/c8fViNLhmrbpSFS57EoxUmD6Q==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@ampproject/remapping": "^2.3.0",
|
||||
"enhanced-resolve": "^5.18.1",
|
||||
"jiti": "^2.4.2",
|
||||
"lightningcss": "1.30.1",
|
||||
"magic-string": "^0.30.17",
|
||||
"source-map-js": "^1.2.1",
|
||||
"tailwindcss": "4.1.11"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide": {
|
||||
"version": "4.1.11",
|
||||
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide/-/oxide-4.1.11.tgz",
|
||||
"integrity": "sha512-Q69XzrtAhuyfHo+5/HMgr1lAiPP/G40OMFAnws7xcFEYqcypZmdW8eGXaOUIeOl1dzPJBPENXgbjsOyhg2nkrg==",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"detect-libc": "^2.0.4",
|
||||
"tar": "^7.4.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@tailwindcss/oxide-android-arm64": "4.1.11",
|
||||
"@tailwindcss/oxide-darwin-arm64": "4.1.11",
|
||||
"@tailwindcss/oxide-darwin-x64": "4.1.11",
|
||||
"@tailwindcss/oxide-freebsd-x64": "4.1.11",
|
||||
"@tailwindcss/oxide-linux-arm-gnueabihf": "4.1.11",
|
||||
"@tailwindcss/oxide-linux-arm64-gnu": "4.1.11",
|
||||
"@tailwindcss/oxide-linux-arm64-musl": "4.1.11",
|
||||
"@tailwindcss/oxide-linux-x64-gnu": "4.1.11",
|
||||
"@tailwindcss/oxide-linux-x64-musl": "4.1.11",
|
||||
"@tailwindcss/oxide-wasm32-wasi": "4.1.11",
|
||||
"@tailwindcss/oxide-win32-arm64-msvc": "4.1.11",
|
||||
"@tailwindcss/oxide-win32-x64-msvc": "4.1.11"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-android-arm64": {
|
||||
"version": "4.1.11",
|
||||
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-android-arm64/-/oxide-android-arm64-4.1.11.tgz",
|
||||
"integrity": "sha512-3IfFuATVRUMZZprEIx9OGDjG3Ou3jG4xQzNTvjDoKmU9JdmoCohQJ83MYd0GPnQIu89YoJqvMM0G3uqLRFtetg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-darwin-arm64": {
|
||||
"version": "4.1.11",
|
||||
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-arm64/-/oxide-darwin-arm64-4.1.11.tgz",
|
||||
"integrity": "sha512-ESgStEOEsyg8J5YcMb1xl8WFOXfeBmrhAwGsFxxB2CxY9evy63+AtpbDLAyRkJnxLy2WsD1qF13E97uQyP1lfQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-darwin-x64": {
|
||||
"version": "4.1.11",
|
||||
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-x64/-/oxide-darwin-x64-4.1.11.tgz",
|
||||
"integrity": "sha512-EgnK8kRchgmgzG6jE10UQNaH9Mwi2n+yw1jWmof9Vyg2lpKNX2ioe7CJdf9M5f8V9uaQxInenZkOxnTVL3fhAw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-freebsd-x64": {
|
||||
"version": "4.1.11",
|
||||
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-freebsd-x64/-/oxide-freebsd-x64-4.1.11.tgz",
|
||||
"integrity": "sha512-xdqKtbpHs7pQhIKmqVpxStnY1skuNh4CtbcyOHeX1YBE0hArj2romsFGb6yUmzkq/6M24nkxDqU8GYrKrz+UcA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"freebsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-linux-arm-gnueabihf": {
|
||||
"version": "4.1.11",
|
||||
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm-gnueabihf/-/oxide-linux-arm-gnueabihf-4.1.11.tgz",
|
||||
"integrity": "sha512-ryHQK2eyDYYMwB5wZL46uoxz2zzDZsFBwfjssgB7pzytAeCCa6glsiJGjhTEddq/4OsIjsLNMAiMlHNYnkEEeg==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-linux-arm64-gnu": {
|
||||
"version": "4.1.11",
|
||||
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-gnu/-/oxide-linux-arm64-gnu-4.1.11.tgz",
|
||||
"integrity": "sha512-mYwqheq4BXF83j/w75ewkPJmPZIqqP1nhoghS9D57CLjsh3Nfq0m4ftTotRYtGnZd3eCztgbSPJ9QhfC91gDZQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-linux-arm64-musl": {
|
||||
"version": "4.1.11",
|
||||
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-musl/-/oxide-linux-arm64-musl-4.1.11.tgz",
|
||||
"integrity": "sha512-m/NVRFNGlEHJrNVk3O6I9ggVuNjXHIPoD6bqay/pubtYC9QIdAMpS+cswZQPBLvVvEF6GtSNONbDkZrjWZXYNQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-linux-x64-gnu": {
|
||||
"version": "4.1.11",
|
||||
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-gnu/-/oxide-linux-x64-gnu-4.1.11.tgz",
|
||||
"integrity": "sha512-YW6sblI7xukSD2TdbbaeQVDysIm/UPJtObHJHKxDEcW2exAtY47j52f8jZXkqE1krdnkhCMGqP3dbniu1Te2Fg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-linux-x64-musl": {
|
||||
"version": "4.1.11",
|
||||
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-musl/-/oxide-linux-x64-musl-4.1.11.tgz",
|
||||
"integrity": "sha512-e3C/RRhGunWYNC3aSF7exsQkdXzQ/M+aYuZHKnw4U7KQwTJotnWsGOIVih0s2qQzmEzOFIJ3+xt7iq67K/p56Q==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-wasm32-wasi": {
|
||||
"version": "4.1.11",
|
||||
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-wasm32-wasi/-/oxide-wasm32-wasi-4.1.11.tgz",
|
||||
"integrity": "sha512-Xo1+/GU0JEN/C/dvcammKHzeM6NqKovG+6921MR6oadee5XPBaKOumrJCXvopJ/Qb5TH7LX/UAywbqrP4lax0g==",
|
||||
"bundleDependencies": [
|
||||
"@napi-rs/wasm-runtime",
|
||||
"@emnapi/core",
|
||||
"@emnapi/runtime",
|
||||
"@tybys/wasm-util",
|
||||
"@emnapi/wasi-threads",
|
||||
"tslib"
|
||||
],
|
||||
"cpu": [
|
||||
"wasm32"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"@emnapi/core": "^1.4.3",
|
||||
"@emnapi/runtime": "^1.4.3",
|
||||
"@emnapi/wasi-threads": "^1.0.2",
|
||||
"@napi-rs/wasm-runtime": "^0.2.11",
|
||||
"@tybys/wasm-util": "^0.9.0",
|
||||
"tslib": "^2.8.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-win32-arm64-msvc": {
|
||||
"version": "4.1.11",
|
||||
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.1.11.tgz",
|
||||
"integrity": "sha512-UgKYx5PwEKrac3GPNPf6HVMNhUIGuUh4wlDFR2jYYdkX6pL/rn73zTq/4pzUm8fOjAn5L8zDeHp9iXmUGOXZ+w==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-win32-x64-msvc": {
|
||||
"version": "4.1.11",
|
||||
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-x64-msvc/-/oxide-win32-x64-msvc-4.1.11.tgz",
|
||||
"integrity": "sha512-YfHoggn1j0LK7wR82TOucWc5LDCguHnoS879idHekmmiR7g9HUtMw9MI0NHatS28u/Xlkfi9w5RJWgz2Dl+5Qg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/vite": {
|
||||
"version": "4.1.11",
|
||||
"resolved": "https://registry.npmjs.org/@tailwindcss/vite/-/vite-4.1.11.tgz",
|
||||
"integrity": "sha512-RHYhrR3hku0MJFRV+fN2gNbDNEh3dwKvY8XJvTxCSXeMOsCRSr+uKvDWQcbizrHgjML6ZmTE5OwMrl5wKcujCw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@tailwindcss/node": "4.1.11",
|
||||
"@tailwindcss/oxide": "4.1.11",
|
||||
"tailwindcss": "4.1.11"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vite": "^5.2.0 || ^6 || ^7"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/debug": {
|
||||
"version": "4.1.12",
|
||||
"resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz",
|
||||
@@ -1792,6 +2110,15 @@
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/chownr": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz",
|
||||
"integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==",
|
||||
"license": "BlueOak-1.0.0",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/ci-info": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.3.0.tgz",
|
||||
@@ -2021,7 +2348,6 @@
|
||||
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.4.tgz",
|
||||
"integrity": "sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA==",
|
||||
"license": "Apache-2.0",
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
@@ -2108,6 +2434,19 @@
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/enhanced-resolve": {
|
||||
"version": "5.18.3",
|
||||
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.18.3.tgz",
|
||||
"integrity": "sha512-d4lC8xfavMeBjzGr2vECC3fsGXziXZQyJxD868h2M/mBI3PwAuODxAkLkq5HYuvrPYcUtiLzsTo8U3PgX3Ocww==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"graceful-fs": "^4.2.4",
|
||||
"tapable": "^2.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/entities": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz",
|
||||
@@ -2312,6 +2651,12 @@
|
||||
"integrity": "sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/graceful-fs": {
|
||||
"version": "4.2.11",
|
||||
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
|
||||
"integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/h3": {
|
||||
"version": "1.15.4",
|
||||
"resolved": "https://registry.npmjs.org/h3/-/h3-1.15.4.tgz",
|
||||
@@ -2664,6 +3009,15 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/jiti": {
|
||||
"version": "2.5.1",
|
||||
"resolved": "https://registry.npmjs.org/jiti/-/jiti-2.5.1.tgz",
|
||||
"integrity": "sha512-twQoecYPiVA5K/h6SxtORw/Bs3ar+mLUtoPSc7iMXzQzK8d7eJ/R09wmTwAjiamETn1cXYPGfNnu7DMoHgu12w==",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"jiti": "lib/jiti-cli.mjs"
|
||||
}
|
||||
},
|
||||
"node_modules/js-yaml": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
|
||||
@@ -2685,6 +3039,234 @@
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss": {
|
||||
"version": "1.30.1",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.30.1.tgz",
|
||||
"integrity": "sha512-xi6IyHML+c9+Q3W0S4fCQJOym42pyurFiJUHEcEyHS0CeKzia4yZDEsLlqOFykxOdHpNy0NmvVO31vcSqAxJCg==",
|
||||
"license": "MPL-2.0",
|
||||
"dependencies": {
|
||||
"detect-libc": "^2.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"lightningcss-darwin-arm64": "1.30.1",
|
||||
"lightningcss-darwin-x64": "1.30.1",
|
||||
"lightningcss-freebsd-x64": "1.30.1",
|
||||
"lightningcss-linux-arm-gnueabihf": "1.30.1",
|
||||
"lightningcss-linux-arm64-gnu": "1.30.1",
|
||||
"lightningcss-linux-arm64-musl": "1.30.1",
|
||||
"lightningcss-linux-x64-gnu": "1.30.1",
|
||||
"lightningcss-linux-x64-musl": "1.30.1",
|
||||
"lightningcss-win32-arm64-msvc": "1.30.1",
|
||||
"lightningcss-win32-x64-msvc": "1.30.1"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-darwin-arm64": {
|
||||
"version": "1.30.1",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.30.1.tgz",
|
||||
"integrity": "sha512-c8JK7hyE65X1MHMN+Viq9n11RRC7hgin3HhYKhrMyaXflk5GVplZ60IxyoVtzILeKr+xAJwg6zK6sjTBJ0FKYQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-darwin-x64": {
|
||||
"version": "1.30.1",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.30.1.tgz",
|
||||
"integrity": "sha512-k1EvjakfumAQoTfcXUcHQZhSpLlkAuEkdMBsI/ivWw9hL+7FtilQc0Cy3hrx0AAQrVtQAbMI7YjCgYgvn37PzA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-freebsd-x64": {
|
||||
"version": "1.30.1",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.30.1.tgz",
|
||||
"integrity": "sha512-kmW6UGCGg2PcyUE59K5r0kWfKPAVy4SltVeut+umLCFoJ53RdCUWxcRDzO1eTaxf/7Q2H7LTquFHPL5R+Gjyig==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"freebsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-linux-arm-gnueabihf": {
|
||||
"version": "1.30.1",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.30.1.tgz",
|
||||
"integrity": "sha512-MjxUShl1v8pit+6D/zSPq9S9dQ2NPFSQwGvxBCYaBYLPlCWuPh9/t1MRS8iUaR8i+a6w7aps+B4N0S1TYP/R+Q==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-linux-arm64-gnu": {
|
||||
"version": "1.30.1",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.30.1.tgz",
|
||||
"integrity": "sha512-gB72maP8rmrKsnKYy8XUuXi/4OctJiuQjcuqWNlJQ6jZiWqtPvqFziskH3hnajfvKB27ynbVCucKSm2rkQp4Bw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-linux-arm64-musl": {
|
||||
"version": "1.30.1",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.30.1.tgz",
|
||||
"integrity": "sha512-jmUQVx4331m6LIX+0wUhBbmMX7TCfjF5FoOH6SD1CttzuYlGNVpA7QnrmLxrsub43ClTINfGSYyHe2HWeLl5CQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-linux-x64-gnu": {
|
||||
"version": "1.30.1",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.30.1.tgz",
|
||||
"integrity": "sha512-piWx3z4wN8J8z3+O5kO74+yr6ze/dKmPnI7vLqfSqI8bccaTGY5xiSGVIJBDd5K5BHlvVLpUB3S2YCfelyJ1bw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-linux-x64-musl": {
|
||||
"version": "1.30.1",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.30.1.tgz",
|
||||
"integrity": "sha512-rRomAK7eIkL+tHY0YPxbc5Dra2gXlI63HL+v1Pdi1a3sC+tJTcFrHX+E86sulgAXeI7rSzDYhPSeHHjqFhqfeQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-win32-arm64-msvc": {
|
||||
"version": "1.30.1",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.30.1.tgz",
|
||||
"integrity": "sha512-mSL4rqPi4iXq5YVqzSsJgMVFENoa4nGTT/GjO2c0Yl9OuQfPsIfncvLrEW6RbbB24WtZ3xP/2CCmI3tNkNV4oA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-win32-x64-msvc": {
|
||||
"version": "1.30.1",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.30.1.tgz",
|
||||
"integrity": "sha512-PVqXh48wh4T53F/1CCu8PIPCxLzWyCnn/9T5W1Jpmdy5h9Cwd+0YQS6/LwhHXSafuc61/xg9Lv5OrCby6a++jg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/longest-streak": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-3.1.0.tgz",
|
||||
@@ -3546,6 +4128,42 @@
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/minipass": {
|
||||
"version": "7.1.2",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
|
||||
"integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=16 || 14 >=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/minizlib": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.0.2.tgz",
|
||||
"integrity": "sha512-oG62iEk+CYt5Xj2YqI5Xi9xWUeZhDI8jjQmC5oThVH5JGCTgIjr7ciJDzC7MBzYd//WvR1OTmP5Q38Q8ShQtVA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"minipass": "^7.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/mkdirp": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-3.0.1.tgz",
|
||||
"integrity": "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"mkdirp": "dist/cjs/src/bin.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/mrmime": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.1.tgz",
|
||||
@@ -4370,6 +4988,38 @@
|
||||
"url": "https://github.com/chalk/strip-ansi?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/tailwindcss": {
|
||||
"version": "4.1.11",
|
||||
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.11.tgz",
|
||||
"integrity": "sha512-2E9TBm6MDD/xKYe+dvJZAmg3yxIEDNRc0jwlNyDg/4Fil2QcSLjFKGVff0lAf1jjeaArlG/M75Ey/EYr/OJtBA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/tapable": {
|
||||
"version": "2.2.2",
|
||||
"resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.2.tgz",
|
||||
"integrity": "sha512-Re10+NauLTMCudc7T5WLFLAwDhQ0JWdrMK+9B2M8zR5hRExKmsRDCBA7/aV/pNJFltmBFO5BAMlQFi/vq3nKOg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/tar": {
|
||||
"version": "7.4.3",
|
||||
"resolved": "https://registry.npmjs.org/tar/-/tar-7.4.3.tgz",
|
||||
"integrity": "sha512-5S7Va8hKfV7W5U6g3aYxXmlPoZVAwUMy9AOKyF2fVuZa2UD3qZjg578OrLRt8PcNN1PleVaL/5/yYATNL0ICUw==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@isaacs/fs-minipass": "^4.0.0",
|
||||
"chownr": "^3.0.0",
|
||||
"minipass": "^7.1.2",
|
||||
"minizlib": "^3.0.1",
|
||||
"mkdirp": "^3.0.1",
|
||||
"yallist": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/tiny-inflate": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/tiny-inflate/-/tiny-inflate-1.0.3.tgz",
|
||||
@@ -4982,6 +5632,15 @@
|
||||
"integrity": "sha512-147y/6YNh+tlp6nd/2pWq38i9h6mz/EuQ6njIrmW8D1BS5nCqs0P6DG+m6zTGnNz5I+uhZ0SHxBs9BsPrwcKDA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/yallist": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz",
|
||||
"integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==",
|
||||
"license": "BlueOak-1.0.0",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/yargs-parser": {
|
||||
"version": "21.1.1",
|
||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz",
|
||||
|
||||
@@ -3,14 +3,16 @@
|
||||
"type": "module",
|
||||
"version": "0.0.1",
|
||||
"scripts": {
|
||||
"dev": "astro dev",
|
||||
"dev": "docker compose up pb -d; astro dev --host",
|
||||
"build": "astro build",
|
||||
"preview": "astro preview",
|
||||
"astro": "astro"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/node": "^9.4.0",
|
||||
"@tailwindcss/vite": "^4.1.11",
|
||||
"astro": "^5.12.9",
|
||||
"pocketbase": "^0.26.2"
|
||||
"pocketbase": "^0.26.2",
|
||||
"tailwindcss": "^4.1.11"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
|
||||
import "../styles/global.css"
|
||||
---
|
||||
|
||||
<meta charset="utf-8" />
|
||||
|
||||
30
src/components/Card/OverviewCard.astro
Normal file
30
src/components/Card/OverviewCard.astro
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
import client from "@/data/pocketbase"
|
||||
import TagRow from "./TagRow.astro"
|
||||
|
||||
const { recipe } = Astro.props;
|
||||
|
||||
const image = (await client.getRecipeImages(recipe.id))[0]
|
||||
---
|
||||
|
||||
<div class="relative z-0 flex h-50">
|
||||
<img
|
||||
class="w-full h-full object-cover rounded-xl"
|
||||
src={ image }
|
||||
/>
|
||||
|
||||
<div id="bottom-info-panel" class="absolute bottom-0 left-0 w-full p-2 h-20 backdrop-filter backdrop-blur-lg rounded-b-xl z-1">
|
||||
<p id="recipe-name" class="text-[14pt] text-white opacity-90 font-bold line-clamp-1" >{recipe.name}</p>
|
||||
<!-- <p id="recipe-desc" class="text-white text-[10pt]"> {recipe.description} </p> -->
|
||||
|
||||
<div id="tag-row" class="">
|
||||
<TagRow tags={recipe.expand.tags}/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a id="link" href={`/recipe/${recipe.id}`} class="absolute inset-0 z-0">
|
||||
<span class="block w-full h-full hover:bg-black/10 transition-colors">
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
16
src/components/Card/TagRow.astro
Normal file
16
src/components/Card/TagRow.astro
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
const { tags } = Astro.props
|
||||
---
|
||||
|
||||
<div class="">
|
||||
{
|
||||
(tags ?? []).map(tag => (
|
||||
<a
|
||||
href={`/tags/${tag.name}`}
|
||||
class="text-white bg-white/20 px-2 mr-2 mt-2 rounded-md inline-block hover:bg-white/30"
|
||||
>
|
||||
{tag.name}
|
||||
</a>
|
||||
))
|
||||
}
|
||||
</div>
|
||||
48
src/components/Detail/ImageCarousel.astro
Normal file
48
src/components/Detail/ImageCarousel.astro
Normal file
@@ -0,0 +1,48 @@
|
||||
---
|
||||
import client from "@/data/pocketbase";
|
||||
const { class: className, recipe } = Astro.props
|
||||
const links = await client.getRecipeImages(recipe as string)
|
||||
|
||||
---
|
||||
|
||||
<script>
|
||||
let pos = 0;
|
||||
const dataElement = document.getElementById('carousel-data');
|
||||
const links = dataElement ? JSON.parse(dataElement.textContent || '[]') : [];
|
||||
const cap = links.length - 1;
|
||||
const img = document.getElementById('carousel-img') as HTMLImageElement;
|
||||
|
||||
if (cap == 0) {
|
||||
const b0 = document.getElementById('dec-button')
|
||||
const b1 = document.getElementById('inc-button')
|
||||
|
||||
b0!.hidden = true
|
||||
b1!.hidden = true
|
||||
}
|
||||
|
||||
function inc() {
|
||||
pos = pos === cap ? 0 : pos + 1;
|
||||
if (img) img.src = links[pos];
|
||||
}
|
||||
|
||||
function dec() {
|
||||
pos = pos === 0 ? cap : pos - 1;
|
||||
if (img) img.src = links[pos];
|
||||
}
|
||||
|
||||
// make functions globally accessible
|
||||
(window as any).inc = inc;
|
||||
(window as any).dec = dec;
|
||||
</script>
|
||||
|
||||
<div class={className}>
|
||||
<!-- Hidden element to pass server data to client -->
|
||||
<div class="hidden" id="carousel-data">{JSON.stringify(links)}</div>
|
||||
|
||||
<div class="relative flex items-center w-full h-60">
|
||||
<button id="dec-button" class="absolute left-2" onclick="dec()"><</button>
|
||||
<img id="carousel-img" class="rounded-lg w-full h-full object-cover" src={links[0]} />
|
||||
<!-- <div class="w-70 h-60 bg-green-600" /> -->
|
||||
<button id="inc-button" class="absolute right-2" onclick="inc()">></button>
|
||||
</div>
|
||||
</div>
|
||||
40
src/components/Detail/InfoView.astro
Normal file
40
src/components/Detail/InfoView.astro
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
import TagRow from "../Card/TagRow.astro";
|
||||
|
||||
|
||||
const { re } = Astro.props
|
||||
|
||||
function formatTime(seconds) {
|
||||
if (seconds === 0) return null
|
||||
const h = Math.floor(seconds / 3600);
|
||||
const m = Math.floor((seconds % 3600) / 60);
|
||||
let result = "";
|
||||
if (h > 0) result += `${h}h`;
|
||||
if (m > 0) result += `${m}m`;
|
||||
if (result === "") result = "0m";
|
||||
return result;
|
||||
}
|
||||
|
||||
function formatTimeMin(minutes) {
|
||||
if (minutes === 0) return null
|
||||
const h = Math.floor(minutes / 60);
|
||||
const m = minutes % 60;
|
||||
let result = "";
|
||||
if (h > 0) result += `${h}h`;
|
||||
if (m > 0) result += `${m}m`;
|
||||
if (result === "") result = "0m";
|
||||
return result;
|
||||
}
|
||||
|
||||
const workTime = formatTimeMin(re.worktime)
|
||||
const waitTime = formatTimeMin(re.waittime)
|
||||
---
|
||||
|
||||
<p class="text-white/60 text-sm mt-1 italic">{re.description}</p>
|
||||
<div class="flex pt-1 items-center">
|
||||
{re.servings !== 0 && (<p class="border-r pr-2">Serves: {re.servings}</p>)}
|
||||
{workTime && (<p class="border-r px-2">{workTime} Work</p>)}
|
||||
{waitTime && (<p class="border-r px-2">{waitTime} Wait</p>)}
|
||||
{re.rating !== 0 && (<p class="pl-2">{re.rating}</p><p class="text-white/40 text-xs">/10</p>)}
|
||||
</div>
|
||||
<TagRow tags={re.expand.tags}/>
|
||||
68
src/components/Detail/IngredientTableView.astro
Normal file
68
src/components/Detail/IngredientTableView.astro
Normal file
@@ -0,0 +1,68 @@
|
||||
---
|
||||
// const { ingredients } = Astro.props
|
||||
|
||||
const { class: className, ingredients } = Astro.props
|
||||
const tableView = true
|
||||
---
|
||||
|
||||
{!tableView && (
|
||||
<div class={`bg-[#2a2b2c] p-3 rounded-lg w-full text-left ${className}`}>
|
||||
{
|
||||
ingredients.map(ing => (
|
||||
<div class="text-white/70">
|
||||
<p>• {ing.quantity} {ing.unit} {ing.name}</p>
|
||||
</div>
|
||||
))
|
||||
}
|
||||
|
||||
</div>
|
||||
)}
|
||||
|
||||
{tableView && (
|
||||
<table class={`table-auto text-left bg-[#2a2b2c] rounded-lg ${className}`}>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="px-4 py-2">Quantity</th>
|
||||
<th class="px-4 py-2">Unit</th>
|
||||
<th class="px-4 py-2">Ingredient</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{
|
||||
ingredients.map((ing, index) => (
|
||||
<>
|
||||
<tr class="border-t border-white/10 cursor-pointer hover:bg-white/10 transition-opacity ingredient-row" data-index={index}>
|
||||
<td class="px-4 py-2">{ing.quantity}</td>
|
||||
<td class="px-4 py-2">{ing.unit}</td>
|
||||
<td class="px-4 py-2">{ing.name}</td>
|
||||
</tr>
|
||||
</>
|
||||
))
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
)}
|
||||
|
||||
<style>
|
||||
.ingredient-row.completed {
|
||||
/* background-color: rgba(0, 0, 0, 0.4) !important; */
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.ingredient-row.completed td {
|
||||
text-decoration: line-through;
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const rows = document.querySelectorAll('.ingredient-row');
|
||||
|
||||
rows.forEach(row => {
|
||||
row.addEventListener('click', function() {
|
||||
this.classList.toggle('completed');
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
14
src/components/Detail/StepIngredientSideView.astro
Normal file
14
src/components/Detail/StepIngredientSideView.astro
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
import client from "@/data/pocketbase";
|
||||
|
||||
const { ingredients, class: className } = Astro.props;
|
||||
|
||||
---
|
||||
|
||||
<div class={className}>
|
||||
{ingredients.map(i => (
|
||||
<div class="text-sm">
|
||||
<p>• {i.quantity} {i.unit || " "} {i.name}</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
25
src/components/Detail/StepView.astro
Normal file
25
src/components/Detail/StepView.astro
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
import { record } from "astro:schema"
|
||||
import client from "@/data/pocketbase"
|
||||
import StepIngredientSideView from "./StepIngredientSideView.astro"
|
||||
|
||||
const { steps, class: className } = Astro.props
|
||||
---
|
||||
|
||||
<div class={className}>
|
||||
<p class="text-[22pt] font-bold md:hidden">Steps</p>
|
||||
{ steps.map(s => (
|
||||
<div class="bg-[#2a2b2c] rounded-lg mb-2 p-3">
|
||||
<p class="text-bold text-[10pt]">Step {s.index + 1}</p>
|
||||
|
||||
<div class="flex flex-col md:flex-row md:items-stretch">
|
||||
<p class="w-full md:flex-2/3 pr-1 text-left">{s.instruction}</p>
|
||||
{s.ingredients && s.ingredients.length > 0 && (
|
||||
<div class="w-full md:w-auto md:flex-2/5 mt-2 md:mt-0 md:ml-2 md:pl-3 md:border-l text-white/70 border-white/70">
|
||||
<StepIngredientSideView class="text-left" ingredients={s.expand.ingredients} />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)) }
|
||||
</div>
|
||||
15
src/components/Header.astro
Normal file
15
src/components/Header.astro
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
<div class="flex w-full items-center bg-[#2a2b2c] text-white p-5">
|
||||
<a class="flex" href="/">
|
||||
<p class="text-3xl">Recipie</p>
|
||||
<!-- <p class=" text-3xl text-amber-500">pie</p> -->
|
||||
🥧
|
||||
</a>
|
||||
|
||||
<div class="ml-auto space-x-5">
|
||||
<a class="hover:underline underline-offset-4" href="/recipe/new">new</a>
|
||||
<a class="hover:underline underline-offset-4" href="/recipe/import">add</a>
|
||||
<!-- <a class="hover:underline underline-offset-4" href="/tags">tags</a> -->
|
||||
<a class="hover:underline underline-offset-4" >search</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,4 +1,71 @@
|
||||
import Pocketbase from "pocketbase"
|
||||
import Pocketbase, { type RecordListOptions } from "pocketbase"
|
||||
import {
|
||||
type Recipe,
|
||||
type Ingredient,
|
||||
type Step,
|
||||
type Tag,
|
||||
Collection
|
||||
} from './schema'
|
||||
|
||||
export const client = new Pocketbase(import.meta.env.PUBLIC_PB_URL)
|
||||
// export const client = new Pocketbase("http://localhost:8080")
|
||||
class APIClient {
|
||||
pb: Pocketbase
|
||||
|
||||
constructor() {
|
||||
this.pb = new Pocketbase("http://localhost:4321")
|
||||
this.pb.autoCancellation(false)
|
||||
}
|
||||
|
||||
async getRecipesPage(page: number, perPage: number = 30, options: RecordListOptions) {
|
||||
return await this.pb.collection<Recipe>(Collection.RECIPES).getList(page, perPage, options)
|
||||
}
|
||||
|
||||
async getAllRecipes() {
|
||||
return await this.pb.collection<Recipe>(Collection.RECIPES).getFullList({ expand: 'ingredients,tags,steps,images,steps.ingredients' })
|
||||
}
|
||||
|
||||
async getRecipe(id: string) {
|
||||
return await this.pb.collection<Recipe>(Collection.RECIPES).getOne(id, { expand: 'ingredients,tags,steps,images,steps.ingredients' })
|
||||
}
|
||||
|
||||
// IMAGE
|
||||
async getImageURL(imgID: string, relative: boolean = true) {
|
||||
const record = await this.pb.collection(Collection.IMAGES).getOne(imgID)
|
||||
const res = this.pb.files.getURL(record, record.image)
|
||||
return relative ? res.substring(21) : res
|
||||
}
|
||||
|
||||
async getRecipeImages(recipeID: string) {
|
||||
const re = await this.getRecipe(recipeID)
|
||||
const imgIDs = re.images ?? []
|
||||
|
||||
const urls = Promise.all(
|
||||
imgIDs.map(img => this.getImageURL(img))
|
||||
)
|
||||
return urls
|
||||
}
|
||||
|
||||
async getAllTags() {
|
||||
return await this.pb.collection<Tag>(Collection.TAGS).getFullList()
|
||||
}
|
||||
|
||||
async getTag(name: string) {
|
||||
return await this.pb.collection<Tag>(Collection.TAGS).getList(1, 50, { filter: `name = '${name}'` })
|
||||
}
|
||||
|
||||
async getRecipesOfTag(tagName: string) {
|
||||
// get the tag id first
|
||||
const tagResult = await this.getTag(tagName)
|
||||
if (tagResult.items.length === 0) {
|
||||
return []
|
||||
}
|
||||
const tag = tagResult.items[0]
|
||||
|
||||
return await this.pb.collection<Recipe>(Collection.RECIPES).getFullList({
|
||||
filter: `tags ~ '${tag.id}'`,
|
||||
expand: 'ingredients,tags,steps,images,steps.ingredients'
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
const client = new APIClient()
|
||||
export default client;
|
||||
55
src/data/schema.ts
Normal file
55
src/data/schema.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
// Base PB type
|
||||
export interface BaseRecord {
|
||||
id: string,
|
||||
created: string,
|
||||
updated: string
|
||||
}
|
||||
|
||||
export interface Ingredient extends BaseRecord {
|
||||
quantity: string,
|
||||
unit: string,
|
||||
name: string
|
||||
}
|
||||
|
||||
export interface Step extends BaseRecord {
|
||||
index: number,
|
||||
instruction: string,
|
||||
ingredients?: Ingredient[]
|
||||
}
|
||||
|
||||
export interface Tag extends BaseRecord {
|
||||
name: string
|
||||
}
|
||||
|
||||
// not sure Image is the best type cos it might be quite heavy to get all the fields every time but
|
||||
// it is here in case it is (a good idea)
|
||||
export interface Image extends BaseRecord {
|
||||
id: string
|
||||
filename: string
|
||||
url?: string
|
||||
}
|
||||
|
||||
export interface Recipe extends BaseRecord {
|
||||
name: string,
|
||||
description?: string,
|
||||
servings?: number,
|
||||
images?: string[], // image IDs
|
||||
ingredients: string[]
|
||||
steps: string[],
|
||||
tags?: string[]
|
||||
|
||||
expand: {
|
||||
images?: Image[], // image IDs,
|
||||
ingredients: Ingredient[]
|
||||
steps: Step[],
|
||||
tags?: Tag[]
|
||||
}
|
||||
}
|
||||
|
||||
export const Collection = {
|
||||
RECIPES: 'recipes',
|
||||
STEPS: 'steps',
|
||||
INGREDIENTS: 'ingredients',
|
||||
TAGS: 'tags',
|
||||
IMAGES: 'images'
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
---
|
||||
import BaseHead from "../components/BaseHead.astro";
|
||||
import Header from "@/components/Header";
|
||||
---
|
||||
|
||||
<html lang=en>
|
||||
@@ -8,7 +9,10 @@ import BaseHead from "../components/BaseHead.astro";
|
||||
</head>
|
||||
<body>
|
||||
<main id="main" class="flex-1">
|
||||
<slot />
|
||||
<Header/>
|
||||
<div class="px-3 mb-5 md:px-5 pt-2">
|
||||
<slot />
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
9
src/pages/404.astro
Normal file
9
src/pages/404.astro
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
import Base from "@/layouts/base";
|
||||
---
|
||||
|
||||
<Base>
|
||||
<div class="flex items-center justify-center text-3xl font-bold">
|
||||
🥧 404 🥧
|
||||
</div>
|
||||
</Base>
|
||||
19
src/pages/api/[...proxy].ts
Normal file
19
src/pages/api/[...proxy].ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import type { APIRoute } from "astro";
|
||||
|
||||
// THANK YOU https://stackoverflow.com/a/77297521 !!!!!!!
|
||||
|
||||
const getProxyUrl = (request: Request) => {
|
||||
const proxyUrl = new URL(import.meta.env.PUBLIC_PB_URL);
|
||||
const requestUrl = new URL(request.url);
|
||||
return new URL(requestUrl.pathname + requestUrl.search, proxyUrl);
|
||||
};
|
||||
|
||||
export const ALL: APIRoute = async ({ request }) => {
|
||||
const proxyUrl = getProxyUrl(request);
|
||||
const response = await fetch(proxyUrl.href, request);
|
||||
return new Response(response.body, {
|
||||
status: response.status,
|
||||
statusText: response.statusText,
|
||||
headers: response.headers
|
||||
});
|
||||
};
|
||||
@@ -1,16 +1,20 @@
|
||||
---
|
||||
import PageLayout from "@/layouts/base"
|
||||
import { client } from "@/data/pocketbase"
|
||||
import client from "@/data/pocketbase"
|
||||
import OverviewCard from "@/components/Card/OverviewCard"
|
||||
|
||||
const reccies = await client.collection("recipes").getFullList()
|
||||
const recipes = await client.getAllRecipes()
|
||||
---
|
||||
|
||||
<PageLayout>
|
||||
hello
|
||||
|
||||
{
|
||||
reccies.map(rec => (
|
||||
<p>{rec.name}</p>
|
||||
))
|
||||
}
|
||||
<PageLayout>
|
||||
<!-- <p class="pb-2">What would you like today?</p> -->
|
||||
|
||||
<div class="grid gap-3 grid-cols-1 py-3 md:grid-cols-2 lg:grid-cols-4 xl:grid-cols-6">
|
||||
{
|
||||
recipes.map(r => (
|
||||
<OverviewCard recipe={r} />
|
||||
))
|
||||
}
|
||||
</div>
|
||||
|
||||
</PageLayout>
|
||||
|
||||
34
src/pages/recipe/[recipeid].astro
Normal file
34
src/pages/recipe/[recipeid].astro
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
import client from "@/data/pocketbase";
|
||||
|
||||
import SiteLayout from "@/layouts/base";
|
||||
import ImageCarousel from "@/components/Detail/ImageCarousel";
|
||||
import IngredientTableView from "@/components/Detail/IngredientTableView";
|
||||
import StepView from "@/components/Detail/StepView";
|
||||
import InfoView from "@/components/Detail/InfoView";
|
||||
|
||||
const { recipeid } = Astro.params;
|
||||
|
||||
const re = await client.getRecipe(recipeid as string)
|
||||
---
|
||||
|
||||
<SiteLayout>
|
||||
<div class="flex flex-col md:flex-row mx-auto justify-center w-full lg:max-w-3/4 xl:max-w-2/3 2xl:max-w-1/2">
|
||||
<div class="flex md:flex-1/3 flex-col mt-2 md:mt-4 sticky">
|
||||
<ImageCarousel class="w-full" recipe={recipeid} />
|
||||
<p class="text-[28pt] font-bold leading-11 mt-2">{re.name}</p>
|
||||
|
||||
<!-- Details -->
|
||||
<InfoView re={re} />
|
||||
|
||||
<p class="text-[22pt] font-bold 'md:mt-4'">Ingredients</p>
|
||||
<IngredientTableView class:list={['md:w-80', 'px-4']} ingredients={re.expand.ingredients ?? []} />
|
||||
</div>
|
||||
|
||||
<div class="flex mt-4 md:flex-2/3 w-full flex-col">
|
||||
<!-- Steps -->
|
||||
<StepView class="md:ml-3" steps={re.expand.steps ?? []} />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</SiteLayout>
|
||||
140
src/pages/recipe/new.astro
Normal file
140
src/pages/recipe/new.astro
Normal file
@@ -0,0 +1,140 @@
|
||||
---
|
||||
import SiteLayout from "@/layouts/base";
|
||||
|
||||
const { recipeid } = Astro.params;
|
||||
|
||||
// Actually post the recipe with the stored variables
|
||||
async function submitRecipe() {
|
||||
|
||||
}
|
||||
|
||||
---
|
||||
<script src="@/script/newRecipe.ts"/>
|
||||
|
||||
<SiteLayout>
|
||||
<div class="flex flex-col md:flex-row mx-auto justify-center w-full lg:max-w-3/4 xl:max-w-2/3 2xl:max-w-1/2">
|
||||
<div class="flex md:flex-1/3 flex-col sticky">
|
||||
|
||||
<div class="flex mb-2 items-center">
|
||||
<p class="text-[28pt] mr-auto">New Recipe</p>
|
||||
<button
|
||||
id="btn-save"
|
||||
class="px-1 w-15 h-9 bg-white/10 active:bg-white/20 transition-colors rounded-lg"
|
||||
>
|
||||
Save
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="relative">
|
||||
<input
|
||||
id="photo"
|
||||
type="file"
|
||||
accept="image/png,image/jpeg"
|
||||
class="w-full bg-white/10 rounded-lg h-50
|
||||
file:mr-4 file:py-2 file:px-4
|
||||
file:rounded-lg file:border-0 file:hidden
|
||||
before:content-['camera'] before:w-full before:h-full before:flex
|
||||
before:items-center before:justify-center before:absolute
|
||||
relative cursor-pointer
|
||||
[&::-webkit-file-upload-button]:hidden"
|
||||
>
|
||||
</div>
|
||||
|
||||
<!-- Details -->
|
||||
<textarea
|
||||
id="rec-name"
|
||||
rows="1"
|
||||
placeholder="Name"
|
||||
class="text-[28pt] font-bold p-1 leading-none mt-2 bg-white/10 rounded-lg resize-none overflow-hidden"
|
||||
oninput="this.style.height = ''; this.style.height = this.scrollHeight + 'px'"
|
||||
/>
|
||||
<textarea
|
||||
id="rec-desc"
|
||||
rows="3"
|
||||
placeholder="Description"
|
||||
class="text-sm italic leading-none mt-2 bg-white/10 rounded-lg resize-none overflow-hidden p-2"
|
||||
oninput="this.style.height = ''; this.style.height = this.scrollHeight + 'px'"
|
||||
/>
|
||||
<!-- if it works :3 -->
|
||||
|
||||
<!-- Smaller details -->
|
||||
<div class="flex mt-2 h-9 space-x-2">
|
||||
<input
|
||||
id="rec-servings"
|
||||
type="number"
|
||||
class="bg-white/10 px-2 rounded-lg w-24 overflow-hidden"
|
||||
placeholder="Servings"
|
||||
/>
|
||||
<input
|
||||
id="rec-worktime"
|
||||
type="text"
|
||||
class="bg-white/10 px-2 rounded-lg w-24 overflow-hidden"
|
||||
placeholder="Work Time"
|
||||
/>
|
||||
<input
|
||||
id="rec-waittime"
|
||||
type="text"
|
||||
class="bg-white/10 px-2 rounded-lg w-24 overflow-hidden"
|
||||
placeholder="Wait Time"
|
||||
/>
|
||||
<input
|
||||
id="rec-rating"
|
||||
type="number"
|
||||
class="bg-white/10 px-2 rounded-lg w-23 overflow-hidden"
|
||||
placeholder="Rating"
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="flex flex-row align-middle items-center">
|
||||
<p class="mt-4 text-[22pt] font-bold">Ingredients</p>
|
||||
<button disabled class="disabled:text-white/20 transition-colors ml-auto mt-5 text-white bg-white/10 rounded-lg px-3 py-1 " id="add-ingredient-btn" >Add</button>
|
||||
</div>
|
||||
<table class={`table-fixed text-left bg-[#2a2b2c] rounded-lg w-full`}>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="px-4 py-2 w-18">Qty</th>
|
||||
<th class="px-4 py-2 w-20">Unit</th>
|
||||
<th class="px-4 py-2">Ingredient</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="ingredient-table" class="w-full border-t px-4 py-2 border-white/10">
|
||||
<tr id="ingredient-input" class="">
|
||||
<td class="px-2 py-1">
|
||||
<input id="ing-qty" class="w-full h-9 my-1 bg-white/10 rounded-lg px-2 py-2" type="text" placeholder="Qty">
|
||||
</td>
|
||||
<td class="px-2 py-1">
|
||||
<input id="ing-unit" class="w-full h-9 bg-white/10 rounded-lg px-2 py-2" type="text" placeholder="Unit">
|
||||
</td>
|
||||
<td class="px-2 py-1">
|
||||
<!-- <textarea id="ing-name" class="w-full h-11 bg-white/20 rounded-lg px-2 py-3 mt-1 resize-none leading-tight" placeholder="Ingredient" rows="1"/> -->
|
||||
<input id="ing-name" class="w-full h-9 bg-white/10 rounded-lg px-2 py-2" type="text" placeholder="Ingredient">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="flex mt-4 md:mt-16 md:flex-2/3 w-full flex-col md:ml-3">
|
||||
<!-- <p class="hidden md:block text-[28pt] font-bold pl-5">Helloi</p> -->
|
||||
|
||||
<!-- Steps -->
|
||||
<p class="text-[22pt] font-bold md:hidden">Steps</p>
|
||||
|
||||
<div class="bg-[#2a2b2c] rounded-lg mb-2 p-2">
|
||||
<!-- <p class="text-bold text-[10pt]">Step</p> -->
|
||||
<textarea
|
||||
id="new-instruction"
|
||||
class="block bg-white/10 w-full h-full rounded-lg resize-none px-3 py-1"
|
||||
placeholder="New Step"
|
||||
oninput="this.style.height = ''; this.style.height = this.scrollHeight + 'px'"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<button disabled class="disabled:text-white/20 ml-auto mb-2 transition-colors text-white bg-white/10 rounded-lg px-3 py-1 " id="add-step-btn" >Add</button>
|
||||
|
||||
<ul id="step-list"></ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</SiteLayout>
|
||||
22
src/pages/tags/[name].astro
Normal file
22
src/pages/tags/[name].astro
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
import SiteLayout from "@/layouts/base";
|
||||
import client from "@/data/pocketbase";
|
||||
import OverviewCard from "@/components/Card/OverviewCard";
|
||||
|
||||
const { name } = Astro.params
|
||||
const recipes = await client.getRecipesOfTag(name) // todo redir to 404 if not found
|
||||
---
|
||||
|
||||
<SiteLayout>
|
||||
<p class="text-xl pb-2">
|
||||
{recipes.length} { recipes.length == 1 ? "Recipe" : "Recipes" } with: <code class="bg-white/10 p-1 text-sm rounded-lg" >{name}</code>
|
||||
</p>
|
||||
|
||||
<div class="grid md:gap-2 gap-3 grid-cols-1 md:grid-cols-2 lg:grid-cols-4 xl:grid-cols-8">
|
||||
{
|
||||
recipes.map(r => (
|
||||
<OverviewCard recipe={r} />
|
||||
))
|
||||
}
|
||||
</div>
|
||||
</SiteLayout>
|
||||
24
src/pages/tags/index.astro
Normal file
24
src/pages/tags/index.astro
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
import client from "@/data/pocketbase";
|
||||
import SiteLayout from "@/layouts/base";
|
||||
|
||||
const tags = await client.getAllTags()
|
||||
|
||||
const countsPerTag = await Promise.all(
|
||||
tags.map(async t => (await client.getRecipesOfTag(t.name)).length)
|
||||
)
|
||||
---
|
||||
|
||||
<SiteLayout>
|
||||
<p class="title pb-2">
|
||||
{tags.length} Tags
|
||||
</p>
|
||||
{
|
||||
(tags ?? []).map((t, i) => (
|
||||
// <p>{t.name} -> {countsPerTag[i]} {countsPerTag[i] == 1 ? "Recipe" : "Recipes" } </p>
|
||||
<a class="hover:underline" href={`/tags/${t.name}`}>
|
||||
{t.name} ({countsPerTag[i]})
|
||||
</a><br/>
|
||||
))
|
||||
}
|
||||
</SiteLayout>
|
||||
227
src/script/newRecipe.ts
Normal file
227
src/script/newRecipe.ts
Normal file
@@ -0,0 +1,227 @@
|
||||
import client from "@/data/pocketbase"
|
||||
|
||||
let ingredientFields: HTMLInputElement[] = []
|
||||
let ingredientTable: HTMLTableSectionElement = document.querySelector('#ingredient-table')!
|
||||
let ingredientAddButton: HTMLButtonElement = document.querySelector('#add-ingredient-btn')!
|
||||
|
||||
let stepInput: HTMLTextAreaElement = document.querySelector('#new-instruction')!
|
||||
let stepAddButton: HTMLButtonElement = document.querySelector('#add-step-btn')!
|
||||
let stepList: HTMLUListElement = document.querySelector('#step-list')!
|
||||
let currentStepIndex = 0
|
||||
|
||||
// - VARS
|
||||
let ingredients: {quantity: string, unit: string, name: string}[] = []
|
||||
let steps: {
|
||||
index: number,
|
||||
instruction: string,
|
||||
ingredients: string[], // IDs of ingredient fields
|
||||
}[] = []
|
||||
|
||||
const formFields = () => {
|
||||
return {
|
||||
name: (document.querySelector("#rec-name") as HTMLTextAreaElement).value ?? "",
|
||||
description: (document.querySelector("#rec-desc") as HTMLTextAreaElement).value ?? "",
|
||||
servings: (document.querySelector("#rec-servings") as HTMLInputElement).value ?? "",
|
||||
worktime: (document.querySelector("#rec-worktime") as HTMLInputElement).value ?? "",
|
||||
waittime: (document.querySelector("#rec-waittime") as HTMLInputElement).value ?? "",
|
||||
rating: (document.querySelector("#rec-rating") as HTMLInputElement).value ?? "",
|
||||
ings: ingredients,
|
||||
stepList: steps
|
||||
}
|
||||
}
|
||||
|
||||
// - INIT
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
|
||||
ingredientFields.push(
|
||||
document.querySelector('#ing-qty')!,
|
||||
document.querySelector('#ing-unit')!,
|
||||
document.querySelector('#ing-name')!
|
||||
)
|
||||
|
||||
stepInput.addEventListener('input', showAddStepButton)
|
||||
document.querySelector('#btn-save')?.addEventListener('click', addRecipe)
|
||||
|
||||
// show plus button once the user types in the text fields
|
||||
ingredientFields.forEach(f => {
|
||||
f.addEventListener('input', showAddIngredientButton)
|
||||
f.addEventListener('keydown', showAddIngredientButton)
|
||||
})
|
||||
// onclick for add button
|
||||
document.querySelector('#add-ingredient-btn')?.addEventListener('click', addIngredient);
|
||||
|
||||
// Enter key navigation for ingredient fields
|
||||
ingredientFields[0].addEventListener('keydown', e => {
|
||||
if (e.key === 'Enter') {
|
||||
ingredientFields[1].focus() // Move from qty to unit
|
||||
}
|
||||
})
|
||||
|
||||
ingredientFields[1].addEventListener('keydown', e => {
|
||||
if (e.key === 'Enter') {
|
||||
ingredientFields[2].focus() // Move from unit to name
|
||||
}
|
||||
})
|
||||
|
||||
// for pressing enter to add ingredient (on the last field)
|
||||
ingredientFields[2].addEventListener('keydown', e => {if (e.key === 'Enter') addIngredient()} )
|
||||
|
||||
// Initial check for button state
|
||||
showAddIngredientButton()
|
||||
showAddStepButton()
|
||||
|
||||
// Steps
|
||||
stepInput.addEventListener('keyup', e => { if (e.key === 'Enter' && e.shiftKey) addStep() } )
|
||||
stepAddButton.addEventListener('click', addStep)
|
||||
});
|
||||
|
||||
// - ADD
|
||||
async function addRecipe() {
|
||||
const comps = formFields()
|
||||
console.log(comps.ings)
|
||||
|
||||
const ingredientIDs = await Promise.all(
|
||||
comps.ings.map(async it => (await client.pb.collection('ingredients').create(it)).id) // get the id of the returned record
|
||||
)
|
||||
|
||||
const stepIDs = await Promise.all(
|
||||
comps.stepList.map(async it => (await client.pb.collection('steps').create(it)).id)
|
||||
)
|
||||
|
||||
const recipe = await client.pb.collection('recipes').create({
|
||||
name: comps.name,
|
||||
description: comps.description,
|
||||
servings: comps.servings,
|
||||
worktime: comps.worktime,
|
||||
waittime: comps.waittime,
|
||||
rating: comps.rating,
|
||||
ingredients: ingredientIDs,
|
||||
steps: stepIDs
|
||||
})
|
||||
|
||||
console.log(recipe)
|
||||
}
|
||||
|
||||
function addIngredient() {
|
||||
const ing = {
|
||||
quantity: ingredientFields[0].value,
|
||||
unit: ingredientFields[1].value,
|
||||
name: ingredientFields[2].value
|
||||
}
|
||||
|
||||
ingredients.push(ing)
|
||||
|
||||
const newRow = document.createElement('tr')
|
||||
newRow.innerHTML = `
|
||||
<td class="px-4 py-2 border-t border-white/10">${ing.quantity}</td>
|
||||
<td class="px-4 py-2 border-t border-white/10">${ing.unit}</td>
|
||||
<td class="px-4 py-2 border-t border-white/10">${ing.name}</td>
|
||||
`
|
||||
|
||||
// Add row to table and clear fields
|
||||
ingredientTable.appendChild(newRow)
|
||||
ingredientFields.forEach(f => f.value = '')
|
||||
ingredientAddButton.disabled = true // Hide Add Ingredient button
|
||||
// move cursor to Qty field again
|
||||
ingredientFields[0].focus()
|
||||
}
|
||||
|
||||
function addStep() {
|
||||
const step = {
|
||||
index: currentStepIndex++,
|
||||
instruction: stepInput.value,
|
||||
ingredients: []
|
||||
}
|
||||
|
||||
steps.push(step)
|
||||
renderSteps()
|
||||
stepInput.value = ''
|
||||
stepAddButton.disabled = true
|
||||
stepInput.focus()
|
||||
}
|
||||
|
||||
function renderSteps() {
|
||||
// clear the step list
|
||||
stepList.innerHTML = ''
|
||||
|
||||
// re-render all steps in their current order
|
||||
steps.forEach((step, displayIndex) => {
|
||||
const newStep = document.createElement('div')
|
||||
// times like this i regret using astro
|
||||
newStep.innerHTML = `
|
||||
<div class="flex justify-between items-start ">
|
||||
<div class="flex flex-col">
|
||||
<p class="text-bold text-[10pt]">Step ${displayIndex + 1}</p>
|
||||
<div class="flex flex-col md:flex-row md:items-stretch">
|
||||
<p class="w-full md:flex-2/3 pr-1 text-left">${step.instruction}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-1">
|
||||
<button id="move-up-btn" class="px-2 py-1 bg-white/10 hover:bg-white/30 transition-colors rounded text-xs" data-step-index="${step.index}" ${displayIndex === 0 ? 'disabled' : ''}>↑</button>
|
||||
|
||||
<button id="move-down-btn" class="px-2 py-1 bg-white/10 hover:bg-white/30 transition-colors rounded text-xs" data-step-index="${step.index}" ${displayIndex === steps.length - 1 ? 'disabled' : ''}>↓</button>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
newStep.id = `step-${step.index}`
|
||||
newStep.className = "bg-[#2a2b2c] rounded-lg mb-2 p-3"
|
||||
stepList.appendChild(newStep)
|
||||
})
|
||||
|
||||
// event listeners to reorder buttons
|
||||
document.querySelectorAll('#move-up-btn').forEach(btn => {
|
||||
btn.addEventListener('click', (e) => {
|
||||
const stepIndex = parseInt((e.target as HTMLButtonElement).dataset.stepIndex!)
|
||||
moveStep(stepIndex, -1)
|
||||
})
|
||||
})
|
||||
|
||||
document.querySelectorAll('#move-down-btn').forEach(btn => {
|
||||
btn.addEventListener('click', (e) => {
|
||||
const stepIndex = parseInt((e.target as HTMLButtonElement).dataset.stepIndex!)
|
||||
moveStep(stepIndex, 1)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// - UTILS
|
||||
function showAddIngredientButton() {
|
||||
const hasQty = ingredientFields[0].value.trim().length > 0
|
||||
const hasName = ingredientFields[2].value.trim().length > 0
|
||||
|
||||
if (hasQty && hasName) {
|
||||
ingredientAddButton.disabled = false
|
||||
} else {
|
||||
ingredientAddButton.disabled = true
|
||||
}
|
||||
}
|
||||
|
||||
function showAddStepButton() {
|
||||
if (stepInput.value.trim().length > 0) {
|
||||
stepAddButton.disabled = false
|
||||
} else {
|
||||
stepAddButton.disabled = true
|
||||
}
|
||||
}
|
||||
|
||||
// shift: the direction to move. should be +1 to move down or -1 to move up the list
|
||||
function moveStep(stepIndex: number, shift: number) {
|
||||
// Find the step in the array
|
||||
const currentStepArrayIndex = steps.findIndex(step => step.index === stepIndex)
|
||||
|
||||
if (currentStepArrayIndex === -1) return // step not found
|
||||
|
||||
const newIndex = currentStepArrayIndex + shift
|
||||
|
||||
// check bounds
|
||||
if (newIndex < 0 || newIndex >= steps.length) return
|
||||
|
||||
// swap the steps in the array
|
||||
const temp = steps[currentStepArrayIndex]
|
||||
steps[currentStepArrayIndex] = steps[newIndex]
|
||||
steps[newIndex] = temp
|
||||
|
||||
// re-render the steps
|
||||
renderSteps()
|
||||
}
|
||||
14
src/styles/global.css
Normal file
14
src/styles/global.css
Normal file
@@ -0,0 +1,14 @@
|
||||
@import "tailwindcss";
|
||||
|
||||
html {
|
||||
@apply bg-[#1d1f21];
|
||||
/* @apply bg-[#fafafa]; */
|
||||
@apply text-white;
|
||||
/* @apply font-; */
|
||||
@apply font-sans;
|
||||
/* font-family: 'SF Pro Display', 'Segoe UI', 'Helvetica Neue', Arial, 'Noto Sans', sans-serif; */
|
||||
}
|
||||
|
||||
.title {
|
||||
@apply text-2xl;
|
||||
}
|
||||
@@ -3,9 +3,11 @@
|
||||
"include": [".astro/types.d.ts", "**/*"],
|
||||
"exclude": ["dist"],
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/components/*": ["src/components/*.astro"],
|
||||
"@/layouts/*": ["src/layouts/*.astro"],
|
||||
"@/script/*": ["src/script/*"],
|
||||
"@/utils": ["src/utils/index.ts"],
|
||||
"@/data/*": ["src/data/*"],
|
||||
"@/site-config": ["src/site.config.ts"]
|
||||
|
||||
Reference in New Issue
Block a user