- Introduction
- Features
- Technologies Used
- Directory Structure
- Getting Started
- Usage
- Building For Production
- Docker
The Staking Rewards Frontend is a web-based application that allows users to create and manage spreadsheets. It provides functionality similar to popular spreadsheet software, such as creating cells, entering formulas, and performing calculations.
- Create, edit, and delete cells in a grid-based spreadsheet.
- Support for mathematical calculations using formulas.
- Automatic recalculation of dependent cells when a value changes.
- Save and load spreadsheet data.
- Auto-save functionality to persist changes periodically.
- Error handling for invalid formulas and circular dependencies.
- React: A JavaScript library for building user interfaces.
- Vite A build tool that provides faster and leaner development experience
- TypeScript: A typed superset of JavaScript that compiles to plain JavaScript.
- Math.js: A library for mathematical calculations and expressions.
- Axios: A promise-based HTTP client for making API requests.
- React Router: A library for routing and navigation in React applications.
- Tailwind CSS: A utility-first CSS framework for rapid UI development.
Here is an overview of the project's directory structure:
- src/ # Source code directory
- assets/ # Project assets
- components/ # Reusable components
- containers/ # Application pages
- libs/ # Library functions
- styles/ # Project styling files
- utils/ # Utility functions
- App.tsx # Main component
- main.tsx # Main entry point
- public/ # Static assets
- package.json # Project configuration
- README.md # Project documentation
Follow the instructions below to get a local copy of the project up and running on your machine.
- Node.js: Install Node.js from the official website.
-
Clone the repository:
git clone https://github.com/sstefdev/staking-rewards-task
-
Navigate to the project directory:
cd <project_directory>
-
Install project dependencies:
npm install
-
Start the development server:
npm run dev
-
Open your web browser and access the application at http://localhost:3000.
- Upon opening the application, you will see a grid-based spreadsheet interface.
- Click on any cell to edit its value. You can enter numbers, text, or formulas starting with the "=" sign.
- Formulas can include mathematical operations, cell references, and functions provided by the application.
- Changes are automatically saved periodically.
- The application will recalculate dependent cells whenever a referenced cell changes.
- Errors will be displayed if there are circular dependencies or invalid formulas.
-
To create a production-ready build of your application, run the following command:
npm run build
This command builds your application and generates optimized production assets in the dist directory.
-
You can preview the production build locally by running:
npm run preview
This command starts a server to serve the production build, allowing you to test and verify the build locally before deployment.
-
Linting: Run ESLint to analyze and enforce code quality:
npm run lint
-
Formatting: Run Prettier to format your code according to the defined rules:
npm run prettier
This repository includes a Dockerfile that can be used to containerize the application for deployment. The Dockerfile sets up the build environment, installs the application dependencies, builds the application, and creates a lightweight production image using serve to serve the static files.
To use the Dockerfile, follow these steps:
-
Build the Docker image by running the following command in the terminal:
docker build -t staking-rewards-task .
-
Once the image is built, you can run a container from it using the following command:
docker run -d -p 3000:3000 staking-rewards-task
The application will be accessible at http://localhost:3000 within your Docker environment.
Note: Ensure that you have Docker installed and running on your machine before running the above commands.