Skip to content

FiveStackDev/Dev_ResourceHub_FrontEnd

Repository files navigation

Resource Hub

License: MIT React TypeScript Vite

Resource Hub is a comprehensive web application designed for efficient management of organizational resources, including meals, assets, and maintenance tasks. Built with modern React and TypeScript, it provides distinct interfaces and functionalities for Administrators, SuperAdmins, and regular Users with advanced role-based access control.

πŸš€ Demo

Note: Add screenshots or demo links here once available

πŸ“‹ Table of Contents

✨ Features

πŸ‘¨β€πŸ’Ό Admin & SuperAdmin Features

  • Dashboard: Comprehensive overview of organizational statistics and activities with advanced analytics
  • Meal Management:
    • Configure meal types (breakfast, lunch, dinner) and custom meal categories
    • Set meal times and availability schedules
    • Monitor meal requests and generate analytics reports
    • Manage requested meals with approval workflows
  • Asset Management:
    • Add, edit, and delete organizational assets across multiple categories
    • Monitor asset requests and allocations in real-time
    • Track asset status, availability, and due dates
    • Comprehensive asset monitoring with category-based filtering
  • Maintenance Management:
    • Review and assign maintenance requests across multiple categories
    • Set priorities and track task statuses with detailed workflows
    • Manage maintenance services including tech support, general maintenance, cleaning, furniture, safety, and lighting
  • User Management: Create, edit, and manage user accounts with role-based permissions
  • Advanced Reporting: Generate detailed PDF reports for meals, assets, and maintenance activities
  • System Settings: Configure application-wide settings and organization details
  • Role Switching: SuperAdmins can switch between admin and user views

πŸ‘€ User Features

  • Personal Dashboard: View personalized statistics, upcoming activities, and quick actions
  • Meal Requests:
    • Interactive FullCalendar interface for meal booking and management
    • View meal schedules, availability, and personal meal history
  • Asset Requests:
    • Submit asset requests with category-based filtering
    • Track asset request status and due dates
    • View personal asset allocation history
  • Maintenance Requests: Report maintenance issues and track progress with detailed status updates
  • Notifications: Real-time notifications system with unread count indicators
  • Profile Settings: Manage personal information, account settings, and theme preferences
  • View Organization: Access organization details and user directory

πŸ”’ Common Features

  • Advanced Role-Based Access Control: Secure, permission-based interface with support for User, Admin, and SuperAdmin roles
  • Responsive Design: Fully optimized for desktop, tablet, and mobile devices
  • Advanced Theme Support: Light and dark mode options with dynamic theme switching
  • Real-time Notifications: Instant updates, alerts, and notification management system
  • PDF Export: Generate and download comprehensive reports
  • Protected Routes: Secure routing with authentication and authorization guards
  • Multi-Layout Architecture: Separate layouts for Admin and User interfaces
  • Context-Based State Management: Efficient global state management with React Context

πŸ›  Tech Stack

Frontend Framework & Core

  • Framework: React 18.3.1 with TypeScript 5.5.3
  • Build Tool: Vite 5.4.2 (Lightning-fast development and build)
  • UI Framework: Material-UI (MUI) 5.14.16
  • Styling: Tailwind CSS 3.4.1 + PostCSS 8.4.35
  • Routing: React Router DOM 7.5.2

State Management & Data Fetching

  • API Client: Axios 1.9.0
  • Data Fetching: TanStack React Query 5.74.7
  • Context Management: React Context API for global state
  • Authentication: JWT-based authentication with protected routes

UI Components & Libraries

  • Calendar: FullCalendar 6.1.17 (with React integration)
  • Charts & Analytics: Chart.js 4.4.0 + react-chartjs-2 5.2.0, Recharts 2.15.3
  • Icons: Material-UI Icons, Lucide React 0.344.0
  • Notifications: React Hot Toast 2.5.2, React Toastify 11.0.5
  • PDF Generation: html2pdf.js 0.10.3

Development Tools & Configuration

  • Linting: ESLint 9.9.1 with TypeScript support and Prettier integration
  • Formatting: Prettier 3.5.3 with consistent code style
  • CSS Processing: PostCSS 8.4.35, Autoprefixer 10.4.18
  • Type Checking: TypeScript with strict configuration

πŸ“ Project Structure

