image

Installation process

The following process will be used to install admin dashboard using package manager.

  • Install Node.js : Please install latest version of Node.js from https://nodejs.org
  • Extract main template : Extract the admin template site to your suitable directory or folder.
  • Access Command Prompt : Open node.js command prompt.
    • Note:- The process mentioned below can also be excuted with system command prompt.
  • In CMD, Navigate to the location where main folder is extracted.
  • Navigate to the root folder of project where package.json file exist.
  • Install node dependencies : Run npm install.
  • To run npm run dev.
    • Note:- when you run above command it will run project in browser automatically.
    • Note:- It will enable auto refresh function everytime you save a file.
  • Run command npm run build to build for production.

In case if you have any problems or query then please contact us

File Sturcture

The arrangement below describes our file structure.

  • Vristo
    • components
      • layouts
      • all the react js other components
    • pages
    • public
      • assets
        • images
      • locales
    • store
    • styles
    • App.tsx - custom app setting configuration file
    • next.config.js
    • ni18n.config.ts.js
    • package.json
    • postcss.config.js
    • tailwind.config.js
    • theme.config.tsx
    • tsconfig.json
    • .editorconfig
    • .gitignore
    • .prettierrc

Code Structure

This section will give you a brief description of our code.

1. Header Section : This is the default navbar section. It contains :

  • Sidebar Toggle button.
  • Quick access button for calendar.
  • Quick access button for todolist.
  • Quick access button for chat.
  • Search Bar
  • Theme toggle button.
  • Language Dropdown
  • Message Dropdown
  • Notification Dropdown
  • User Profile with Dropdown
  • Horizontal Menu

Note:- These categories are defined by us and you can modify as per your needs :)

  <!--  Navbar Component  -->
  <Header></Header>
  ==========================================================

  <!--  BEGIN NAVBAR  -->
  <header className={themeConfig.semidark && themeConfig.menu === 'horizontal' ? 'dark' : ''}>
      <div className="shadow-sm">
          <div className="relative flex w-full items-center bg-white px-5 py-2.5 dark:bg-[#0e1726]">
              ..............................
          </div>

          <!-- horizontal menu -->
          <ul
              className="horizontal-menu hidden border-t border-[#ebedf2] bg-white py-1.5 px-6 font-semibold text-black rtl:space-x-reverse dark:border-[#191e3a] dark:bg-[#0e1726] dark:text-white-dark lg:space-x-1.5 xl:space-x-8"
          >
              ..............................
          </ul>
      </div>
  </header>
  <!--  END NAVBAR  -->

2. Main Container Section : The main container section includes header, footer and main content section.

  • Sidebar Section
  • Header Section
  • Main Content Section
  • Footer Section
  <!--  BEGIN MAIN CONTAINER  -->
  <div
      className={`${(store.getState().themeConfig.sidebar && 'toggle-sidebar') || ''} ${themeConfig.menu} ${themeConfig.layout} ${
          themeConfig.rtlClass
      } main-section antialiased relative font-nunito text-sm font-normal`}
  >
      ..............................
  </div>
  <!-- END MAIN CONTAINER -->

3. Sidebar : This is the sidebar code.

  <!--  Sidebar Component  -->
  <Sidebar></Sidebar>
  ==========================================================

  <!--  BEGIN SIDEBAR  -->
  <div className={semidark ? 'dark' : ''}>
      <nav
          className={`sidebar fixed min-h-screen h-full top-0 bottom-0 w-[260px] shadow-[5px_0_25px_0_rgba(94,92,154,0.1)] z-50 transition-all duration-300 ${semidark ? 'text-white-dark' : ''}`}
      >
          ..............................
      </nav>
  </div>
  <!--  END SIDEBAR  -->

4. Main Content : This is the Main Content code section.

This is the root structure where you can create widgets, charts, tables etc.

  <!--  BEGIN CONTENT PART  -->
  <div className="main-content">
      ..............................
  </div>

  <!--  END CONTENT PART  -->

5. Footer : This is the Footer code.

  <!--  Footer Component  -->
  <Footer></Footer>
  ==========================================================

  <!--  BEGIN FOOTER  -->
  <p className="pt-6 text-center dark:text-white-dark ltr:sm:text-left rtl:sm:text-right">
      ..............................
  </p>
  <!--  END FOOTER  -->

The Combined Code

