complete score page - complete transition for pages

This commit is contained in:
Alihaghighattalab
2024-08-19 13:29:46 +03:30
parent 09621e8230
commit ddb0075e2f
27 changed files with 178 additions and 38 deletions
+26
View File
@@ -22,6 +22,7 @@
"@types/react-dom": "^18.3.0", "@types/react-dom": "^18.3.0",
"axios": "^1.7.3", "axios": "^1.7.3",
"clsx": "^2.1.1", "clsx": "^2.1.1",
"framer-motion": "^11.3.28",
"iconsax-react": "^0.0.8", "iconsax-react": "^0.0.8",
"iranianbanklogos": "^3.1.2", "iranianbanklogos": "^3.1.2",
"moment-jalaali": "^0.10.1", "moment-jalaali": "^0.10.1",
@@ -9678,6 +9679,31 @@
"url": "https://github.com/sponsors/rawify" "url": "https://github.com/sponsors/rawify"
} }
}, },
"node_modules/framer-motion": {
"version": "11.3.28",
"resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-11.3.28.tgz",
"integrity": "sha512-dqhoawipEAjqdv32zbv72sOMJZjol7dROWn7t/FOq23WXJ40O4OUybgnO2ldnuS+3YquSn8xO/KKRavZ+TBVOQ==",
"license": "MIT",
"dependencies": {
"tslib": "^2.4.0"
},
"peerDependencies": {
"@emotion/is-prop-valid": "*",
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"peerDependenciesMeta": {
"@emotion/is-prop-valid": {
"optional": true
},
"react": {
"optional": true
},
"react-dom": {
"optional": true
}
}
},
"node_modules/fresh": { "node_modules/fresh": {
"version": "0.5.2", "version": "0.5.2",
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
+1
View File
@@ -17,6 +17,7 @@
"@types/react-dom": "^18.3.0", "@types/react-dom": "^18.3.0",
"axios": "^1.7.3", "axios": "^1.7.3",
"clsx": "^2.1.1", "clsx": "^2.1.1",
"framer-motion": "^11.3.28",
"iconsax-react": "^0.0.8", "iconsax-react": "^0.0.8",
"iranianbanklogos": "^3.1.2", "iranianbanklogos": "^3.1.2",
"moment-jalaali": "^0.10.1", "moment-jalaali": "^0.10.1",
+3
View File
@@ -1,12 +1,15 @@
import { Imei } from "./components/home/imei"; import { Imei } from "./components/home/imei";
import { StatusBox } from "./components/home/status-box"; import { StatusBox } from "./components/home/status-box";
import { TransitionPages } from "./transition";
function App() { function App() {
return ( return (
<TransitionPages>
<div className="flex flex-col gap-y-[30px] w-full"> <div className="flex flex-col gap-y-[30px] w-full">
<StatusBox /> <StatusBox />
<Imei /> <Imei />
</div> </div>
</TransitionPages>
); );
} }
+18
View File
@@ -0,0 +1,18 @@
export const AwardSkeleton = () => {
return <div className="grid grid-cols-1 sm:grid-cols-2 2xl:grid-cols-4 gap-6 animate-pulse">
<div className="w-full bg-auth-form p-[18px] h-full rounded-[40px] flex flex-col gap-[42px] min-h-[220px]">
<div className="size-16 bg-secondary-color flex justify-center rounded-full items-center"></div>
<div className="flex flex-col gap-8">
<div className="flex flex-col gap-3 w-32 h-2 bg-secondary-color rounded-full"></div>
<div className="flex flex-col gap-3 w-20 h-2 bg-secondary-color rounded-full"></div>
</div>
</div>
<div className="w-full bg-auth-form p-[18px] h-full rounded-[40px] flex flex-col gap-[42px] min-h-[220px]">
<div className="size-16 bg-secondary-color flex justify-center rounded-full items-center"></div>
<div className="flex flex-col gap-8">
<div className="flex flex-col gap-3 w-32 h-2 bg-secondary-color rounded-full"></div>
<div className="flex flex-col gap-3 w-20 h-2 bg-secondary-color rounded-full"></div>
</div>
</div>
</div>
}
+2 -1
View File
@@ -2,6 +2,7 @@ import { useQuery } from "@tanstack/react-query"
import { AwardNotComplete } from "./award-not-complete" import { AwardNotComplete } from "./award-not-complete"
import { getAwardsList } from "../../services/api/awards" import { getAwardsList } from "../../services/api/awards"
import { AwardsResponse } from "../../types" import { AwardsResponse } from "../../types"
import { AwardSkeleton } from "./award-skeleton"
export const Awards = () => { export const Awards = () => {
const { data, isLoading } = useQuery({ const { data, isLoading } = useQuery({
@@ -9,7 +10,7 @@ export const Awards = () => {
queryFn: getAwardsList queryFn: getAwardsList
}) })
if (isLoading) return <p>LOADING...</p> if (isLoading) return <AwardSkeleton />
return ( return (
<div className="flex flex-col gap-10"> <div className="flex flex-col gap-10">
<div className="flex flex-row justify-between items-center"> <div className="flex flex-row justify-between items-center">
+1 -1
View File
@@ -12,6 +12,6 @@ export const Score = () => {
queryFn: getScoresList queryFn: getScoresList
}) })
return ( return (
<Table sorting={sorting} setSorting={setSorting} columns={scoresCol} data={data?.data} tableStatus={data?.score} isLoading={isLoading} /> <Table sorting={sorting} setSorting={setSorting} columns={scoresCol} data={data?.data?.data} tableStatus={data?.score} isLoading={isLoading} />
) )
} }
+2 -3
View File
@@ -4,12 +4,11 @@ import { SocialsInterface } from "../../../types"
export const AuthLayout = () => { export const AuthLayout = () => {
return ( return (
<section <>
className="flex flex-row min-h-screen p-5 justify-center items-center xl:justify-stretch xl:items-stretch max-h-[750px] overflow-y-hidden relative">
<Outlet /> <Outlet />
<footer className="hidden w-full xl:flex flex-row gap-x-2 justify-end !absolute left-4 bottom-4"> <footer className="hidden w-full xl:flex flex-row gap-x-2 justify-end !absolute left-4 bottom-4">
{socialsList?.map((item: SocialsInterface) => <img key={item?.name} src={item?.path} alt={item?.name} className="size-10 min-w-10 min-h-10 cursor-pointer" />)} {socialsList?.map((item: SocialsInterface) => <img key={item?.name} src={item?.path} alt={item?.name} className="size-10 min-w-10 min-h-10 cursor-pointer" />)}
</footer> </footer>
</section> </>
) )
} }
+1 -1
View File
@@ -1,5 +1,5 @@
export const WalletStatusSkeleton = () => { export const WalletStatusSkeleton = () => {
return <div className="grid grid-cols-1 sm:grid-cols-2 2xl:grid-cols-4 gap-6 animate-pulse"> return <div className="grid grid-cols-1 sm:grid-cols-2 gap-6 animate-pulse">
<div className="w-full bg-auth-form p-[18px] h-full rounded-[40px] flex flex-col gap-[42px] min-h-[220px]"> <div className="w-full bg-auth-form p-[18px] h-full rounded-[40px] flex flex-col gap-[42px] min-h-[220px]">
<div className="size-16 bg-secondary-color flex justify-center rounded-full items-center"></div> <div className="size-16 bg-secondary-color flex justify-center rounded-full items-center"></div>
<div className="flex flex-col gap-8"> <div className="flex flex-col gap-8">
+3 -2
View File
@@ -1,12 +1,13 @@
import { ForgotPasswordForm } from "../../components/forms/forgot-password-form" import { ForgotPasswordForm } from "../../components/forms/forgot-password-form"
import { AuthTransitionPages } from "../../transition/auth-transition"
export const ForgotPassword = () => { export const ForgotPassword = () => {
return ( return (
<> <AuthTransitionPages>
<ForgotPasswordForm /> <ForgotPasswordForm />
<div className="hidden xl:flex w-1/2 h-screen justify-center items-center"> <div className="hidden xl:flex w-1/2 h-screen justify-center items-center">
<img src="/svgs/auth/forgot-password.svg" alt="forgot password" className="auth-image-desktop" /> <img src="/svgs/auth/forgot-password.svg" alt="forgot password" className="auth-image-desktop" />
</div> </div>
</> </AuthTransitionPages>
) )
} }
+3 -2
View File
@@ -1,12 +1,13 @@
import { LoginWithCodeForm } from "../../components/forms/login-with-code-form" import { LoginWithCodeForm } from "../../components/forms/login-with-code-form"
import { AuthTransitionPages } from "../../transition/auth-transition"
export const LoginWithCode = () => { export const LoginWithCode = () => {
return ( return (
<> <AuthTransitionPages>
<LoginWithCodeForm /> <LoginWithCodeForm />
<div className="hidden xl:flex w-1/2 h-screen justify-center items-center"> <div className="hidden xl:flex w-1/2 h-screen justify-center items-center">
<img src="/svgs/auth/login-with-code.svg" alt="login with code" className="auth-image-desktop" /> <img src="/svgs/auth/login-with-code.svg" alt="login with code" className="auth-image-desktop" />
</div> </div>
</> </AuthTransitionPages>
) )
} }
+3 -2
View File
@@ -1,13 +1,14 @@
import { LoginForm } from "../../components/forms/login-form" import { LoginForm } from "../../components/forms/login-form"
import { AuthTransitionPages } from "../../transition/auth-transition"
export const Login = () => { export const Login = () => {
return ( return (
<> <AuthTransitionPages>
<LoginForm /> <LoginForm />
<div className="hidden xl:flex w-1/2 h-screen justify-center items-center"> <div className="hidden xl:flex w-1/2 h-screen justify-center items-center">
<img src="/svgs/auth/login.svg" alt="login" className="auth-image-desktop" /> <img src="/svgs/auth/login.svg" alt="login" className="auth-image-desktop" />
</div> </div>
</> </AuthTransitionPages>
) )
} }
+3 -2
View File
@@ -1,12 +1,13 @@
import { RegisterForm } from "../../components/forms/register-form" import { RegisterForm } from "../../components/forms/register-form"
import { AuthTransitionPages } from "../../transition/auth-transition"
export const Register = () => { export const Register = () => {
return ( return (
<> <AuthTransitionPages>
<RegisterForm /> <RegisterForm />
<div className="hidden xl:flex w-1/2 h-screen justify-center items-center"> <div className="hidden xl:flex w-1/2 h-screen justify-center items-center">
<img src="/svgs/auth/register.svg" alt="register" className="auth-image-desktop" /> <img src="/svgs/auth/register.svg" alt="register" className="auth-image-desktop" />
</div> </div>
</> </AuthTransitionPages>
) )
} }
+3 -3
View File
@@ -1,14 +1,14 @@
import React from "react"
import { ResetpasswordCodeForm } from "../../components/forms/reset-password-code-form" import { ResetpasswordCodeForm } from "../../components/forms/reset-password-code-form"
import { AuthTransitionPages } from "../../transition/auth-transition"
export const ResetPasswordCode = () => { export const ResetPasswordCode = () => {
return ( return (
<React.Fragment> <AuthTransitionPages>
<ResetpasswordCodeForm /> <ResetpasswordCodeForm />
<div className="hidden xl:flex w-1/2 h-screen justify-center items-center"> <div className="hidden xl:flex w-1/2 h-screen justify-center items-center">
<img src="/svgs/auth/reset-password-code.svg" alt="send code reset password" className="auth-image-desktop" /> <img src="/svgs/auth/reset-password-code.svg" alt="send code reset password" className="auth-image-desktop" />
</div> </div>
</React.Fragment> </AuthTransitionPages>
) )
} }
+3 -3
View File
@@ -1,13 +1,13 @@
import React from "react"
import { ResetPasswordForm } from "../../components/forms/reset-password.form" import { ResetPasswordForm } from "../../components/forms/reset-password.form"
import { AuthTransitionPages } from "../../transition/auth-transition"
export const ResetPassword = () => { export const ResetPassword = () => {
return ( return (
<React.Fragment> <AuthTransitionPages>
<ResetPasswordForm /> <ResetPasswordForm />
<div className="hidden xl:flex w-1/2 h-screen justify-center items-center"> <div className="hidden xl:flex w-1/2 h-screen justify-center items-center">
<img src="/svgs/auth/reset-password.svg" alt="reset password" className="auth-image-desktop" /> <img src="/svgs/auth/reset-password.svg" alt="reset password" className="auth-image-desktop" />
</div> </div>
</React.Fragment> </AuthTransitionPages>
) )
} }
+4 -3
View File
@@ -1,13 +1,14 @@
import React from "react"
import { SendCodeForm } from "../../components/forms/send-code-form" import { SendCodeForm } from "../../components/forms/send-code-form"
import { AuthTransitionPages } from "../../transition/auth-transition"
export const SendCode = () => { export const SendCode = () => {
return ( return (
<React.Fragment> <AuthTransitionPages>
<SendCodeForm /> <SendCodeForm />
<div className="hidden xl:flex w-1/2 h-screen justify-center items-center"> <div className="hidden xl:flex w-1/2 h-screen justify-center items-center">
<img src="/svgs/auth/send-code.svg" alt="send code" className="auth-image-desktop" /> <img src="/svgs/auth/send-code.svg" alt="send code" className="auth-image-desktop" />
</div> </div>
</React.Fragment> </AuthTransitionPages>
) )
} }
+3
View File
@@ -1,7 +1,10 @@
import { Awards } from "../../components/awards" import { Awards } from "../../components/awards"
import { TransitionPages } from "../../transition"
export const AwardsPage = () => { export const AwardsPage = () => {
return ( return (
<TransitionPages>
<Awards /> <Awards />
</TransitionPages>
) )
} }
@@ -1,7 +1,10 @@
import { InstallationReports } from "../../components/installation-reports" import { InstallationReports } from "../../components/installation-reports"
import { TransitionPages } from "../../transition"
export const InstallationReportsPage = () => { export const InstallationReportsPage = () => {
return ( return (
<TransitionPages>
<InstallationReports /> <InstallationReports />
</TransitionPages>
) )
} }
@@ -1,7 +1,10 @@
import { ManagementBankAccounts } from "../../components/management-bank-accounts" import { ManagementBankAccounts } from "../../components/management-bank-accounts"
import { TransitionPages } from "../../transition"
export const ManagementBankAccountPage = () => { export const ManagementBankAccountPage = () => {
return ( return (
<TransitionPages>
<ManagementBankAccounts /> <ManagementBankAccounts />
</TransitionPages>
) )
} }
+4
View File
@@ -1,7 +1,11 @@
import { MyAccountPage } from "../../components/my-account" import { MyAccountPage } from "../../components/my-account"
import { TransitionPages } from "../../transition"
export const MyAcccount = () => { export const MyAcccount = () => {
return ( return (
<TransitionPages>
<MyAccountPage /> <MyAccountPage />
</TransitionPages>
) )
} }
+3
View File
@@ -1,7 +1,10 @@
import { Score } from "../../components/score" import { Score } from "../../components/score"
import { TransitionPages } from "../../transition"
export const ScorePage = () => { export const ScorePage = () => {
return ( return (
<TransitionPages>
<Score /> <Score />
</TransitionPages>
) )
} }
@@ -1,7 +1,10 @@
import { SubscriptionReport } from "../../components/subscription-report" import { SubscriptionReport } from "../../components/subscription-report"
import { TransitionPages } from "../../transition"
export const SubscriptionReportPage = () => { export const SubscriptionReportPage = () => {
return ( return (
<TransitionPages>
<SubscriptionReport /> <SubscriptionReport />
</TransitionPages>
) )
} }
+3
View File
@@ -1,7 +1,10 @@
import { Transactions } from "../../components/transactions" import { Transactions } from "../../components/transactions"
import { TransitionPages } from "../../transition"
export const TransactionsPage = () => { export const TransactionsPage = () => {
return ( return (
<TransitionPages>
<Transactions /> <Transactions />
</TransitionPages>
) )
} }
+3
View File
@@ -1,7 +1,10 @@
import { TransitionPages } from "../../transition"
import { WalletPage } from "../../components/wallet/wallet-page" import { WalletPage } from "../../components/wallet/wallet-page"
export const Wallet = () => { export const Wallet = () => {
return ( return (
<TransitionPages>
<WalletPage /> <WalletPage />
</TransitionPages>
) )
} }
+3 -1
View File
@@ -22,7 +22,9 @@ import { Guard } from "../guard";
export const router = createBrowserRouter([ export const router = createBrowserRouter([
{ {
element: <Guard><DashboardLayout /></Guard>, element: <Guard>
<DashboardLayout />
</Guard>,
path: "/", path: "/",
children: [ children: [
{ {
+36
View File
@@ -0,0 +1,36 @@
import { PropsWithChildren } from "react"
import { motion } from "framer-motion"
export const AuthTransitionPages = ({ children }: PropsWithChildren) => {
const animations = {
initial: {
opacity: 0,
scale: 0.95,
transition: {
duration: 0.5,
ease: "easeIn"
}
},
animate: {
opacity: 1,
scale: 1,
transition: {
duration: 0.5,
ease: "easeOut"
}
},
exit: {
opacity: 0,
scale: 0.95,
transition: {
duration: 0.2,
ease: "easeIn"
}
}
}
return (
<motion.div variants={animations} initial="initial" animate="animate" exit="exit" className="flex flex-row min-h-screen p-5 justify-center items-center xl:justify-stretch xl:items-stretch max-h-[750px] overflow-y-hidden relative">
{children}
</motion.div>
)
}
+24
View File
@@ -0,0 +1,24 @@
import { PropsWithChildren } from "react"
import { motion } from "framer-motion"
export const TransitionPages = ({ children }: PropsWithChildren) => {
const animations = {
initial: {
opacity: 0,
x: 100
},
animate: {
opacity: 1,
x: 0
},
exit: {
opacity: 0,
x: -100
}
}
return (
<motion.div variants={animations} initial="initial" animate="animate" exit="exit">
{children}
</motion.div>
)
}
+2 -2
View File
@@ -1,12 +1,12 @@
import { createColumns } from "../components/common/create-col"; import { createColumns } from "../components/common/create-col";
import { colConfig } from "../types"; import { colConfig } from "../types";
import { formatDateToPersian } from "./getDate";
const columnConfigs: colConfig[] | [] = [ const columnConfigs: colConfig[] | [] = [
{ accessor: "title", header: "عنوان" }, { accessor: "title", header: "عنوان" },
{ accessor: "score", header: "امتیاز" }, { accessor: "score", header: "امتیاز" },
{ accessor: "date", header: "تاریخ", cellRenderer: (info) => info.getValue() && <p style={{ direction: "ltr" }}>{info.getValue()}</p> }, { accessor: "created_at", header: "تاریخ", cellRenderer: (info) => info.getValue() && <p style={{ direction: "ltr" }}>{formatDateToPersian(info.getValue())}</p> },
]; ];
export const scoresCol = createColumns<any>(columnConfigs); export const scoresCol = createColumns<any>(columnConfigs);