feat(tenant): Add public-facing landing page for business subdomains
- New TenantLandingPage component with 'Coming Soon' message - Shows business name derived from subdomain - Has 'Sign In' button that goes to /login - 'Powered by SmoothSchedule' footer - Will be customizable later for each tenant 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -61,6 +61,7 @@ const VerifyEmail = React.lazy(() => import('./pages/VerifyEmail'));
|
||||
const EmailVerificationRequired = React.lazy(() => import('./pages/EmailVerificationRequired'));
|
||||
const AcceptInvitePage = React.lazy(() => import('./pages/AcceptInvitePage'));
|
||||
const TenantOnboardPage = React.lazy(() => import('./pages/TenantOnboardPage'));
|
||||
const TenantLandingPage = React.lazy(() => import('./pages/TenantLandingPage'));
|
||||
const Tickets = React.lazy(() => import('./pages/Tickets')); // Import Tickets page
|
||||
const HelpGuide = React.lazy(() => import('./pages/HelpGuide')); // Import Platform Guide page
|
||||
const HelpTicketing = React.lazy(() => import('./pages/HelpTicketing')); // Import Help page for ticketing
|
||||
@@ -287,29 +288,40 @@ const AppContent: React.FC = () => {
|
||||
);
|
||||
}
|
||||
|
||||
// Not authenticated - redirect to root domain for login if on subdomain
|
||||
// Not authenticated - show appropriate page based on subdomain
|
||||
if (!user) {
|
||||
// If on a subdomain, redirect to root domain login page
|
||||
const currentHostname = window.location.hostname;
|
||||
const hostnameParts = currentHostname.split('.');
|
||||
const baseDomain = hostnameParts.length >= 2
|
||||
? hostnameParts.slice(-2).join('.')
|
||||
: currentHostname;
|
||||
const isRootDomainForUnauthUser = currentHostname === baseDomain || currentHostname === 'localhost';
|
||||
const isPlatformSubdomain = hostnameParts[0] === 'platform';
|
||||
const currentSubdomain = hostnameParts[0];
|
||||
|
||||
// Don't redirect for certain public paths that should work on any subdomain
|
||||
const publicPaths = ['/accept-invite', '/verify-email', '/tenant-onboard'];
|
||||
const currentPath = window.location.pathname;
|
||||
const isPublicPath = publicPaths.some(path => currentPath.startsWith(path));
|
||||
// Check if we're on a business subdomain (not root, not platform, not api)
|
||||
const isBusinessSubdomain = !isRootDomainForUnauthUser && !isPlatformSubdomain && currentSubdomain !== 'api';
|
||||
|
||||
if (!isRootDomainForUnauthUser && !isPublicPath) {
|
||||
// Redirect to root domain login (preserve port)
|
||||
const protocol = window.location.protocol;
|
||||
const port = window.location.port ? `:${window.location.port}` : '';
|
||||
window.location.href = `${protocol}//${baseDomain}${port}/login`;
|
||||
return <LoadingScreen />;
|
||||
// For business subdomains, show the tenant landing page with login option
|
||||
if (isBusinessSubdomain) {
|
||||
return (
|
||||
<Suspense fallback={<LoadingScreen />}>
|
||||
<Routes>
|
||||
<Route path="/" element={<TenantLandingPage subdomain={currentSubdomain} />} />
|
||||
<Route path="/login" element={<LoginPage />} />
|
||||
<Route path="/mfa-verify" element={<MFAVerifyPage />} />
|
||||
<Route path="/oauth/callback/:provider" element={<OAuthCallback />} />
|
||||
<Route path="/verify-email" element={<VerifyEmail />} />
|
||||
<Route path="/accept-invite" element={<AcceptInvitePage />} />
|
||||
<Route path="/accept-invite/:token" element={<AcceptInvitePage />} />
|
||||
<Route path="/tenant-onboard" element={<TenantOnboardPage />} />
|
||||
<Route path="*" element={<Navigate to="/" replace />} />
|
||||
</Routes>
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
|
||||
// For root domain or platform subdomain, show marketing site / login
|
||||
return (
|
||||
<Suspense fallback={<LoadingScreen />}>
|
||||
<Routes>
|
||||
|
||||
Reference in New Issue
Block a user