Giter Club home page Giter Club logo

matthewnobes / recipe-book Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 5.56 MB

This is the frontend web app for the recipe book system. It consists of a JS React web app that uses a supabase database underneath to manage the backend, including storage and authentication.

Home Page: https://recipe-book-blond-three.vercel.app

License: Apache License 2.0

HTML 0.72% CSS 0.16% JavaScript 97.74% Dockerfile 0.28% PLpgSQL 1.10%
js recipes recipes-app react reactjs javascript web webapp webapplication api

recipe-book's Introduction

Recipe App

CI Build CI CodeQL CI Docker Image CI ESLint

This is the frontend web app for the recipe book system. It consists of a JS React web app that uses a supabase database underneath to manage the backend, including storage and authentication.

It was originally built from a create-react-app template that has grown and changed significantly.

Development

To get started with this component. Open a new terminal for Recipe App. The type the following command to install the necessary dependencies

pnpm install

The next step is to configure the environment variables. Make a new file in the root of the component called .env. This is where the connection parameters for supabase will be kept. See the example .env file below:

REACT_APP_SUPABASE_URL = "<url goes here>"
REACT_APP_SUPABASE_KEY="<key goes here>"

Once this is configured, start up the app using the command:

pnpm start

Local Supabase

Supabase has been setup for this project to work locally using the supabase command line interface. As prerequisites to this, you will need Docker and the Supabase CLI installed.

With Supabase CLI installed, you need to link the local instance to the repo, you can do this by running the following command with the project reference in place.

supabase link --project-ref project-id

After the project is linked, you need to pull down the changes from the remote database using the following command:

supabase db pull

The local version of supabase can then be launched using the command supabase start. This will use Docker to create localised versions of everything supabase has to offer, include the database, authentication and edge functions.

When making changes, its advised to make database changes in the Studio UI, which is typically hosted locally on: http://localhost:54323

Once changes have been made to the schema, run the command below to create a new .sql file showing the new changes to the schema. Insert a name when running the command to identify the changes that have taken place.

supabase db diff -f insert-name

This change migration file can be pushed to the remote hosted database using the following command:

supabase db push

Testing

Jest is being used for unit testing on this component. You can run these tests using the following command:

pnpm test

Linting

ESLint has been setup with this project, you can view the ESLint configuration in the .eslintrc.js file. If you wish to check the linting for this component use the following command:

pnpm run lint

Deployment

This component is setup with a Dockerfile. An image of this app can be created using the docker build command as seen below. (insert-name marks where you can set the Docker image name, the -t flag allows this name tag to be allocated)

docker build . -t insert-name

To load this Docker image into a container, the docker run command is used as follows with the name selected for the image in the previous step in place for insert-name.

docker run -p 3000:3000 -d insert-name

NOTE: The Dockerfile has been configured to run on port 3000. The app can be run on another port by replacing the first 3000 in the command above with your own choice of port.

recipe-book's People

Contributors

dependabot[bot] avatar matthewnobes avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

recipe-book's Issues

Fix ingredient display

The ingredient display doesn't look right, some items should have a space between the quantity and the unit, while others should not.

Find a way to resolve this.

Set up as progressive web app

Make the necessary changes to ensure this app can be used as a progressive web app, enabling a user to install it onto their device from the browser.

Add delete recipe

Add a system for deleting a single recipe, it should be available from the menu on the top right of the recipe. There should be a warning message before deleting and a toast notification to confirm.

View recipe page

A view recipe page should load when the user selects a recipe. The page should be passed the ID of the recipe selected and make a call to the database requesting all the data relevant to that recipe.

View created date

Add a section at the bottom of the recipe view page that allows a user to see when a recipe was created.

Set up server

Set up the express API server that will be used to provide communication between the database and the web app.

A simple test request to pull all the recipes from the recipe table should be part of this.

Reccomend a recipe

Make an experience that will ask users a series of questions about what they might like to eat, and then using the results it will recommend a recipe for them.

Add a tag system

Add a tag system which will allow key words or tags to be attached to a recipe. These will later be used for searching and reccomendation alogirthems.

It will require a tag table, with the columns key word ID, key word and recipe ID, linked to the recipe. As a result a new route on the API will be needed for adding key words. Tags can be multiple words, but will be capped at 30 cahracters.

Replace favourites with caegories

Replace the favorites page with a categories page, the favorites page should move into settings under the account section as a sublink.

The categories page should have large picture buttons for each of the categories with the text laid over the top, upon clicking on it should open a page showing:

  • At the top 4 picture recipes picked from random, titled recommended (2 by 2 grid)
  • A list (same as the browse page) showing all the recipes in that category

Mark ingredients as optional

Enable ingredients to be marked as optional, which will then be seen as a chip in the ingredients list. This will require changes to the database and API to accommodate the feature

Add country chip

Add a chip to the country page, when clicked it will open a browser recipes page, showing recipes from the selected country. The title of the page should show the country.

Expand database

Add the following columns to the recipe database:

  • recipe country ID (including a new table for countries) can be null (examples - British, French)
  • recipe region ID (including a new table for regions) can be null (examples - Mediterranean, Asian)
  • recipe category (including a new table for categories) can be null (examples - deserts, breakfast, baking, bread)
  • recommended accompaniment (links back to the recipe id for another recipe)

Browse list item chopped off

The bottom item on the browse recipes list gets cut off and is hidden behind the nav menu. This should be fixed, possibly by a page component that can be called for any page to prevent the issue in the future.

