Git Product home page Git Product logo

drawly's Introduction

drawly

Deploy with Vercel

Improve your drawing by practicing your skill daily with the help of drawly!

NextJS

This is a Next.js project bootstrapped with create-next-app.

Getting Started

First, run the development server:

npm run dev
# or
yarn dev

Open http://localhost:3000 with your browser to see the result.

Env file

Copy the provided example environment file

cp .env.example .env

Variables

  • PEXELS_API_KEY is used for loading images
  • UPSTASH_REDIS_* is used for caching purposes
  • SUPABASE_* is used as database

Image Providers

With extensibility in mind, there should be the possibility to include multiple sources where the images are loaded from.

Currently included

Pexels

Images provided by Pexels

Caching

Upstash Redis

To avoid requesting the pexels api too much we are caching the selected categories for a day.

Database

Supabase

Supabase is used as a primary datastore.

Misc

Resources

drawly's People

Contributors

valefant avatar

Stargazers

 avatar

Watchers

 avatar

drawly's Issues

Support drawing with mouse

Add a new option before starting a drawing session where the user will be able to draw with the mouse.

This will result in displaying the canvas and the reference side by side.

The canvas should not be really that fancy. It would suffice having a black pen and an eraser functionality.

Questions

  • Which library do we use or should we implement a basic canvas functionality ourselves?

Recently drawn categories

Before entering a category show the recently drawn categories by other users.

When a drawing session is started the selected category should be stored in a database.

Tasks

  • Create table recent_categories
  • Show recently drawn categories when the search input is empty, otherwise show the suggested categories
  • By starting a drawing session, save the selected category in recent_categories

Animation for the pause button

The play icon should transition to the pause button and vice versa.

Implementation Note

The following CodePen can be used as a starting point.

Questions

  • If the icons are displayed via clip-path then they need to be rounded a bit to match our current design. Maybe we could achieve the rounding effect with an svg filter?

Reference implementation

Check animation when pausing or playing a video on Youtube

Add button for random selection of settings

We should add a button on the title screen which randomly selects a category, the number of images to draw and the timer duration.

Note

The drawing session is not started automatically. The button should only randomly configure those values.

Image mirroring and rotation

Aside from the image filters #3 we want to add a mirroring and rotating functionality.
This should help the user during a drawing session to exercise to his liking.

Add query parameter to link to a specific image within a drawing session

When visiting e.g. http://localhost:3000/draw/cat we would always be starting at the first image.
If I would want to link to a different image I would need an indicator inside the link to determine the offset from the starting point.

Solution

We solve this by adding a query parameter named image which represents the offset from the starting point.

Example

http://localhost:3000/draw/cat?image=5 would show the fifth image in the cat category.

Conditions

  • image=1 should represent the first image
  • Given: images in drawing sesion n and the query parameter value x. Then the following invariant should hold x <= n

Pause timer when tab is inactive

When switching tabs the timer should pause automatically.

If the timer is paused by the user and the tab is switched then the timer should stay paused after the tab is active again.

Add drawing by memory mode

It would be cool if the user could choose between two different drawing modes.

One mode is the default one which we currently have implemented.

The other mode would be drawing by memory (which can be a much harder challenge).

Sequence

  1. The user configures his settings and starts a drawing by memory session
  2. A memory timer of 10 seconds* starts
  3. After the memory timer expires, we hide the image and the usual drawing timer kicks in
  4. After the drawing timer expires we advance to the next image as usual and repeat step 2

*10 seconds is the default configuration for the memory timer, we can think about changing it in the future

Drawing session should be configurable

Currently when starting a drawing session, we default to a 1 minute timer for each image and showing 10 images in total.

To make things more configurable, we should introduce options to select from, before starting a drawing session.

Tasks

  • Add multiple options
    • to the timer duration (Options: {1, 3, 5} Minutes)
    • for selecting how many images to show (Options: {5, 10, 15})

Play a sound when a timer expires

It would be nice to indicate to the user that the timer expired. By doing so he won't lose time when starting to draw the next image.

Show version number in app

Dynamically read the version property from the package.json file and display in the app.

Design Note

The text should be small and slightly noticeable by making lowering the opacity and placing it in the right corner

Add image filters to change the drawing experience

Image filters should provide the function to challenge the drawing experience of the users by making it easier or harder. For example we could change the image showing only the outlines or coloring it in grayscale thus removing to pay attention to colors.

Implementation Note

We will make use of the following library to provide image filters
https://github.com/ahaoboy/lena-ts (TS fork of the original JS version)

Original Project
https://github.com/davidsonfellipe/lena.js/

Showcase
https://www.fellipe.com/demos/lena-js/

The first filters to implement are: Laplacian, Grayscale, Thresholding

There is no need for multiple filters being active at the same time.

Add i18n

For now we will support: English, German and Italian (sry I don't know any more languages than that ๐Ÿ˜“)

Implementation Note

For the client side localization we will use the following library
https://github.com/ivanhofer/typesafe-i18n (Typesafety ftw! ๐Ÿ˜Ž )

For the flags we will use the following svg files
https://github.com/lipis/flag-icons/tree/main/flags/1x1

Save the selected locale in locale storage. If none is available, set English as default language

General Note

Link the flag providing repository in our README.md under the Resources section

Cache pexels api response

Cache the api response once a drawing session for a category was started.
This will avoid hitting the pexels api too much.

Implementation Note

The cached entries should have a ttl of 24 hours.

Image zooming

Depending on the image it can be hard to recognize each detail. The zooming functionality of desktop and mobile browsers works as a general solution, but fails when wanting to examine only a specific part of the image.

Task

  • When clicking on the image the image should be enlarged at the mouse position

Implementation Note

The library to use (a library which is not too old and does seem to work)
https://github.com/laurenashpole/react-inner-image-zoom

Start a drawing session without setting a category first

To spice things up a little, we should include a button next to the select component on the main page, where an user can start a drawing session without specifying a category first. This should result in presenting randomly selected images to the user.

By making use of the curated endpoint provided by Pexels this task will be rather small. This endpoint will not really provide randomized images but can act as a starting point, as the results of this endpoint will change over time.

Excerpt from the doc

 We add at least one new photo per hour to our curated list so that you always get a changing selection of trending photos. 

Providing real randomization is then a future task for itself (if this feature is really necessary or wanted).

Implementation Note

import { pexelsApi } from './server';

// use this method for implementing the issue
pexelsApi.photos.curated()

Add Dark Mode

Self explanatory. Everyone who opposes a dark mode is not welcomed here!

Just kidding ๐Ÿฅฒ

Tasks

  • Add dark mode with Tailwind
  • Make sure to take the users OS settings first and use them as a default value, when rendering our app. When the user overwrites the setting manually it should take precedence over the OS setting.
  • Provide a dark mode version of the tiled background image

Randomize image order

Currently we are fetching the images and displaying them in the order as we receive them.

To provide more variety we could randomize the order of the images before displaying them.

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.