fix bug structure

This commit is contained in:
hamid zarghami
2025-08-26 22:35:06 +03:30
parent c69d4ea60b
commit 2bc32e9d08
18 changed files with 726 additions and 192 deletions
+643 -65
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -11,6 +11,7 @@
}, },
"dependencies": { "dependencies": {
"@headlessui/react": "^2.2.7", "@headlessui/react": "^2.2.7",
"@tailwindcss/vite": "^4.1.12",
"@tanstack/react-query": "^5.85.5", "@tanstack/react-query": "^5.85.5",
"axios": "^1.11.0", "axios": "^1.11.0",
"formik": "^2.4.6", "formik": "^2.4.6",
-6
View File
@@ -1,6 +0,0 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
+4 -3
View File
@@ -1,8 +1,9 @@
import { type FC, useEffect, useState } from 'react' import { type FC, useEffect, useState } from 'react'
import { BrowserRouter } from 'react-router-dom' import { BrowserRouter } from 'react-router-dom'
import 'swiper/swiper-bundle.css'; // import 'swiper/swiper-bundle.css';
import 'rc-rate/assets/index.css'; // import 'rc-rate/assets/index.css';
import "react-multi-date-picker/styles/layouts/mobile.css" // import "react-multi-date-picker/styles/layouts/mobile.css"
import './assets/fonts/irancell/style.css'
import i18next from 'i18next' import i18next from 'i18next'
import { I18nextProvider } from 'react-i18next' import { I18nextProvider } from 'react-i18next'
import { QueryCache, QueryClient, QueryClientProvider } from '@tanstack/react-query' import { QueryCache, QueryClient, QueryClientProvider } from '@tanstack/react-query'
Binary file not shown.
Binary file not shown.
Binary file not shown.
+18
View File
@@ -0,0 +1,18 @@
@font-face {
font-family: "irancell";
font-style: thin;
font-weight: 200;
src: url("./irancell-extralight.ttf");
}
@font-face {
font-family: "irancell";
font-style: normal;
font-weight: 300;
src: url("./irancell-light.ttf");
}
@font-face {
font-family: "irancell";
font-style: thin;
font-weight: 600;
src: url("./irancell-bold.ttf");
}
+1 -1
View File
@@ -2,7 +2,7 @@ import axios from "axios";
import { getToken } from "./func"; import { getToken } from "./func";
const axiosInstance = axios.create({ const axiosInstance = axios.create({
baseURL: import.meta.env.VITE_BASE_URL || "http://localhost:3000/api", baseURL: import.meta.env.VITE_BASE_URL,
}); });
axiosInstance.interceptors.response.use( axiosInstance.interceptors.response.use(
+6 -10
View File
@@ -7,32 +7,28 @@ export function NumberFormat(number: number): string {
return Intl.NumberFormat("fa-IR").format(number); return Intl.NumberFormat("fa-IR").format(number);
} }
const TOKEN_NAME = import.meta.env.VITE_TOKEN_NAME || "access_token";
const REFRESH_TOKEN_NAME =
import.meta.env.VITE_REFRESH_TOKEN_NAME || "refresh_token";
export const getToken = () => { export const getToken = () => {
return localStorage.getItem(TOKEN_NAME); return localStorage.getItem(import.meta.env.VITE_TOKEN_NAME);
}; };
export const getRefreshToken = () => { export const getRefreshToken = () => {
return localStorage.getItem(REFRESH_TOKEN_NAME); return localStorage.getItem(import.meta.env.VITE_REFRESH_TOKEN_NAME);
}; };
export const setToken = (token: string) => { export const setToken = (token: string) => {
localStorage.setItem(TOKEN_NAME, token); localStorage.setItem(import.meta.env.VITE_TOKEN_NAME, token);
}; };
export const setRefreshToken = (refreshToken: string) => { export const setRefreshToken = (refreshToken: string) => {
localStorage.setItem(REFRESH_TOKEN_NAME, refreshToken); localStorage.setItem(import.meta.env.VITE_REFRESH_TOKEN_NAME, refreshToken);
}; };
export const removeToken = () => { export const removeToken = () => {
localStorage.removeItem(TOKEN_NAME); localStorage.removeItem(import.meta.env.VITE_TOKEN_NAME);
}; };
export const removeRefreshToken = () => { export const removeRefreshToken = () => {
localStorage.removeItem(REFRESH_TOKEN_NAME); localStorage.removeItem(import.meta.env.VITE_REFRESH_TOKEN_NAME);
}; };
export const timeAgo = (date: string | Date): string => { export const timeAgo = (date: string | Date): string => {
+33 -66
View File
@@ -1,74 +1,41 @@
@tailwind base; @import "tailwindcss";
@tailwind components;
@tailwind utilities;
@import "react-toastify/dist/ReactToastify.css"; html {
direction: rtl;
:root {
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-weight: 400;
color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
}
a:hover {
color: #535bf2;
} }
body { body {
font-family: irancell;
margin: 0; margin: 0;
display: flex; padding: 0;
place-items: center; width: 100%;
min-width: 320px; direction: rtl;
min-height: 100vh; overflow-x: hidden !important;
background: #eceef6;
font-weight: 300;
overflow: hidden;
}
html,
body,
#root {
min-height: 100% !important;
height: 100%;
}
* {
outline: none;
}
input::placeholder,
textarea::placeholder {
color: #888888;
} }
h1 { @theme {
font-size: 3.2em; --color-primary: black;
line-height: 1.1; --color-secondary: #f4f5f9;
} --color-border: #d0d0d0;
--color-description: #888888;
button { --color-header: #c3c7dd;
border-radius: 8px; --color-success: #00ba4b;
border: 1px solid transparent; --width-sidebar: 300px;
padding: 0.6em 1.2em; --border-radius-2.5: 10px;
font-size: 1em;
font-weight: 500;
font-family: inherit;
background-color: #1a1a1a;
cursor: pointer;
transition: border-color 0.25s;
}
button:hover {
border-color: #646cff;
}
button:focus,
button:focus-visible {
outline: 4px auto -webkit-focus-ring-color;
}
@media (prefers-color-scheme: light) {
:root {
color: #213547;
background-color: #ffffff;
}
a:hover {
color: #747bff;
}
button {
background-color: #f9f9f9;
}
} }
+1 -1
View File
@@ -1,4 +1,4 @@
import { FC } from 'react' import { type FC } from 'react'
import LogoImage from '../../assets/images/logo.svg' import LogoImage from '../../assets/images/logo.svg'
import LogoSmallImage from '../../assets/images/logo-small.svg' import LogoSmallImage from '../../assets/images/logo-small.svg'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
+7 -7
View File
@@ -1,12 +1,12 @@
import axios from "../../../config/axios"; import axios from "../../../config/axios";
import { import {
CheckHasAccountPhoneType, type CheckHasAccountPhoneType,
CheckHasAccountType, type CheckHasAccountType,
LoginWithOtpType, type LoginWithOtpType,
LoginWithPasswordType, type LoginWithPasswordType,
OtpVerifyType, type OtpVerifyType,
RefreshTokenType, type RefreshTokenType,
RegisterType, type RegisterType,
} from "../types/AuthTypes"; } from "../types/AuthTypes";
export const loginWithPassword = async (params: LoginWithPasswordType) => { export const loginWithPassword = async (params: LoginWithPasswordType) => {
+1 -1
View File
@@ -1,5 +1,5 @@
import { create } from "zustand"; import { create } from "zustand";
import { AuthStoreType } from "../types/AuthTypes"; import { AuthStoreType } from "../../auth/types/AuthTypes";
export const useAuthStore = create<AuthStoreType>((set) => ({ export const useAuthStore = create<AuthStoreType>((set) => ({
phone: "", phone: "",
+4 -9
View File
@@ -1,14 +1,9 @@
import { type FC } from 'react' import React from 'react'
import { Route, Routes } from 'react-router-dom'
import Login from '../pages/auth/Login'
const AuthRouter: FC = () => { const Auth = () => {
return ( return (
<Routes> <div>Auth</div>
<Route path="/auth/login" element={<Login />} />
<Route path="/auth/*" element={<Login />} />
</Routes>
) )
} }
export default AuthRouter export default Auth
+2 -3
View File
@@ -1,7 +1,7 @@
import { type FC } from 'react' import { type FC } from 'react'
import SideBar from '../shared/SideBar' import SideBar from '../shared/SideBar'
import Header from '../shared/Header' import Header from '../shared/Header'
import { Routes, Route } from 'react-router-dom' import { Routes } from 'react-router-dom'
import Footer from '../shared/Footer' import Footer from '../shared/Footer'
import { clx } from '../helpers/utils' import { clx } from '../helpers/utils'
import { useSharedStore } from '../shared/store/sharedStore' import { useSharedStore } from '../shared/store/sharedStore'
@@ -23,8 +23,7 @@ const MainRouter: FC = () => {
)}> )}>
<div className='pb-20'> <div className='pb-20'>
<Routes> <Routes>
<Route path="/" element={<div className="p-8 text-center">خوش آمدید - صفحه اصلی</div>} />
<Route path="/dashboard" element={<div className="p-8 text-center">داشبورد</div>} />
</Routes> </Routes>
</div> </div>
</div> </div>
-16
View File
@@ -1,16 +0,0 @@
/** @type {import('tailwindcss').Config} */
export default {
content: [
"./index.html",
"./src/**/*.{js,ts,jsx,tsx}",
],
theme: {
extend: {
colors: {
primary: "#007bff",
secondary: "#6c757d",
}
},
},
plugins: [],
}
+5 -4
View File
@@ -1,7 +1,8 @@
import { defineConfig } from 'vite' import { defineConfig } from "vite";
import react from '@vitejs/plugin-react' import react from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite";
// https://vite.dev/config/ // https://vite.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [react()], plugins: [react(), tailwindcss()],
}) });