GithubHelp home page GithubHelp logo

lietsaki / paperchat Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 1.52 MB

An online Pictochat spiritual successor - Draw and chat in real time!

License: GNU Affero General Public License v3.0

TypeScript 76.47% JavaScript 0.40% SCSS 22.66% Java 0.47%
nextjs react canvas typescript

paperchat's Introduction

Paperchat - Intro

Paperchat is an online, real-time spiritual successor of Pictochat, an app that was included with the Nintendo DS released for the first time in 2004.

I created a fully responsive version from scratch using React (Next.js), without help from any external libraries to interact with the canvas. Please check it out on paperchat.net :)

Component Highlights

The repository you see right now contains about 70% of the code needed to run your own instance. Specifically, what's included is the frontend logic and components. Here are my personal highlights:

  • Canvas.tsx: The canvas itself. Crops your messages before sending them so they take as little space as possible. This gif illustrates it very well:

    As you can see, there are 4 possible variations:

    • Everything is next to the username rectangle.
    • The highest point of your drawing is next to the username rectangle.
    • The highest point of your drawing is below and under the username rectangle (to the left).
    • The highest point of your drawing is outside the username rectangle, but below it (to the right).
  • ContentIndicator.tsx: The bars stacked on top of each other in the left side of the top screen.

    They follow the messages that are currently shown on-screen thanks to an Intersection Observer. When it is overflown, the top or bottom of it becomes smaller to indicate in which direction there are more messages.

Creating my own instance

The backend pieces that allow creating rooms and sending messages were created with Firebase. I used these products to bring Paperchat into life:

  • Realtime Database.
  • Storage.
  • Hosting.
  • Functions (the /functions directory is in fact included here!)
  • Authentication (anonymous)

The directory that contains the data related to such products is /firebase-config and it has only 3 files:

  1. init.ts: Initializes the Firebase App.
  2. realtimeDB.ts: Contains functions to interact with the realtime database.
  3. storage.ts: Contains one function that uploads pictures to the app's Storage bucket.

By leaving out this directory from the repository I'm allowing you to create your own backend with the technology you prefer, say for example Node.js + Socket.io.

But if you wanted to use Firebase as well, I can provide you with the names of the variables exported from these files.

// init.ts
One default export that simply initializes the app.

// realtimeDB.ts
export {
USERS_LIMIT,
SIMULTANEOUS_ROOMS_LIMIT,
PRIVATE_CODE_LENGTH,
DAILY_ROOMS_LIMIT,
createRoom,
joinRoom,
sendMessageToRoom,
getRoomMessages,
searchForRooms,
requestJoinPrivateRoom,
leaveRoom,
getCurrentRoomData,
getCurrentUserID,
listenForDisconnectAndMessages,
updateRoomMessages
}

// storage.ts
export { uploadAndGetUrl }

Bug reporting

Please feel free to open an issue if you think you've found a bug, provide least the following information:

  • Description of the problem.
  • Platform (desktop browser, mobile browser, android app)
  • If related to styles breaking or similar, dimensions of the screen where this happens.
  • A screenshot, if possible.

Contributions

If you have expanded or improved the functionality of Paperchat, please feel free to submit a pull request explaining how your changes make the application better :)

paperchat's People

Contributors

lietsaki avatar

Stargazers

WLHQ avatar Hayley Jolliffe avatar  avatar bree avatar

Watchers

 avatar

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.