Code Monkey home page Code Monkey logo

meals's Introduction

Meals

A meals manager built with Next.js and Tailwind CSS.

Getting started

Prerequisites

  • Node.js 10 or later
  • MacOS, Windows (including WSL), and Linux are supported

Installation

  1. Clone the repo
git clone https://github.com/maelquerre/meals
  1. Install dependencies
npm install

Development

Start Next.js in development mode:

npm run dev

This starts a development server on http://localhost:3000.

Production

Build the application for production usage:

npm run build

Static HTML Export

Build and export the app to static HTML, which can be run standalone without the need of a Node.js server:

npm run export

A static version of the app will be built in the out directory.

Usage

On the homepage, add the food groups you already ate for different meals in the different days. Click on the 'Generate meals' button to generate the recommendations. You can choose to not enter any meal before generating the recommendations, it will just generate all the meals for you.

On the settings page (cogwheel button in the top bar), you can set some preferences for the meals that will be generated:

  • How much you eat: for setting the minimum or maximum portions you'll want to have.
  • What you eat and when: for setting your eating habits for the different meals.

Stylesheets

The styles are written in PostCSS to improve development efficiency.

Project structure

meals/
  components/ # JSX components
  data/       # Simple js data
  model/      # The Meal class
  pages/      # The pages of the app
    api/      # The API of the app
  public/     # Public assets
  styles/     # App styles
  views/      # Main views of the app
  utils.js    # Javascript utility functions

Data

Intakes

The intakes are an array of intake objects. Each intake object is defined with a specific day, meal, foodGroup ID and portions.

Example
intakes: [
  {
    day: 'monday',
    meal: 'breakfast',
    foodGroupId: 1,
    portions: 1
  }
]

Portions preferences (recommendations)

Portions preferences are quantities of food groups that are preferred to be eaten within a day or a week.

The Project's API gives recommendations as default portions preferences, based on PNNS.

Recommendations

recommendations: [
    {
      foodGroupId: 1,
      min: 5,
      period: 'day'
    },
    {
      foodGroupId: 2,
      min: 2,
      period: 'week'
    },
    {
      foodGroupId: 3,
      min: 1,
      period: 'day'
    },
    {
      foodGroupId: 4,
      max: 1,
      period: 'week'
    },
    {
      foodGroupId: 5,
      max: 1,
      period: 'week'
    },
    {
      foodGroupId: 6,
      min: 1,
      max: 2,
      period: 'day'
    },
    {
      foodGroupId: 7,
      max: 5,
      period: 'week'
    },
    {
      foodGroupId: 8,
      max: 2,
      period: 'week'
    },
    {
      foodGroupId: 9,
      min: 2,
      period: 'day'
    }
  ]

Included preferences

Included preferences are food groups that are preferred to eat at specific meals.

Example
includedPreferences: [
  {
    meal: 'breakfast',
    foodGroupId: 1
  },
  {
    meal: 'lunch',
    foodGroupId: 7
  }
]

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.