DashWind Admin Dashboard Template

repository·master·Indexed 22 days ago

https://github.com/robbins23/daisyui-admin-dashboard-template

A free, customizable admin dashboard template built with React JS v18.2.0, Tailwind CSS v3.3.6, and Daisy UI v4.4.19. It features Redux Toolkit for state management, token-based authentication, light/dark mode toggling, and data visualization via Chart.js 2. The template includes pre-built components such as a calendar with event management, a global modal system, a right-side drawer, and various chart types (Line, Bar, Doughnut, Pie, Scatter).

Tokens
7.7K
Snippets
34
Records
42
Agent score
77%

What's inside DashWind

  1. Overview of DashWind features

    master

    DashWind is a free admin dashboard template built with React JS and Daisy UI. It provides a fully customizable and themable CSS environment powered by Tailwind CSS.

    Key features include:

    • Theming: Light/dark mode toggle.
    • Authentication: Token-based user authentication.
    • Navigation: Sidebar with submenu support, right and left sidebars.
    • State Management: Store management using Redux Toolkit.
    • UI Components: Daisy UI components, universal loader, notifications, global modal, and calendar.
    • Data Visualization: Integration with Chart.js 2.
  2. How Transactions filtering and searching works

    master

    The Transactions component manages its own internal state for the displayed list of transactions (trans). It provides three primary interaction methods via its internal TopSideButtons sub-component:

    1. Search: When a user types in the SearchBar, the applySearch function filters the original RECENT_TRANSACTIONS list by checking if the transaction's email includes the search string (case-insensitive).
    2. Filter: Users can select a location from a dropdown menu. The applyFilter function filters the list to only include transactions matching that specific location.
    3. Remove: Users can clear both the active search text and the active location filter to restore the full list of transactions.
  3. How CalendarView handles event overflow

    master

    The CalendarView component limits the number of events displayed directly on the calendar grid to prevent UI clutter.

    • If a specific day has 2 or fewer events, all events are rendered normally.
    • If a day has more than 2 events, the component renders the first two events and then adds a special placeholder event with the title {originalLength - 2} more and a theme of "MORE".
    • Clicking this "more" placeholder triggers the openDayDetail prop, passing the full list of events for that day.
  4. Configure application routes in App.js

    master

    The application uses react-router-dom for routing. To add new pages or features, you should define new <Route /> components within the <Routes> block in App.js.

    Note the following routing patterns:

    • Public Routes: Routes like /login, /register, and /documentation are accessible directly.
    • Protected/Layout Routes: The /app/* path uses the Layout container. New application features should typically be nested under this path to inherit the dashboard layout.
    • Auth-based Redirect: The catch-all route (*) automatically redirects users to /app/welcome if a valid authentication token is present, or to /login if no token is found.
    <Router>
      <Routes>
        {/* Public routes */}
        <Route path="/login" element={<Login />} />
        
        {/* Place new routes over this to include them in the dashboard layout */}
        <Route path="/app/*" element={<Layout />} />
    
        {/* Redirect logic */}
        <Route path="*" element={<Navigate to={token ? "/app/welcome" : "/login"} replace />}/>
      </Routes>
    </Router>
  5. Initialize DaisyUI themes and application state

    master

    The application performs two main initialization steps upon startup:

    1. Library Initialization: initializeApp() is called to set up core libraries.
    2. Theme Management: The themeChange(false) function from the theme-change library is called inside a useEffect hook to initialize DaisyUI theme switching capabilities.
    3. Authentication Check: checkAuth() is called to retrieve the authentication token, which determines the initial redirect behavior.
    // Library initialization
    initializeApp();
    
    // Auth check
    const token = checkAuth();
    
    // Inside the App component
    useEffect(() => {
      themeChange(false);
    }, []);
  6. Configure application routes

    master

    The application uses a central routes array to map URL paths to React components. This array is exported as the default export from src/routes/index.js.

    Each route object in the array must contain:

    • path: A string representing the URL segment.
    • component: The React component to be rendered when the path matches.

    To optimize performance, components are loaded using React.lazy(), which enables code-splitting for each route.

    const routes = [
      {
        path: '/dashboard',
        component: Dashboard,
      },
      {
        path: '/leads',
        component: Leads,
      },
      // ... other routes
    ]
    
    export default routes
  7. Handle dashboard period updates

    master

    The DashboardTopBar component within the Dashboard feature accepts an updateDashboardPeriod prop. This callback is triggered when a user selects a new time range.

    When the period changes, the callback receives a newRange object containing startDate and endDate. You can use this to dispatch actions or trigger API calls to refresh the dashboard data.

    Example implementation pattern:

    const updateDashboardPeriod = (newRange) => {
        // newRange contains { startDate, endDate }
        // Implement logic to refresh your dashboard data here
        console.log(`Updating data from ${newRange.startDate} to ${newRange.endDate}`);
    };
  8. Manage leads with addNewLead and deleteLead actions

    master

    The leadsSlice provides two synchronous actions to modify the local leads state:

    • addNewLead: Adds a new lead object to the existing list. Expects a payload with the shape { newLeadObj: { ... } }.
    • deleteLead: Removes a lead from the list by its index. Expects a payload with the shape { index: number }.
    import { addNewLead, deleteLead } from './path/to/leadSlice';
    import { useDispatch } from 'react-redux';
    
    const dispatch = useDispatch();
    
    // To add a lead:
    dispatch(addNewLead({ newLeadObj: { name: 'John Doe', email: 'john@example.com' } }));
    
    // To delete a lead at a specific index:
    dispatch(deleteLead({ index: 0 }));
  9. Use the Dashboard component

    master

    The Dashboard component is the main entry point for the dashboard feature. It provides a layout containing a top bar for period selection, statistical cards, various charts (Line, Bar, Doughnut), and data tables (User Channels, Amount Stats, Page Stats).

    To integrate the dashboard and handle period changes, you should implement an updateDashboardPeriod function that reacts to the newRange object provided by the DashboardTopBar component. This function typically triggers data fetching or state updates to refresh the dashboard values.

    import Dashboard from './features/dashboard';
    
    function App() {
      return (
        <Dashboard />
      );
    }