Giter Club home page Giter Club logo

nextjs-kids-clothing-storage-web-app's Introduction

nextjs-kids-clothing-storage-web-app

Description

This web app is called "Neatify!" and was created with Next.js.

It has:

  • a start page
  • a register page
  • a login page
  • an account page, where the user account can be deleted
  • a see-you-soon page, after logout
  • a goodbye-page, after the account has been deleted
  • a dashboard, where storage units can be added
  • a page for each storage unit, where clothing items can be added
  • a search page, where clothing items can be searched across all storage items
  • a my-list page, where a list of clothing items can be created
  • a print-my-list page, which is a printable version of the my-list page including the current date and checkboxes next to each clothing item on the list.

Landing page

Landing Page

Dashboard

Empty dashboard

Dashboard with storage unit

Storage unit page

Empty storage unit

Storage unit with clothing items

Search page

Search with no results

Search with results

My List page My list page

My List page - printable version My list printable

This web app was built with the following technologies:

  • Next.js
  • Emotion/react
  • TypeScript
  • PostgresQL
  • Ley
  • Dotenv
  • dotenvcli
  • js-cookie
  • Next-cookies
  • cookie
  • Argon2
  • Csrf

Deployment

The web app has been deployed on Heroku.

Planning & Design

The database scheme was planned with SQLDBM as well as DB Fiddle.

SQLDBM

The project planned with GitHub Projects and Agantty (not in the picture).

GitHub Projects

The design of the website including layout, colors, fonts and icons was planned with Figma.

Figma Figma

Idea

Oftentimes, it is hard for parents to keep track of all the clothing their child*(ren)* have already grown out of, but should be kept for later reuse. Usually, these items are stored somewhere in basements, closets or storage rooms in big boxes and bags. After a certain time, the memory of what exactly is inside each of these becomes somewhat foggy and with two or even more children to take care of, it turns out to be far too time-consuming to rummage through all these boxes and bags in order just to find a pair of gloves or some t-shirts in a certain size. This may result in quickly popping into to the next store to buy even more clothes, because this seems the quickest - hence best - solution at this point in time.

My web app aims at helping parents to keep track of the clothes their children have grown out of and locate exactly what they need very quickly. Also, it can be used as a tool to help plan ahead the mandatory shopping of kids' clothes for the coming season, because it provides detailed information about which kinds of clothing in which size are held by the respective storage unit.

No waste of time, no waste of money!

Database Setup

Copy the .env.example file to a new file called .env (ignored from Git) and fill in the necessary information.

Follow the instructions from the PostgreSQL step in UpLeveled's System Setup Instructions.

Then, connect to the built-in postgres database as administrator in order to create the database:

Windows

If it asks for a password, use postgres.

psql -U postgres

macOS

psql postgres

Once you have connected, run the following to create the database:

CREATE DATABASE <database name>;
CREATE USER <user name> WITH ENCRYPTED PASSWORD '<user password>';
GRANT ALL PRIVILEGES ON DATABASE <database name> TO <user name>;

Then, to connect to the database using this new user, quit psql and reconnect:

\q
psql -U <user name> <database name>

Running the migrations

To set up the structure and the content of the database, run the migrations using Ley:

yarn migrate up

To reverse the last single migration, run:

yarn migrate down

Start application

  • 1st terminal: postgres (starts dbms)
  • 2nd terminal: psql -U <user name> <database name> (to work with database, enter new data etc.)
  • 3rd terminal: yarn dev (starts web app on localhost:3000)

nextjs-kids-clothing-storage-web-app's People

Contributors

hedi-far avatar

Watchers

 avatar

nextjs-kids-clothing-storage-web-app's Issues

Code Backend

  • Set up database with Postgres and Ley
  • users
  • sessions

  • start with TypeScript

Make authorization work

  • Registration (= Add user to db)
  • Login/Logout
  • Why is session still on computer even though not on db?

Header "logged in/out"

  • Start page
  • Register page -??? token conflict
  • Login page - no link when logged in
  • Dashboard
  • My account
  • Search
  • Storage item
  • My list
  • Goodbye
  • See you soon