Screenshot 2023-05-31 at 11 14 42

Set up SQLite db

An SQLite database is needed, full details will be provided soon.

Release 1 prep

The following activities need to be done ahead of release one:

  • re-versioning the package
  • package updates
  • check unit tests
  • refactor any inefficient code
  • set up table switch when in dev and prod
  • check manifest for missing properties
  • removal of redundant code (old console.log's etc.)

Create fav system

Create a system that will allow a user to add items to their favorites, the heart icon next to a recipe reflecting if it is in their favorites or not.

There should be an option under the settings page to open the favorites page, this page should show a list of the favorite recipes.

It should also make sure that the favorites heart icon button is not visible unless the user is logged in

Create Apperance page

As a user, I wish to be able to modify parts of the application's appearance, such as changing the text size and switching between light and dark mode.

Create add new recipe page

Create a form for creating a new recipe. This page will need space for:

  • recipe name
  • description
  • preparation time
  • cook time
  • personal difficulty
  • A list block for adding the instructions in, items in here should have a number, instruction and an X button on the end to delete it
    • Instructions should be drag and dropable
  • A similar list block for ingredients, with the following options
    • x remove button on the right-hand side
    • textbox for the ingredient name
    • number box for quantity (e.g. 1)
    • autocomplete box for measurement type (e.g. teaspoon, g, kg, etc.)

Options

All this content will only be sent to the database once the user has hit the save button.
An add to my favourites button should also be available. Upon completion, it will load up the recipe page with this recipe loaded into it (yet to be created).
A clear button will also be present to clear the form of all information (reload it)
A cancel button should also be present to cancel the addition of a new recipe.

Changes

The form is being remade to fit into a stepped approach. It also not allow the user to:

  • add new countries
  • add new categories
  • add new regions

They will be able to add new ingredients still

Make home page recipes random

The recipes on the home screen should be chosen at random from all the recipes in the recipes table.

It may also be worth looking at how the gallery scales on larger screens.

Add settings page

Add a settings page, replacing my account. It should have a list of pages (not setup yet), containing the following pages:

  • my account
  • accessibility
  • admin options (eventually will be visible to only admin users)

Create the login system

Create the login system. This will require an authentication system (username and password), it will also be used for authentication with the API (permissions system).

Users will be prompted to authenticate before accessing their account, adding or editing recipes.

Cap the browse page

The browse page should be capped at a reasonable number of recipes, this will prevent issues when the database gets larger. When the user gets to the end of the list, it should either have a button to load more or automatically load some more.

Recipe notes

Add a system for adding notes about a recipe. A recipe should be able to have multiple notes, ideally stored as an array in the table, for simplicity of retrieval.

This will require a new form section where notes can be added for notes. Notes should be optional.

A new section under the method should be in place for notes, they should be displayed in a MUI list

Add a toast notification system

Add a toast notification system that is declared at the high app level that can be called at any point in the app by resetting the redux state for it to be true, passing it a new message and colour property.

Create admin activities

As an admin, I wish to be able to add, edit and delete countries, categories and regions. I should be unable to delete ones that are in use by active recipes.

App icon

An app icon needs to be created to reflect the apps purpose. This should then be made to be scaled for a wide range of devices.

Fill units from db

The units combobox on the add ingredients model needs to be updated to pull values from the database rather than using manually fed values.

Add vegan/vegetarian

Add a column in the DB for vegetarian/vegan, this can be one of three different options:

  • null: not vegetarian or vegan
  • vegetarian
  • vegan

Create about page

Create the about page to inform users about this project, provide a link to the repository and a link to the API swagger for the current instance.

Dockerise

The application and express server need to be packaged up into a docker image or two.

If packaging separately, the react app needs to be able to receive the port of the API or standard ports need to be agreed. The IP will also need to be set for whatever server it is running on.

This issue required testing on the deployment server before closing.

Generate CI pipeline

Generate a CI pipeline for running the unit tests. There should also be an ESLint workflow and a CodeQL one too. This may also involve mocking up the API and rewriting some tests, so tests can be executed without the API running.

Test warnings

All tests are passing but some warnings have been raised, these should be resolved.

Fix broken appearance menu

The appearance menu is broken, when you apply settings it causes the page to lag and the setting is not applied. This needs to be fixed.

Add optional back button to header

Add a back button on the left of the header, this will be enabled for when on pages that are when on pages that are spun off from the main pages, like some of the settings pages.

Experiment with the text placement at the same time, it may look better with the text centred.

Add recipe search

Add a recipe search on the browse recipe page. Users will be able to search by name, description, keyword or ingredient.

It will use a debouncer and could in future be open to autofill using AI.

Make picture gallery for home page

Make a picture gallery for the home page that cycles through 5 images, with (imaginary linked recipes). This is a starter for the home page that will be built on more in the future.

Add filtering

Add a system to allow the browse recipe list to be filtered. The following filter options should be available:

  • country
  • difficulty
  • total time

More options may be added in the future

Setup recipe card list

Set up the recipe card list component properly that is fed an array of recipe ID's and requests each recipe from the table.

Calls to the database will need to be made for

  • getting all recipe ID's (/api/recipe/all) - a view should be made in the database to simplify this
  • getting a recipes details from its ID (/api/recipe/:recipeID)

Add a can be frozen badge

Add a can be frozen badge, this will let you know if cooked portions can be frozen and if so for how long. It will require additional database and API work.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.