recode and add editor config file
This commit is contained in:
@@ -1,30 +1,30 @@
|
||||
import "&/fontiran.scss";
|
||||
import AppLayout from "@/layouts/AppLayout";
|
||||
import MuiLayout from "@/layouts/MuiLayout";
|
||||
import { LanguageProvider } from "@/lib/app/contexts/language";
|
||||
import { LoadingProvider } from "@/lib/app/contexts/loading";
|
||||
import { UserProvider } from "@/lib/app/contexts/user";
|
||||
import {LanguageProvider} from "@/lib/app/contexts/language";
|
||||
import {LoadingProvider} from "@/lib/app/contexts/loading";
|
||||
import {UserProvider} from "@/lib/app/contexts/user";
|
||||
import "moment/locale/fa";
|
||||
import { NextIntlProvider } from "next-intl";
|
||||
import {NextIntlProvider} from "next-intl";
|
||||
|
||||
const App = ({ Component, pageProps }) => {
|
||||
return (
|
||||
<>
|
||||
<UserProvider>
|
||||
<LanguageProvider>
|
||||
<NextIntlProvider messages={pageProps.messages}>
|
||||
<MuiLayout isBot={pageProps.isBot}>
|
||||
<LoadingProvider>
|
||||
<AppLayout isBot={pageProps.isBot}>
|
||||
<Component {...pageProps} />
|
||||
</AppLayout>
|
||||
</LoadingProvider>
|
||||
</MuiLayout>
|
||||
</NextIntlProvider>
|
||||
</LanguageProvider>
|
||||
</UserProvider>
|
||||
</>
|
||||
);
|
||||
const App = ({Component, pageProps}) => {
|
||||
return (
|
||||
<>
|
||||
<UserProvider>
|
||||
<LanguageProvider>
|
||||
<NextIntlProvider messages={pageProps.messages}>
|
||||
<MuiLayout isBot={pageProps.isBot}>
|
||||
<LoadingProvider>
|
||||
<AppLayout isBot={pageProps.isBot}>
|
||||
<Component {...pageProps} />
|
||||
</AppLayout>
|
||||
</LoadingProvider>
|
||||
</MuiLayout>
|
||||
</NextIntlProvider>
|
||||
</LanguageProvider>
|
||||
</UserProvider>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default App;
|
||||
|
||||
@@ -1,67 +1,65 @@
|
||||
import {
|
||||
createEmotionCacheLtr
|
||||
} from "@/core/utils/createEmotionCache";
|
||||
import {createEmotionCacheLtr} from "@/core/utils/createEmotionCache";
|
||||
import theme from "@/core/utils/theme";
|
||||
import createEmotionServer from "@emotion/server/create-instance";
|
||||
import Document, { Head, Html, Main, NextScript } from "next/document";
|
||||
import Document, {Head, Html, Main, NextScript} from "next/document";
|
||||
|
||||
export default function MyDocument(props) {
|
||||
const { emotionStyleTags } = props;
|
||||
const {emotionStyleTags} = props;
|
||||
|
||||
return (
|
||||
<Html>
|
||||
<Head>
|
||||
<meta name="theme-color" content={theme.palette.primary.main} />
|
||||
<meta name="emotion-insertion-point" content="" />
|
||||
<link rel="shortcut icon" href="/icons/favicon.ico" />
|
||||
<link rel="manifest" href="/manifest.json" />
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
|
||||
/>
|
||||
{emotionStyleTags}
|
||||
</Head>
|
||||
<body>
|
||||
<Main />
|
||||
<NextScript />
|
||||
</body>
|
||||
</Html>
|
||||
);
|
||||
return (
|
||||
<Html>
|
||||
<Head>
|
||||
<meta name="theme-color" content={theme.palette.primary.main}/>
|
||||
<meta name="emotion-insertion-point" content=""/>
|
||||
<link rel="shortcut icon" href="/icons/favicon.ico"/>
|
||||
<link rel="manifest" href="/manifest.json"/>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
|
||||
/>
|
||||
{emotionStyleTags}
|
||||
</Head>
|
||||
<body>
|
||||
<Main/>
|
||||
<NextScript/>
|
||||
</body>
|
||||
</Html>
|
||||
);
|
||||
}
|
||||
|
||||
MyDocument.getInitialProps = async (ctx) => {
|
||||
const originalRenderPage = ctx.renderPage;
|
||||
let cache;
|
||||
switch (ctx.locale) {
|
||||
case "fa":
|
||||
cache = createEmotionCacheLtr();
|
||||
break;
|
||||
}
|
||||
const originalRenderPage = ctx.renderPage;
|
||||
let cache;
|
||||
switch (ctx.locale) {
|
||||
case "fa":
|
||||
cache = createEmotionCacheLtr();
|
||||
break;
|
||||
}
|
||||
|
||||
const { extractCriticalToChunks } = createEmotionServer(cache);
|
||||
const {extractCriticalToChunks} = createEmotionServer(cache);
|
||||
|
||||
ctx.renderPage = () =>
|
||||
originalRenderPage({
|
||||
enhanceApp: (App) =>
|
||||
function EnhanceApp(props) {
|
||||
return <App emotionCache={cache} {...props} />;
|
||||
},
|
||||
});
|
||||
ctx.renderPage = () =>
|
||||
originalRenderPage({
|
||||
enhanceApp: (App) =>
|
||||
function EnhanceApp(props) {
|
||||
return <App emotionCache={cache} {...props} />;
|
||||
},
|
||||
});
|
||||
|
||||
const initialProps = await Document.getInitialProps(ctx);
|
||||
const initialProps = await Document.getInitialProps(ctx);
|
||||
|
||||
const emotionStyles = extractCriticalToChunks(initialProps.html);
|
||||
const emotionStyleTags = emotionStyles.styles.map((style) => (
|
||||
<style
|
||||
data-emotion={`${style.key} ${style.ids.join(" ")}`}
|
||||
key={style.key}
|
||||
// eslint-disable-next-line react/no-danger
|
||||
dangerouslySetInnerHTML={{ __html: style.css }}
|
||||
/>
|
||||
));
|
||||
const emotionStyles = extractCriticalToChunks(initialProps.html);
|
||||
const emotionStyleTags = emotionStyles.styles.map((style) => (
|
||||
<style
|
||||
data-emotion={`${style.key} ${style.ids.join(" ")}`}
|
||||
key={style.key}
|
||||
// eslint-disable-next-line react/no-danger
|
||||
dangerouslySetInnerHTML={{__html: style.css}}
|
||||
/>
|
||||
));
|
||||
|
||||
return {
|
||||
...initialProps,
|
||||
emotionStyleTags,
|
||||
};
|
||||
return {
|
||||
...initialProps,
|
||||
emotionStyleTags,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
import DashboardChangePasswordComponent from "@/components/dashboard/change-password";
|
||||
import TitlePage from "@/core/components/TitlePage";
|
||||
import WithAuthMiddleware from "@/middlewares/WithAuth";
|
||||
import { parse } from "next-useragent";
|
||||
import {parse} from "next-useragent";
|
||||
|
||||
export default function LoanFollowUp() {
|
||||
return (
|
||||
<WithAuthMiddleware>
|
||||
<TitlePage text="Dashboard.change_password" />
|
||||
<DashboardChangePasswordComponent />
|
||||
</WithAuthMiddleware>
|
||||
);
|
||||
return (
|
||||
<WithAuthMiddleware>
|
||||
<TitlePage text="Dashboard.change_password"/>
|
||||
<DashboardChangePasswordComponent/>
|
||||
</WithAuthMiddleware>
|
||||
);
|
||||
}
|
||||
|
||||
export async function getServerSideProps({ req, locale }) {
|
||||
const { isBot } = parse(req.headers["user-agent"]);
|
||||
return {
|
||||
props: {
|
||||
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
||||
isBot,
|
||||
},
|
||||
};
|
||||
export async function getServerSideProps({req, locale}) {
|
||||
const {isBot} = parse(req.headers["user-agent"]);
|
||||
return {
|
||||
props: {
|
||||
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
||||
isBot,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
import DashboardEditProfile from "@/components/dashboard/edit-profile";
|
||||
import TitlePage from "@/core/components/TitlePage";
|
||||
import WithAuthMiddleware from "@/middlewares/WithAuth";
|
||||
import { parse } from "next-useragent";
|
||||
import {parse} from "next-useragent";
|
||||
|
||||
export default function LoanFollowUp() {
|
||||
return (
|
||||
<WithAuthMiddleware>
|
||||
<TitlePage text="Dashboard.edit_profile" />
|
||||
<DashboardEditProfile />
|
||||
</WithAuthMiddleware>
|
||||
);
|
||||
return (
|
||||
<WithAuthMiddleware>
|
||||
<TitlePage text="Dashboard.edit_profile"/>
|
||||
<DashboardEditProfile/>
|
||||
</WithAuthMiddleware>
|
||||
);
|
||||
}
|
||||
|
||||
export async function getServerSideProps({ req, locale }) {
|
||||
const { isBot } = parse(req.headers["user-agent"]);
|
||||
return {
|
||||
props: {
|
||||
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
||||
isBot,
|
||||
},
|
||||
};
|
||||
export async function getServerSideProps({req, locale}) {
|
||||
const {isBot} = parse(req.headers["user-agent"]);
|
||||
return {
|
||||
props: {
|
||||
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
||||
isBot,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
import DashboardFirstComponent from "@/components/dashboard/first";
|
||||
import TitlePage from "@/core/components/TitlePage";
|
||||
import WithAuthMiddleware from "@/middlewares/WithAuth";
|
||||
import { parse } from "next-useragent";
|
||||
import {parse} from "next-useragent";
|
||||
|
||||
export default function Dashboard() {
|
||||
return (
|
||||
<WithAuthMiddleware>
|
||||
<TitlePage text="Dashboard.dashboard_page" />
|
||||
<DashboardFirstComponent />
|
||||
</WithAuthMiddleware>
|
||||
);
|
||||
return (
|
||||
<WithAuthMiddleware>
|
||||
<TitlePage text="Dashboard.dashboard_page"/>
|
||||
<DashboardFirstComponent/>
|
||||
</WithAuthMiddleware>
|
||||
);
|
||||
}
|
||||
|
||||
export async function getServerSideProps({ req, locale }) {
|
||||
const { isBot } = parse(req.headers["user-agent"]);
|
||||
return {
|
||||
props: {
|
||||
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
||||
isBot,
|
||||
},
|
||||
};
|
||||
export async function getServerSideProps({req, locale}) {
|
||||
const {isBot} = parse(req.headers["user-agent"]);
|
||||
return {
|
||||
props: {
|
||||
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
||||
isBot,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,25 +2,26 @@ import DashboardMachinaryOfficeComponent from "@/components/dashboard/machinary-
|
||||
import TitlePage from "@/core/components/TitlePage";
|
||||
import RolePermission from "@/middlewares/RolePermission";
|
||||
import WithAuthMiddleware from "@/middlewares/WithAuth";
|
||||
import { parse } from "next-useragent";
|
||||
import {parse} from "next-useragent";
|
||||
|
||||
const requiredPermissions = ["machinery_expert"];
|
||||
export default function PassengerOffice() {
|
||||
return (
|
||||
<WithAuthMiddleware>
|
||||
<RolePermission requiredPermissions={requiredPermissions}>
|
||||
<TitlePage text="Dashboard.machinary_office_page" />
|
||||
<DashboardMachinaryOfficeComponent />
|
||||
</RolePermission>
|
||||
</WithAuthMiddleware>
|
||||
);
|
||||
return (
|
||||
<WithAuthMiddleware>
|
||||
<RolePermission requiredPermissions={requiredPermissions}>
|
||||
<TitlePage text="Dashboard.machinary_office_page"/>
|
||||
<DashboardMachinaryOfficeComponent/>
|
||||
</RolePermission>
|
||||
</WithAuthMiddleware>
|
||||
);
|
||||
}
|
||||
|
||||
export async function getServerSideProps({ req, locale }) {
|
||||
const { isBot } = parse(req.headers["user-agent"]);
|
||||
return {
|
||||
props: {
|
||||
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
||||
isBot,
|
||||
},
|
||||
};
|
||||
export async function getServerSideProps({req, locale}) {
|
||||
const {isBot} = parse(req.headers["user-agent"]);
|
||||
return {
|
||||
props: {
|
||||
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
||||
isBot,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,25 +2,26 @@ import DashboardPassengerBossComponent from "@/components/dashboard/passenger-bo
|
||||
import TitlePage from "@/core/components/TitlePage";
|
||||
import RolePermission from "@/middlewares/RolePermission";
|
||||
import WithAuthMiddleware from "@/middlewares/WithAuth";
|
||||
import { parse } from "next-useragent";
|
||||
import {parse} from "next-useragent";
|
||||
|
||||
const requiredPermissions = ["passenger_office_chief"];
|
||||
export default function PassengerBoss() {
|
||||
return (
|
||||
<WithAuthMiddleware>
|
||||
<RolePermission requiredPermissions={requiredPermissions}>
|
||||
<TitlePage text="Dashboard.passenger_boss_page" />
|
||||
<DashboardPassengerBossComponent />
|
||||
</RolePermission>
|
||||
</WithAuthMiddleware>
|
||||
);
|
||||
return (
|
||||
<WithAuthMiddleware>
|
||||
<RolePermission requiredPermissions={requiredPermissions}>
|
||||
<TitlePage text="Dashboard.passenger_boss_page"/>
|
||||
<DashboardPassengerBossComponent/>
|
||||
</RolePermission>
|
||||
</WithAuthMiddleware>
|
||||
);
|
||||
}
|
||||
|
||||
export async function getServerSideProps({ req, locale }) {
|
||||
const { isBot } = parse(req.headers["user-agent"]);
|
||||
return {
|
||||
props: {
|
||||
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
||||
isBot,
|
||||
},
|
||||
};
|
||||
export async function getServerSideProps({req, locale}) {
|
||||
const {isBot} = parse(req.headers["user-agent"]);
|
||||
return {
|
||||
props: {
|
||||
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
||||
isBot,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,25 +2,26 @@ import DashboardPassengerOfficeComponent from "@/components/dashboard/passenger-
|
||||
import TitlePage from "@/core/components/TitlePage";
|
||||
import RolePermission from "@/middlewares/RolePermission";
|
||||
import WithAuthMiddleware from "@/middlewares/WithAuth";
|
||||
import { parse } from "next-useragent";
|
||||
import {parse} from "next-useragent";
|
||||
|
||||
const requiredPermissions = ["passenger_office_chief"];
|
||||
export default function PassengerOffice() {
|
||||
return (
|
||||
<WithAuthMiddleware>
|
||||
<RolePermission requiredPermissions={requiredPermissions}>
|
||||
<TitlePage text="Dashboard.passenger_office_page" />
|
||||
<DashboardPassengerOfficeComponent />
|
||||
</RolePermission>
|
||||
</WithAuthMiddleware>
|
||||
);
|
||||
return (
|
||||
<WithAuthMiddleware>
|
||||
<RolePermission requiredPermissions={requiredPermissions}>
|
||||
<TitlePage text="Dashboard.passenger_office_page"/>
|
||||
<DashboardPassengerOfficeComponent/>
|
||||
</RolePermission>
|
||||
</WithAuthMiddleware>
|
||||
);
|
||||
}
|
||||
|
||||
export async function getServerSideProps({ req, locale }) {
|
||||
const { isBot } = parse(req.headers["user-agent"]);
|
||||
return {
|
||||
props: {
|
||||
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
||||
isBot,
|
||||
},
|
||||
};
|
||||
export async function getServerSideProps({req, locale}) {
|
||||
const {isBot} = parse(req.headers["user-agent"]);
|
||||
return {
|
||||
props: {
|
||||
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
||||
isBot,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,25 +2,26 @@ import DashboardProvinceManagerComponent from "@/components/dashboard/province-m
|
||||
import TitlePage from "@/core/components/TitlePage";
|
||||
import RolePermission from "@/middlewares/RolePermission";
|
||||
import WithAuthMiddleware from "@/middlewares/WithAuth";
|
||||
import { parse } from "next-useragent";
|
||||
import {parse} from "next-useragent";
|
||||
|
||||
const requiredPermissions = ["province_manager"];
|
||||
export default function PassengerOffice() {
|
||||
return (
|
||||
<WithAuthMiddleware>
|
||||
<RolePermission requiredPermissions={requiredPermissions}>
|
||||
<TitlePage text="Dashboard.province_manager_page" />
|
||||
<DashboardProvinceManagerComponent />
|
||||
</RolePermission>
|
||||
</WithAuthMiddleware>
|
||||
);
|
||||
return (
|
||||
<WithAuthMiddleware>
|
||||
<RolePermission requiredPermissions={requiredPermissions}>
|
||||
<TitlePage text="Dashboard.province_manager_page"/>
|
||||
<DashboardProvinceManagerComponent/>
|
||||
</RolePermission>
|
||||
</WithAuthMiddleware>
|
||||
);
|
||||
}
|
||||
|
||||
export async function getServerSideProps({ req, locale }) {
|
||||
const { isBot } = parse(req.headers["user-agent"]);
|
||||
return {
|
||||
props: {
|
||||
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
||||
isBot,
|
||||
},
|
||||
};
|
||||
export async function getServerSideProps({req, locale}) {
|
||||
const {isBot} = parse(req.headers["user-agent"]);
|
||||
return {
|
||||
props: {
|
||||
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
||||
isBot,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,25 +2,26 @@ import DashboardTransportationAssistanceComponent from "@/components/dashboard/t
|
||||
import TitlePage from "@/core/components/TitlePage";
|
||||
import RolePermission from "@/middlewares/RolePermission";
|
||||
import WithAuthMiddleware from "@/middlewares/WithAuth";
|
||||
import { parse } from "next-useragent";
|
||||
import {parse} from "next-useragent";
|
||||
|
||||
const requiredPermissions = ["transportation_assistant"];
|
||||
export default function TransportationAssistance() {
|
||||
return (
|
||||
<WithAuthMiddleware>
|
||||
<RolePermission requiredPermissions={requiredPermissions}>
|
||||
<TitlePage text="Dashboard.transportation_assistance" />
|
||||
<DashboardTransportationAssistanceComponent />
|
||||
</RolePermission>
|
||||
</WithAuthMiddleware>
|
||||
);
|
||||
return (
|
||||
<WithAuthMiddleware>
|
||||
<RolePermission requiredPermissions={requiredPermissions}>
|
||||
<TitlePage text="Dashboard.transportation_assistance"/>
|
||||
<DashboardTransportationAssistanceComponent/>
|
||||
</RolePermission>
|
||||
</WithAuthMiddleware>
|
||||
);
|
||||
}
|
||||
|
||||
export async function getServerSideProps({ req, locale }) {
|
||||
const { isBot } = parse(req.headers["user-agent"]);
|
||||
return {
|
||||
props: {
|
||||
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
||||
isBot,
|
||||
},
|
||||
};
|
||||
export async function getServerSideProps({req, locale}) {
|
||||
const {isBot} = parse(req.headers["user-agent"]);
|
||||
return {
|
||||
props: {
|
||||
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
||||
isBot,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
import FirstComponent from "@/components/first";
|
||||
import TitlePage from "@/core/components/TitlePage";
|
||||
import { parse } from "next-useragent";
|
||||
import {parse} from "next-useragent";
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<>
|
||||
<TitlePage text="first_page" />
|
||||
<FirstComponent />
|
||||
</>
|
||||
);
|
||||
return (
|
||||
<>
|
||||
<TitlePage text="first_page"/>
|
||||
<FirstComponent/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export async function getServerSideProps({ req, locale }) {
|
||||
const { isBot } = parse(req.headers["user-agent"]);
|
||||
return {
|
||||
props: {
|
||||
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
||||
isBot,
|
||||
},
|
||||
};
|
||||
export async function getServerSideProps({req, locale}) {
|
||||
const {isBot} = parse(req.headers["user-agent"]);
|
||||
return {
|
||||
props: {
|
||||
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
||||
isBot,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
import LoginComponent from "@/components/login-expert";
|
||||
import TitlePage from "@/core/components/TitlePage";
|
||||
import WithoutAuthMiddleware from "@/middlewares/WithoutAuth";
|
||||
import { parse } from "next-useragent";
|
||||
import {parse} from "next-useragent";
|
||||
import "react-toastify/dist/ReactToastify.css";
|
||||
import { ToastContainer } from "react-toastify";
|
||||
import {ToastContainer} from "react-toastify";
|
||||
import useDirection from "@/lib/app/hooks/useDirection";
|
||||
|
||||
export default function Login() {
|
||||
const { directionApp } = useDirection();
|
||||
return (
|
||||
<WithoutAuthMiddleware>
|
||||
<TitlePage text="Titles.title_login_expert_page" />
|
||||
<LoginComponent />
|
||||
{directionApp === "rtl" ? <ToastContainer rtl /> : <ToastContainer ltr />}
|
||||
</WithoutAuthMiddleware>
|
||||
);
|
||||
const {directionApp} = useDirection();
|
||||
return (
|
||||
<WithoutAuthMiddleware>
|
||||
<TitlePage text="Titles.title_login_expert_page"/>
|
||||
<LoginComponent/>
|
||||
{directionApp === "rtl" ? <ToastContainer rtl/> : <ToastContainer ltr/>}
|
||||
</WithoutAuthMiddleware>
|
||||
);
|
||||
}
|
||||
|
||||
export async function getServerSideProps({ req, locale }) {
|
||||
const { isBot } = parse(req.headers["user-agent"]);
|
||||
return {
|
||||
props: {
|
||||
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
||||
isBot,
|
||||
},
|
||||
};
|
||||
export async function getServerSideProps({req, locale}) {
|
||||
const {isBot} = parse(req.headers["user-agent"]);
|
||||
return {
|
||||
props: {
|
||||
messages: (await import(`&/locales/${locale}/app.json`)).default,
|
||||
isBot,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user