Redirect to login page from pages:

  • dashboard (index)
  • account
  • my-list
  • search
  • storage-item

Other redirects:

  • Start page - no redirect necessary
  • Register page - no redirect necessary bc button will not displayed when logged in; when successufully registered, pushed to login!
  • Login page - no link when logged in bc logout; when successufully logged in, pushed to dashboard!
  • Goodbye - redirect to dashboard when logged in
  • See you soon - - redirect to dashboard when logged in

Set up database for storage/clothing items

  • storage items (think of ON DELETE CASCADE!)
  • type
  • insert types
  • sizes
  • insert sizes
  • seasons
  • insert seasons
  • gender
  • insert gender
  • colors
  • insert colors
  • clothing items - (think of ON DELETE CASCADE!)
  • add further options to color table: multicolor, patterned

  • Make dashboard page + storage-item page (-> frontend)
    https://nextjs.org/docs/routing/dynamic-routes (?)
  • “Delete user from db”
  • “Add storage item to db”
  • write extra functions for special cases (add without color/gender/season)- put them in extra file(?)
  • change join type so entire list is displayed
  • “Delete storage item from db”
  • “Add clothing item to db” -
  • What happens in database when sthg is added and field is empty?
  • “Delete clothing item in db" - check!!!

  • Form validation:
  • Register - check if username is already taken!
  • Login
  • Add storage item
  • Add clothing item
  • Error messages!!!
  • Make empty option field before every option!
  • What happens in select field when option is not required?

  • Prevent users from seeing other users storage items via [id]
  • Write error messages on pages (-> not necessary bc users are redirected to login pages)

  • Make my-list page (-> frontend)
  • “Add to my list”
  • Prevent double entries on list!
  • Make new query / junction table!
  • “Delete from list”
  • Delete cookie on logout

  • TypeScript Errors!!
    Migrations:
  • Insert into sizes
  • Insert into types
  • Insert into seasons
  • Insert gender
  • Insert colors
  • Insert add colors
    Index.ts, [id].ts, search.ts
  • user is possibly undefined
    search.ts
  • e is declared in upper scope
  • handleSearch is unused
    get-search-results.ts
  • Argument of type 'ClothingItemDetail' is not assignable to parameter of type 'never'.ts(2345)
  • clothing-item.notes is possibly undefined

  • “Edit storage item in db” (incl. save changes or dismss)
  • “Edit clothing item in db” (incl. save changes or dismss)
  • make possible to search in notes

  • API routes: return info / write error messages
  • API route validation - is user allowed to do this?!
    authentication of user sessions when doing sensitive database queries such as reading, creating, updating and deleting user data.
    Eg. If you have an API route that deletes something with a certain id, you should also be checking to make sure that the request.cookie.session matches a valid session that is allowed to access that data

  • check if arguments in functions are undefined & what happens if this is the case (redirect ...)

Search page:

  • code frontend (select fields and results)
  • write SQL query
  • check results list for double entries?!

Fix:

  • //condition 15: size, season are set - FIXME

  • //condition 12: type, season are set -FIXME

  • //condition 14: size, color are set - FIXME

  • //condition 11: type, color are set - FIXME

  • //condition 13: type, gender are set - FIXME

  • //condition 16: size, gender are set - FIXME

  • //condition 8: size, color, season are set - FIXME!!!

  • //condition 9: size, color, gender are set - FIXME!

  • fix display of filter terms!


BUGS:

  • Reset function / insertClothingItem
  • Remove ID number from search page!

Apply styles

Style components

  • basic layout for all pages
  • Headings, paragraphs
  • buttons
  • links
  • font sizes
  • colors:
    muzli color palette
  • Header
  • Footer
  • margin 128 px (Betty)????
  • Form
  • Storage item (some kind of interactive card that is repeated – maybe cklick on plus button)
  • List/table -> search results
  • Error messages!

Media queries

  • Tablet
  • Mobile
  • Printer

Visible form validation

  • Register
  • Login

Notes

Nice to have

Design

Design

