refactor project
This commit is contained in:
@@ -42,6 +42,7 @@ export const Table: FC<Props> = ({ columns, data, setSorting, sorting, tableStat
|
||||
<ComboBox placeholder="100" className="bg-auth-form" />
|
||||
</div>
|
||||
</div>
|
||||
{tableStatus && <div className="w-full flex justify-end items-end text-sm lg:text-lg text-primary-text-color font-normal -mb-7 pl-2">امتیاز من: {tableStatus}</div>}
|
||||
<div className="block max-w-full overflow-x-auto overflow-y-hidden bg-auth-form rounded-[40px] shadow-sm p-4 pb-0 xl:p-9 xl:pb-0 relative">
|
||||
<table>
|
||||
<thead className="border-b border-b-secondary-color">
|
||||
@@ -70,14 +71,13 @@ export const Table: FC<Props> = ({ columns, data, setSorting, sorting, tableStat
|
||||
))}
|
||||
</tbody>}
|
||||
</table>
|
||||
{isLoading ? <Loading /> : <>
|
||||
{isLoading ? <Loading /> :
|
||||
<div className="flex flex-row justify-center items-center border-t p-4 gap-x-3 mt-3">
|
||||
<ArrowRight2 color="#11212D" size={19} className="cursor-pointer" onClick={() => table.getCanNextPage() && table.nextPage()} />
|
||||
<p className="text-base font-normal text-primary-text-color">1-{table.getPageCount()}</p>
|
||||
<ArrowLeft2 color="#11212D" size={19} className="cursor-pointer" onClick={() => table.getCanPreviousPage() && table.previousPage()} />
|
||||
</div>
|
||||
{tableStatus && <div className="absolute text-sm bottom-1.5 lg:left-10 lg:top-5 lg:text-lg text-primary-text-color font-normal">امتیاز من: {tableStatus}</div>}
|
||||
</>}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -12,6 +12,6 @@ export const Score = () => {
|
||||
queryFn: getScoresList
|
||||
})
|
||||
return (
|
||||
<Table sorting={sorting} setSorting={setSorting} columns={scoresCol} data={data?.data?.data} tableStatus={data?.score} isLoading={isLoading} />
|
||||
<Table sorting={sorting} setSorting={setSorting} columns={scoresCol} data={data?.data?.data} tableStatus={data?.data?.score} isLoading={isLoading} />
|
||||
)
|
||||
}
|
||||
@@ -1,21 +1,7 @@
|
||||
import { ScoreResponse } from "../../types";
|
||||
import axiosInstance from "../axios";
|
||||
|
||||
export type ScoreData = {
|
||||
_id: string,
|
||||
deviceId: string,
|
||||
score: number,
|
||||
created_at: string,
|
||||
updated_at: string,
|
||||
__v: number,
|
||||
userId: string,
|
||||
id: string
|
||||
}
|
||||
|
||||
export interface ScoreResponse {
|
||||
data: ScoreData[] | []
|
||||
score: number,
|
||||
total: number
|
||||
}
|
||||
|
||||
export const getScoresList = () => axiosInstance.get<ScoreData, any>("/gps/score")
|
||||
export const getScoresList = () => axiosInstance.get<ScoreResponse, any>("/gps/score")
|
||||
|
||||
|
||||
@@ -1,30 +1,4 @@
|
||||
import { TransactionsResponse } from "../../types";
|
||||
import axiosInstance from "../axios";
|
||||
|
||||
export interface TransactionsResponse {
|
||||
data: TransactionsData[] | []
|
||||
}
|
||||
|
||||
export interface TransactionsData {
|
||||
_id: string,
|
||||
card: TransactionsCard
|
||||
userId: string,
|
||||
amount: number,
|
||||
dollarAmount: number,
|
||||
status: number,
|
||||
created_at: string,
|
||||
updated_at: string,
|
||||
__v: number,
|
||||
id: string
|
||||
}
|
||||
|
||||
export interface TransactionsCard {
|
||||
_id: string,
|
||||
holderName: string,
|
||||
PAN: number,
|
||||
IBAN: string,
|
||||
created_at: string,
|
||||
updated_at: string,
|
||||
id: string
|
||||
}
|
||||
|
||||
export const getTransactionsList = () => axiosInstance.get<TransactionsResponse>("/gps/withdraw")
|
||||
@@ -1,17 +1,5 @@
|
||||
import axiosInstance from "../axios";
|
||||
|
||||
export type OverviewUser = {
|
||||
walletBalance: number,
|
||||
dollarBalance: number,
|
||||
score: number,
|
||||
_id: string,
|
||||
id: string
|
||||
}
|
||||
|
||||
export interface OverviewResponse {
|
||||
pending: boolean,
|
||||
user: OverviewUser
|
||||
}
|
||||
import { OverviewResponse } from "./overview";
|
||||
|
||||
export const getWalletDetails = () => axiosInstance.get<OverviewResponse[] | OverviewResponse | [], any>("/gps/overview/wallet")
|
||||
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
import { create } from "zustand";
|
||||
|
||||
type UserType = {
|
||||
token: string | null
|
||||
}
|
||||
|
||||
const useUserStore = create<UserType>((set) => ({
|
||||
token: '',
|
||||
setToken: (token: string | null) => {
|
||||
set({ token: token });
|
||||
},
|
||||
}));
|
||||
|
||||
export default useUserStore;
|
||||
@@ -218,4 +218,61 @@ export interface AwardsResponse {
|
||||
updated_at: string,
|
||||
__v: number,
|
||||
id: string
|
||||
}
|
||||
|
||||
interface TransactionsData {
|
||||
_id: string,
|
||||
card: TransactionsCard
|
||||
userId: string,
|
||||
amount: number,
|
||||
dollarAmount: number,
|
||||
status: number,
|
||||
created_at: string,
|
||||
updated_at: string,
|
||||
__v: number,
|
||||
id: string
|
||||
}
|
||||
|
||||
interface TransactionsCard {
|
||||
_id: string,
|
||||
holderName: string,
|
||||
PAN: number,
|
||||
IBAN: string,
|
||||
created_at: string,
|
||||
updated_at: string,
|
||||
id: string
|
||||
}
|
||||
|
||||
export interface TransactionsResponse {
|
||||
data: TransactionsData[] | []
|
||||
}
|
||||
|
||||
type OverviewUser = {
|
||||
walletBalance: number,
|
||||
dollarBalance: number,
|
||||
score: number,
|
||||
_id: string,
|
||||
id: string
|
||||
}
|
||||
|
||||
export interface OverviewResponse {
|
||||
pending: boolean,
|
||||
user: OverviewUser
|
||||
}
|
||||
|
||||
type ScoreData = {
|
||||
_id: string,
|
||||
deviceId: string,
|
||||
score: number,
|
||||
created_at: string,
|
||||
updated_at: string,
|
||||
__v: number,
|
||||
userId: string,
|
||||
id: string
|
||||
}
|
||||
|
||||
export interface ScoreResponse {
|
||||
data: ScoreData[] | []
|
||||
score: number,
|
||||
total: number
|
||||
}
|
||||
Reference in New Issue
Block a user