GithubHelp home page GithubHelp logo

offblocks-admin's Introduction

OffBlocks Admin Dashboard

Main CI Status

A dashboard to view a list of transactions and transaction details. APIs including sign up are mocked in /src/mocks. I chose to use react-query to handle data fetching / caching / retrying due to ease of use and the large amount of features it offers. Jotai atoms for global state such as auth information. Zod is used for type validation.

Testing Steps:

  • Sign up with email and password (this will be stored so you can login again with it)
  • View list of transactions and use pagination
  • Click transaction to see transaction detail modal
  • Light and dark themes provided

Mock data & apis live in src/mocks. Querying / endpoints are in src/api.

The API is built to be able to pull lists of transactions by accounts where ideally only the necessary fields to show them in a table are returned. Then, when a user clicks into the modal it can load the whole object. React-query makes it really easy to set how long the data is considered fresh for and so data that won't change can be cached for a long time.

Installation

  • Install nvm (Node version manager)
  • Install Node v20 and upgrade npm
    nvm install 20
    nvm use 20
    npm upgrade -g npm
  • Clone this repository
    git clone https://github.com/dwolfgram/offblocks-admin.git
  • Install project dependencies
    npm i
  • Edit the .env file

Usage

Start the app locally

npm start

Vite will run web server in the development mode at http://localhost:3000.

This project includes Mock Service Worker to mock API. It starts automatically and provides API for authentication and user functionality.

Building for Production

Build the app for production

npm run build

The app is then ready to be deployed from the /dist folder. See the Building for Production and Deploying a Static Site for more information.

Analysing & Visualizing production JS bundle

There are 2 different tools to analyze and visualize the production JS bundle:

  • source-map-explorer
    npm run analyze
  • rollup-plugin-visualizer
    npm run visualize

Testing

Launch the test runner in the interactive watch mode

npm run test

Vitest also provides a neat UI to view and interact with the tests. Open it by running npm run test:ui.

See Vitest docs for more information.

Prettier

This project uses Prettier, an opinionated code formatter, to ensure that the whole codebase conforms to a consistent style.

Prettier runs when:

  • developer manually executes npm run format command
  • in IDE on file-save if configured (VSCode, IntelliJ IDEA)
  • automatically on pre-commit hook, right before code is committed
  • during CI

ESLint

Project comes with ESLint configured. It helps us prevent common errors.

Code quality concerns, best practices, possible logical issues etc. are checked by ESLint. Our custom ESLint configuration .eslintrc.cjs includes these rules and plugins:

ESLint runs when:

  • developer manually executes npm run lint command
  • developer starts Vite dev server by npm start command
  • in IDE on background if supported (VSCode, IntelliJ IDEA)
  • automatically on pre-commit hook, right before code is committed
  • during continuous integration defined in .github/workflows/test.yml

i18n

Running npm run i18n will first parse the whole codebase to find all used i18n keys. Then it inserts missing keys into the JSON files and removes deprecated keys which are not used in the codebase anymore. The result will be an alphabetically sorted JSONs containing all the currently used i18n keys in the codebase.

CI/CD

This project is using GitHub's Actions to run integration tests on each PR and Main branch. It includes running eslint, prettier, tests and building the app. PR becomes mergable only if it passes. We also show badge on top of README.md to show Main branch status.

There is also a code-quality action to run Github's CodeQL analysis.

If you don't use GitHub you can remove the .github folder, otherwise follow these steps to configure your GitHub repository:

  1. Go to Settings -> Branches -> Add rule
    • Apply to your master branch
    • Require status checks to pass before merging
    • Select build checks being run in test.yml

What's Included

offblocks-admin's People

Watchers

Dan Wolfgram 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.