Now, after a brief description of our admin template. Below is the combined code of the snippets we have discuss above.

  <!--  BEGIN MAIN CONTAINER  -->
  <div className="main-section antialiased relative font-nunito text-sm font-normal" :className="[store.sidebar ? 'toggle-sidebar' : '', store.menu, store.layout, store.rtlClass]">
      <!-- BEGIN SIDEBAR MENU OVERLAY -->
      <div className={`${(!themeConfig.sidebar && 'hidden') || ''} fixed inset-0 bg-[black]/60 z-50 lg:hidden`} onClick={() => dispatch(toggleSidebar())}></div>
      <!-- END SIDEBAR MENU OVERLAY -->

      <!-- BEGIN SCREEN LOADER -->
      {showLoader && (
          <div className="screen_loader fixed inset-0 bg-[#fafafa] dark:bg-[#060818] z-[60] grid place-content-center animate__animated">
          <svg>...</svg>
      </div>
      )}
      <!-- END SCREEN LOADER -->

      <!-- BEGIN SCROLL TO TOP BUTTON -->
      <div className="fixed bottom-6 ltr:right-6 rtl:left-6 z-50">
          {showTopButton && (
              <button type="button" className="btn btn-outline-primary animate-pulse rounded-full bg-[#fafafa] p-2 dark:bg-[#060818] dark:hover:bg-primary" @click="goToTop">
                  <svg>...</svg>
              </button>
          )}
      </div>
      <!-- END SCROLL TO TOP BUTTON -->

      <!-- BEGIN APP SETTING LAUNCHER -->
      <Setting />
      <!-- END APP SETTING LAUNCHER -->

      <div className={`${themeConfig.navbar} main-container text-black dark:text-white-dark min-h-screen`}>
          <!--  BEGIN SIDEBAR  -->
          <Sidebar />
          <!--  END SIDEBAR  -->

          <!--  BEGIN CONTENT AREA  -->
          <div className="main-content">
              <!--  BEGIN NAVBAR  -->
              <Header />
              <!--  END NAVBAR  -->

                  <Suspense>
                      <div className={`${themeConfig.animation} p-6 animate__animated`}>
                  <!--  BEGIN PAGE CONTENT  -->
                          {children}

                            <!-- BEGIN FOOTER -->
                          <Footer />
                          <!-- END FOOTER -->
                      </div>
                  </Suspense>
                  <!--  END PAGE CONTENT  -->
          </div>
          <!--  END CONTENT AREA  -->
      </div>
  </div>
  <!--  END MAIN CONTAINER  -->

Admin JS Code Structure

This section will give you a brief description of our admin template JS code.

1. app-setting.js : This is primary js file. It is necessary for the layout to work. It contains the code as follows :-

  • Set default layout
  • Set Navigation Position
  • Set Navbar Type
  • Set Router Animation
  • Theme change funtionality
  • Direction change funtionality
    import { PropsWithChildren, useEffect } from 'react';
    import { useDispatch, useSelector } from 'react-redux';
    import { IRootState } from './store';
    import { toggleRTL, toggleTheme, toggleLocale, toggleMenu, toggleLayout, toggleAnimation, toggleNavbar, toggleSemidark } from './store/themeConfigSlice';
    import store from './store';

    function App({ children }: PropsWithChildren) {
        const themeConfig = useSelector((state: IRootState) => state.themeConfig);
        const dispatch = useDispatch();

        useEffect(() => {
            dispatch(toggleTheme(localStorage.getItem('theme') || themeConfig.theme));
            dispatch(toggleMenu(localStorage.getItem('menu') || themeConfig.menu));
            dispatch(toggleLayout(localStorage.getItem('layout') || themeConfig.layout));
            dispatch(toggleRTL(localStorage.getItem('rtlClass') || themeConfig.rtlClass));
            dispatch(toggleAnimation(localStorage.getItem('animation') || themeConfig.animation));
            dispatch(toggleNavbar(localStorage.getItem('navbar') || themeConfig.navbar));
            dispatch(toggleLocale(localStorage.getItem('i18nextLng') || themeConfig.locale));
            dispatch(toggleSemidark(localStorage.getItem('semidark') || themeConfig.semidark));
        }, [dispatch, themeConfig.rtlClass, themeConfig.theme, themeConfig.locale, themeConfig.menu, themeConfig.layout, themeConfig.animation, themeConfig.navbar, themeConfig.semidark]);

        return (
            <div
                className={`${(store.getState().themeConfig.sidebar && 'toggle-sidebar') || ''} ${themeConfig.menu} ${themeConfig.layout} ${
                    themeConfig.rtlClass
                } main-section antialiased relative font-nunito text-sm font-normal`}
            >
                {children}
            </div>
        );
    }

    export default App;

2. theme.config.js : This is theme configuration js file. This file contains optional setting for set defaut layout, theme and language functionality. It contains the code as follows :-

  • Language
  • Theme
  • Navigation
  • Layout
  • Direction
  • Animation
  • Navbar
  • Semidark
  // APP CONFIG
  export const $themeConfig = {
      locale: 'en', // en, da, de, el, es, fr, hu, it, ja, pl, pt, ru, sv, tr, zh
      theme: 'light', // light, dark, system
      menu: 'vertical', // vertical, collapsible-vertical, horizontal
      layout: 'full', // full, boxed-layout
      rtlClass: 'ltr', // rtl, ltr
      animation: '', // animate__fadeIn, animate__fadeInDown, animate__fadeInUp, animate__fadeInLeft, animate__fadeInRight, animate__slideInDown, animate__slideInLeft, animate__slideInRight, animate__zoomIn
      navbar: 'navbar-sticky', // navbar-sticky, navbar-floating, navbar-static
      semidark: false,
  };