FAQ
How I can remove the Customizer(Setting) button?
For example, I want to remove the theme setting button from the default layout. First of all, I need to go to the src/@crema/components/AppLayout/DefaultLayout/index.js
file, and to remove the customizer button, I need to remove <AppThemeSetting/> Tag.
In case you are using another layout go to the src/@crema/components/AppLayout/{Layout}/index.js
and remove the <AppThemeSetting/> Tag.
Is there any way to remove the menus from the left sidebar? what all files do I need to remove it from?
Yes, You can remove the menus from the left sidebar. but we suggest that it would be great if you use the starter_template of your desired version. In case you want to remove a few menus from the template then you can follow the following steps
Go to the
src/@crema/core/AppRoutes/routeConfig.js
file and remove the object that you don't want to use in your left sidebar. In the Next.js version please modify thesrc/@crema/core/AppRoutes/routeConfig.js
Remove all unrelated routes from the
src/@crema/core/AppRoutes/index.js
file. (Only for CRA)Remove all unrelated files/modules from the
src/modules/
directory. And remove the unrelated routes (Only for CRA)If you are using the Next.js version you need to remove from the
src/modules/
src/pages/
directory
Which icon package is used for the sidebar menu icons?
We are using react-icons for the sidebar menu. you can check out these here: https://react-icons.github.io/react-icons/
How easy is it to extract the Mail App into my own project?
There are a few simple steps to move apps into a separate project.
Copy the Mail folder into your project from the apps
Add the Mail app's route into your project and link it to your navigation(You can update the base path 'apps/mail' to as your project need.)
Copy AppsContainer from the core components
Copy the MailApp action and reducer file from the redux and link it to your app redux.
In case you want to use a fake API and database, please copy the DB file and mock API into your project(In case you want to integrate it with your API Please link your API to mail)
Please make sure you initialize APIs in your demo version.
How I can remove the default login email and password?
If you are using the CRA version then go to src/modules/auth/Signin/SigninFirebase.js
and remove the initialValues and follow a similar way for other types of authentication.
initialValues={{// remove this attribute of Formik
email: 'crema.demo@gmail.com',
password: 'Pass@1!@all',
}}
Where I can found the Nextjs Document?
If you are using the Next.js Version of Crema. For now, You should follow the same doc for the Next.js version.
Where I can found the TypeScript Document?
If you are using the Typescript Version of Crema. You should follow the same doc for the TypeScript version. The folder structure and way of code style are the same for all versions of Crema.
Where I can change the initial URL of the theme?
To change the initial path you need to change the NX_INITIAL_URL value in the .env file
How I can set dynamic initialUrl instead of static url('/dashboards/crypto')?
If you want to assign the dynamic URL then you need to get your URL in the src/@crema/core/AppLayout/index.js
file and assign it to the initURL like below.
// Update this initURL by using any method you like.
// You can access it from the user of authUser hook.There are a lot of possibility
const initURL = params?.redirect ? params?.redirect : initialUrl;
How I change the menu text in existing version?
To change the text of the menu you need to update the locale value to a particular messageId you need to follow the following steps to achieve that.
Copy your messageId. It looks like this "sidebar.apps.wall" in the below message
messageId: "sidebar.apps.wall",
Search it in your locale file in the
src/shared/localization/locales/{locale}.json
file and replace its value according to you.
"sidebar.apps.wall": "Wall App",
How I can rid-off from the locale(Multilingual)?
Go to the .env file and set NX_MULTILINGUAL to false.
Is the Crema use nextjs default routing or its use next-router?
Crema uses the default routing method in Next.js. In this routing method page route is based on the file and directory name.
Where I can change the logo of Crema?
To change the logo you need to go to the file src/@crema/components/AppLayout/components/AppLogo/index.js
. You can modify this file according to your requirements.
import React from 'react';
import {Box} from '@mui/material';
import {useThemeContext} from '@crema/context/AppContextProvider/ThemeContextProvider';
import {alpha} from '@mui/material/styles';
import {ReactComponent as Logo} from '../../../../../assets/icon/logo.svg';
import {ReactComponent as LogoText} from '../../../../../assets/icon/logo_text.svg';
const AppLogo = () => {
const {theme} = useThemeContext();
return (
<Box
sx={{
height: {xs: 56, sm: 70},
padding: 2.5,
display: 'flex',
flexDirection: 'row',
cursor: 'pointer',
alignItems: 'center',
justifyContent: 'center',
'& svg': {
height: {xs: 40, sm: 45},
},
}}
className='app-logo'
>
<Logo fill={theme.palette.primary.main} />
<Box
sx={{
mt: 1,
display: {xs: 'none', md: 'block'},
'& svg': {
height: {xs: 25, sm: 30},
},
}}
>
<LogoText fill={alpha(theme.palette.text.primary, 0.8)} />
</Box>
</Box>
);
};
export default AppLogo;
How I can fix the scrolling of the Navbar jumping back to the top of the menu when clicking on a menu item(NextJs)?
To stop the jump back to the top, you need to follow the following steps.
Go to the file
libs/components/src/lib/AppLayout/components/VerticalNav/index.js
and add the following code.
const {pathname} = useRouter();
useEffect(() => {
if (process.browser) {
if (pathname === item.url && document.getElementById(pathname)) {
setTimeout(() => {
document
.getElementById(pathname)
.scrollIntoView({behavior: 'smooth', block: 'center'});
}, 1);
}
}
}, [pathname]);
2. Replace the following anchor tag in the same file VerticalItem/index.js
// Replace this with
<a style={{textDecoration: 'none'}}>
// Replace with this
<a style={{textDecoration: 'none'}} id={item.url}>
How can I change the current font ?
To change the Crema Current font you need to follow the following steps.
1. Go to the file public/index.htm
l and Replace the current Poppins font with your current font <link href="https://fonts.googleapis.com/css2?family=Be Vietnam:wght@100;200;300;400;500;600&display=swap"rel="stylesheet">
2. Go to the file libs/constants/src/defaultConfig.js
and replace the font family in the Typography
export const defaultTheme = {
theme: {
...
typography: {
fontFamily: ['Be Vietnam', 'sans-serif'].join(','),
},
...
};
3. Go to the file src/@crema/constants/AppEnums.js
update the Font weight according to your project.
export enum Fonts {
LIGHT = "300",
REGULAR = "400",
MEDIUM = "500",
SEMI_BOLD = "600",
BOLD = "700",
}
4. Go to the file src/styles/base.css
and replace the current font family 'Be Vietnam' with your current font in this file
How to disable the mock api in the App?
We suggest, please start your project with the starter kit. To fetch data from real APIs, you need to follow the following steps.
Update
src/@crema/mockapi/index.js
the file's content like below.
import jwtAxios from '@crema/services/axios';
// import MockAdapter from 'axios-mock-adapter';
// export default new MockAdapter(jwtAxios, { delayResponse: 200 });
export default jwtAxios;
Remove the following import statement from the
src/App.js
file.
import '@crema/mockapi';
Make sure you are using the axios from the following lib in APIHooks or Redux Actions, by default we are using it from
'@crema/services/axios'
import jwtAxios from '@crema/services/auth/JWT';
How to fix: BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default (froala-editor\js)
Can't resolve 'crypto' in '..\node_modules\froala-editor\js'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
The above error occurs due to the froala-editor compatibility with webpack 5.
The froala-editor team will fix this in their next update. Till then you can remove this file src/modules/thirdParty/froalaEditor/index.js
. and remove the froala-editor dependency.
How can I make server-side requests on a page, with the JWT token?
Here is an example of the code getting data from an API using a JWT token on the server side
const Page = (props) => {
return <PageDetail {...props} />;
};
export const getServerSideProps = async (context) => {
const { slug } = params;
const token = getCookie('token', { req, res });
const props = {};
try {
setAuthToken(token);
const response = await httpClient.get(`get-data/${slug}/`, {
token: token,
});
if (isRequestSuccessful(response.status)) {
const data= response.data.data;
props = { data };
}
} catch (error) {
console.log('error: ', error);
}
return {
props,
};
};
export default Page;
How InfoViewContext works?
InfoViewContext has all the info about the API state like loading/success/error, according to their updated state, it will show the loader, success, and error message on the UI. We can set ferchStart, fetchMessage, and fetchError according to your requirement and This component will handle the state in the proper way
Please let us know if you missed anything in the docs. We will add that asap.
Last updated