Initial commit: SmoothSchedule multi-tenant scheduling platform
This commit includes: - Django backend with multi-tenancy (django-tenants) - React + TypeScript frontend with Vite - Platform administration API with role-based access control - Authentication system with token-based auth - Quick login dev tools for testing different user roles - CORS and CSRF configuration for local development - Docker development environment setup 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
41
frontend/src/pages/Scheduler.tsx
Normal file
41
frontend/src/pages/Scheduler.tsx
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Scheduler - Main wrapper component that renders appropriate scheduler view
|
||||
* Refactored to avoid conditional hooks issue
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { useOutletContext } from 'react-router-dom';
|
||||
import { User, Business } from '../types';
|
||||
import { useAppointments, useUpdateAppointment, useDeleteAppointment } from '../hooks/useAppointments';
|
||||
import { useResources } from '../hooks/useResources';
|
||||
import { useServices } from '../hooks/useServices';
|
||||
import ResourceScheduler from './ResourceScheduler';
|
||||
import OwnerScheduler from './OwnerScheduler';
|
||||
|
||||
const Scheduler: React.FC = () => {
|
||||
const { user, business } = useOutletContext<{ user: User, business: Business }>();
|
||||
|
||||
// Fetch data from API (shared across both views)
|
||||
const { data: appointments = [], isLoading: appointmentsLoading } = useAppointments();
|
||||
const { data: resources = [], isLoading: resourcesLoading } = useResources();
|
||||
const { data: services = [], isLoading: servicesLoading } = useServices();
|
||||
|
||||
// Show loading state
|
||||
if (appointmentsLoading || resourcesLoading || servicesLoading) {
|
||||
return (
|
||||
<div className="flex items-center justify-center h-screen">
|
||||
<div className="text-gray-500 dark:text-gray-400">Loading scheduler...</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// Render appropriate scheduler based on user role
|
||||
if (user.role === 'resource') {
|
||||
return <ResourceScheduler user={user} business={business} />;
|
||||
}
|
||||
|
||||
// Owner, manager, staff get horizontal timeline view
|
||||
return <OwnerScheduler user={user} business={business} />;
|
||||
};
|
||||
|
||||
export default Scheduler;
|
||||
Reference in New Issue
Block a user