import React, { useEffect, useMemo, useState } from 'react'; import { Alert, Badge, Breadcrumb, BreadcrumbItem, Button, ButtonDropdown, ButtonGroup, Col, DropdownItem, DropdownMenu, DropdownToggle, ListGroup, Progress, Row, Table, } from 'reactstrap'; import { Bell, ChatDots, Cloud, Eye, Person, Telephone, } from 'react-bootstrap-icons'; import { Link } from 'react-router-dom'; import { useAppDispatch, useAppSelector } from '../../app/hooks'; import { fetchPosts } from '../../features/posts/postsSlice'; import Widget from '../../components/Widget'; import s from './Dashboard.module.scss'; const formatDate = (value) => new Intl.DateTimeFormat('en', { month: 'short', day: 'numeric', year: 'numeric', }).format(new Date(value)); const quickLinks = [ { to: '/app/main', label: 'Incoming calls', icon: Telephone, badge: { color: 'danger', value: '3' }, }, { to: '/app/notifications', label: 'Notifications', icon: Bell, badge: { color: 'warning', value: '6' }, }, { to: '/app/posts', label: 'Messages', icon: ChatDots, badge: { color: 'success', value: '18' }, }, { to: '/app/main', label: 'Visits total', icon: Eye, }, { to: '/app/main', label: 'Inbox', icon: Cloud, }, ]; const Dashboard = () => { const dispatch = useAppDispatch(); const posts = useAppSelector((state) => state.posts.items); const fetchStatus = useAppSelector((state) => state.posts.fetchStatus); const [isDropdownOpened, setIsDropdownOpened] = useState(false); useEffect(() => { if (fetchStatus === 'idle' && posts.length === 0) { dispatch(fetchPosts()); } }, [dispatch, fetchStatus, posts.length]); const recentPosts = useMemo(() => posts.slice(0, 5), [posts]); return (
YOU ARE HERE Dashboard

Dashboard

Users
)} > {[ ['1', 'Alice', 'alice@email.com', 'active', 'success'], ['2', 'Bob', 'bob@email.com', 'delayed', 'warning'], ['3', 'Duck', 'duck@email.com', 'active', 'success'], ['4', 'Shepherd', 'shepherd@email.com', 'removed', 'danger'], ].map(([id, username, email, status, color]) => ( ))}
ID Username Email Status
{id} {username} {email} {status}
Warning: Track dependency drift proactively. Success: The template now boots on a modern runtime. Info: Demo data is local-first and easy to replace. Action: Connect a real API before production.
Options
Recent posts {recentPosts.length}

Latest entries from the local demo feed.

)} > {recentPosts.map((post) => ( ))} {fetchStatus === 'loading' ? ( ) : null} {fetchStatus !== 'loading' && recentPosts.length === 0 ? ( ) : null}
{formatDate(post.updatedAt)} {post.title}
Loading...
No posts yet.
View all Posts {posts.length}
{quickLinks.map(({ badge, icon: ShortcutIcon, label, to }) => ( {label} {badge ? ( {badge.value} ) : ( )} ))}
setIsDropdownOpened((value) => !value)}> Dropdown 1 2

For more components, check the{' '} reactstrap documentation .

); }; export default Dashboard;