Compare commits

...

5 Commits

Author SHA1 Message Date
e3fe5a1618 Merge pull request '[fixed] - changes password' (#25) from dev into main
Reviewed-on: #25
2024-12-20 14:30:54 +00:00
Swapnil Bendal
edcb4cd7b9 [fixed] - changes password 2024-12-20 20:00:13 +05:30
c72f3ece4e Merge pull request 'dev' (#24) from dev into main
Reviewed-on: #24
2024-12-20 12:26:22 +00:00
3217605a0f Update README.md 2024-12-20 10:24:31 +00:00
b4d28387fa Update README.md 2024-12-20 09:36:28 +00:00
2 changed files with 116 additions and 15 deletions

104
README.md
View File

@@ -1,10 +1,100 @@
# React + Vite
# **Tanami Capital**
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
**Tanami** is a cutting-edge fintech platform designed to streamline investment opportunities for users in the Gulf region. It features two main components:
Currently, two official plugins are available:
- **Admin Panel:** A web-based dashboard for managing users, monitoring transactions, and overseeing investments efficiently.
- **Mobile Application:** A user-friendly app that empowers individuals to invest in diverse asset classes, including real estate, private equity, and other financial instruments located in Gulf countries.
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
# rubix-admin-panel
# tanami-admin-panel
---
## **Key Features**
- **Regional Focus:** Exclusively operational in Gulf countries, offering investment opportunities tailored to the region.
- **Diverse Investment Options:** Enables users to invest in financial instruments like real estate and private equity with ease and transparency.
- **Comprehensive Admin Tools:** The admin panel offers robust tools for tracking and managing platform activity.
---
## **Current Status**
The project is **live and operational**, catering specifically to the investment needs of users in the Gulf region.
---
## **Table of Contents**
- [Installation](#installation)
- [Usage](#usage)
- [Environment Variables](#environment-variables)
- [Scripts](#scripts)
- [License](#license)
---
## **Installation**
### **Prerequisites**
- [Node.js](https://nodejs.org/) (version 14 or higher recommended)
- [npm](https://www.npmjs.com/) (bundled with Node.js)
### **Steps**
1. Clone the repository:
```bash
git clone http://git.wdipl.com/Siddhesh.More/tanami-admin-panel.git
```
2. Navigate to the project directory:
```bash
cd tanami-admin-panel
```
3. Install dependencies:
```bash
npm install
```
---
## **Usage**
### **Development Mode**
1. Start the development server:
```bash
npm run dev
```
2. Open your browser and navigate to:
```
http://localhost:5173/
```
### **Production Mode**
1. Install [PM2](https://pm2.keymetrics.io/) globally for process management:
```bash
npm install pm2 -g
```
2. Start the production server:
```bash
npm start
```
---
## **Environment Variables**
Create a `.env` file in the root directory based on the structure of [`.env.example`](.env.example).
---
## **Scripts**
| Script | Description |
|---------------------|-------------------------------------------------------------|
| `npm start` | Starts the app in production mode using PM2. |
| `npm run dev` | Starts the app in development mode with `nodemon`. |
| `npm run test` | Starts the app in test mode with `nodemon`. |
| `npm run lint` | Runs ESLint to check for code quality issues. |
| `npm run lint:fix` | Fixes fixable issues detected by ESLint. |
| `npm run prettier` | Checks code formatting using Prettier. |
| `npm run prettier:fix` | Formats code files according to Prettier rules. |
| `npm run prepare` | Prepares Husky for managing Git hooks. |
---
## **License**
This project is licensed under the [MIT License](LICENSE).

View File

@@ -16,14 +16,13 @@ import {
Stack,
useToast,
} from "@chakra-ui/react";
import * as yup from "yup";
import React, { useState, useContext } from "react";
import { useForm } from "react-hook-form";
import { yupResolver } from "@hookform/resolvers/yup";
import React, { useState } from "react";
import { useForm } from "react-hook-form";
import * as yup from "yup";
import CustomAlertDialog from "../Components/CustomAlertDialog";
import ToastBox from "../Components/ToastBox";
import { useUpdatePasswordMutation } from "../Services/change.password.service";
import { all } from "axios";
// Validation schema
const passwordSchema = yup.object().shape({
@@ -53,12 +52,18 @@ const ChangePassword = ({
actionId,
setActionId,
}) => {
const initialValue = {
oldPassword: "",
newPassword: "",
confirmNewPassword: "",
};
const [isLoading, setIsLoading] = useState(false);
const [alert, setAlert] = useState(false);
const [showCurrentPassword, setShowCurrentPassword] = useState(false);
const [showNewPassword, setShowNewPassword] = useState(false);
const [showConfirmPassword, setShowConfirmPassword] = useState(false);
const toast = useToast();
const [input, setInput] = useState(initialValue);
const [updatePassword] = useUpdatePasswordMutation();
@@ -74,10 +79,10 @@ const ChangePassword = ({
});
// Form submit handler
const onSubmit = async (data) => {
const onSubmit = async () => {
setIsLoading(true);
try {
const res = await updatePassword(data); // Assuming API request works as expected
const res = await updatePassword(input); // Assuming API request works as expected
if (res?.data?.statusCode === 200) {
toast({
render: () => <ToastBox message={res?.data?.message} />,
@@ -98,6 +103,11 @@ const ChangePassword = ({
}
};
const handleSubmitFrom = (data) => {
setAlert(true);
setInput(data);
};
// Handle modal close
const handleClose = () => {
setAlert(false);
@@ -211,7 +221,8 @@ const ChangePassword = ({
rounded={"sm"}
colorScheme="forestGreen"
size="sm"
onClick={() => setAlert(true)}
// onClick={() => setAlert(true)}
onClick={handleSubmit(handleSubmitFrom)}
isLoading={isLoading}
>
Save
@@ -223,7 +234,7 @@ const ChangePassword = ({
<CustomAlertDialog
isOpen={alert}
onClose={() => setAlert(false)}
alertHandler={handleSubmit(onSubmit)}
alertHandler={onSubmit}
message={"Are you sure you want to change the password?"}
isLoading={isLoading}
/>