init project

This commit is contained in:
2023-07-10 10:48:53 +03:30
parent 75fc37753a
commit 5aeb3f0f64
104 changed files with 11256 additions and 0 deletions

View File

@@ -0,0 +1,116 @@
import MuiLink from "@mui/material/Link";
import { styled } from "@mui/material/styles";
import clsx from "clsx";
import NextLink from "next/link";
import { useRouter } from "next/router";
import * as React from "react";
// Add support for the sx prop for consistency with the other branches.
const Anchor = styled("a")({});
export const NextLinkComposed = React.forwardRef(function NextLinkComposed(
props,
ref
) {
const {
to,
linkAs,
replace,
scroll,
shallow,
prefetch,
legacyBehavior = true,
locale,
...other
} = props;
return (
<NextLink
href={to}
prefetch={prefetch}
as={linkAs}
replace={replace}
scroll={scroll}
shallow={shallow}
passHref
locale={locale}
legacyBehavior={legacyBehavior}
>
<Anchor ref={ref} {...other} />
</NextLink>
);
});
// A styled version of the Next.js Link component:
// https://nextjs.org/docs/api-reference/next/link
const LinkRouting = React.forwardRef(function Link(props, ref) {
const {
activeClassName = "active",
as,
className: classNameProps,
href,
legacyBehavior,
linkAs: linkAsProp,
locale,
noLinkStyle,
prefetch,
replace,
role, // Link don't have roles.
scroll,
shallow,
...other
} = props;
const router = useRouter();
const pathname = typeof href === "string" ? href : href.pathname;
const className = clsx(classNameProps, {
[activeClassName]: router.pathname === pathname && activeClassName,
});
const isExternal =
typeof href === "string" &&
(href.indexOf("http") === 0 || href.indexOf("mailto:") === 0);
if (isExternal) {
if (noLinkStyle) {
return <Anchor className={className} href={href} ref={ref} {...other} />;
}
return <MuiLink className={className} href={href} ref={ref} {...other} />;
}
const linkAs = linkAsProp || as;
const nextjsProps = {
to: href,
linkAs,
replace,
scroll,
shallow,
prefetch,
legacyBehavior,
locale,
};
if (noLinkStyle) {
return (
<NextLinkComposed
className={className}
ref={ref}
{...nextjsProps}
{...other}
/>
);
}
return (
<MuiLink
component={NextLinkComposed}
className={className}
ref={ref}
{...nextjsProps}
{...other}
/>
);
});
export default LinkRouting;

View File

@@ -0,0 +1,44 @@
import { Backdrop, Fade, styled } from "@mui/material";
import StyledImage from "./StyledImage";
const LoadingImage = styled(StyledImage)({
"@keyframes load": {
"0%": {
// opacity: 0,
transform: "scale(1)",
},
"50%": {
// opacity: 1,
transform: "scale(2)",
},
"100%": {
// opacity: 0,
transform: "scale(1)",
},
},
animation: "load 2s infinite",
});
const LoadingHardPage = ({ children, loading }) => {
return (
<>
<Backdrop
sx={{ bgcolor: "#fff", zIndex: (theme) => theme.zIndex.drawer + 1 }}
open={loading}
>
<Fade in={true}>
<LoadingImage
src={"/images/logo.svg"}
alt="loading marhaba"
priority
width={100}
height={100}
/>
</Fade>
</Backdrop>
{children}
</>
);
};
export default LoadingHardPage;

View File

@@ -0,0 +1,22 @@
import CenterLayout from "@/layouts/CenterLayout";
import FullPageLayout from "@/layouts/FullPageLayout";
import StyledImage from "./StyledImage";
const Message = ({ text, actions }) => {
return (
<FullPageLayout sx={{ p: 1 }}>
<CenterLayout spacing={3}>
<StyledImage
src={"/images/logo.svg"}
alt="loading loan facilities"
width={100}
height={100}
/>
{text}
{actions}
</CenterLayout>
</FullPageLayout>
);
};
export default Message;

View File

@@ -0,0 +1,33 @@
import { useState } from "react";
import { IconButton, InputAdornment, TextField } from "@mui/material";
import { Visibility, VisibilityOff } from "@mui/icons-material";
import { Field } from "formik";
const PasswordField = (props) => {
const [showPassword, setShowPassword] = useState(false);
const handleClickShowPassword = () => {
setShowPassword(!showPassword);
};
return (
<Field
variant="outlined"
fullWidth
as={TextField}
{...props}
type={showPassword ? "text" : "password"}
InputProps={{
endAdornment: (
<InputAdornment position="end">
<IconButton onClick={handleClickShowPassword}>
{showPassword ? <Visibility /> : <VisibilityOff />}
</IconButton>
</InputAdornment>
),
}}
/>
);
};
export default PasswordField;

View File

@@ -0,0 +1,6 @@
import { styled } from "@mui/material";
import { Form } from "formik";
const StyledForm = styled(Form)``;
export default StyledForm;

View File

@@ -0,0 +1,6 @@
import { styled } from "@mui/material";
import Image from "next/image";
const StyledImage = styled(Image)``;
export default StyledImage;

View File

@@ -0,0 +1,15 @@
import { useTranslations } from "next-intl";
import Head from "next/head";
const TitlePage = ({ text }) => {
const t = useTranslations();
return (
<Head>
<title>
{text ? `${t("app_short_name")} | ${t(text)}` : t("app_short_name")}
</title>
</Head>
);
};
export default TitlePage;

View File

@@ -0,0 +1,8 @@
import { NoSsr } from "@mui/material";
const NoSsrHandler = ({ isBot, children }) => {
if (isBot) return children;
return <NoSsr>{children}</NoSsr>;
};
export default NoSsrHandler;