Resource_Hub-Frontend/
β”œβ”€β”€ public/                         # Static assets and media files
β”‚   β”œβ”€β”€ *.png                      # Application images and logos
β”‚   β”œβ”€β”€ Asset/                     # Asset category icons (Electronics, Furniture, etc.)
β”‚   β”œβ”€β”€ Maintenance/               # Maintenance-related images and categories
β”‚   └── Report/                    # Report category icons and assets
β”‚
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ App.jsx                    # Main application component with routing configuration
β”‚   β”œβ”€β”€ main.jsx                   # Application entry point with providers
β”‚   β”œβ”€β”€ index.css                  # Global styles (Tailwind base configuration)
β”‚   β”‚
β”‚   β”œβ”€β”€ components/                # Reusable UI components organized by feature
β”‚   β”‚   β”œβ”€β”€ ProtectedRoute.tsx     # Route protection with role-based access control
β”‚   β”‚   β”œβ”€β”€ Asset/                 # Asset management components
β”‚   β”‚   β”‚   β”œβ”€β”€ AssetMonitoring/   # Asset monitoring and tracking features
β”‚   β”‚   β”‚   β”œβ”€β”€ AssetRequestingUser/ # User asset request components and dialogs
β”‚   β”‚   β”‚   └── OrganizationAssets/ # Organization asset management tools
β”‚   β”‚   β”œβ”€β”€ Calendar/              # Calendar and meal scheduling components
β”‚   β”‚   β”‚   β”œβ”€β”€ CalendarComponents.css # Calendar-specific styling
β”‚   β”‚   β”‚   β”œβ”€β”€ MealTimeCard.jsx   # Meal time selection components
β”‚   β”‚   β”‚   β”œβ”€β”€ MealTypeCard.jsx   # Meal type management
β”‚   β”‚   β”‚   └── Calender-CSS/      # Calendar styling directory
β”‚   β”‚   β”œβ”€β”€ Dashboard/             # Dashboard components for different roles
β”‚   β”‚   β”‚   β”œβ”€β”€ Admin/             # Admin dashboard features and charts
β”‚   β”‚   β”‚   β”œβ”€β”€ Common/            # Shared dashboard components
β”‚   β”‚   β”‚   └── User/              # User dashboard features
β”‚   β”‚   β”œβ”€β”€ Maintenance/           # Maintenance management system
β”‚   β”‚   β”‚   β”œβ”€β”€ Admin/             # Admin maintenance tools and tables
β”‚   β”‚   β”‚   β”œβ”€β”€ User/              # User maintenance request components
β”‚   β”‚   β”‚   └── shared/            # Shared maintenance components
β”‚   β”‚   β”œβ”€β”€ Meal/                  # Meal management system
β”‚   β”‚   β”‚   β”œβ”€β”€ Meal-CSS/          # Meal-specific styling
β”‚   β”‚   β”‚   β”œβ”€β”€ MealTime/          # Meal timing components
β”‚   β”‚   β”‚   β”œβ”€β”€ MealType/          # Meal type management
β”‚   β”‚   β”‚   └── RequestedMeals/    # Meal request management
β”‚   β”‚   β”œβ”€β”€ Notification/          # Notification system components
β”‚   β”‚   β”œβ”€β”€ Report/                # Reporting and analytics components
β”‚   β”‚   β”œβ”€β”€ Settings/              # Application settings management
β”‚   β”‚   β”‚   β”œβ”€β”€ Account/           # Account settings
β”‚   β”‚   β”‚   β”œβ”€β”€ Appearance/        # Theme and appearance settings
β”‚   β”‚   β”‚   β”œβ”€β”€ Organization/      # Organization configuration
β”‚   β”‚   β”‚   β”œβ”€β”€ Profile/           # Profile management
β”‚   β”‚   β”‚   └── Shared/            # Shared settings components
β”‚   β”‚   └── Users/                 # User management components
β”‚   β”‚
β”‚   β”œβ”€β”€ contexts/                  # React context providers for global state
β”‚   β”‚   β”œβ”€β”€ SidebarContext.tsx     # Sidebar state and mobile responsiveness
β”‚   β”‚   └── UserContext.tsx        # User authentication and role management
β”‚   β”‚
β”‚   β”œβ”€β”€ hooks/                     # Custom React hooks for reusable logic
β”‚   β”‚   β”œβ”€β”€ useNotifications.js    # Notification management and real-time updates
β”‚   β”‚   └── useThemeStyles.js      # Theme and styling utilities
β”‚   β”‚
β”‚   β”œβ”€β”€ layouts/                   # Page layout structures for different user roles
β”‚   β”‚   β”œβ”€β”€ Admin/                 # Admin layout with header and sidebar
β”‚   β”‚   β”‚   β”œβ”€β”€ AdminLayout.jsx    # Main admin layout wrapper
β”‚   β”‚   β”‚   β”œβ”€β”€ AdminHeader.jsx    # Admin-specific header with notifications
β”‚   β”‚   β”‚   └── AdminSidebar.jsx   # Admin navigation sidebar
β”‚   β”‚   β”œβ”€β”€ User/                  # User layout components
β”‚   β”‚   β”‚   β”œβ”€β”€ UserLayout.jsx     # Main user layout wrapper
β”‚   β”‚   β”‚   β”œβ”€β”€ UserHeader.jsx     # User-specific header
β”‚   β”‚   β”‚   └── UserSidebar.jsx    # User navigation sidebar
β”‚   β”‚   └── shared/                # Shared layout components
β”‚   β”‚       β”œβ”€β”€ BaseLayout.jsx     # Base layout structure
β”‚   β”‚       β”œβ”€β”€ AppHeader.jsx      # Shared header component
β”‚   β”‚       └── SidebarWrapper.jsx # Sidebar wrapper component
β”‚   β”‚
β”‚   β”œβ”€β”€ pages/                     # Top-level page components organized by role
β”‚   β”‚   β”œβ”€β”€ Auth/                  # Authentication pages
β”‚   β”‚   β”‚   β”œβ”€β”€ Login.jsx          # User login with role-based routing
β”‚   β”‚   β”‚   β”œβ”€β”€ Register.jsx       # User registration
β”‚   β”‚   β”‚   └── ForgotPassword.jsx # Password recovery
β”‚   β”‚   β”œβ”€β”€ Admin/                 # Admin-specific pages
β”‚   β”‚   β”‚   β”œβ”€β”€ DashboardAdmin.jsx # Admin dashboard with analytics
β”‚   β”‚   β”‚   β”œβ”€β”€ Requested_Assets/  # Asset management pages
β”‚   β”‚   β”‚   β”œβ”€β”€ Organization_Assets/ # Organization asset pages
β”‚   β”‚   β”‚   β”œβ”€β”€ Maintenance/       # Maintenance management pages
β”‚   β”‚   β”‚   β”œβ”€β”€ Meal_Management/   # Meal configuration pages
β”‚   β”‚   β”‚   β”œβ”€β”€ Reports/           # Report generation pages
β”‚   β”‚   β”‚   └── UserManagement/    # User administration pages
β”‚   β”‚   β”œβ”€β”€ User/                  # User-specific pages
β”‚   β”‚   β”‚   β”œβ”€β”€ DashboardUser.jsx  # User dashboard
β”‚   β”‚   β”‚   β”œβ”€β”€ RequestAsset/      # Asset request pages
β”‚   β”‚   β”‚   β”œβ”€β”€ MealRequest/       # Meal booking pages
β”‚   β”‚   β”‚   β”œβ”€β”€ Maintenance/       # Maintenance request pages
β”‚   β”‚   β”‚   └── ViewUsers/         # User directory pages
β”‚   β”‚   β”œβ”€β”€ Shared/                # Pages accessible by multiple roles
β”‚   β”‚   β”‚   β”œβ”€β”€ Settings.jsx       # Settings management
β”‚   β”‚   β”‚   β”œβ”€β”€ Notification.jsx   # Notification center
β”‚   β”‚   β”‚   └── OrganizationDetails.jsx # Organization information
β”‚   β”‚   └── css/                   # Page-specific stylesheets
β”‚   β”‚
β”‚   β”œβ”€β”€ query/                     # React Query hooks for data fetching
β”‚   β”‚   β”œβ”€β”€ adminDashboardQueries.js # Admin dashboard data queries
β”‚   β”‚   └── userDashboardQueries.js  # User dashboard data queries
β”‚   β”‚
β”‚   β”œβ”€β”€ services/                  # External service integrations and API management
β”‚   β”‚   └── api/                   # API service configurations
β”‚   β”‚       β”œβ”€β”€ config.js          # API endpoints and base URLs
β”‚   β”‚       └── notificationService.js # Notification API service
β”‚   β”‚
β”‚   β”œβ”€β”€ theme/                     # Material-UI theme configuration
β”‚   β”‚   β”œβ”€β”€ theme.ts               # Theme definitions and color schemes
β”‚   β”‚   └── ThemeProvider.tsx      # Theme provider with context
β”‚   β”‚
β”‚   β”œβ”€β”€ utils/                     # Utility functions and helpers
β”‚   β”‚   β”œβ”€β”€ authHeader.js          # Authentication header utilities
β”‚   β”‚   β”œβ”€β”€ dateUtils.js           # Date manipulation and formatting
β”‚   β”‚   β”œβ”€β”€ notificationApi.js     # Notification API utilities
β”‚   β”‚   └── sendAssetNotification.js # Asset notification helpers
β”‚   β”‚
β”‚   β”œβ”€β”€ styles/                    # Additional styling resources
β”‚   └── css/                       # Global CSS files
β”‚
β”œβ”€β”€ Configuration Files/
β”œβ”€β”€ eslint.config.js               # ESLint configuration with TypeScript rules
β”œβ”€β”€ tailwind.config.js             # Tailwind CSS configuration and theme
β”œβ”€β”€ postcss.config.js              # PostCSS configuration for CSS processing
β”œβ”€β”€ vite.config.ts                 # Vite build configuration and optimization
β”œβ”€β”€ vercel.json                    # Vercel deployment configuration
└── package.json                   # Project dependencies and npm scripts

