155 Commits

Author SHA1 Message Date
Michael Genson
666085b9ca
Fix: Print Preferences Menu Missing (#2162)
* fixed console errors for missing recipe prop

* restored print preferences to action menu
2023-02-21 19:00:22 -09:00
Michael Genson
fd03d468d4
Fix: Allow Last Made to be Updated on Locked Recipes (#2140)
* allow certain props to be updated on locked recipe

* pytest

* added "last_made" to hardcoded datetime fields

* refactored last made to its own route

* codegen/types

* updated pytest
2023-02-21 18:59:22 -09:00
Michael Genson
a6c46a7420
Feature: Shopping List Label Section Improvements (#2090)
* added backend for shopping list label config

* updated codegen

* refactored shopping list ops to service
removed unique contraint
removed label settings from main route/schema
added new route for label settings

* codegen

* made sure label settings output in position order

* implemented submenu for label order drag and drop

* removed redundant label and tweaked formatting

* added view by label to user preferences

* made items draggable within each label section

* moved reorder labels to its own button

* made dialog scrollable

* fixed broken model

* refactored labels to use a service
moved shopping list label logic to service
modified label seeder to use service

* added tests

* fix for first label missing the tag icon

* fixed wrong mapped type

* added statement to create existing relationships

* fix restore test, maybe
2023-02-21 18:58:41 -09:00
Michael Genson
eaa6ee57a9
Fix: Remove dead search link (#2158)
* removed old references to search page

* changed overflow from scroll to auto
2023-02-20 21:51:24 -09:00
Michael Genson
09e58b36af
fix: added limited context menu for public users (#2138) 2023-02-19 16:28:57 -09:00
Michael Genson
5562effd66
feat: select ingredients to add to shopping List (#2136)
* added recipe ingredient override to backend

* pytest

* new dialog to filter recipe items added to list
2023-02-19 16:20:32 -09:00
Philipp Fischbeck
89b003589d
chore(deps): update to Nuxt 2.16 (Vue 2.7) (#2144) 2023-02-19 16:11:52 -09:00
Michael Genson
670907b563
feat: Print Preferences (#2131)
* added basic recipe print settings
added print settings dialog
refactored print view to live inside print container

* removed unwanted padding

* changed preferences layout
2023-02-19 15:37:18 -09:00
Hayden
71f8c1066a
feat: server side search (#2112) (#2117)
* feat: server side search API (#2112)

* refactor repository_recipes filter building

* add food filter to recipe repository page_all

* fix query type annotations

* working search

* add tests and make sure title matches are ordered correctly

* remove instruction matching again

* fix formatting and small issues

* fix another linting error

* make search test no rely on actual words

* fix failing postgres compiled query

* revise incorrectly ordered migration

* automatically extract latest migration version

* test migration orderes

* run type generators

* new search function

* wip: new search page

* sortable field options

* fix virtual scroll issue

* fix search casing bug

* finalize search filters/sorts

* remove old composable

* fix type errors

---------

Co-authored-by: Sören <fleshgolem@gmx.net>
2023-02-11 21:26:10 -09:00
Sören
f4b819899d
fix: duplicate network calls on index page (#2085)
* Prevent extra recipe load on index page

* Prevent loading recipes with food for all components but search ones

* add missing change in search page
2023-02-05 09:52:49 -09:00
Hayden
5dc253799d
fix: eslint errors and failing tests (#2078)
* fix eslint errors

* fix failing tests
2023-01-29 13:01:41 -09:00
sephrat
f8b8680b45
Localize hard-coded texts (#2044)
* feat(lang): localize some views

* feat(lang): an attempt at localizing vuetify (WIP)

* feat(lang): localized some more screens

* feat(lang): localized some more screens again

* feat(lang): hack to localize vuetify

* feat(lang): localize data management pages

* fix linting errors

---------

Co-authored-by: Hayden <64056131+hay-kot@users.noreply.github.com>
2023-01-28 16:39:51 -09:00
Philipp
59f43a58d3
Upload recipe step images from mobile devices (#2025)
* Upload recipe step images from mobile devices

This adds a button in the recipe step dropdown, as not all mobile
devices can drag and drop a file into the web page

See #885

* Add progress bar
2023-01-28 16:27:40 -09:00
Michael Genson
617cc1fdfb
Refactor Shopping List API (#2021)
* tidied up shopping list item models
redefined recipe refs and updated models
added calculated display attribute to unify shopping list item rendering
added validation to use a food's label if an item's label is null

* fixed schema reference

* refactored shopping list item service
route all operations through one central method to account for edgecases
return item collections for all operations to account for merging
consolidate recipe items before sending them to the shopping list

* made fractions prettier

* replaced redundant display text util

* fixed edgecase for zero quantity items on a recipe

* fix for pre-merging recipe ingredients

* fixed edgecase for merging create_items together

* fixed bug with merged updated items creating dupes

* added test for self-removing recipe ref

* update items are now merged w/ existing items

* refactored service to make it easier to read

* added a lot of tests

* made it so checked items are never merged

* fixed bug with dragging + re-ordering

* fix for postgres cascade issue

* added prevalidator to recipe ref to avoid db error
2023-01-28 15:45:02 -09:00
Hayden
a72f038247
fix: use markdown for description in cards (#2011) 2023-01-08 09:51:36 -09:00
Hayden
ae59f04b9f
fix: allow-iframe-embeds (#2009)
* allow embedding iframes

* fix alignment issue for buttons
2023-01-08 09:50:26 -09:00
Michael Genson
856a009dd8
fix: for several Shopping List bugs (#1912)
* prevent list refresh while re-ordering items

* update position of new items to stay at the bottom

* prevent refresh while loading

* copy item while editing so it isn't refreshed

* added loading count to handle overlapping actions

* fixed recipe reference throttling

* prevent merging checked and unchecked items
2023-01-08 08:23:24 -09:00
Michael Genson
46cc3898ab
feat: Improved Recipe Scaling Support and Shopping List Recipe Refactor (#1847)
* propogate scale changes to print view

* fixed incorrect variable reference

* refactored shopping list recipe routes
cleaned up existing logic
added support for recipe scaling

* updated current revision

* adding to shopping list respects UI recipe scale

* added field annotations

* added tests for recipe scaling

* made column nullable and set to 1 during migration
2022-12-30 13:47:35 -09:00
jenscalaerts
83b8ce659e
feat: improve automatic ingredient linking (#1836)
* Filtering special characters during automatic linking of ingredients to instructions

Used a unicode group to have a set of all unicode punctuation marks

* allowing for linking of ingredients to instruction at the beginning of a newline in the instruction

* Extracted ingredient matching into a composable and added tests. Ignoring 2 letter words to avoid false matches.

While testing the code 2 letter matches were a large source of false positives.
2022-12-29 13:00:31 -09:00
Michael Genson
4e8e2d7510
Feat/recipe timeline event UI (#1831)
* added new icons

* added timeline badge and dialog to action menu

* more icons

* implemented timeline dialog using temporary API

* added route for fetching all timeline events

* formalized API call and added mobile-friendly view

* cleaned tags

* improved last made UI for mobile

* added event context menu with placeholder methods

* adjusted default made this date
set time to 1 minute before midnight
adjusted display to properly interpret UTC

* fixed local date display

* implemented update/delete routes

* fixed formating for long subjects

* added api error handling

* made everything localizable

* fixed weird formatting

* removed unnecessary async

* combined mobile/desktop views w/ conditional attrs
2022-12-11 12:16:55 -09:00
Michael Genson
1b9ff454fb
feat: additional recipe sort behavior (#1858)
* changed default sort direction for certain attrs

* added workaround for filtering out null datetimes

* filtered out null-valued results for certain sorts

* removed unecessary parse

* used minyear instead of 1900
2022-11-30 20:59:30 -09:00
Philipp
33dffccaa5
feat: duplicate recipes (#1750)
* feature/frontend: Add duplicate button to recipe

* feature/backend: Add recipe duplication endpoint

* feature/frontend: add duplication API call

* Regenerate API docs

* Fix linter errors

* Fix backend linter error

* Move recipe duplication logic to recipe service

* Add test for recipe duplication

* Improve recipe ingredients copy test

* generate types

* import type

Co-authored-by: Hayden <64056131+hay-kot@users.noreply.github.com>
2022-11-30 20:57:26 -09:00
Jambaldorj Ochirpurev
05dfe38f19
feat: add the fuzzy search on Categories, Tags, and Tools pages (#1867) 2022-11-30 20:31:16 -09:00
Jambaldorj Ochirpurev
ac6554efdd
fix: text overflow on RecipeCard (#1830)
* fix the text overflow on RecipeCard

* add a wrapper class for description text for recipes
2022-11-27 10:33:03 -09:00
Michael Genson
a2dcdc1adf
feat: "I Made This" Dialog (#1801)
* added chef hat

* removed unnecessary log

* modified recipe and recipe timeline event schema
changed timeline event "message" -> "event_message"
added "last made" timestamp to recipe

* added "I made this" dialog to recipe action menu

* added missing field and re-ran code-gen

* moved dialog out of context menu and refactored
removed references in action menu and context menu
refactored dialog to be triggered by a button instead
added route to update recipe last made timestamp
added visual for last made timestamp to recipe header and title

* added sorting by last made

* switched event type to comment

* replaced alter column with pydantic alias

* added tests for event message alias
2022-11-13 14:12:53 -09:00
Michael Genson
1e3c0b0859
fix: recipe rating display (#1779)
* remove rating from recipe title

* fixed rating not rendering on landscape mode
2022-10-27 10:45:52 -08:00
Hayden
97d9e2a109
chore: lint-and-fix-vue-demi-imports (#1762)
* lint for 'vue-demi' imports

* fix invalid imports
2022-10-23 13:02:56 -08:00
Hayden
c5613694d9
fix: display food label if no label present (#1757)
The only label that was applied to the shopping list view was one that was manually assigned. Now we first check if the item has a label, if not we check if the food has a label, then if there really is no label we display nothing.
2022-10-22 13:00:10 -08:00
Hayden
2e11e57e0a
feat: fix recipe rating overwriting (#1756)
Previously, the recipe-ratings component would not sync to the v-modeled value when doing it's own updating. This PR fixes that issue and ensures that the value is pushed up to the parent whether in emit only mode or not.
2022-10-22 12:54:47 -08:00
Hayden
ce4315f971
chore: drop legacy editor (#1755)
* drop legacy editor

* remove unused components
2022-10-22 12:49:59 -08:00
Hayden
fcc5d99d40
chore: frontend testing setup (#1739)
* add vitest

* initialize lib w/ tests

* move to dev dep

* run tests in CI

* update file names

* move api folder to lib

* move api and api types to same folder

* update generator outpath

* rm husky

* i guess i _did_ need those types

* reorg types

* extract validators into testable components

* (WIP) start composable testing

* fix import type

* fix linter complaint

* simplify icon type def

* fix linter errors (maybe?)

* rename client file for sorting
2022-10-22 11:51:07 -08:00
Hayden
558789cd02
fix firefox drag and drop + add visual indicator (#1747) 2022-10-21 20:01:08 -08:00
Hayden
9ecef4c25f
chore: file generation cleanup (#1736)
This PR does too many things :( 

1. Major refactoring of the dev/scripts and dev/code-generation folders. 

Primarily this was removing duplicate code and cleaning up some poorly written code snippets as well as making them more idempotent so then can be re-run over and over again but still maintain the same results. This is working on my machine, but I've been having problems in CI and comparing diffs so running generators in CI will have to wait. 

2. Re-Implement using the generated api routes for testing

This was a _huge_ refactor that touched damn near every test file but now we have auto-generated typed routes with inline hints and it's used for nearly every test excluding a few that use classes for better parameterization. This should greatly reduce errors when writing new tests. 

3. Minor Perf improvements for the All Recipes endpoint

  A. Removed redundant loops
  B. Uses orjson to do the encoding directly and returns a byte response instead of relying on the default 
       jsonable_encoder.

4. Fix some TS type errors that cropped up for seemingly no reason half way through the PR.

See this issue https://github.com/phillipdupuis/pydantic-to-typescript/issues/28

Basically, the generated TS type is not-correct since Pydantic will automatically fill in null fields. The resulting TS type is generated with a ? to indicate it can be null even though we _know_ that i can't be.
2022-10-18 14:49:41 -08:00
Hayden
6159b55be9
fix: image and CI errors (#1694)
* bump cache version

* bump version

* delete template file

* maybe fix invalid CI?

* chain status command

* fix add tesseract bin to container & bump poetry (#1676)

* Add tesseract bin to container

* Add tesseract bin

Co-authored-by: Miroito <88556823+Miroito@users.noreply.github.com>
2022-10-02 16:24:13 -08:00
Michael Genson
796e55b7d5
refactor: webhook events (#1661)
* refactored EventBusService to work outside FastAPI

* extended event models

* refactored webhooks to run through event bus

* added basic webhook test route

* changed get_all to page_all

* fixed incorrectly implemented Vue variables

* fixed broken webhook test

* changed factory from staticmethod to classmethod

* made query boundary definitions easier to read
2022-09-27 18:55:20 -08:00
Ben Boeckel
2e6b877ba9
docs: fix typos (#1665)
* docs: fix typos

* typos: fix typos found by `codespell` across the codebase

* docs: fix `macOS` spelling

* docs: fix `authentification` terminology

"Authentification" is not a thing.

* docs: fix `localhost` typo in example link

* typos: fix in-code typos

These are potentially higher risk, but no other mentions of these typos
show up in the codebase.
2022-09-25 15:17:27 -08:00
Hayden
39adea4ee3
feat (WIP): bring png OCR scanning support (#1670)
* Add pytesseract

* Add simple ocr endpoint

replace extension argument

* feat/ocr-editor gui

* fix frontend linting issues

* Add service unit tests

* Add split text modes & single ingredient/instruction editing

* make split mode really reactive

* Remove default step and ingredient

* make the linter haappy

* Accept only image uploads

* Add automatic recipe title suggestion

* Correct regex

* fix incorrect array.map method usage

* make the linter happy again

* Swap route to use asset name

* Rearange buttons

* fix test data

* feat: Allow making image the recipe image

* Add translation

* Make the linter happy

* Restrict function setPropertyValueByPath generic

* Restrict template literal type

* Add a more friendly icon to creation page

* update poetry lock file

* Correct sloppy ocr classes

* Make MyPy happy

* Rewrite safer tests

* Add tesseract to backend test CI container dependencies

* Make canvas element a component global

* Remove unwanted spaces in selected text

* Add way to know if recipe was created with ocr

* Access to ocr-editor for ocr recipes

* Update Alembic revision

* Make the frontend build

* Fix scrolling offset bug

* Allow creation of recipes with custom settings

* Fix rebasing mistakes

* Add format_tsv_output test

* Exclude the tests data directory only

* Enforce camelCase for frontend functions

* Remove import of unused component

* Fix type and class initialization

* Add multi-language support

* Highlight words in mount

* Fix image ratio bug

* Better ocr creation page

* Revert awkward feature to scroll in Selection mode

* Rebasing alembic migrations sux

* Remove obsolete getShared function

* Add function docstring

* Move down ocr creation option

* Make toolbar icons more generic

* Show help at the bottom of the page

* move ocr types to own file

* Use template ref for the canvas

* Use i18n.tc to get strings directly

* Correct naming mistake

* Move Ocr editor to own directory

* Create Ocr Editor parts

* Safeguard recipe properties access

* Add loading frontend animation due to longer request time

* minor cleanup chores

Co-authored-by: Miroito <alban.vachette@gmail.com>
2022-09-25 15:00:45 -08:00
Philipp Fischbeck
1c938cb835
fix: set meta description and image for shared recipes (#1635) 2022-09-10 09:29:21 -08:00
Michael Genson
2007bcfe28
feat: added "cookbook" filter to recipe pagination to serve frontend (#1609)
* added cookbook filter to recipe pagination

* fixed wrong filter var

* restored cookbook sorting

* reverted unnecessary var change
2022-09-10 08:59:30 -08:00
Hayden
18b2c92a76
feat: public recipe access (#1610)
* initial public explorer API endpoint

* public API endpoint

* cleanup recipe page

* wip: init explorer page

* use public URLs for shared recipes

* refactor private share tokens to use shared page
2022-08-28 20:08:33 -08:00
Hayden
4a0fb56d18
fix: unsafe window access on recipe assets (#1613)
resolves 500 error on new recipes page
2022-08-28 13:54:32 -08:00
Hayden
caa9e03050
refactor: recipe-page (#1587)
Refactor recipe page to use break up the component and make it more usable across different pages. I've left the old route in as well in case there is some functional breaks, I plan to remove it before the official release once we've tested the new editor some more in production. For now there will just have to be some duplicate components and pages around.
2022-08-27 10:44:58 -08:00
Michael Genson
a8da1a7594
fix: removed sort menu from pages that don't support it (#1606) 2022-08-26 18:50:24 -08:00
Michael Genson
aaeb162dd5
feat: unify recipe card sections (#1560)
* removed unused import

* moved categories/tags to new recipe card section

* nuked old frontend sort code
minor refactoring

* bug fixes

* added backend recipes filter for tools

* removed debug log

* removed unusued props

* fixed sort for recipes by tool

* added tests for getting recipes by tool
2022-08-20 10:59:49 -08:00
Michael Genson
f231109194
fix: print view for recipes with multiple ingredient sections (#1580)
* fix for recipes with multiple ingredient sections

* removed unused key
2022-08-19 23:01:55 -08:00
Michael Genson
f4278737fb
ui: changed ingredient auto grid to be more natural (#1578) 2022-08-19 11:42:06 -08:00
Hayden
7adcc86d03
feat: bulk recipe settings update (#1557)
* extract switches from menu component

* implement bulk updater for settings

* fix browser cache api calls issue

* add frontend for bulk settings modifications
2022-08-14 10:37:44 -08:00
Michael Genson
5cfff75dbe
moved header out of "cook mode" conditional block (#1556) 2022-08-14 08:04:09 -08:00
Michael Genson
238f555f5e
fix: general bug fixes (#1547)
* grouped "instructions" header with first section

* fixed sort by last updated date

* somewhat-hacky bugfix for large screens

* modified page size to be divisible by 4

* fixed missing export for new data forms
2022-08-13 21:44:11 -08:00
Hayden
54c4f19a5c
security: enforce min length for user password (#1555)
* fix typing on auth context

* extract user password strength meter

* fix broken useToggle method

* extend form to accept arguments for validators

* enforce password length on update

* fix user password change form
2022-08-13 21:38:26 -08:00