Crucial

Part 1:

  • Make layout to apply via CSS - grid & content alignment

Prototype on Figma: https://www.figma.com/file/GcdMIySrnycWC5vC1oKrBj/Layout?node-id=0%3A1

Part 2:

Part 3

Feature planning

Crucial features

  • Users can create accounts.

  • Users can log in to these accounts/log out.

  • Logged-in users can provide and save information about:

  • What kind of clothes they possess incl. specific information such as size, season, colour.

  • Where exactly they are stored, such as “box nr. 1, bag nr. 2”.

  • Logged-in users can update and/or delete the information they have ever entered into the database.

  • Logged-in users can retrieve the information they have entered into the database:
    a complete list
    a filtered list

  • Logged-in users can search for specific items e.g.:
    A blue t-shirt in size 92
    A pair of winter-boots, sized 25
    The content of “box nr. 5”
    All t-shirts in size 92 in box nr. 2
    All summer clothing in size 92.

  • Logged-in users can add the search results to a list that can be displayed in the browser.

Necessary – what would the user expect?

  • Logged-in users can save the list as a PDF or print it out. (Stretch goal) - maybe this can be done via browser print function?
  • Users can their delete accounts.
  • Dismiss button for every form.

Nice to have?

  • Open printable version in new tab
  • List: make pink on hover
  • Display number of items in each storage unit!
  • Divy up the long list of clothing types into sub-categories (via different tables).
  • Links to social accounts in footer.
  • Welcome e-mail on registration.
  • Logged-in users can reset their password.
  • Logged-in users can order their data by their personal preference .
  • Logged-in users can edit personal information (e-mail, firstname, lastname)
  • Logged-in users can upload photos of the respective item.
  • Logged-in users can share the list they have put together via Mail/WhatsApp ...
  • Logged-in users are asked for confirmation before deleting their account/save any changes to their data.
  • Logged-in users are also able to administer kids' shoes (now difficult bc of different kinds of sizing).

Backend Planning

General

  • Plan database schema: Clothing Database, User administration ...
  • CASCADE on delete?!
  • Think of data structures - What is supposed to happen with the information? How is it supposed to be processed?
  • Plan SQL queries!!!

SQL queries:

Database schema:

image

User administration

  • Seperate table for users
  • Seperate table for sessions
  • Users have possibility to delete their account.
  • What happens after they delete their account?
    • Get back to start page!
  • What happens in database when the users delete their account?
    • Cascade ...(?)

User Authentication

  • How can users login to the page?
  • How can they log out?
  • How is the session stored?
  • How is the session terminated?

Interaction with storage database

Create

  • How will users be able to get information INTO the database?
    They will enter the information via a form.
    • Which fields will the form have?
      This depends on database schema.
    • Will users be restricted to fixed terms (such as "shirt", "sweater", or will they be able to put in their own categories?)
    • Validate forms to prevent SQL injections?
  • How will data be stored inside database technically?
    • POST request?

Read

  • How will users be able to get information OUT of the database?

    Dashboard - Overview:

    • They will see all the data they have entered so far on their dashboard.
    • e.g. "Bag 1" - list: 1 shirt size 92, 2 pants size 93
    • Dropdown-kind of thing (- as in bog posts - "Read on")
    • Go to seperate page for each storage unit? - Probably not.
  • How will this information be sorted?

    • Will users be able to re-sort their information? -
    • Probably not. Just static list.

    Search function:

    • This should be a seperate page.
    • Users should be able to find items that have specific according to specific features,
      e.g. find all T-Shirts inside Box 1 that have size 92 (see also feature planning).
    • Can users enter their own search terms or are they restricted to given keywords (more like a filter
      function)?
    • How are the search results displayed?
    • How will it be possible to add them to a new dataset which will be then added to a final list?
    • Will it be possible to edit this list?

Update

  • Which ways to edit data?
  • Click on edit button next to specific item.

Delete

  • Delete dataset (e.g. entire box/bag - single item)

Stretch goal: GraphQL

  • Use GraphQL to send information between React and the backend.

