Initial Commit
This commit is contained in:
36
mvp-platform-services/landing/Dockerfile
Normal file
36
mvp-platform-services/landing/Dockerfile
Normal file
@@ -0,0 +1,36 @@
|
||||
FROM node:18-alpine as builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files and install dependencies
|
||||
COPY package.json ./
|
||||
RUN npm install
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Build arguments for environment variables
|
||||
ARG VITE_AUTH0_DOMAIN
|
||||
ARG VITE_AUTH0_CLIENT_ID
|
||||
ARG VITE_TENANTS_API_URL
|
||||
|
||||
# Set environment variables for build
|
||||
ENV VITE_AUTH0_DOMAIN=${VITE_AUTH0_DOMAIN}
|
||||
ENV VITE_AUTH0_CLIENT_ID=${VITE_AUTH0_CLIENT_ID}
|
||||
ENV VITE_TENANTS_API_URL=${VITE_TENANTS_API_URL}
|
||||
|
||||
# Build the application
|
||||
RUN npm run build
|
||||
|
||||
# Production stage
|
||||
FROM nginx:alpine
|
||||
|
||||
# Copy built app to nginx
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||
|
||||
# Copy nginx configuration
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
13
mvp-platform-services/landing/index.html
Normal file
13
mvp-platform-services/landing/index.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>MotoVaultPro - Vehicle Management Platform</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
27
mvp-platform-services/landing/nginx.conf
Normal file
27
mvp-platform-services/landing/nginx.conf
Normal file
@@ -0,0 +1,27 @@
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
# Single HTTP server for internal proxying (edge TLS handled by nginx-proxy)
|
||||
server {
|
||||
listen 3000;
|
||||
server_name localhost motovaultpro.com;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# Handle React Router (SPA)
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# Security headers
|
||||
add_header X-Frame-Options DENY;
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
add_header X-XSS-Protection "1; mode=block";
|
||||
}
|
||||
}
|
||||
26
mvp-platform-services/landing/nginx.conf.backup
Normal file
26
mvp-platform-services/landing/nginx.conf.backup
Normal file
@@ -0,0 +1,26 @@
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
server {
|
||||
listen 3000;
|
||||
server_name localhost;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# Handle React Router (SPA)
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# Security headers
|
||||
add_header X-Frame-Options DENY;
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
add_header X-XSS-Protection "1; mode=block";
|
||||
}
|
||||
}
|
||||
24
mvp-platform-services/landing/package.json
Normal file
24
mvp-platform-services/landing/package.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "mvp-platform-landing",
|
||||
"version": "1.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "tsc && vite build",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"react-router-dom": "^6.8.0",
|
||||
"@auth0/auth0-react": "^2.2.3",
|
||||
"axios": "^1.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^18.2.0",
|
||||
"@types/react-dom": "^18.2.0",
|
||||
"@vitejs/plugin-react": "^4.2.0",
|
||||
"typescript": "^5.6.3",
|
||||
"vite": "^5.0.6"
|
||||
}
|
||||
}
|
||||
19
mvp-platform-services/landing/src/App.tsx
Normal file
19
mvp-platform-services/landing/src/App.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import { Routes, Route } from 'react-router-dom'
|
||||
import HomePage from './components/HomePage'
|
||||
import TenantSignup from './components/TenantSignup'
|
||||
import CallbackHandler from './components/CallbackHandler'
|
||||
|
||||
function App() {
|
||||
|
||||
return (
|
||||
<div className="App">
|
||||
<Routes>
|
||||
<Route path="/" element={<HomePage />} />
|
||||
<Route path="/signup/:tenantId" element={<TenantSignup />} />
|
||||
<Route path="/callback" element={<CallbackHandler />} />
|
||||
</Routes>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default App
|
||||
@@ -0,0 +1,22 @@
|
||||
import React, { useEffect } from 'react'
|
||||
|
||||
const CallbackHandler: React.FC = () => {
|
||||
useEffect(() => {
|
||||
// This component is no longer needed since we removed Auth0 from landing page
|
||||
// Redirect to main app
|
||||
window.location.href = 'https://admin.motovaultpro.com'
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div style={{
|
||||
padding: '2rem',
|
||||
textAlign: 'center',
|
||||
fontFamily: 'Arial, sans-serif'
|
||||
}}>
|
||||
<h2>Redirecting...</h2>
|
||||
<p>Please wait while we redirect you to MotoVaultPro.</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default CallbackHandler
|
||||
55
mvp-platform-services/landing/src/components/HomePage.tsx
Normal file
55
mvp-platform-services/landing/src/components/HomePage.tsx
Normal file
@@ -0,0 +1,55 @@
|
||||
import React from 'react'
|
||||
|
||||
const HomePage: React.FC = () => {
|
||||
const handleLogin = () => {
|
||||
// Redirect directly to admin tenant for login
|
||||
window.location.href = 'https://admin.motovaultpro.com'
|
||||
}
|
||||
|
||||
return (
|
||||
<div style={{ padding: '2rem', fontFamily: 'Arial, sans-serif' }}>
|
||||
<header style={{ textAlign: 'center', marginBottom: '3rem' }}>
|
||||
<h1>MotoVaultPro</h1>
|
||||
<p>The complete vehicle management platform for automotive professionals</p>
|
||||
</header>
|
||||
|
||||
<main style={{ maxWidth: '800px', margin: '0 auto' }}>
|
||||
<section style={{ marginBottom: '3rem' }}>
|
||||
<h2>Features</h2>
|
||||
<ul>
|
||||
<li>Vehicle inventory management</li>
|
||||
<li>Maintenance tracking and scheduling</li>
|
||||
<li>Fuel log analytics</li>
|
||||
<li>Service station locator</li>
|
||||
<li>Multi-tenant architecture for teams</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section style={{ textAlign: 'center' }}>
|
||||
<h2>Get Started</h2>
|
||||
<p>Already have an account?</p>
|
||||
<button
|
||||
onClick={handleLogin}
|
||||
style={{
|
||||
padding: '1rem 2rem',
|
||||
fontSize: '1.1rem',
|
||||
backgroundColor: '#007bff',
|
||||
color: 'white',
|
||||
border: 'none',
|
||||
borderRadius: '4px',
|
||||
cursor: 'pointer'
|
||||
}}
|
||||
>
|
||||
Access Your Dashboard
|
||||
</button>
|
||||
|
||||
<p style={{ marginTop: '2rem' }}>
|
||||
Need to join a team? Contact your tenant administrator for an invitation.
|
||||
</p>
|
||||
</section>
|
||||
</main>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default HomePage
|
||||
109
mvp-platform-services/landing/src/components/TenantSignup.tsx
Normal file
109
mvp-platform-services/landing/src/components/TenantSignup.tsx
Normal file
@@ -0,0 +1,109 @@
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import { useParams } from 'react-router-dom'
|
||||
import { useAuth0 } from '@auth0/auth0-react'
|
||||
import axios from 'axios'
|
||||
|
||||
interface TenantInfo {
|
||||
id: string
|
||||
name: string
|
||||
status: string
|
||||
}
|
||||
|
||||
const TenantSignup: React.FC = () => {
|
||||
const { tenantId } = useParams<{ tenantId: string }>()
|
||||
const { loginWithRedirect } = useAuth0()
|
||||
const [tenant, setTenant] = useState<TenantInfo | null>(null)
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
|
||||
useEffect(() => {
|
||||
const fetchTenant = async () => {
|
||||
try {
|
||||
const response = await axios.get(
|
||||
`${import.meta.env.VITE_TENANTS_API_URL}/api/v1/tenants/${tenantId}`
|
||||
)
|
||||
setTenant(response.data)
|
||||
} catch (err) {
|
||||
setError('Tenant not found or not accepting signups')
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
if (tenantId) {
|
||||
fetchTenant()
|
||||
}
|
||||
}, [tenantId])
|
||||
|
||||
const handleSignup = async () => {
|
||||
await loginWithRedirect({
|
||||
authorizationParams: {
|
||||
screen_hint: 'signup',
|
||||
redirect_uri: `${window.location.origin}/callback`
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (loading) {
|
||||
return <div style={{ padding: '2rem' }}>Loading...</div>
|
||||
}
|
||||
|
||||
if (error || !tenant) {
|
||||
return (
|
||||
<div style={{ padding: '2rem', textAlign: 'center' }}>
|
||||
<h2>Tenant Not Found</h2>
|
||||
<p>{error}</p>
|
||||
<a href="/">Return to Homepage</a>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div style={{ padding: '2rem', maxWidth: '600px', margin: '0 auto', fontFamily: 'Arial, sans-serif' }}>
|
||||
<header style={{ textAlign: 'center', marginBottom: '2rem' }}>
|
||||
<h1>Join {tenant.name}</h1>
|
||||
<p>Create your account to get started</p>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<div style={{
|
||||
border: '1px solid #ddd',
|
||||
borderRadius: '8px',
|
||||
padding: '2rem',
|
||||
backgroundColor: '#f9f9f9'
|
||||
}}>
|
||||
<h3>What happens next?</h3>
|
||||
<ol>
|
||||
<li>Create your account with Auth0</li>
|
||||
<li>Your signup request will be sent to the tenant administrator</li>
|
||||
<li>Once approved, you'll receive access to {tenant.name}</li>
|
||||
<li>Login at <code>{tenant.id}.motovaultpro.com</code></li>
|
||||
</ol>
|
||||
|
||||
<div style={{ textAlign: 'center', marginTop: '2rem' }}>
|
||||
<button
|
||||
onClick={handleSignup}
|
||||
style={{
|
||||
padding: '1rem 2rem',
|
||||
fontSize: '1.1rem',
|
||||
backgroundColor: '#28a745',
|
||||
color: 'white',
|
||||
border: 'none',
|
||||
borderRadius: '4px',
|
||||
cursor: 'pointer'
|
||||
}}
|
||||
>
|
||||
Create Account for {tenant.name}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style={{ textAlign: 'center', marginTop: '2rem' }}>
|
||||
<a href="/">← Back to Homepage</a>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default TenantSignup
|
||||
12
mvp-platform-services/landing/src/main.tsx
Normal file
12
mvp-platform-services/landing/src/main.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import React from 'react'
|
||||
import ReactDOM from 'react-dom/client'
|
||||
import { BrowserRouter } from 'react-router-dom'
|
||||
import App from './App'
|
||||
|
||||
ReactDOM.createRoot(document.getElementById('root')!).render(
|
||||
<React.StrictMode>
|
||||
<BrowserRouter>
|
||||
<App />
|
||||
</BrowserRouter>
|
||||
</React.StrictMode>
|
||||
)
|
||||
11
mvp-platform-services/landing/src/vite-env.d.ts
vendored
Normal file
11
mvp-platform-services/landing/src/vite-env.d.ts
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
interface ImportMetaEnv {
|
||||
readonly VITE_AUTH0_DOMAIN: string
|
||||
readonly VITE_AUTH0_CLIENT_ID: string
|
||||
readonly VITE_TENANTS_API_URL: string
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
readonly env: ImportMetaEnv
|
||||
}
|
||||
21
mvp-platform-services/landing/tsconfig.json
Normal file
21
mvp-platform-services/landing/tsconfig.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2020",
|
||||
"useDefineForClassFields": true,
|
||||
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||
"module": "ESNext",
|
||||
"skipLibCheck": true,
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx",
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
},
|
||||
"include": ["src"],
|
||||
"references": [{ "path": "./tsconfig.node.json" }]
|
||||
}
|
||||
9
mvp-platform-services/landing/tsconfig.node.json
Normal file
9
mvp-platform-services/landing/tsconfig.node.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"skipLibCheck": true,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler"
|
||||
},
|
||||
"include": ["vite.config.ts"]
|
||||
}
|
||||
14
mvp-platform-services/landing/vite.config.ts
Normal file
14
mvp-platform-services/landing/vite.config.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
server: {
|
||||
host: true,
|
||||
port: 3000
|
||||
},
|
||||
build: {
|
||||
outDir: 'dist',
|
||||
sourcemap: true
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user