AeThex-OS/client/src/hooks/use-platform-layout.ts
MrPiglr a15b5b1015 feat: integrate AeThex Language across entire OS ecosystem
Major Features:
- Custom .aethex programming language with cross-platform compilation
- Compiles to JavaScript, Lua (Roblox), Verse (UEFN), and C# (Unity)
- Built-in COPPA compliance and PII detection for safe metaverse development

Integration Points:
1. Terminal Integration
   - Added 'aethex' command for in-terminal compilation
   - Support for all compilation targets with --target flag
   - Real-time error reporting and syntax highlighting

2. IDE Integration
   - Native .aethex file support in Monaco editor
   - One-click compilation with target selector
   - Download compiled code functionality
   - Two example files: hello.aethex and auth.aethex

3. Curriculum Integration
   - New "AeThex Language" section in Foundry tech tree
   - Three modules: Realities & Journeys, Cross-Platform Sync, COPPA Compliance
   - Certification path for students

4. Documentation Site
   - Complete docs at /docs route (client/src/pages/aethex-docs.tsx)
   - Searchable documentation with sidebar navigation
   - Language guide, standard library reference, and examples
   - Ready for deployment to aethex.dev

5. npm Package Publishing
   - @aethex.os/core@1.0.0 - Standard library (published)
   - @aethex.os/cli@1.0.1 - Command line compiler (published)
   - Both packages live on npm and globally installable

Domain Configuration:
- DNS setup for 29+ domains (aethex.app, aethex.co, etc.)
- nginx reverse proxy configuration
- CORS configuration for cross-domain requests
- OAuth redirect fixes for hash-based routing

Standard Library Features:
- Passport: Universal identity across platforms
- DataSync: Cross-platform data synchronization
- SafeInput: PII detection (phone, email, SSN, credit cards)
- Compliance: COPPA/FERPA age gates and audit logging

Documentation Package:
- Created aethex-dev-docs.zip with complete documentation
- Ready for static site deployment
- Includes examples, API reference, and quickstart guide

Technical Improvements:
- Fixed OAuth blank page issue (hash routing)
- Added .gitignore rules for temp files
- Cleaned up build artifacts and temporary files
- Updated all package references to @aethex.os namespace

Co-Authored-By: Claude <noreply@anthropic.com>
2026-02-11 22:28:05 -07:00

120 lines
3.5 KiB
TypeScript

import { useMemo } from 'react';
import { isMobile, isDesktop, isWeb } from '@/lib/platform';
interface LayoutConfig {
isMobile: boolean;
isDesktop: boolean;
isWeb: boolean;
containerClass: string;
cardClass: string;
navClass: string;
spacing: string;
fontSize: string;
}
/**
* Hook to get platform-specific layout configuration
* Use this to conditionally render or style components based on platform
*/
export function usePlatformLayout(): LayoutConfig {
// Call detection functions once and cache
const platformCheck = useMemo(() => {
const mobile = isMobile();
const desktop = isDesktop();
const web = isWeb();
return { isMobile: mobile, isDesktop: desktop, isWeb: web };
}, []); // Empty array - only check once on mount
const config = useMemo((): LayoutConfig => {
if (platformCheck.isMobile) {
// Tablet Optimization: Check if screen is large enough (e.g. iPad/Tablet)
const isTablet = typeof window !== 'undefined' && window.innerWidth >= 768;
if (isTablet) {
return {
...platformCheck,
// Tablet styling (Hybrid)
containerClass: 'px-6 py-4 max-w-2xl mx-auto', // Centered content for tablets
cardClass: 'rounded-xl shadow-md border p-5',
navClass: 'fixed bottom-0 left-0 right-0 bg-background/95 backdrop-blur border-t z-50',
spacing: 'space-y-4',
fontSize: 'text-base',
};
}
return {
...platformCheck,
// Mobile-first container styling (Phone)
containerClass: 'px-4 py-3 max-w-full',
cardClass: 'rounded-lg shadow-sm border p-4',
navClass: 'fixed bottom-0 left-0 right-0 bg-background border-t',
spacing: 'space-y-3',
fontSize: 'text-base',
};
}
if (platformCheck.isDesktop) {
return {
...platformCheck,
// Desktop app styling
containerClass: 'px-8 py-6 max-w-7xl mx-auto',
cardClass: 'rounded-xl shadow-lg border p-6',
navClass: 'fixed top-0 left-0 right-0 bg-background border-b',
spacing: 'space-y-6',
fontSize: 'text-sm',
};
}
// Web browser styling (default)
return {
...platformCheck,
containerClass: 'px-6 py-4 max-w-6xl mx-auto',
cardClass: 'rounded-xl shadow-md border p-6',
navClass: 'sticky top-0 bg-background/95 backdrop-blur border-b z-50',
spacing: 'space-y-4',
fontSize: 'text-sm',
};
}, [platformCheck]);
return config;
}
/**
* Get platform-specific class names
*/
export function usePlatformClasses() {
const layout = usePlatformLayout();
return {
container: layout.containerClass,
card: layout.cardClass,
nav: layout.navClass,
spacing: layout.spacing,
fontSize: layout.fontSize,
// Additional utility classes
button: layout.isMobile ? 'h-12 text-base' : 'h-10 text-sm',
input: layout.isMobile ? 'h-12 text-base' : 'h-10 text-sm',
heading: layout.isMobile ? 'text-2xl' : 'text-3xl',
subheading: layout.isMobile ? 'text-lg' : 'text-xl',
};
}
/**
* Conditional rendering based on platform
*/
export function PlatformSwitch({
mobile,
desktop,
web,
fallback
}: {
mobile?: React.ReactNode;
desktop?: React.ReactNode;
web?: React.ReactNode;
fallback?: React.ReactNode;
}) {
if (isMobile() && mobile) return mobile as React.ReactElement;
if (isDesktop() && desktop) return desktop as React.ReactElement;
if (isWeb() && web) return web as React.ReactElement;
return (fallback || null) as React.ReactElement;
}