🚦 Application Routes

Public Routes

  • / - Redirects to login page
  • /login - User authentication
  • /register - User registration
  • /forgot-password - Password recovery

Admin Routes (Admin & SuperAdmin Access)

  • /admin-dashboardadmin - Admin dashboard with analytics
  • /admin-assethome - Asset categories overview
  • /admin-assetmonitoring - Asset monitoring and tracking
  • /admin-dueassets - Assets due for return
  • /admin-asset - Organization asset management
  • /admin-maintenance - Maintenance request management
  • /admin-maintenancehome - Maintenance categories
  • /admin-reporthome - Reports dashboard
  • /admin-assetreport - Asset reports
  • /admin-mealreport - Meal reports
  • /admin-maintenancereport - Maintenance reports
  • /admin-mealTimes - Meal time configuration
  • /admin-mealTypes - Meal type management
  • /admin-requestedMeals - Meal request management
  • /admin-users - User management

User Routes

  • /user-dashboarduser - User dashboard
  • /user-users - User directory
  • /user-assetrequest - Asset request submission
  • /user-dueassets - User's due assets
  • /user-mealcalendar - Meal booking calendar
  • /user-maintenance - Maintenance request submission

Shared Routes (All Authenticated Users)

  • /notifications - Notification center
  • /settings - Application settings
  • /organization - Organization details