Strech goal: Typescript

  • Write at least two pages and two components in Typescript.

Testing

Which features should be tested?

  • End-to-end

  • Unit tests

  • Test on different devices/browsers

  • IE

  • Mozzilla
    . [ ] Chrome

  • Opera

  • My mobile phone

  • Other mobile phones

  • Let other people test functionality

  • Test printing possibilities

Code Frontend

Basic coding done:

  • Start page - index.js
  • Register page - register.js
  • Login page - login.js
  • Dashboard - dashboard/dashboard.js
  • My account dashboard/account.js
  • Search - dashboard/search.js
  • Storage item - dashboard/storage-item.js
  • My list - dashboard/my-list.js
  • Goodbye - goodbye.js
  • See you soon - see-you-soon.js

  • Header - components/Header.js
  • Footer - components/Footer.js

Frontend Planning

Basic layout & Wireframing & UX

see attached document
20201030_154100

Prototype on Figma: http://figma.com/file/GcdMIySrnycWC5vC1oKrBj/Layout?node-id=0%3A1
User journey on Mindmeister: https://mm.tt/1673164279?t=UjqvMwXIcW

Which pages do I need?

  • Start page
  • Register page
  • Login page
  • Dashboard
  • My account
  • Search
  • Storage item
  • My list
  • Goodbye
  • See you soon

Further details: https://1drv.ms/w/s!ApNpoFe28_AmgrNMgYcDtmllW1V_Ww?e=Jlo5dE

Which components do I need?

React components

  • Header

    • Header "not logged in"
    • Header "logged in"
  • Footer

  • https://jetpack.com/2018/08/22/website-footer-tips/

  • https://www.bowlerhat.co.uk/include-websites-footer

  • Dismiss (?) (vrgl. "Abbrechen")

  • “Add clothing item to db”

  • “Delete clothing item in db”

  • “Edit clothing item in db” (incl. save changes or dismss)

  • “Save storage item to db”

  • “Delete storage item from db”

  • “Edit storage item in db” (incl. save changes or dismss)

  • “Delete user from db”

  • "Logout user from session"

  • “Add to my list”

  • “Delete from list”

Style components

  • Header
  • Footer
  • Form
  • Storage item (some kind of interactive card that is repeated – maybe cklick on plus button)
  • Button (maybe big and also small for +, x)
  • List/table -> search results

UX

UX

  • Write nice texts and explanations!
  • Add dismiss buttons
  • Your list is empty.
  • Your storage item is emtpy.
  • You have no storage items!
  • Make links to storage items in results list.
  • Check text in open tab!
  • Empty form after submission. Give confirmation message.
  • Make lines in tables colorful on hover.
  • window.alert on mobile? > better: setErrorMessage?!
  • sort my-list (or let user sort themselves)?
  • redirect to goodbye from delete account
  • favicon

Forms and buttons:

  • Register
    • Message that registration worked!
  • Emtpy input fields after successful registration!
  • Message that username has already been taken
  • Search: No item/no notes have been found!
  • Search: No display of "entire list"
  • Display filter that is set at the moment of the search!
  • Fix issue with "notes" search!
  • Sort results (or let user sort themselves)?
  • Login - "Login failed"
  • Add storage item
  • Delete storage item
  • Add clothing item
  • Delete clothing item
  • Add to list
  • Delete from list

  • Add onesize to size table!
  • Remove socks from clothes table?

Tech stack planning

Project planning in general

  • GitHub Projects
  • Agantty

User Journey

  • Mindmeister

Coding in general:

Authentication:

Design:

Databse

API routes & SQL

Print/PDF-Function

Deployment

Testing:

Stretch goal: GraphQL

https://learn.upleveled.io/courses/btcmp-l-webfs-gen-0/modules/123-cheatsheet-graphql/

Strech goal: Typescript

https://learn.upleveled.io/courses/btcmp-l-webfs-gen-0/modules/125-cheatsheet-typescript-jsdoc/

Misc

  • Write CV & send to Antje!

  • LinkedIn profile

  • GitHub profile

  • Twitter account

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.