πŸ“‹ Prerequisites

Before you begin, ensure you have the following installed on your system:

  • Node.js (version 16.0 or higher)
  • npm (version 7.0 or higher) or yarn (version 1.22 or higher)
  • Git (for cloning the repository)

πŸš€ Installation

1. Clone the Repository

git clone https://github.com/FiveStackDev/Resource_Hub-Frontend.git
cd Resource_Hub-Frontend

2. Install Dependencies

Using npm:

npm install

Or using yarn:

yarn install

3. Environment Configuration

Create a .env file in the root directory and configure your environment variables:

# Cloudinary Configuration (for file uploads)
VITE_CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name
VITE_CLOUDINARY_UPLOAD_PRESET=your_upload_preset
VITE_CLOUDINARY_API_URL=https://api.cloudinary.com/v1_1/your_cloud_name/image/upload

# Optional: Additional configuration variables
VITE_APP_NAME=Resource Hub

Note: The application uses Cloudinary for file uploads (profile pictures, asset images, etc.). Get your Cloudinary credentials from your Cloudinary Dashboard. The API endpoints are configured directly in src/services/api/config.js and don't require environment variables for local development.

🎯 Usage

Development Mode

Start the development server:

npm run dev

Or with yarn:

yarn dev

The application will open in your browser at http://localhost:5173 (or the port specified by Vite).

Production Build

Build the application for production:

npm run build

This creates an optimized production build in the dist folder.

Preview Production Build

Preview the production build locally:

npm run preview

πŸ“œ Scripts

Script Description
npm run dev Start development server with hot reload
npm run build Build the application for production
npm run preview Preview the production build locally
npm run lint Run ESLint to check code quality
npm run format Format code using Prettier

πŸ”Œ API Integration

This frontend application is designed to work with a microservices architecture and requires multiple backend services to function properly. The application communicates with various backend services through RESTful APIs:

Microservices Integration

  • Authentication Service (Port 9094): User login, registration, and JWT token management
  • Asset Management Service (Port 9090): Asset CRUD operations, asset requests, and monitoring
  • Maintenance Service (Port 9090): Maintenance request handling and task management
  • User Management Service (Port 9090): User profile management and organization settings
  • Calendar Service (Port 9090): Meal scheduling and calendar operations
  • Notification Service (Port 9093): Real-time notifications and alerts
  • Dashboard Services (Port 9092): Analytics data for admin and user dashboards

Configuration

The API endpoints are configured in src/services/api/config.js. The application supports both local development and production deployment configurations:

  • Local Development: Individual microservice URLs on different ports
  • Production: Unified backend URL with service-specific endpoints

Ensure all required backend services are running and properly configured before starting the frontend application.

πŸ—οΈ Architecture Overview

The application follows a modern, scalable architecture with clear separation of concerns:

Component Architecture

  • Modular Component Structure: Reusable UI components organized by feature and domain
  • Role-Based Layouts: Separate layout systems for Admin and User interfaces
  • Protected Routing: Comprehensive route protection with multi-level role authorization
  • Shared Components: Common UI elements and utilities across different user roles

State Management

  • Context-Based Global State: React Context for user authentication, sidebar state, and theme management
  • Query-Based Data Fetching: TanStack React Query for efficient server state management
  • Local Component State: React hooks for component-specific state management

Design Patterns

  • Higher-Order Components: Protected routes and layout wrappers
  • Custom Hooks: Reusable logic for notifications, themes, and data fetching
  • Provider Pattern: Context providers for global state management
  • Compound Components: Complex UI components with multiple sub-components

Microservices Integration

  • Service-Oriented Architecture: Integration with multiple backend microservices
  • API Abstraction: Centralized API configuration and service management
  • Error Handling: Comprehensive error handling and user feedback systems

🀝 Contributing

We welcome contributions to the Resource Hub project! Please follow these guidelines:

Development Workflow

  1. Fork the repository
  2. Create a new branch for your feature (git checkout -b feature/amazing-feature)
  3. Commit your changes with conventional commit messages (git commit -m 'feat: add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request with detailed description

Code Standards

  • TypeScript: Use TypeScript for type safety where applicable
  • ESLint & Prettier: Follow the existing code style and formatting rules
  • Component Structure: Organize components by feature and maintain consistent file structure
  • Naming Conventions: Use descriptive names for components, hooks, and utilities
  • Comments: Add JSDoc comments for complex logic and component props
  • Testing: Ensure all functionality works before submitting (testing framework to be implemented)

Commit Message Convention

Follow conventional commit format:

  • feat: New features
  • fix: Bug fixes
  • docs: Documentation updates
  • style: Code style changes
  • refactor: Code refactoring
  • test: Test additions or updates

Issue Reporting

When reporting issues, please include:

  • Clear Description: Detailed explanation of the problem
  • Reproduction Steps: Step-by-step instructions to reproduce the issue
  • Expected vs Actual Behavior: What should happen vs what actually happens
  • Environment Information: Browser, version, operating system
  • Screenshots/Logs: Visual evidence or console logs if applicable
  • User Role: Specify if the issue occurs for Admin, User, or SuperAdmin roles

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ‘₯ Team

FiveStackDev - Development Team

Core Contributors


πŸ“ž Support

For support and questions:


πŸš€ Deployment

Vercel Deployment

The application is configured for Vercel deployment with vercel.json. To deploy:

  1. Connect your repository to Vercel
  2. Configure environment variables in Vercel dashboard
  3. Deploy automatically on push to main branch

Manual Deployment

  1. Build the application: npm run build
  2. Deploy the dist folder to your hosting service
  3. Configure environment variables for production API URLs

πŸ”§ Development Notes

Browser Compatibility

  • Modern Browsers: Chrome 90+, Firefox 88+, Safari 14+, Edge 90+
  • Mobile Support: iOS Safari 14+, Chrome Mobile 90+
  • Progressive Enhancement: Graceful degradation for older browsers

Performance Considerations

  • Code Splitting: Route-based code splitting with React.lazy
  • Bundle Optimization: Vite optimization for production builds
  • Asset Optimization: Image optimization and lazy loading
  • Caching Strategy: Browser caching for static assets

Database Relational Schema

Database_Diagram

⭐ Star this repo if you find it helpful! ⭐

Releases

No releases published

Packages

No packages published

Contributors 5