Spaces:
Paused
Paused
Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +1 -0
- .github/workflows/sync-to-hf.yml +19 -0
- .gitignore +24 -0
- .hfignore +5 -0
- Agent.md +81 -0
- App.tsx +137 -0
- Dockerfile +24 -0
- README.md +25 -4
- components/Accuracy.tsx +86 -0
- components/ChatPage.tsx +466 -0
- components/Documentation.tsx +81 -0
- components/FAQ.tsx +54 -0
- components/Footer.tsx +27 -0
- components/Hero.tsx +78 -0
- components/HowItWorks.tsx +80 -0
- components/InteractiveDemo.tsx +374 -0
- components/Navbar.tsx +104 -0
- components/Pricing.tsx +104 -0
- components/ProductGuide.tsx +109 -0
- components/ProductOverview.tsx +55 -0
- components/RealNetworkGraph.tsx +128 -0
- components/SimulationGraph.tsx +244 -0
- components/SimulationPage.tsx +641 -0
- components/Testimonials.tsx +47 -0
- components/TrustedBy.tsx +89 -0
- components/UseCases.tsx +32 -0
- components/ui/Button.tsx +40 -0
- constants.ts +73 -0
- dist/assets/index-hfJc7AJb.js +0 -0
- dist/index.html +80 -0
- gradio_api.txt +129 -0
- index.html +72 -0
- index.tsx +15 -0
- node_modules/.bin/acorn +4 -0
- node_modules/.bin/baseline-browser-mapping +2 -0
- node_modules/.bin/browserslist +156 -0
- node_modules/.bin/esbuild +3 -0
- node_modules/.bin/escodegen +77 -0
- node_modules/.bin/esgenerate +64 -0
- node_modules/.bin/esparse +139 -0
- node_modules/.bin/esvalidate +236 -0
- node_modules/.bin/findup +41 -0
- node_modules/.bin/geo2svg +89 -0
- node_modules/.bin/geograticule +55 -0
- node_modules/.bin/geojson-rewind +33 -0
- node_modules/.bin/geoproject +53 -0
- node_modules/.bin/geoquantize +40 -0
- node_modules/.bin/geostitch +37 -0
- node_modules/.bin/glslify +101 -0
- node_modules/.bin/hfjs +0 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
node_modules/.bin/esbuild filter=lfs diff=lfs merge=lfs -text
|
.github/workflows/sync-to-hf.yml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Sync to Hugging Face hub
|
| 2 |
+
on:
|
| 3 |
+
push:
|
| 4 |
+
branches: [main]
|
| 5 |
+
workflow_dispatch:
|
| 6 |
+
|
| 7 |
+
jobs:
|
| 8 |
+
sync-to-hub:
|
| 9 |
+
runs-on: ubuntu-latest
|
| 10 |
+
steps:
|
| 11 |
+
- uses: actions/checkout@v3
|
| 12 |
+
with:
|
| 13 |
+
fetch-depth: 0
|
| 14 |
+
lfs: true
|
| 15 |
+
- name: Push to hub
|
| 16 |
+
env:
|
| 17 |
+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 18 |
+
run: |
|
| 19 |
+
git push --force https://AUXteam:$HF_TOKEN@huggingface.co/spaces/AUXteam/UserSyncInterface main
|
.gitignore
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Logs
|
| 2 |
+
logs
|
| 3 |
+
*.log
|
| 4 |
+
npm-debug.log*
|
| 5 |
+
yarn-debug.log*
|
| 6 |
+
yarn-error.log*
|
| 7 |
+
pnpm-debug.log*
|
| 8 |
+
lerna-debug.log*
|
| 9 |
+
|
| 10 |
+
node_modules
|
| 11 |
+
dist
|
| 12 |
+
dist-ssr
|
| 13 |
+
*.local
|
| 14 |
+
|
| 15 |
+
# Editor directories and files
|
| 16 |
+
.vscode/*
|
| 17 |
+
!.vscode/extensions.json
|
| 18 |
+
.idea
|
| 19 |
+
.DS_Store
|
| 20 |
+
*.suo
|
| 21 |
+
*.ntvs*
|
| 22 |
+
*.njsproj
|
| 23 |
+
*.sln
|
| 24 |
+
*.sw?
|
.hfignore
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
node_modules/
|
| 2 |
+
.git/
|
| 3 |
+
test-results/
|
| 4 |
+
.env
|
| 5 |
+
.env.local
|
Agent.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Agent Deployment Information
|
| 2 |
+
|
| 3 |
+
This file informs further agents about deployment best practices and tricks for the UserSyncFrontend on Hugging Face Spaces.
|
| 4 |
+
|
| 5 |
+
## 1. Deployment Configuration
|
| 6 |
+
|
| 7 |
+
### Target Space
|
| 8 |
+
- **Profile:** Leon4gr45
|
| 9 |
+
- **Space:** UserSyncFrontend
|
| 10 |
+
- **Full Identifier:** Leon4gr45/UserSyncFrontend
|
| 11 |
+
- **Frontend Port:** 7860
|
| 12 |
+
|
| 13 |
+
### Deployment Method
|
| 14 |
+
- **Docker SDK**
|
| 15 |
+
|
| 16 |
+
### Mandatory Endpoints
|
| 17 |
+
- `/health`: Returns HTTP 200 when the app is ready.
|
| 18 |
+
- `/api-docs`: Documents all available API endpoints. Reachable at `https://leon4gr45-usersyncfrontend.hf.space/api-docs`.
|
| 19 |
+
|
| 20 |
+
## 2. API Endpoints
|
| 21 |
+
|
| 22 |
+
### /api/craft
|
| 23 |
+
- **Method:** POST
|
| 24 |
+
- **Purpose:** Run model inference via Blablador API to craft content.
|
| 25 |
+
- **Request:** `{"content": "string", "variation": "string"}`
|
| 26 |
+
- **Response:** `{"result": "string"}`
|
| 27 |
+
|
| 28 |
+
### /api/config
|
| 29 |
+
- **Method:** GET
|
| 30 |
+
- **Purpose:** Retrieve OAuth configuration.
|
| 31 |
+
|
| 32 |
+
### /login
|
| 33 |
+
- **Method:** GET
|
| 34 |
+
- **Purpose:** Initiate Hugging Face OAuth login flow.
|
| 35 |
+
|
| 36 |
+
### /oauth/callback
|
| 37 |
+
- **Method:** GET
|
| 38 |
+
- **Purpose:** OAuth callback handler.
|
| 39 |
+
|
| 40 |
+
### /api/user
|
| 41 |
+
- **Method:** GET
|
| 42 |
+
- **Purpose:** Get authenticated user information.
|
| 43 |
+
|
| 44 |
+
### /api/logout
|
| 45 |
+
- **Method:** GET
|
| 46 |
+
- **Purpose:** Logout user and clear session.
|
| 47 |
+
|
| 48 |
+
### /api/save-data
|
| 49 |
+
- **Method:** POST
|
| 50 |
+
- **Purpose:** Save simulation data.
|
| 51 |
+
- **Request:** `{"type": "string", "data": "any", "user": "string"}`
|
| 52 |
+
|
| 53 |
+
### /api/list-data
|
| 54 |
+
- **Method:** GET
|
| 55 |
+
- **Purpose:** List saved simulation data.
|
| 56 |
+
|
| 57 |
+
### /health
|
| 58 |
+
- **Method:** GET
|
| 59 |
+
- **Purpose:** Health check endpoint.
|
| 60 |
+
|
| 61 |
+
## 3. Deployment Workflow
|
| 62 |
+
|
| 63 |
+
### Clean Remote Space
|
| 64 |
+
```bash
|
| 65 |
+
hf repos ls --repo-type space Leon4gr45/UserSyncFrontend
|
| 66 |
+
hf repos delete-files Leon4gr45/UserSyncFrontend <file> --repo-type space
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
### Standard Deployment Command
|
| 70 |
+
```bash
|
| 71 |
+
hf upload Leon4gr45/UserSyncFrontend --repo-type=space
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
### Monitoring Logs
|
| 75 |
+
```bash
|
| 76 |
+
# Build logs
|
| 77 |
+
curl -N -H "Authorization: Bearer <HF_TOKEN>" "https://huggingface.co/api/spaces/Leon4gr45/UserSyncFrontend/logs/build"
|
| 78 |
+
|
| 79 |
+
# Run logs
|
| 80 |
+
curl -N -H "Authorization: Bearer <HF_TOKEN>" "https://huggingface.co/api/spaces/Leon4gr45/UserSyncFrontend/logs/run"
|
| 81 |
+
```
|
App.tsx
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import React, { useState, useEffect } from 'react';
|
| 3 |
+
import { X } from 'lucide-react';
|
| 4 |
+
import Navbar from './components/Navbar';
|
| 5 |
+
import Hero from './components/Hero';
|
| 6 |
+
import TrustedBy from './components/TrustedBy';
|
| 7 |
+
import ProductOverview from './components/ProductOverview';
|
| 8 |
+
import InteractiveDemo from './components/InteractiveDemo';
|
| 9 |
+
import UseCases from './components/UseCases';
|
| 10 |
+
import HowItWorks from './components/HowItWorks';
|
| 11 |
+
import Accuracy from './components/Accuracy';
|
| 12 |
+
import Documentation from './components/Documentation';
|
| 13 |
+
import FAQ from './components/FAQ';
|
| 14 |
+
import Footer from './components/Footer';
|
| 15 |
+
import SimulationPage from './components/SimulationPage';
|
| 16 |
+
import ChatPage from './components/ChatPage';
|
| 17 |
+
import ProductGuide from './components/ProductGuide';
|
| 18 |
+
|
| 19 |
+
function App() {
|
| 20 |
+
const [currentView, setCurrentView] = useState<'landing' | 'simulation' | 'chat' | 'guide'>('simulation');
|
| 21 |
+
const [user, setUser] = useState<any>(null);
|
| 22 |
+
const [simulationResult, setSimulationResult] = useState<any>(null);
|
| 23 |
+
|
| 24 |
+
useEffect(() => {
|
| 25 |
+
const fetchUser = async () => {
|
| 26 |
+
try {
|
| 27 |
+
const response = await fetch('/api/user');
|
| 28 |
+
if (response.ok) {
|
| 29 |
+
const data = await response.json();
|
| 30 |
+
setUser(data);
|
| 31 |
+
}
|
| 32 |
+
} catch (error) {
|
| 33 |
+
console.error("Failed to fetch user:", error);
|
| 34 |
+
}
|
| 35 |
+
};
|
| 36 |
+
fetchUser();
|
| 37 |
+
|
| 38 |
+
// Listen for storage changes in case of popup login
|
| 39 |
+
const handleStorage = () => fetchUser();
|
| 40 |
+
window.addEventListener('storage', handleStorage);
|
| 41 |
+
return () => window.removeEventListener('storage', handleStorage);
|
| 42 |
+
}, []);
|
| 43 |
+
|
| 44 |
+
const loginWithHF = () => {
|
| 45 |
+
// Open in a new tab to pop out of iframe
|
| 46 |
+
window.open('/login', '_blank');
|
| 47 |
+
};
|
| 48 |
+
|
| 49 |
+
const handleLogout = async () => {
|
| 50 |
+
await fetch('/api/logout');
|
| 51 |
+
setUser(null);
|
| 52 |
+
};
|
| 53 |
+
|
| 54 |
+
const startSimulation = () => {
|
| 55 |
+
setCurrentView('simulation');
|
| 56 |
+
window.scrollTo(0,0);
|
| 57 |
+
};
|
| 58 |
+
|
| 59 |
+
const goBackToLanding = () => {
|
| 60 |
+
setCurrentView('landing');
|
| 61 |
+
};
|
| 62 |
+
|
| 63 |
+
const openChat = () => {
|
| 64 |
+
setCurrentView('chat');
|
| 65 |
+
};
|
| 66 |
+
|
| 67 |
+
const openGuide = () => {
|
| 68 |
+
setCurrentView('guide');
|
| 69 |
+
};
|
| 70 |
+
|
| 71 |
+
const goBackToSimulation = () => {
|
| 72 |
+
setCurrentView('simulation');
|
| 73 |
+
};
|
| 74 |
+
|
| 75 |
+
if (currentView === 'guide') {
|
| 76 |
+
return (
|
| 77 |
+
<div className="bg-black min-h-screen relative">
|
| 78 |
+
<button
|
| 79 |
+
onClick={goBackToSimulation}
|
| 80 |
+
className="absolute top-8 left-8 p-3 bg-gray-900 border border-gray-800 rounded-full text-white hover:bg-gray-800 transition-colors z-50"
|
| 81 |
+
>
|
| 82 |
+
<X size={24} />
|
| 83 |
+
</button>
|
| 84 |
+
<ProductGuide />
|
| 85 |
+
</div>
|
| 86 |
+
);
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
if (currentView === 'simulation') {
|
| 90 |
+
return (
|
| 91 |
+
<SimulationPage
|
| 92 |
+
onBack={goBackToLanding}
|
| 93 |
+
onOpenChat={openChat}
|
| 94 |
+
onOpenGuide={openGuide}
|
| 95 |
+
user={user}
|
| 96 |
+
onLogin={loginWithHF}
|
| 97 |
+
onLogout={handleLogout}
|
| 98 |
+
simulationResult={simulationResult}
|
| 99 |
+
setSimulationResult={setSimulationResult}
|
| 100 |
+
/>
|
| 101 |
+
);
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
if (currentView === 'conversation') {
|
| 105 |
+
return <ConversationPage onBack={goBackToSimulation} />;
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
if (currentView === 'chat') {
|
| 109 |
+
return (
|
| 110 |
+
<ChatPage
|
| 111 |
+
onBack={goBackToSimulation}
|
| 112 |
+
simulationResult={simulationResult}
|
| 113 |
+
setSimulationResult={setSimulationResult}
|
| 114 |
+
/>
|
| 115 |
+
);
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
return (
|
| 119 |
+
<div className="bg-black min-h-screen text-white selection:bg-teal-500/30">
|
| 120 |
+
<Navbar onStart={startSimulation} onLogin={loginWithHF} user={user} />
|
| 121 |
+
<main>
|
| 122 |
+
<Hero onStart={startSimulation} />
|
| 123 |
+
<TrustedBy />
|
| 124 |
+
<ProductOverview />
|
| 125 |
+
<InteractiveDemo />
|
| 126 |
+
<UseCases />
|
| 127 |
+
<HowItWorks />
|
| 128 |
+
<Accuracy />
|
| 129 |
+
<Documentation />
|
| 130 |
+
<FAQ />
|
| 131 |
+
</main>
|
| 132 |
+
<Footer />
|
| 133 |
+
</div>
|
| 134 |
+
);
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
export default App;
|
Dockerfile
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM node:20-slim AS build
|
| 2 |
+
WORKDIR /app
|
| 3 |
+
COPY package*.json ./
|
| 4 |
+
RUN npm install
|
| 5 |
+
COPY . .
|
| 6 |
+
RUN npm run build
|
| 7 |
+
|
| 8 |
+
FROM node:20-slim
|
| 9 |
+
WORKDIR /app
|
| 10 |
+
|
| 11 |
+
# Use the existing node user
|
| 12 |
+
USER node
|
| 13 |
+
ENV HOME=/home/node \
|
| 14 |
+
PATH=/home/node/.local/bin:$PATH
|
| 15 |
+
|
| 16 |
+
WORKDIR $HOME/app
|
| 17 |
+
|
| 18 |
+
COPY --from=build --chown=node:node /app/dist ./dist
|
| 19 |
+
COPY --from=build --chown=node:node /app/package*.json ./
|
| 20 |
+
RUN npm install --only=production
|
| 21 |
+
COPY --chown=node:node server.cjs ./
|
| 22 |
+
|
| 23 |
+
EXPOSE 7860
|
| 24 |
+
CMD ["node", "server.cjs"]
|
README.md
CHANGED
|
@@ -1,10 +1,31 @@
|
|
| 1 |
---
|
| 2 |
title: UserSyncFrontend
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
colorTo: blue
|
| 6 |
sdk: docker
|
| 7 |
-
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
title: UserSyncFrontend
|
| 3 |
+
emoji: 🔄
|
| 4 |
+
colorFrom: blue
|
| 5 |
colorTo: blue
|
| 6 |
sdk: docker
|
| 7 |
+
app_port: 7860
|
| 8 |
+
hf_oauth: true
|
| 9 |
+
persistent_storage: true
|
| 10 |
---
|
| 11 |
|
| 12 |
+
<div align="center">
|
| 13 |
+
<img width="1200" height="475" alt="GHBanner" src="https://github.com/user-attachments/assets/0aa67016-6eaf-458a-adb2-6e31a0763ed6" />
|
| 14 |
+
</div>
|
| 15 |
+
|
| 16 |
+
# Run and deploy your AI Studio app
|
| 17 |
+
|
| 18 |
+
This contains everything you need to run your app locally.
|
| 19 |
+
|
| 20 |
+
View your app in AI Studio: https://ai.studio/apps/drive/1uBpK_suSmvNgTEgSyU7qMenb62ZRrQwX
|
| 21 |
+
|
| 22 |
+
## Run Locally
|
| 23 |
+
|
| 24 |
+
**Prerequisites:** Node.js
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
1. Install dependencies:
|
| 28 |
+
`npm install`
|
| 29 |
+
2. Set the `GEMINI_API_KEY` in [.env.local](.env.local) to your Gemini API key
|
| 30 |
+
3. Run the app:
|
| 31 |
+
`npm run dev`
|
components/Accuracy.tsx
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React from 'react';
|
| 2 |
+
import { BarChart, Bar, XAxis, YAxis, Tooltip, ResponsiveContainer, Cell } from 'recharts';
|
| 3 |
+
|
| 4 |
+
const data = [
|
| 5 |
+
{ name: 'SyncUsers', score: 82, color: '#ffffff' }, // White
|
| 6 |
+
{ name: 'Claude 3.7 Sonnet', score: 64, color: '#4b5563' }, // Gray-600
|
| 7 |
+
{ name: 'Gemini 1.5 pro', score: 63, color: '#4b5563' },
|
| 8 |
+
{ name: 'GPT-4o', score: 60, color: '#4b5563' },
|
| 9 |
+
{ name: 'GPT-3.5 Turbo', score: 54, color: '#4b5563' },
|
| 10 |
+
];
|
| 11 |
+
|
| 12 |
+
const Accuracy: React.FC = () => {
|
| 13 |
+
return (
|
| 14 |
+
<section id="accuracy" className="py-24 bg-black">
|
| 15 |
+
<div className="max-w-7xl mx-auto px-6 grid grid-cols-1 lg:grid-cols-2 gap-16 items-center">
|
| 16 |
+
<div>
|
| 17 |
+
<div className="inline-block px-4 py-1.5 rounded-full border border-gray-700 text-sm text-gray-300 mb-8">Accuracy</div>
|
| 18 |
+
<h2 className="text-3xl md:text-5xl font-semibold leading-tight mb-8">
|
| 19 |
+
SyncUsers is <span className="text-white">30% more accurate</span> at predicting engagement than standard LLMs.
|
| 20 |
+
</h2>
|
| 21 |
+
|
| 22 |
+
<div className="bg-gray-900/30 border border-gray-800 rounded-2xl p-6 md:p-8">
|
| 23 |
+
<h4 className="text-gray-400 mb-6">Success rate at picking winners from pairs of LinkedIn posts</h4>
|
| 24 |
+
<div className="h-[300px] w-full">
|
| 25 |
+
<ResponsiveContainer width="100%" height="100%">
|
| 26 |
+
<BarChart data={data} layout="vertical" margin={{ left: 0, right: 40 }}>
|
| 27 |
+
<XAxis type="number" hide />
|
| 28 |
+
<YAxis
|
| 29 |
+
dataKey="name"
|
| 30 |
+
type="category"
|
| 31 |
+
width={150}
|
| 32 |
+
tick={{ fill: '#9ca3af', fontSize: 12 }}
|
| 33 |
+
axisLine={false}
|
| 34 |
+
tickLine={false}
|
| 35 |
+
/>
|
| 36 |
+
<Tooltip
|
| 37 |
+
cursor={{ fill: 'transparent' }}
|
| 38 |
+
contentStyle={{ backgroundColor: '#111', border: '1px solid #333' }}
|
| 39 |
+
/>
|
| 40 |
+
<Bar dataKey="score" radius={[0, 4, 4, 0]} barSize={32}>
|
| 41 |
+
{data.map((entry, index) => (
|
| 42 |
+
<Cell key={`cell-${index}`} fill={entry.name === 'SyncUsers' ? 'url(#gradient)' : '#374151'} />
|
| 43 |
+
))}
|
| 44 |
+
</Bar>
|
| 45 |
+
</BarChart>
|
| 46 |
+
</ResponsiveContainer>
|
| 47 |
+
{/* Def for gradient */}
|
| 48 |
+
<svg style={{ height: 0 }}>
|
| 49 |
+
<defs>
|
| 50 |
+
<linearGradient id="gradient" x1="0" y1="0" x2="1" y2="0">
|
| 51 |
+
<stop offset="0%" stopColor="#e5e7eb" />
|
| 52 |
+
<stop offset="100%" stopColor="#ffffff" />
|
| 53 |
+
</linearGradient>
|
| 54 |
+
</defs>
|
| 55 |
+
</svg>
|
| 56 |
+
</div>
|
| 57 |
+
{/* Custom Labels overlay for scores since Recharts labels are tricky with layout vertical sometimes */}
|
| 58 |
+
<div className="hidden">
|
| 59 |
+
{/* Placeholder for accessibility */}
|
| 60 |
+
</div>
|
| 61 |
+
</div>
|
| 62 |
+
</div>
|
| 63 |
+
|
| 64 |
+
{/* Right 3D Visual */}
|
| 65 |
+
<div className="relative h-[600px] flex items-end justify-center perspective-1000">
|
| 66 |
+
{/* Abstract 3D Bar representation */}
|
| 67 |
+
<div className="relative w-40 h-80 bg-teal-800 transform rotate-y-12 shadow-2xl translate-x-10 translate-y-10 z-10 opacity-90">
|
| 68 |
+
<div className="absolute top-0 left-0 w-full h-10 bg-teal-400 transform -skew-x-[40deg] origin-top -translate-y-10"></div>
|
| 69 |
+
<div className="absolute top-0 left-0 h-full w-10 bg-teal-900 transform skew-y-[50deg] origin-left -translate-x-10"></div>
|
| 70 |
+
</div>
|
| 71 |
+
|
| 72 |
+
<div className="relative w-24 h-40 bg-blue-900 transform rotate-y-12 shadow-xl -translate-x-10 translate-y-20 opacity-70">
|
| 73 |
+
<div className="absolute top-0 left-0 w-full h-8 bg-blue-500 transform -skew-x-[40deg] origin-top -translate-y-8"></div>
|
| 74 |
+
<div className="absolute top-0 left-0 h-full w-8 bg-blue-950 transform skew-y-[50deg] origin-left -translate-x-8"></div>
|
| 75 |
+
</div>
|
| 76 |
+
|
| 77 |
+
<div className="absolute top-20 right-20 text-9xl font-bold text-gray-800 opacity-20 select-none">
|
| 78 |
+
Λ
|
| 79 |
+
</div>
|
| 80 |
+
</div>
|
| 81 |
+
</div>
|
| 82 |
+
</section>
|
| 83 |
+
);
|
| 84 |
+
};
|
| 85 |
+
|
| 86 |
+
export default Accuracy;
|
components/ChatPage.tsx
ADDED
|
@@ -0,0 +1,466 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import React, { useState, useRef, useEffect } from 'react';
|
| 3 |
+
import { X, ClipboardList, Linkedin, Instagram, Mail, Layout, Edit3, MonitorPlay, Lightbulb, Image, Plus, Sparkles, Zap, Video, Megaphone, Link as LinkIcon, Loader2, RefreshCw, CheckCircle2, MessageSquare } from 'lucide-react';
|
| 4 |
+
import { GradioService } from '../services/gradioService';
|
| 5 |
+
|
| 6 |
+
// --- Types ---
|
| 7 |
+
interface ChatPageProps {
|
| 8 |
+
onBack: () => void;
|
| 9 |
+
simulationResult: any;
|
| 10 |
+
setSimulationResult: (res: any) => void;
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
// --- Sub-components (Modular Structure) ---
|
| 14 |
+
|
| 15 |
+
const ChatButton: React.FC<{ label: string; primary?: boolean; icon?: React.ReactNode; onClick?: () => void; className?: string }> = ({ label, primary, icon, onClick, className = "" }) => (
|
| 16 |
+
<button
|
| 17 |
+
onClick={onClick}
|
| 18 |
+
className={`flex items-center gap-2 px-4 py-2 rounded-lg text-xs md:text-sm font-medium transition-all duration-200 whitespace-nowrap
|
| 19 |
+
${primary
|
| 20 |
+
? 'bg-white text-black hover:bg-gray-200 shadow-[0_0_15px_rgba(255,255,255,0.2)]'
|
| 21 |
+
: 'bg-gray-900 border border-gray-800 text-gray-300 hover:bg-gray-800 hover:text-white hover:border-gray-600'
|
| 22 |
+
} ${className}`}
|
| 23 |
+
>
|
| 24 |
+
{icon}
|
| 25 |
+
{primary && <Zap size={14} className="fill-black" />}
|
| 26 |
+
{label}
|
| 27 |
+
</button>
|
| 28 |
+
);
|
| 29 |
+
|
| 30 |
+
const CategoryCard: React.FC<{
|
| 31 |
+
title: string;
|
| 32 |
+
options: { label: string; icon: React.ReactNode }[];
|
| 33 |
+
selectedVariation: string;
|
| 34 |
+
onSelect: (label: string) => void;
|
| 35 |
+
}> = ({ title, options, selectedVariation, onSelect }) => (
|
| 36 |
+
<div className="flex flex-col gap-3">
|
| 37 |
+
<h3 className="text-[10px] font-bold text-gray-500 uppercase tracking-widest mb-2 ml-1">{title}</h3>
|
| 38 |
+
<div className="space-y-1">
|
| 39 |
+
{options.map((option) => (
|
| 40 |
+
<div
|
| 41 |
+
key={option.label}
|
| 42 |
+
onClick={() => onSelect(option.label)}
|
| 43 |
+
className={`group flex items-center gap-3 p-3 rounded-xl cursor-pointer border transition-all duration-200
|
| 44 |
+
${selectedVariation === option.label
|
| 45 |
+
? 'bg-teal-900/20 border-teal-500/50 text-white'
|
| 46 |
+
: 'hover:bg-gray-900/80 border-transparent hover:border-gray-800'}`}
|
| 47 |
+
>
|
| 48 |
+
<div className={`${selectedVariation === option.label ? 'text-teal-400' : 'text-gray-500 group-hover:text-white'} transition-colors w-5 flex justify-center`}>
|
| 49 |
+
{option.icon}
|
| 50 |
+
</div>
|
| 51 |
+
<span className={`text-sm font-medium ${selectedVariation === option.label ? 'text-teal-100' : 'text-gray-400 group-hover:text-gray-200'}`}>{option.label}</span>
|
| 52 |
+
</div>
|
| 53 |
+
))}
|
| 54 |
+
</div>
|
| 55 |
+
</div>
|
| 56 |
+
);
|
| 57 |
+
|
| 58 |
+
const ChatInput: React.FC<{ onSimulate: (msg: string) => void; onHelpMeCraft: (msg: string) => void; isSimulating: boolean }> = ({ onSimulate, onHelpMeCraft, isSimulating }) => {
|
| 59 |
+
const [message, setMessage] = useState('');
|
| 60 |
+
const [uploadedFiles, setUploadedFiles] = useState<File[]>([]);
|
| 61 |
+
const fileInputRef = useRef<HTMLInputElement>(null);
|
| 62 |
+
|
| 63 |
+
const handleUploadClick = () => {
|
| 64 |
+
fileInputRef.current?.click();
|
| 65 |
+
};
|
| 66 |
+
|
| 67 |
+
const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
| 68 |
+
const files = e.target.files;
|
| 69 |
+
if (files && files.length > 0) {
|
| 70 |
+
const newFiles = Array.from(files);
|
| 71 |
+
setUploadedFiles(prev => [...prev, ...newFiles]);
|
| 72 |
+
console.log("Selected files:", newFiles.map(f => f.name));
|
| 73 |
+
}
|
| 74 |
+
};
|
| 75 |
+
|
| 76 |
+
const removeFile = (index: number) => {
|
| 77 |
+
setUploadedFiles(prev => prev.filter((_, i) => i !== index));
|
| 78 |
+
};
|
| 79 |
+
|
| 80 |
+
return (
|
| 81 |
+
<div className="border-t border-gray-800 pt-6 bg-[#0a0a0a] px-6 pb-8 md:pb-10 z-20 shadow-[0_-20px_50px_rgba(0,0,0,0.8)]">
|
| 82 |
+
<div className="max-w-5xl mx-auto space-y-4">
|
| 83 |
+
{uploadedFiles.length > 0 && (
|
| 84 |
+
<div className="flex flex-wrap gap-2 mb-2">
|
| 85 |
+
{uploadedFiles.map((file, idx) => (
|
| 86 |
+
<div key={idx} className="flex items-center gap-2 bg-gray-800 border border-gray-700 px-3 py-1.5 rounded-full text-[10px] text-gray-300">
|
| 87 |
+
<Image size={10} />
|
| 88 |
+
<span className="truncate max-w-[100px]">{file.name}</span>
|
| 89 |
+
<button onClick={() => removeFile(idx)} className="text-gray-500 hover:text-white">
|
| 90 |
+
<X size={10} />
|
| 91 |
+
</button>
|
| 92 |
+
</div>
|
| 93 |
+
))}
|
| 94 |
+
</div>
|
| 95 |
+
)}
|
| 96 |
+
<textarea
|
| 97 |
+
className="w-full h-24 bg-black border border-gray-800 text-gray-200 placeholder-gray-600 p-4 rounded-2xl resize-none focus:outline-none focus:border-gray-600 focus:ring-1 focus:ring-gray-600 transition-all text-sm leading-relaxed"
|
| 98 |
+
placeholder="Paste your brand narrative or campaign copy here"
|
| 99 |
+
value={message}
|
| 100 |
+
onChange={(e) => setMessage(e.target.value)}
|
| 101 |
+
/>
|
| 102 |
+
<div className="flex flex-wrap justify-between items-start gap-4">
|
| 103 |
+
<div className="flex gap-2 md:gap-3 flex-wrap">
|
| 104 |
+
<div className="flex flex-col gap-2">
|
| 105 |
+
<ChatButton label="Brand Asset for Testing" icon={<LinkIcon size={14} />} />
|
| 106 |
+
</div>
|
| 107 |
+
<input
|
| 108 |
+
type="file"
|
| 109 |
+
ref={fileInputRef}
|
| 110 |
+
onChange={handleFileChange}
|
| 111 |
+
className="hidden"
|
| 112 |
+
accept="image/*"
|
| 113 |
+
multiple
|
| 114 |
+
/>
|
| 115 |
+
<ChatButton
|
| 116 |
+
label={uploadedFiles.length > 0 ? `${uploadedFiles.length} Images Selected` : "Upload Images"}
|
| 117 |
+
icon={uploadedFiles.length > 0 ? <CheckCircle2 size={14} className="text-green-500" /> : <Image size={14} />}
|
| 118 |
+
className="h-fit"
|
| 119 |
+
onClick={handleUploadClick}
|
| 120 |
+
/>
|
| 121 |
+
</div>
|
| 122 |
+
<div className="flex gap-3 items-center mt-auto">
|
| 123 |
+
<button
|
| 124 |
+
onClick={() => onHelpMeCraft(message)}
|
| 125 |
+
className="hidden md:flex text-xs text-gray-500 hover:text-white transition-colors items-center gap-1 mr-2"
|
| 126 |
+
>
|
| 127 |
+
Help Me Craft <Sparkles size={12} />
|
| 128 |
+
</button>
|
| 129 |
+
<div className="flex gap-2">
|
| 130 |
+
<ChatButton
|
| 131 |
+
label="Send"
|
| 132 |
+
onClick={() => onSimulate(message)}
|
| 133 |
+
icon={<MessageSquare size={14} />}
|
| 134 |
+
/>
|
| 135 |
+
<ChatButton
|
| 136 |
+
label={isSimulating ? "Please wait..." : "Simulate"}
|
| 137 |
+
primary
|
| 138 |
+
onClick={() => onSimulate(message)}
|
| 139 |
+
icon={isSimulating ? <Loader2 size={14} className="animate-spin" /> : undefined}
|
| 140 |
+
/>
|
| 141 |
+
</div>
|
| 142 |
+
</div>
|
| 143 |
+
</div>
|
| 144 |
+
</div>
|
| 145 |
+
</div>
|
| 146 |
+
);
|
| 147 |
+
};
|
| 148 |
+
|
| 149 |
+
// --- Main Page Component ---
|
| 150 |
+
|
| 151 |
+
const ChatPage: React.FC<ChatPageProps> = ({ onBack, simulationResult, setSimulationResult }) => {
|
| 152 |
+
const [showNotification, setShowNotification] = useState(false);
|
| 153 |
+
const [isSimulating, setIsSimulating] = useState(false);
|
| 154 |
+
const [currentJobId, setCurrentJobId] = useState<string | null>(null);
|
| 155 |
+
const [simulationId, setSimulationId] = useState<string>('User Group 1');
|
| 156 |
+
const [selectedVariation, setSelectedVariation] = useState<string>('');
|
| 157 |
+
const [showContextModal, setShowContextModal] = useState(false);
|
| 158 |
+
const [contextInput, setContextInput] = useState('');
|
| 159 |
+
|
| 160 |
+
useEffect(() => {
|
| 161 |
+
const fetchSimulations = async () => {
|
| 162 |
+
try {
|
| 163 |
+
const sims = await GradioService.listSimulations();
|
| 164 |
+
if (Array.isArray(sims) && sims.length > 0) {
|
| 165 |
+
const firstSim = typeof sims[0] === 'string' ? sims[0] : (sims[0].id || sims[0].name || '');
|
| 166 |
+
if (firstSim) {
|
| 167 |
+
setSimulationId(firstSim);
|
| 168 |
+
}
|
| 169 |
+
}
|
| 170 |
+
} catch (e) {
|
| 171 |
+
console.error("Failed to fetch simulations:", e);
|
| 172 |
+
}
|
| 173 |
+
};
|
| 174 |
+
fetchSimulations();
|
| 175 |
+
}, []);
|
| 176 |
+
|
| 177 |
+
const handleSimulate = async (msg: string) => {
|
| 178 |
+
if (!msg.trim()) {
|
| 179 |
+
alert("Please enter some content to simulate.");
|
| 180 |
+
return;
|
| 181 |
+
}
|
| 182 |
+
setIsSimulating(true);
|
| 183 |
+
setShowNotification(true);
|
| 184 |
+
setSimulationResult(null);
|
| 185 |
+
|
| 186 |
+
try {
|
| 187 |
+
const result = await GradioService.startSimulationAsync(simulationId, msg);
|
| 188 |
+
setCurrentJobId(result);
|
| 189 |
+
setIsSimulating(false);
|
| 190 |
+
const resData = {
|
| 191 |
+
status: "Initiated",
|
| 192 |
+
message: "Simulation started successfully. Please wait for the results.",
|
| 193 |
+
data: result,
|
| 194 |
+
content: msg,
|
| 195 |
+
variation: selectedVariation,
|
| 196 |
+
simulationId
|
| 197 |
+
};
|
| 198 |
+
setSimulationResult(resData);
|
| 199 |
+
|
| 200 |
+
// Persist simulation initiation
|
| 201 |
+
fetch('/api/save-data', {
|
| 202 |
+
method: 'POST',
|
| 203 |
+
headers: { 'Content-Type': 'application/json' },
|
| 204 |
+
body: JSON.stringify({
|
| 205 |
+
type: 'simulation-start',
|
| 206 |
+
data: resData,
|
| 207 |
+
user: 'chat-user'
|
| 208 |
+
})
|
| 209 |
+
}).catch(console.error);
|
| 210 |
+
|
| 211 |
+
} catch (error) {
|
| 212 |
+
setIsSimulating(false);
|
| 213 |
+
setSimulationResult({
|
| 214 |
+
status: "Error",
|
| 215 |
+
message: "Failed to start simulation. Please try again."
|
| 216 |
+
});
|
| 217 |
+
}
|
| 218 |
+
};
|
| 219 |
+
|
| 220 |
+
const handleRefresh = async () => {
|
| 221 |
+
setIsSimulating(true);
|
| 222 |
+
try {
|
| 223 |
+
const status = await GradioService.getSimulationStatus(currentJobId || simulationId);
|
| 224 |
+
setIsSimulating(false);
|
| 225 |
+
const resData = {
|
| 226 |
+
status: "Updated",
|
| 227 |
+
message: "Latest status gathered from API.",
|
| 228 |
+
data: status,
|
| 229 |
+
simulationId
|
| 230 |
+
};
|
| 231 |
+
setSimulationResult(resData);
|
| 232 |
+
|
| 233 |
+
// Persist simulation result
|
| 234 |
+
fetch('/api/save-data', {
|
| 235 |
+
method: 'POST',
|
| 236 |
+
headers: { 'Content-Type': 'application/json' },
|
| 237 |
+
body: JSON.stringify({
|
| 238 |
+
type: 'simulation-result',
|
| 239 |
+
data: resData,
|
| 240 |
+
user: 'chat-user'
|
| 241 |
+
})
|
| 242 |
+
}).catch(console.error);
|
| 243 |
+
|
| 244 |
+
} catch (error) {
|
| 245 |
+
setIsSimulating(false);
|
| 246 |
+
setSimulationResult({
|
| 247 |
+
status: "Error",
|
| 248 |
+
message: "Failed to gather results. The simulation might still be in progress."
|
| 249 |
+
});
|
| 250 |
+
}
|
| 251 |
+
};
|
| 252 |
+
|
| 253 |
+
const handleHelpMeCraft = async (msg: string) => {
|
| 254 |
+
if (!msg.trim()) {
|
| 255 |
+
alert("Please enter some content first.");
|
| 256 |
+
return;
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
setIsSimulating(true);
|
| 260 |
+
try {
|
| 261 |
+
const response = await fetch('/api/craft', {
|
| 262 |
+
method: 'POST',
|
| 263 |
+
headers: { 'Content-Type': 'application/json' },
|
| 264 |
+
body: JSON.stringify({
|
| 265 |
+
content: msg,
|
| 266 |
+
variation: selectedVariation
|
| 267 |
+
})
|
| 268 |
+
});
|
| 269 |
+
|
| 270 |
+
const data = await response.json();
|
| 271 |
+
|
| 272 |
+
if (!response.ok) {
|
| 273 |
+
throw new Error(data.error || 'Failed to craft content');
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
alert(`Crafted variants for ${selectedVariation || 'general content'}:\n\n` + data.result);
|
| 277 |
+
} catch (e: any) {
|
| 278 |
+
console.error(e);
|
| 279 |
+
alert("Failed to craft content: " + e.message);
|
| 280 |
+
} finally {
|
| 281 |
+
setIsSimulating(false);
|
| 282 |
+
}
|
| 283 |
+
};
|
| 284 |
+
|
| 285 |
+
const categories = {
|
| 286 |
+
'Survey': [
|
| 287 |
+
{ label: 'Survey', icon: <ClipboardList size={18} /> }
|
| 288 |
+
],
|
| 289 |
+
'Marketing Content': [
|
| 290 |
+
{ label: 'Article', icon: <Edit3 size={18} /> },
|
| 291 |
+
{ label: 'Website Link', icon: <Layout size={18} /> },
|
| 292 |
+
{ label: 'Advertisement', icon: <Megaphone size={18} /> }
|
| 293 |
+
],
|
| 294 |
+
'Social Media Posts': [
|
| 295 |
+
{ label: 'LinkedIn Post', icon: <Linkedin size={18} /> },
|
| 296 |
+
{ label: 'Instagram Post', icon: <Instagram size={18} /> },
|
| 297 |
+
{ label: 'X Post', icon: <X size={18} /> },
|
| 298 |
+
{ label: 'TikTok Script', icon: <Video size={18} /> }
|
| 299 |
+
],
|
| 300 |
+
'Communication': [
|
| 301 |
+
{ label: 'Email Subject Line', icon: <Mail size={18} /> },
|
| 302 |
+
{ label: 'Email', icon: <Mail size={18} /> }
|
| 303 |
+
],
|
| 304 |
+
'Product': [
|
| 305 |
+
{ label: 'Product Proposition', icon: <Lightbulb size={18} /> }
|
| 306 |
+
]
|
| 307 |
+
};
|
| 308 |
+
|
| 309 |
+
return (
|
| 310 |
+
<div className="fixed inset-0 z-50 bg-[#050505] text-white flex flex-col animate-in fade-in duration-300 overflow-hidden">
|
| 311 |
+
|
| 312 |
+
{/* Header / Nav */}
|
| 313 |
+
<div className="flex items-center justify-between px-6 py-4 md:px-8 md:py-6 border-b border-gray-800/50 bg-[#050505] z-10 relative">
|
| 314 |
+
<div className="flex items-center gap-3">
|
| 315 |
+
<div className="w-8 h-8 flex items-center justify-center bg-gray-800 rounded-lg text-white font-bold">Λ</div>
|
| 316 |
+
<h2 className="text-xl font-medium tracking-tight">New Simulation</h2>
|
| 317 |
+
</div>
|
| 318 |
+
<div className="flex items-center gap-4">
|
| 319 |
+
<button onClick={onBack} className="p-2 text-gray-500 hover:text-white hover:bg-gray-900 rounded-full transition-colors">
|
| 320 |
+
<X size={24} />
|
| 321 |
+
</button>
|
| 322 |
+
</div>
|
| 323 |
+
</div>
|
| 324 |
+
|
| 325 |
+
{/* Notification Banner */}
|
| 326 |
+
{showNotification && (
|
| 327 |
+
<div className="absolute top-24 left-1/2 -translate-x-1/2 z-50 w-[90%] max-w-lg animate-in slide-in-from-top-4 fade-in duration-500">
|
| 328 |
+
<div className="bg-[#0f1f15] backdrop-blur-xl border border-green-500/20 text-green-100 px-6 py-5 rounded-2xl shadow-2xl flex items-start gap-4 ring-1 ring-green-500/10">
|
| 329 |
+
{/* Eliminated service alert signal */}
|
| 330 |
+
<div className="flex-1">
|
| 331 |
+
<h4 className="font-semibold text-green-300 mb-1">Simulation Status</h4>
|
| 332 |
+
<p className="text-sm text-green-200/70 leading-relaxed">
|
| 333 |
+
Please wait, the results will show here. The simulation process can take up to <strong className="text-white">30 minutes</strong>. Click "Gather Results" to fetch the latest state.
|
| 334 |
+
</p>
|
| 335 |
+
{simulationResult && (
|
| 336 |
+
<div className="mt-4 p-3 bg-black/40 rounded-xl border border-green-500/20 text-xs text-green-200 flex flex-col gap-3">
|
| 337 |
+
<div className="font-medium flex items-center gap-2">
|
| 338 |
+
<div className={`w-1.5 h-1.5 rounded-full ${simulationResult.status === 'Error' ? 'bg-red-500' : 'bg-green-500'}`}></div>
|
| 339 |
+
{simulationResult.message}
|
| 340 |
+
</div>
|
| 341 |
+
{simulationResult.data && (
|
| 342 |
+
<pre className="text-[10px] bg-black/50 p-2 rounded max-h-32 overflow-y-auto custom-scrollbar whitespace-pre-wrap">
|
| 343 |
+
{JSON.stringify(simulationResult.data, null, 2)}
|
| 344 |
+
</pre>
|
| 345 |
+
)}
|
| 346 |
+
<button
|
| 347 |
+
onClick={handleRefresh}
|
| 348 |
+
disabled={isSimulating}
|
| 349 |
+
className="flex items-center gap-2 px-3 py-1.5 bg-green-600/20 hover:bg-green-600/40 rounded-lg self-end transition-colors disabled:opacity-50"
|
| 350 |
+
>
|
| 351 |
+
<RefreshCw size={14} className={isSimulating ? "animate-spin" : ""} />
|
| 352 |
+
Gather Results
|
| 353 |
+
</button>
|
| 354 |
+
</div>
|
| 355 |
+
)}
|
| 356 |
+
</div>
|
| 357 |
+
<button onClick={() => setShowNotification(false)} className="text-green-400 hover:text-white ml-auto p-1">
|
| 358 |
+
<X size={16} />
|
| 359 |
+
</button>
|
| 360 |
+
</div>
|
| 361 |
+
</div>
|
| 362 |
+
)}
|
| 363 |
+
|
| 364 |
+
{/* Scrollable Content Area */}
|
| 365 |
+
<div className="flex-1 overflow-y-auto custom-scrollbar p-6 md:p-8">
|
| 366 |
+
<div className="max-w-5xl mx-auto pb-20">
|
| 367 |
+
<h1 className="text-2xl md:text-3xl font-semibold text-center mb-12 mt-4 md:mt-8">What would you like to simulate?</h1>
|
| 368 |
+
|
| 369 |
+
<div className="grid grid-cols-1 md:grid-cols-3 gap-8 md:gap-12">
|
| 370 |
+
{/* Column 1 */}
|
| 371 |
+
<div className="space-y-12">
|
| 372 |
+
<CategoryCard title="Survey" options={categories['Survey']} selectedVariation={selectedVariation} onSelect={setSelectedVariation} />
|
| 373 |
+
<CategoryCard title="Marketing Content" options={categories['Marketing Content']} selectedVariation={selectedVariation} onSelect={setSelectedVariation} />
|
| 374 |
+
</div>
|
| 375 |
+
|
| 376 |
+
{/* Column 2 */}
|
| 377 |
+
<div className="space-y-12">
|
| 378 |
+
<CategoryCard title="Social Media Posts" options={categories['Social Media Posts']} selectedVariation={selectedVariation} onSelect={setSelectedVariation} />
|
| 379 |
+
</div>
|
| 380 |
+
|
| 381 |
+
{/* Column 3 */}
|
| 382 |
+
<div className="space-y-12">
|
| 383 |
+
<CategoryCard title="Communication" options={categories['Communication']} selectedVariation={selectedVariation} onSelect={setSelectedVariation} />
|
| 384 |
+
<CategoryCard title="Product" options={categories['Product']} selectedVariation={selectedVariation} onSelect={setSelectedVariation} />
|
| 385 |
+
</div>
|
| 386 |
+
</div>
|
| 387 |
+
|
| 388 |
+
<div className="flex justify-center mt-16 mb-8">
|
| 389 |
+
<button
|
| 390 |
+
onClick={() => setShowContextModal(true)}
|
| 391 |
+
className="flex items-center gap-2 text-gray-500 hover:text-gray-300 transition-colors text-sm px-4 py-2 hover:bg-gray-900 rounded-lg"
|
| 392 |
+
>
|
| 393 |
+
<Plus size={16} />
|
| 394 |
+
Request a new context
|
| 395 |
+
</button>
|
| 396 |
+
</div>
|
| 397 |
+
</div>
|
| 398 |
+
</div>
|
| 399 |
+
|
| 400 |
+
{/* Context Modal */}
|
| 401 |
+
{showContextModal && (
|
| 402 |
+
<div className="absolute inset-0 z-[60] flex items-center justify-center p-6 bg-black/60 backdrop-blur-sm">
|
| 403 |
+
<div className="bg-[#111] border border-gray-800 rounded-2xl w-full max-w-md overflow-hidden shadow-2xl">
|
| 404 |
+
<div className="p-6 border-b border-gray-800 flex items-center justify-between">
|
| 405 |
+
<h3 className="font-semibold text-lg">Request New Context</h3>
|
| 406 |
+
<button onClick={() => setShowContextModal(false)} className="text-gray-500 hover:text-white">
|
| 407 |
+
<X size={20} />
|
| 408 |
+
</button>
|
| 409 |
+
</div>
|
| 410 |
+
<div className="p-6 space-y-4">
|
| 411 |
+
<div className="space-y-1.5">
|
| 412 |
+
<label className="text-xs text-gray-400 font-medium">New Context / Fuse Box</label>
|
| 413 |
+
<textarea
|
| 414 |
+
value={contextInput}
|
| 415 |
+
onChange={(e) => setContextInput(e.target.value)}
|
| 416 |
+
className="w-full bg-black border border-gray-800 rounded-lg p-3 text-sm focus:border-teal-500 outline-none h-40 resize-none"
|
| 417 |
+
placeholder="Specify the testing environment or scenario..."
|
| 418 |
+
/>
|
| 419 |
+
</div>
|
| 420 |
+
</div>
|
| 421 |
+
<div className="p-6 border-t border-gray-800 flex gap-3">
|
| 422 |
+
<button
|
| 423 |
+
onClick={() => setShowContextModal(false)}
|
| 424 |
+
className="flex-1 py-2.5 rounded-xl border border-gray-800 text-sm font-medium hover:bg-gray-900 transition-colors"
|
| 425 |
+
>
|
| 426 |
+
Cancel
|
| 427 |
+
</button>
|
| 428 |
+
<button
|
| 429 |
+
onClick={async () => {
|
| 430 |
+
try {
|
| 431 |
+
const response = await fetch('/api/save-data', {
|
| 432 |
+
method: 'POST',
|
| 433 |
+
headers: { 'Content-Type': 'application/json' },
|
| 434 |
+
body: JSON.stringify({
|
| 435 |
+
type: 'context-request',
|
| 436 |
+
data: { context: contextInput },
|
| 437 |
+
user: 'chat-user'
|
| 438 |
+
})
|
| 439 |
+
});
|
| 440 |
+
if (response.ok) {
|
| 441 |
+
alert('Context request saved!');
|
| 442 |
+
setShowContextModal(false);
|
| 443 |
+
setContextInput('');
|
| 444 |
+
}
|
| 445 |
+
} catch (e) {
|
| 446 |
+
console.error(e);
|
| 447 |
+
alert('Successfully submitted (Local simulation)');
|
| 448 |
+
setShowContextModal(false);
|
| 449 |
+
}
|
| 450 |
+
}}
|
| 451 |
+
className="flex-1 py-2.5 rounded-xl bg-teal-600 text-white text-sm font-bold hover:bg-teal-500 transition-colors shadow-lg shadow-teal-900/20"
|
| 452 |
+
>
|
| 453 |
+
Confirm
|
| 454 |
+
</button>
|
| 455 |
+
</div>
|
| 456 |
+
</div>
|
| 457 |
+
</div>
|
| 458 |
+
)}
|
| 459 |
+
|
| 460 |
+
{/* Input Footer */}
|
| 461 |
+
<ChatInput onSimulate={handleSimulate} onHelpMeCraft={handleHelpMeCraft} isSimulating={isSimulating} />
|
| 462 |
+
</div>
|
| 463 |
+
);
|
| 464 |
+
};
|
| 465 |
+
|
| 466 |
+
export default ChatPage;
|
components/Documentation.tsx
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React from 'react';
|
| 2 |
+
import { Book, Code, Terminal, Zap } from 'lucide-react';
|
| 3 |
+
import Button from './ui/Button';
|
| 4 |
+
|
| 5 |
+
const Documentation: React.FC = () => {
|
| 6 |
+
return (
|
| 7 |
+
<section id="docs" className="py-24 bg-black border-t border-gray-900">
|
| 8 |
+
<div className="max-w-7xl mx-auto px-6">
|
| 9 |
+
<div className="flex flex-col md:flex-row justify-between items-end mb-12 gap-6">
|
| 10 |
+
<div>
|
| 11 |
+
<div className="inline-block px-4 py-1.5 rounded-full border border-gray-700 text-sm text-gray-300 mb-6">
|
| 12 |
+
Developers First
|
| 13 |
+
</div>
|
| 14 |
+
<h2 className="text-3xl md:text-5xl font-semibold mb-4">
|
| 15 |
+
Build with our API
|
| 16 |
+
</h2>
|
| 17 |
+
<p className="text-gray-400 text-lg max-w-xl">
|
| 18 |
+
Integrate user simulation directly into your CI/CD pipeline or product workflow.
|
| 19 |
+
Get started for free.
|
| 20 |
+
</p>
|
| 21 |
+
</div>
|
| 22 |
+
<Button variant="outline">View Full Documentation</Button>
|
| 23 |
+
</div>
|
| 24 |
+
|
| 25 |
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-8">
|
| 26 |
+
{/* Code Snippet Card */}
|
| 27 |
+
<div className="bg-gray-900/30 border border-gray-800 rounded-2xl p-6 md:p-8 font-mono text-sm overflow-hidden relative group">
|
| 28 |
+
<div className="absolute top-4 right-4 flex gap-2">
|
| 29 |
+
<div className="w-3 h-3 rounded-full bg-red-500/20 border border-red-500/50"></div>
|
| 30 |
+
<div className="w-3 h-3 rounded-full bg-yellow-500/20 border border-yellow-500/50"></div>
|
| 31 |
+
<div className="w-3 h-3 rounded-full bg-green-500/20 border border-green-500/50"></div>
|
| 32 |
+
</div>
|
| 33 |
+
<div className="text-gray-500 mb-2"># Install the SDK</div>
|
| 34 |
+
<div className="text-teal-400 mb-6">$ npm install @aux/sdk</div>
|
| 35 |
+
|
| 36 |
+
<div className="text-gray-500 mb-2"># Run a simulation</div>
|
| 37 |
+
<div className="text-purple-300">import</div> <div className="text-white inline">{`{ AuxClient }`}</div> <div className="text-purple-300 inline">from</div> <div className="text-green-300 inline">'@aux/sdk'</div>;
|
| 38 |
+
<br/>
|
| 39 |
+
<br/>
|
| 40 |
+
<div className="text-purple-300">const</div> <div className="text-white inline">client</div> = <div className="text-purple-300 inline">new</div> <div className="text-yellow-300 inline">AuxClient</div>({`{ apiKey: '...' }`});
|
| 41 |
+
<br/>
|
| 42 |
+
<br/>
|
| 43 |
+
<div className="text-purple-300">const</div> <div className="text-white inline">result</div> = <div className="text-purple-300 inline">await</div> client.simulation.<div className="text-blue-300 inline">create</div>({`{`}
|
| 44 |
+
<br/>
|
| 45 |
+
audience: <div className="text-green-300 inline">'tech-founders'</div>,
|
| 46 |
+
<br/>
|
| 47 |
+
content: <div className="text-green-300 inline">'https://myapp.com/launch'</div>
|
| 48 |
+
<br/>
|
| 49 |
+
{`}`});
|
| 50 |
+
</div>
|
| 51 |
+
|
| 52 |
+
{/* Docs Links Grid */}
|
| 53 |
+
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
| 54 |
+
<div className="bg-gray-900/20 border border-gray-800 p-6 rounded-xl hover:bg-gray-900/40 transition-colors cursor-pointer group">
|
| 55 |
+
<Book className="w-8 h-8 text-teal-500 mb-4 group-hover:scale-110 transition-transform" />
|
| 56 |
+
<h3 className="text-white font-medium mb-2">Quick Start Guide</h3>
|
| 57 |
+
<p className="text-gray-500 text-sm">Deploy your first simulation in under 5 minutes.</p>
|
| 58 |
+
</div>
|
| 59 |
+
<div className="bg-gray-900/20 border border-gray-800 p-6 rounded-xl hover:bg-gray-900/40 transition-colors cursor-pointer group">
|
| 60 |
+
<Terminal className="w-8 h-8 text-purple-500 mb-4 group-hover:scale-110 transition-transform" />
|
| 61 |
+
<h3 className="text-white font-medium mb-2">API Reference</h3>
|
| 62 |
+
<p className="text-gray-500 text-sm">Detailed endpoints, parameters, and response types.</p>
|
| 63 |
+
</div>
|
| 64 |
+
<div className="bg-gray-900/20 border border-gray-800 p-6 rounded-xl hover:bg-gray-900/40 transition-colors cursor-pointer group">
|
| 65 |
+
<Code className="w-8 h-8 text-blue-500 mb-4 group-hover:scale-110 transition-transform" />
|
| 66 |
+
<h3 className="text-white font-medium mb-2">SDKs & Libraries</h3>
|
| 67 |
+
<p className="text-gray-500 text-sm">Official libraries for Node.js, Python, and Go.</p>
|
| 68 |
+
</div>
|
| 69 |
+
<div className="bg-gray-900/20 border border-gray-800 p-6 rounded-xl hover:bg-gray-900/40 transition-colors cursor-pointer group">
|
| 70 |
+
<Zap className="w-8 h-8 text-yellow-500 mb-4 group-hover:scale-110 transition-transform" />
|
| 71 |
+
<h3 className="text-white font-medium mb-2">Webhooks</h3>
|
| 72 |
+
<p className="text-gray-500 text-sm">Real-time event notifications for your integrations.</p>
|
| 73 |
+
</div>
|
| 74 |
+
</div>
|
| 75 |
+
</div>
|
| 76 |
+
</div>
|
| 77 |
+
</section>
|
| 78 |
+
);
|
| 79 |
+
};
|
| 80 |
+
|
| 81 |
+
export default Documentation;
|
components/FAQ.tsx
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React, { useState } from 'react';
|
| 2 |
+
import { FAQS } from '../constants';
|
| 3 |
+
import { ChevronDown, ChevronUp } from 'lucide-react';
|
| 4 |
+
|
| 5 |
+
const FAQ: React.FC = () => {
|
| 6 |
+
const [openIndex, setOpenIndex] = useState<number | null>(0);
|
| 7 |
+
|
| 8 |
+
const toggleFAQ = (index: number) => {
|
| 9 |
+
setOpenIndex(openIndex === index ? null : index);
|
| 10 |
+
};
|
| 11 |
+
|
| 12 |
+
return (
|
| 13 |
+
<section className="py-24 bg-black">
|
| 14 |
+
<div className="max-w-7xl mx-auto px-6 grid grid-cols-1 lg:grid-cols-2 gap-16">
|
| 15 |
+
<div>
|
| 16 |
+
<div className="inline-block px-4 py-1.5 rounded-full border border-gray-700 text-sm text-gray-300 mb-8">FAQ</div>
|
| 17 |
+
<h2 className="text-3xl md:text-5xl font-semibold mb-6">
|
| 18 |
+
We simulated what questions you need answering
|
| 19 |
+
</h2>
|
| 20 |
+
<p className="text-gray-400 text-lg mb-8">
|
| 21 |
+
Explore quick solutions to common questions. Need more? Feel free to contact our <u className="text-white cursor-pointer">support team</u>.
|
| 22 |
+
</p>
|
| 23 |
+
</div>
|
| 24 |
+
|
| 25 |
+
<div className="space-y-4">
|
| 26 |
+
{FAQS.map((faq, idx) => (
|
| 27 |
+
<div
|
| 28 |
+
key={idx}
|
| 29 |
+
className="border border-gray-800 rounded-xl overflow-hidden bg-gray-900/20"
|
| 30 |
+
>
|
| 31 |
+
<button
|
| 32 |
+
className="w-full flex justify-between items-center p-6 text-left hover:bg-gray-900/50 transition-colors"
|
| 33 |
+
onClick={() => toggleFAQ(idx)}
|
| 34 |
+
>
|
| 35 |
+
<span className="font-medium text-lg">{faq.question}</span>
|
| 36 |
+
{openIndex === idx ? <ChevronUp className="text-gray-400" /> : <ChevronDown className="text-gray-400" />}
|
| 37 |
+
</button>
|
| 38 |
+
|
| 39 |
+
<div
|
| 40 |
+
className={`transition-all duration-300 ease-in-out overflow-hidden ${openIndex === idx ? 'max-h-48 opacity-100' : 'max-h-0 opacity-0'}`}
|
| 41 |
+
>
|
| 42 |
+
<div className="p-6 pt-0 text-gray-400 leading-relaxed">
|
| 43 |
+
{faq.answer}
|
| 44 |
+
</div>
|
| 45 |
+
</div>
|
| 46 |
+
</div>
|
| 47 |
+
))}
|
| 48 |
+
</div>
|
| 49 |
+
</div>
|
| 50 |
+
</section>
|
| 51 |
+
);
|
| 52 |
+
};
|
| 53 |
+
|
| 54 |
+
export default FAQ;
|
components/Footer.tsx
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React from 'react';
|
| 2 |
+
|
| 3 |
+
const Footer: React.FC = () => {
|
| 4 |
+
return (
|
| 5 |
+
<footer className="py-12 bg-black border-t border-gray-900 text-sm text-gray-500">
|
| 6 |
+
<div className="max-w-7xl mx-auto px-6 flex flex-col md:flex-row justify-between items-center gap-6">
|
| 7 |
+
<div className="flex items-center gap-2">
|
| 8 |
+
<div className="w-6 h-6 flex items-center justify-center font-bold text-white bg-gray-800 rounded">Λ</div>
|
| 9 |
+
<span className="text-white font-semibold">SyncUsers</span>
|
| 10 |
+
</div>
|
| 11 |
+
|
| 12 |
+
<div className="flex gap-8">
|
| 13 |
+
<a href="#" className="hover:text-white transition-colors">Twitter</a>
|
| 14 |
+
<a href="#" className="hover:text-white transition-colors">LinkedIn</a>
|
| 15 |
+
<a href="#" className="hover:text-white transition-colors">Privacy</a>
|
| 16 |
+
<a href="#" className="hover:text-white transition-colors">Terms</a>
|
| 17 |
+
</div>
|
| 18 |
+
|
| 19 |
+
<div>
|
| 20 |
+
© 2024 SyncUsers Inc.
|
| 21 |
+
</div>
|
| 22 |
+
</div>
|
| 23 |
+
</footer>
|
| 24 |
+
);
|
| 25 |
+
};
|
| 26 |
+
|
| 27 |
+
export default Footer;
|
components/Hero.tsx
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import React, { useState, useEffect } from 'react';
|
| 3 |
+
import Button from './ui/Button';
|
| 4 |
+
import RealNetworkGraph from './RealNetworkGraph';
|
| 5 |
+
|
| 6 |
+
interface HeroProps {
|
| 7 |
+
onStart?: () => void;
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
const Hero: React.FC<HeroProps> = ({ onStart }) => {
|
| 11 |
+
const [currentSlide, setCurrentSlide] = useState(0);
|
| 12 |
+
|
| 13 |
+
useEffect(() => {
|
| 14 |
+
const interval = setInterval(() => {
|
| 15 |
+
setCurrentSlide((prev) => (prev === 0 ? 1 : 0));
|
| 16 |
+
}, 6000);
|
| 17 |
+
return () => clearInterval(interval);
|
| 18 |
+
}, []);
|
| 19 |
+
|
| 20 |
+
return (
|
| 21 |
+
<section className="relative min-h-[90vh] flex flex-col items-center justify-center pt-32 pb-20 overflow-hidden">
|
| 22 |
+
{/* Background Ambience */}
|
| 23 |
+
<div className="absolute top-0 left-1/2 -translate-x-1/2 w-[800px] h-[500px] bg-purple-900/10 rounded-full blur-[120px] pointer-events-none" />
|
| 24 |
+
|
| 25 |
+
<div className="relative z-10 max-w-7xl mx-auto px-6 w-full grid grid-cols-1 lg:grid-cols-2 gap-12 items-center">
|
| 26 |
+
|
| 27 |
+
{/* Left Content - Animated Transitions */}
|
| 28 |
+
<div className="space-y-8 relative h-[400px]">
|
| 29 |
+
{/* Slide 1 */}
|
| 30 |
+
<div className={`absolute top-0 left-0 w-full transition-all duration-1000 ease-in-out transform ${currentSlide === 0 ? 'opacity-100 translate-y-0' : 'opacity-0 -translate-y-10 pointer-events-none'}`}>
|
| 31 |
+
<h1 className="text-5xl md:text-7xl font-bold leading-tight">
|
| 32 |
+
Branding Simulation <span className="text-gray-400">API</span> for Global Teams
|
| 33 |
+
</h1>
|
| 34 |
+
<p className="text-xl text-gray-400 mt-6 max-w-lg">
|
| 35 |
+
Programmatically test your brand narratives. Integrate accurate audience simulation into your creative workflow. Free for developers.
|
| 36 |
+
</p>
|
| 37 |
+
<div className="flex flex-wrap gap-4 mt-8">
|
| 38 |
+
<Button variant="primary" size="lg" onClick={onStart}>Try Branding Simulation</Button>
|
| 39 |
+
<Button variant="outline" size="lg" onClick={() => window.location.href='#features'}>How it Works</Button>
|
| 40 |
+
</div>
|
| 41 |
+
</div>
|
| 42 |
+
|
| 43 |
+
{/* Slide 2 */}
|
| 44 |
+
<div className={`absolute top-0 left-0 w-full transition-all duration-1000 ease-in-out transform ${currentSlide === 1 ? 'opacity-100 translate-y-0' : 'opacity-0 translate-y-10 pointer-events-none'}`}>
|
| 45 |
+
<h1 className="text-5xl md:text-7xl font-bold leading-tight">
|
| 46 |
+
Test your Brand. <span className="bg-gradient-to-r from-purple-400 to-pink-600 bg-clip-text text-transparent">Before you launch.</span>
|
| 47 |
+
</h1>
|
| 48 |
+
<p className="text-xl text-gray-400 mt-6 max-w-lg">
|
| 49 |
+
Validate brand voice and campaign ideas with AI-generated focus groups. The new standard for agentic brand testing and narrative validation.
|
| 50 |
+
</p>
|
| 51 |
+
<div className="flex flex-wrap gap-4 mt-8">
|
| 52 |
+
<Button variant="primary" size="lg" onClick={onStart}>Start Building</Button>
|
| 53 |
+
<Button variant="outline" size="lg" onClick={() => window.location.href='#docs'}>Documentation</Button>
|
| 54 |
+
</div>
|
| 55 |
+
</div>
|
| 56 |
+
</div>
|
| 57 |
+
|
| 58 |
+
{/* Right Visuals - Real Network Graph */}
|
| 59 |
+
<div className="relative h-[500px] w-full flex items-center justify-center">
|
| 60 |
+
<div
|
| 61 |
+
className="w-full h-full opacity-80"
|
| 62 |
+
style={{
|
| 63 |
+
maskImage: 'linear-gradient(to bottom, black 0%, black 70%, transparent 100%)',
|
| 64 |
+
WebkitMaskImage: 'linear-gradient(to bottom, black 0%, black 70%, transparent 100%)'
|
| 65 |
+
}}
|
| 66 |
+
>
|
| 67 |
+
<RealNetworkGraph />
|
| 68 |
+
</div>
|
| 69 |
+
|
| 70 |
+
{/* Overlay Elements for depth */}
|
| 71 |
+
<div className="absolute inset-0 pointer-events-none bg-gradient-to-t from-black via-transparent to-transparent"></div>
|
| 72 |
+
</div>
|
| 73 |
+
</div>
|
| 74 |
+
</section>
|
| 75 |
+
);
|
| 76 |
+
};
|
| 77 |
+
|
| 78 |
+
export default Hero;
|
components/HowItWorks.tsx
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React from 'react';
|
| 2 |
+
import { User, Share2, Cpu, CheckCircle, Scale } from 'lucide-react';
|
| 3 |
+
|
| 4 |
+
const HowItWorks: React.FC = () => {
|
| 5 |
+
const steps = [
|
| 6 |
+
{ icon: <User />, label: "Persona Creation" },
|
| 7 |
+
{ icon: <Share2 />, label: "Focus Group Construction" },
|
| 8 |
+
{ icon: <Cpu />, label: "AI-driven Simulations" },
|
| 9 |
+
{ icon: <CheckCircle />, label: "Result Generation" },
|
| 10 |
+
{ icon: <Scale />, label: "Automatic A/B Testing" },
|
| 11 |
+
];
|
| 12 |
+
|
| 13 |
+
return (
|
| 14 |
+
<section id="how-it-works" className="py-24 bg-black border-t border-gray-900">
|
| 15 |
+
<div className="max-w-7xl mx-auto px-6 text-center">
|
| 16 |
+
<div className="inline-block px-4 py-1.5 rounded-full border border-gray-700 text-sm text-gray-300 mb-8">How It Works</div>
|
| 17 |
+
<h2 className="text-3xl md:text-5xl font-semibold mb-20">From raw data to real understanding</h2>
|
| 18 |
+
|
| 19 |
+
{/* Steps Navigation/Visual */}
|
| 20 |
+
<div className="flex flex-wrap justify-center gap-4 md:gap-8 mb-20">
|
| 21 |
+
{steps.map((step, idx) => (
|
| 22 |
+
<div key={idx} className="flex flex-col items-center gap-3 group cursor-default">
|
| 23 |
+
<div className="w-16 h-12 md:w-auto md:h-auto px-6 py-3 rounded-full border border-gray-700 bg-gray-900/50 flex items-center gap-2 text-gray-400 group-hover:text-white group-hover:border-gray-500 transition-all">
|
| 24 |
+
{step.icon}
|
| 25 |
+
<span className="text-sm font-medium hidden md:inline">{step.label}</span>
|
| 26 |
+
</div>
|
| 27 |
+
</div>
|
| 28 |
+
))}
|
| 29 |
+
</div>
|
| 30 |
+
|
| 31 |
+
{/* Abstract Visualization */}
|
| 32 |
+
<div className="relative h-[400px] w-full max-w-4xl mx-auto border border-gray-800 rounded-3xl bg-black overflow-hidden flex items-center justify-center">
|
| 33 |
+
<div className="absolute inset-0 bg-[url('https://www.transparenttextures.com/patterns/stardust.png')] opacity-20"></div>
|
| 34 |
+
{/* Radar/Network Graphic */}
|
| 35 |
+
<div className="relative w-96 h-96">
|
| 36 |
+
<div className="absolute inset-0 border border-blue-900/30 rounded-full animate-ping duration-[3000ms]"></div>
|
| 37 |
+
<div className="absolute inset-10 border border-blue-800/30 rounded-full"></div>
|
| 38 |
+
<div className="absolute inset-20 border border-blue-700/30 rounded-full"></div>
|
| 39 |
+
|
| 40 |
+
{/* Connecting Lines */}
|
| 41 |
+
<svg className="absolute inset-0 w-full h-full pointer-events-none">
|
| 42 |
+
{/* Center to Top (in) */}
|
| 43 |
+
<line x1="50%" y1="50%" x2="50%" y2="5%" stroke="#3b82f6" strokeWidth="2" strokeOpacity="0.5" />
|
| 44 |
+
{/* Center to Bottom Right (X) */}
|
| 45 |
+
<line x1="50%" y1="50%" x2="85%" y2="85%" stroke="#3b82f6" strokeWidth="2" strokeOpacity="0.5" />
|
| 46 |
+
{/* Center to Bottom Left (Globe) */}
|
| 47 |
+
<line x1="50%" y1="50%" x2="15%" y2="85%" stroke="#3b82f6" strokeWidth="2" strokeOpacity="0.5" />
|
| 48 |
+
</svg>
|
| 49 |
+
|
| 50 |
+
{/* Center Node */}
|
| 51 |
+
<div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-16 h-16 bg-gray-900 rounded-full border-2 border-blue-500 flex items-center justify-center shadow-[0_0_30px_rgba(59,130,246,0.5)] z-10">
|
| 52 |
+
<User className="text-white w-6 h-6" />
|
| 53 |
+
</div>
|
| 54 |
+
|
| 55 |
+
{/* Satellite Nodes */}
|
| 56 |
+
<div className="absolute top-0 left-1/2 -translate-x-1/2 w-10 h-10 bg-gray-900 border border-gray-600 rounded-full flex items-center justify-center z-10">
|
| 57 |
+
<span className="text-xs font-bold">in</span>
|
| 58 |
+
</div>
|
| 59 |
+
<div className="absolute bottom-10 right-10 w-10 h-10 bg-gray-900 border border-gray-600 rounded-full flex items-center justify-center z-10">
|
| 60 |
+
<span className="text-xs font-bold">X</span>
|
| 61 |
+
</div>
|
| 62 |
+
<div className="absolute bottom-10 left-10 w-10 h-10 bg-gray-900 border border-gray-600 rounded-full flex items-center justify-center z-10">
|
| 63 |
+
<GlobeIcon />
|
| 64 |
+
</div>
|
| 65 |
+
</div>
|
| 66 |
+
</div>
|
| 67 |
+
</div>
|
| 68 |
+
</section>
|
| 69 |
+
);
|
| 70 |
+
};
|
| 71 |
+
|
| 72 |
+
const GlobeIcon = () => (
|
| 73 |
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className="w-4 h-4">
|
| 74 |
+
<circle cx="12" cy="12" r="10"></circle>
|
| 75 |
+
<line x1="2" y1="12" x2="22" y2="12"></line>
|
| 76 |
+
<path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path>
|
| 77 |
+
</svg>
|
| 78 |
+
);
|
| 79 |
+
|
| 80 |
+
export default HowItWorks;
|
components/InteractiveDemo.tsx
ADDED
|
@@ -0,0 +1,374 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React, { useState, useEffect, useMemo } from 'react';
|
| 2 |
+
import Button from './ui/Button';
|
| 3 |
+
import { Check, Sparkles, Send, MessageSquare, X } from 'lucide-react';
|
| 4 |
+
|
| 5 |
+
// --- Shared Components ---
|
| 6 |
+
|
| 7 |
+
const NetworkBackground: React.FC<{ className?: string }> = ({ className = "" }) => {
|
| 8 |
+
// Static node positions for consistency in other steps
|
| 9 |
+
const nodes = [
|
| 10 |
+
{ cx: "20%", cy: "20%", r: 4, fill: "#14b8a6" }, // teal
|
| 11 |
+
{ cx: "50%", cy: "10%", r: 6, fill: "#a855f7" }, // purple
|
| 12 |
+
{ cx: "80%", cy: "30%", r: 5, fill: "#f97316" }, // orange
|
| 13 |
+
{ cx: "30%", cy: "50%", r: 7, fill: "#3b82f6" }, // blue
|
| 14 |
+
{ cx: "70%", cy: "60%", r: 6, fill: "#ec4899" }, // pink
|
| 15 |
+
{ cx: "10%", cy: "70%", r: 5, fill: "#ef4444" }, // red
|
| 16 |
+
{ cx: "40%", cy: "80%", r: 4, fill: "#14b8a6" },
|
| 17 |
+
{ cx: "90%", cy: "80%", r: 5, fill: "#8b5cf6" },
|
| 18 |
+
{ cx: "60%", cy: "40%", r: 3, fill: "#eab308" },
|
| 19 |
+
{ cx: "25%", cy: "90%", r: 6, fill: "#3b82f6" },
|
| 20 |
+
];
|
| 21 |
+
|
| 22 |
+
return (
|
| 23 |
+
<div className={`absolute inset-0 overflow-hidden pointer-events-none opacity-30 ${className}`}>
|
| 24 |
+
<svg className="w-full h-full">
|
| 25 |
+
{/* Lines */}
|
| 26 |
+
<line x1="20%" y1="20%" x2="50%" y2="10%" stroke="#374151" strokeWidth="1" />
|
| 27 |
+
<line x1="50%" y1="10%" x2="80%" y2="30%" stroke="#374151" strokeWidth="1" />
|
| 28 |
+
<line x1="20%" y1="20%" x2="30%" y2="50%" stroke="#374151" strokeWidth="1" />
|
| 29 |
+
<line x1="30%" y1="50%" x2="70%" y2="60%" stroke="#374151" strokeWidth="1" />
|
| 30 |
+
<line x1="70%" y1="60%" x2="80%" y2="30%" stroke="#374151" strokeWidth="1" />
|
| 31 |
+
<line x1="30%" y1="50%" x2="10%" y2="70%" stroke="#374151" strokeWidth="1" />
|
| 32 |
+
<line x1="40%" y1="80%" x2="10%" y2="70%" stroke="#374151" strokeWidth="1" />
|
| 33 |
+
<line x1="70%" y1="60%" x2="90%" y2="80%" stroke="#374151" strokeWidth="1" />
|
| 34 |
+
<line x1="50%" y1="10%" x2="60%" y2="40%" stroke="#374151" strokeWidth="1" />
|
| 35 |
+
<line x1="25%" y1="90%" x2="40%" y2="80%" stroke="#374151" strokeWidth="1" />
|
| 36 |
+
|
| 37 |
+
{/* Nodes */}
|
| 38 |
+
{nodes.map((node, i) => (
|
| 39 |
+
<circle key={i} {...node} className="animate-pulse" style={{ animationDelay: `${i * 0.5}s` }} />
|
| 40 |
+
))}
|
| 41 |
+
</svg>
|
| 42 |
+
</div>
|
| 43 |
+
);
|
| 44 |
+
};
|
| 45 |
+
|
| 46 |
+
const SectionLayout: React.FC<{
|
| 47 |
+
number: string;
|
| 48 |
+
title: string;
|
| 49 |
+
description: React.ReactNode;
|
| 50 |
+
visual: React.ReactNode;
|
| 51 |
+
}> = ({ number, title, description, visual }) => {
|
| 52 |
+
return (
|
| 53 |
+
<section className="py-24 border-t border-gray-900 bg-black">
|
| 54 |
+
<div className="max-w-7xl mx-auto px-6 grid grid-cols-1 lg:grid-cols-2 gap-16 items-center">
|
| 55 |
+
{/* Text Content */}
|
| 56 |
+
<div className="order-2 lg:order-1">
|
| 57 |
+
<div className="w-12 h-12 rounded-full border border-gray-700 flex items-center justify-center mb-8 text-xl font-mono text-white">
|
| 58 |
+
{number}
|
| 59 |
+
</div>
|
| 60 |
+
<h2 className="text-4xl md:text-5xl font-semibold mb-6 text-white">{title}</h2>
|
| 61 |
+
<div className="text-xl text-gray-400 leading-relaxed max-w-lg">
|
| 62 |
+
{description}
|
| 63 |
+
</div>
|
| 64 |
+
</div>
|
| 65 |
+
|
| 66 |
+
{/* Visual Content */}
|
| 67 |
+
<div className="order-1 lg:order-2 relative h-[500px] bg-gray-900/20 border border-gray-800 rounded-3xl overflow-hidden flex items-center justify-center">
|
| 68 |
+
<div className="absolute inset-0 w-full h-full flex items-center justify-center p-0">
|
| 69 |
+
{visual}
|
| 70 |
+
</div>
|
| 71 |
+
</div>
|
| 72 |
+
</div>
|
| 73 |
+
</section>
|
| 74 |
+
);
|
| 75 |
+
};
|
| 76 |
+
|
| 77 |
+
// --- Step 1: Generate Focus Group ---
|
| 78 |
+
|
| 79 |
+
const Step1 = () => {
|
| 80 |
+
const [status, setStatus] = useState<'input' | 'creating' | 'ready'>('input');
|
| 81 |
+
const [inputValue, setInputValue] = useState("AI-focused startup founders in Europe");
|
| 82 |
+
|
| 83 |
+
const handleCreate = () => {
|
| 84 |
+
setStatus('creating');
|
| 85 |
+
setTimeout(() => {
|
| 86 |
+
setStatus('ready');
|
| 87 |
+
}, 2000);
|
| 88 |
+
};
|
| 89 |
+
|
| 90 |
+
return (
|
| 91 |
+
<SectionLayout
|
| 92 |
+
number="1"
|
| 93 |
+
title="Generate Any Focus Group"
|
| 94 |
+
description={
|
| 95 |
+
<div className="space-y-6">
|
| 96 |
+
<p>
|
| 97 |
+
Use plain english to describe your target audience, or generate a personal focus group based on your real social media interactions.
|
| 98 |
+
</p>
|
| 99 |
+
<div className="space-y-2 pt-2">
|
| 100 |
+
<p className="text-base font-medium text-gray-300">
|
| 101 |
+
Personalize your experience with your own LinkedIn network database.
|
| 102 |
+
</p>
|
| 103 |
+
<p className="text-sm text-gray-500">
|
| 104 |
+
LinkedIn and X data are going into the persona simulator.
|
| 105 |
+
</p>
|
| 106 |
+
</div>
|
| 107 |
+
</div>
|
| 108 |
+
}
|
| 109 |
+
visual={
|
| 110 |
+
<>
|
| 111 |
+
{/* Background for all phases, fully visible in 'ready' */}
|
| 112 |
+
<div className={`transition-opacity duration-1000 ${status === 'ready' ? 'opacity-100' : 'opacity-30'}`}>
|
| 113 |
+
<NetworkBackground className="opacity-100" />
|
| 114 |
+
</div>
|
| 115 |
+
|
| 116 |
+
{/* Input State */}
|
| 117 |
+
<div className={`transition-all duration-500 absolute w-full max-w-sm z-20 ${status === 'input' ? 'opacity-100 scale-100' : 'opacity-0 scale-95 pointer-events-none'}`}>
|
| 118 |
+
<div className="bg-black border border-gray-800 rounded-xl p-6 shadow-2xl">
|
| 119 |
+
<div className="flex justify-between items-center mb-6">
|
| 120 |
+
<span className="text-gray-400 text-sm">Target Audience</span>
|
| 121 |
+
<button className="text-gray-500 hover:text-white"><X size={16}/></button>
|
| 122 |
+
</div>
|
| 123 |
+
<h4 className="text-xl mb-4 text-center">Who would you like to simulate?</h4>
|
| 124 |
+
<div className="relative mb-6">
|
| 125 |
+
<input
|
| 126 |
+
type="text"
|
| 127 |
+
value={inputValue}
|
| 128 |
+
onChange={(e) => setInputValue(e.target.value)}
|
| 129 |
+
className="w-full bg-gray-900 border border-gray-700 rounded-lg py-3 px-4 text-white focus:outline-none focus:border-teal-500"
|
| 130 |
+
/>
|
| 131 |
+
<span className="absolute right-3 top-3.5 w-0.5 h-5 bg-teal-500 animate-blink"></span>
|
| 132 |
+
</div>
|
| 133 |
+
<Button className="w-full py-3" onClick={handleCreate}>
|
| 134 |
+
Generate Your Focus Group <Sparkles size={16} className="ml-2" />
|
| 135 |
+
</Button>
|
| 136 |
+
</div>
|
| 137 |
+
</div>
|
| 138 |
+
|
| 139 |
+
{/* Creating State */}
|
| 140 |
+
<div className={`transition-all duration-500 absolute z-20 ${status === 'creating' ? 'opacity-100 scale-100' : 'opacity-0 scale-95 pointer-events-none'}`}>
|
| 141 |
+
<div className="bg-black/80 backdrop-blur-md border border-gray-700 rounded-full px-8 py-4 flex items-center gap-3 shadow-2xl">
|
| 142 |
+
<Sparkles className="text-teal-400 animate-pulse" />
|
| 143 |
+
<span className="text-lg font-medium">Generating Focus Group...</span>
|
| 144 |
+
</div>
|
| 145 |
+
</div>
|
| 146 |
+
|
| 147 |
+
{/* Ready State */}
|
| 148 |
+
<div className={`transition-all duration-1000 absolute inset-0 flex items-end justify-center pb-8 ${status === 'ready' ? 'opacity-100' : 'opacity-0 pointer-events-none'}`}>
|
| 149 |
+
{/* Bottom Toast Overlay */}
|
| 150 |
+
<div className="bg-black/80 backdrop-blur border border-gray-800 rounded-full pl-3 pr-6 py-2 flex items-center gap-3 shadow-2xl pointer-events-auto">
|
| 151 |
+
<div className="bg-green-500/20 rounded-full p-1">
|
| 152 |
+
<Check className="w-4 h-4 text-green-500" />
|
| 153 |
+
</div>
|
| 154 |
+
<span className="text-sm font-medium text-white whitespace-nowrap">Your Personal Focus Group is Ready</span>
|
| 155 |
+
</div>
|
| 156 |
+
<div className="absolute bottom-2 text-center pointer-events-auto">
|
| 157 |
+
<button
|
| 158 |
+
onClick={() => setStatus('input')}
|
| 159 |
+
className="text-xs text-gray-500 hover:text-white transition-colors"
|
| 160 |
+
>
|
| 161 |
+
Start Over
|
| 162 |
+
</button>
|
| 163 |
+
</div>
|
| 164 |
+
</div>
|
| 165 |
+
</>
|
| 166 |
+
}
|
| 167 |
+
/>
|
| 168 |
+
);
|
| 169 |
+
};
|
| 170 |
+
|
| 171 |
+
// --- Step 2: Run Experiments ---
|
| 172 |
+
|
| 173 |
+
const Step2 = () => {
|
| 174 |
+
const [isSimulating, setIsSimulating] = useState(false);
|
| 175 |
+
|
| 176 |
+
const handleSimulate = () => {
|
| 177 |
+
setIsSimulating(true);
|
| 178 |
+
setTimeout(() => {
|
| 179 |
+
setIsSimulating(false);
|
| 180 |
+
}, 2500);
|
| 181 |
+
};
|
| 182 |
+
|
| 183 |
+
return (
|
| 184 |
+
<SectionLayout
|
| 185 |
+
number="2"
|
| 186 |
+
title="Validate Campaign Narratives"
|
| 187 |
+
description="Execute simulations in minutes to find the optimal resonance of your brand message."
|
| 188 |
+
visual={
|
| 189 |
+
<>
|
| 190 |
+
<NetworkBackground />
|
| 191 |
+
<div className="w-full max-w-sm relative z-10">
|
| 192 |
+
{/* Post Card */}
|
| 193 |
+
<div className={`bg-black border border-gray-800 rounded-xl p-6 shadow-2xl transition-all duration-500 ${isSimulating ? 'opacity-40 blur-sm scale-95' : 'opacity-100 scale-100'}`}>
|
| 194 |
+
<div className="flex items-center gap-3 mb-4">
|
| 195 |
+
<div className="w-10 h-10 rounded-full bg-gray-700"></div>
|
| 196 |
+
<div>
|
| 197 |
+
<div className="w-24 h-3 bg-gray-700 rounded mb-1"></div>
|
| 198 |
+
<div className="w-16 h-2 bg-gray-800 rounded"></div>
|
| 199 |
+
</div>
|
| 200 |
+
</div>
|
| 201 |
+
<div className="space-y-2 mb-6">
|
| 202 |
+
<div className="w-full h-2 bg-gray-800 rounded"></div>
|
| 203 |
+
<div className="w-full h-2 bg-gray-800 rounded"></div>
|
| 204 |
+
<div className="w-3/4 h-2 bg-gray-800 rounded"></div>
|
| 205 |
+
</div>
|
| 206 |
+
<div className="bg-gray-900 rounded-lg p-4 mb-4 border border-gray-800">
|
| 207 |
+
<p className="text-gray-300 text-sm">
|
| 208 |
+
Our new brand identity focuses on radical transparency and community-driven growth...
|
| 209 |
+
</p>
|
| 210 |
+
</div>
|
| 211 |
+
<Button
|
| 212 |
+
className="w-full flex items-center justify-center gap-2"
|
| 213 |
+
onClick={handleSimulate}
|
| 214 |
+
>
|
| 215 |
+
Simulate Campaign <Send size={16} />
|
| 216 |
+
</Button>
|
| 217 |
+
</div>
|
| 218 |
+
|
| 219 |
+
{/* Simulating Overlay */}
|
| 220 |
+
<div className={`absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 transition-all duration-300 ${isSimulating ? 'opacity-100 scale-100' : 'opacity-0 scale-90 pointer-events-none'}`}>
|
| 221 |
+
<div className="bg-black/90 backdrop-blur border border-gray-700 rounded-2xl p-6 shadow-2xl flex flex-col items-center gap-4 min-w-[200px]">
|
| 222 |
+
<div className="relative">
|
| 223 |
+
<div className="w-12 h-12 rounded-full border-2 border-gray-800 border-t-teal-500 animate-spin"></div>
|
| 224 |
+
<Sparkles className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 text-teal-500 w-5 h-5" />
|
| 225 |
+
</div>
|
| 226 |
+
<span className="text-white font-medium">Simulating reactions...</span>
|
| 227 |
+
</div>
|
| 228 |
+
</div>
|
| 229 |
+
</div>
|
| 230 |
+
</>
|
| 231 |
+
}
|
| 232 |
+
/>
|
| 233 |
+
);
|
| 234 |
+
};
|
| 235 |
+
|
| 236 |
+
// --- Step 3: Get Insights ---
|
| 237 |
+
|
| 238 |
+
const Step3 = () => {
|
| 239 |
+
return (
|
| 240 |
+
<SectionLayout
|
| 241 |
+
number="3"
|
| 242 |
+
title="Measure Brand Resonance"
|
| 243 |
+
description="Evaluate how your brand values land with specific demographics through detailed sentiment scores."
|
| 244 |
+
visual={
|
| 245 |
+
<>
|
| 246 |
+
<NetworkBackground />
|
| 247 |
+
<div className="w-full max-w-sm space-y-4 relative z-10">
|
| 248 |
+
{/* Score Card */}
|
| 249 |
+
<div className="bg-black border border-gray-800 rounded-xl p-6 shadow-2xl hover:border-gray-600 transition-colors cursor-default group">
|
| 250 |
+
<div className="flex justify-between items-start mb-6">
|
| 251 |
+
<div>
|
| 252 |
+
<span className="text-xs text-gray-400 uppercase tracking-wider">Brand Alignment</span>
|
| 253 |
+
<div className="text-3xl font-bold text-white mt-1">94<span className="text-base font-normal text-gray-500">/100</span></div>
|
| 254 |
+
</div>
|
| 255 |
+
<div className="bg-green-500/10 text-green-400 text-xs px-2 py-1 rounded border border-green-500/20">Highly Coherent</div>
|
| 256 |
+
</div>
|
| 257 |
+
|
| 258 |
+
<div className="space-y-4">
|
| 259 |
+
<div>
|
| 260 |
+
<div className="flex justify-between text-xs text-gray-400 mb-1">
|
| 261 |
+
<span>Trustworthiness</span>
|
| 262 |
+
<span>88%</span>
|
| 263 |
+
</div>
|
| 264 |
+
<div className="h-1.5 bg-gray-800 rounded-full overflow-hidden">
|
| 265 |
+
<div className="h-full bg-green-500 w-[88%] rounded-full group-hover:bg-green-400 transition-colors"></div>
|
| 266 |
+
</div>
|
| 267 |
+
</div>
|
| 268 |
+
<div>
|
| 269 |
+
<div className="flex justify-between text-xs text-gray-400 mb-1">
|
| 270 |
+
<span>Brand Recall</span>
|
| 271 |
+
<span>82%</span>
|
| 272 |
+
</div>
|
| 273 |
+
<div className="h-1.5 bg-gray-800 rounded-full overflow-hidden">
|
| 274 |
+
<div className="h-full bg-teal-500 w-[82%] rounded-full group-hover:bg-teal-400 transition-colors"></div>
|
| 275 |
+
</div>
|
| 276 |
+
</div>
|
| 277 |
+
</div>
|
| 278 |
+
</div>
|
| 279 |
+
|
| 280 |
+
{/* Feedback Card */}
|
| 281 |
+
<div className="bg-gray-900/50 border border-gray-800 rounded-xl p-5 backdrop-blur-sm animate-fade-in-up" style={{ animationDelay: '0.2s' }}>
|
| 282 |
+
<div className="flex items-center gap-2 mb-3">
|
| 283 |
+
<MessageSquare size={14} className="text-purple-400" />
|
| 284 |
+
<span className="text-xs font-medium text-purple-200">Brand Insight</span>
|
| 285 |
+
</div>
|
| 286 |
+
<p className="text-sm text-gray-300 leading-relaxed italic">
|
| 287 |
+
"The 'transparency' angle increased trust scores by 25% among Millennial tech professionals."
|
| 288 |
+
</p>
|
| 289 |
+
</div>
|
| 290 |
+
</div>
|
| 291 |
+
</>
|
| 292 |
+
}
|
| 293 |
+
/>
|
| 294 |
+
);
|
| 295 |
+
};
|
| 296 |
+
|
| 297 |
+
// --- Step 4: Forecast Outcome ---
|
| 298 |
+
|
| 299 |
+
const Step4 = () => {
|
| 300 |
+
const [activeVariant, setActiveVariant] = useState(0);
|
| 301 |
+
|
| 302 |
+
const variants = [
|
| 303 |
+
{ label: "Original", score: 52, text: "We're launching a new sustainable clothing line next month." },
|
| 304 |
+
{ label: "Variant 1", score: 91, text: "Radical transparency in every stitch. Meet the brand that's redefining sustainable luxury." },
|
| 305 |
+
{ label: "Variant 2", score: 78, text: "Style without compromise. Our eco-friendly collection arrives soon." },
|
| 306 |
+
];
|
| 307 |
+
|
| 308 |
+
return (
|
| 309 |
+
<SectionLayout
|
| 310 |
+
number="4"
|
| 311 |
+
title="Forecast Every Outcome"
|
| 312 |
+
description="SyncUsers uses your style to generate and test variations of your original post every time you run a simulation."
|
| 313 |
+
visual={
|
| 314 |
+
<div className="relative w-full max-w-lg flex items-center justify-center">
|
| 315 |
+
<NetworkBackground />
|
| 316 |
+
|
| 317 |
+
{/* Main Content Area */}
|
| 318 |
+
<div className="w-full max-w-xs bg-black border border-gray-800 rounded-xl p-6 shadow-2xl relative z-10 transition-all duration-300">
|
| 319 |
+
<div className="flex justify-between items-center mb-4">
|
| 320 |
+
<span className="text-xs text-gray-500 uppercase tracking-wide">{variants[activeVariant].label}</span>
|
| 321 |
+
<div className={`px-2 py-0.5 rounded text-xs font-bold ${activeVariant === 0 ? 'bg-gray-800 text-gray-400' : 'bg-green-900 text-green-400'}`}>
|
| 322 |
+
Score: {variants[activeVariant].score}
|
| 323 |
+
</div>
|
| 324 |
+
</div>
|
| 325 |
+
<div className="min-h-[100px]">
|
| 326 |
+
<p className="text-sm text-gray-200 leading-relaxed animate-fade-in">
|
| 327 |
+
{variants[activeVariant].text}
|
| 328 |
+
</p>
|
| 329 |
+
</div>
|
| 330 |
+
<div className="mt-4 pt-4 border-t border-gray-800 flex gap-4">
|
| 331 |
+
<div className="h-2 w-8 bg-gray-800 rounded-full"></div>
|
| 332 |
+
<div className="h-2 w-16 bg-gray-800 rounded-full"></div>
|
| 333 |
+
</div>
|
| 334 |
+
</div>
|
| 335 |
+
|
| 336 |
+
{/* Floating Menu */}
|
| 337 |
+
<div className="absolute -right-4 top-1/2 -translate-y-1/2 translate-x-1/2 w-48 bg-gray-900/90 backdrop-blur border border-gray-700 rounded-xl p-2 shadow-2xl z-20">
|
| 338 |
+
<div className="text-[10px] text-gray-500 uppercase px-2 mb-2 font-bold tracking-wider">Select Variant</div>
|
| 339 |
+
<div className="space-y-1">
|
| 340 |
+
{variants.map((v, i) => (
|
| 341 |
+
<div
|
| 342 |
+
key={i}
|
| 343 |
+
onMouseEnter={() => setActiveVariant(i)}
|
| 344 |
+
className={`p-2 rounded cursor-pointer transition-all flex justify-between items-center group ${activeVariant === i ? 'bg-white text-black' : 'hover:bg-white/10 text-gray-400'}`}
|
| 345 |
+
>
|
| 346 |
+
<span className="text-xs font-medium">{v.label}</span>
|
| 347 |
+
<span className={`text-xs font-bold ${activeVariant === i ? 'text-black' : 'text-gray-500 group-hover:text-white'}`}>{v.score}</span>
|
| 348 |
+
</div>
|
| 349 |
+
))}
|
| 350 |
+
</div>
|
| 351 |
+
</div>
|
| 352 |
+
|
| 353 |
+
{/* Connecting Line Visual */}
|
| 354 |
+
<div className="absolute right-[50%] top-1/2 w-[30%] h-[1px] bg-gradient-to-r from-transparent to-gray-700 -z-10"></div>
|
| 355 |
+
</div>
|
| 356 |
+
}
|
| 357 |
+
/>
|
| 358 |
+
);
|
| 359 |
+
};
|
| 360 |
+
|
| 361 |
+
// --- Main Container ---
|
| 362 |
+
|
| 363 |
+
const InteractiveDemo: React.FC = () => {
|
| 364 |
+
return (
|
| 365 |
+
<div className="flex flex-col">
|
| 366 |
+
<Step1 />
|
| 367 |
+
<Step2 />
|
| 368 |
+
<Step3 />
|
| 369 |
+
<Step4 />
|
| 370 |
+
</div>
|
| 371 |
+
);
|
| 372 |
+
};
|
| 373 |
+
|
| 374 |
+
export default InteractiveDemo;
|
components/Navbar.tsx
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React, { useState, useEffect } from 'react';
|
| 2 |
+
import { Menu, X } from 'lucide-react';
|
| 3 |
+
import { NAV_LINKS } from '../constants';
|
| 4 |
+
import Button from './ui/Button';
|
| 5 |
+
|
| 6 |
+
interface NavbarProps {
|
| 7 |
+
onStart?: () => void;
|
| 8 |
+
onLogin?: () => void;
|
| 9 |
+
user?: any;
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
const Navbar: React.FC<NavbarProps> = ({ onStart, onLogin, user }) => {
|
| 13 |
+
const [isScrolled, setIsScrolled] = useState(false);
|
| 14 |
+
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
|
| 15 |
+
|
| 16 |
+
useEffect(() => {
|
| 17 |
+
const handleScroll = () => {
|
| 18 |
+
setIsScrolled(window.scrollY > 20);
|
| 19 |
+
};
|
| 20 |
+
window.addEventListener('scroll', handleScroll);
|
| 21 |
+
return () => window.removeEventListener('scroll', handleScroll);
|
| 22 |
+
}, []);
|
| 23 |
+
|
| 24 |
+
return (
|
| 25 |
+
<nav className={`fixed top-0 left-0 right-0 z-50 transition-all duration-300 ${isScrolled ? 'bg-black/80 backdrop-blur-md py-3 border-b border-gray-800' : 'bg-transparent py-5'}`}>
|
| 26 |
+
<div className="max-w-7xl mx-auto px-6 flex items-center justify-between">
|
| 27 |
+
<div className="flex items-center gap-2 cursor-pointer" onClick={() => window.scrollTo(0,0)}>
|
| 28 |
+
<div className="w-8 h-8 flex items-center justify-center font-bold text-xl text-white">
|
| 29 |
+
{/* Stylized Logo Mockup */}
|
| 30 |
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" className="w-full h-full">
|
| 31 |
+
<path d="M12 2L2 22h20L12 2z" className="text-gray-400" />
|
| 32 |
+
<path d="M12 6L6 20h12L12 6z" className="text-white fill-white" />
|
| 33 |
+
</svg>
|
| 34 |
+
</div>
|
| 35 |
+
<span className="font-semibold text-lg tracking-tight">SyncUsers</span>
|
| 36 |
+
</div>
|
| 37 |
+
|
| 38 |
+
{/* Desktop Nav */}
|
| 39 |
+
<div className="hidden md:flex items-center gap-8">
|
| 40 |
+
{NAV_LINKS.map((link) => (
|
| 41 |
+
<a
|
| 42 |
+
key={link.label}
|
| 43 |
+
href={link.href}
|
| 44 |
+
className="text-sm font-medium text-gray-300 hover:text-white transition-colors"
|
| 45 |
+
>
|
| 46 |
+
{link.label}
|
| 47 |
+
</a>
|
| 48 |
+
))}
|
| 49 |
+
</div>
|
| 50 |
+
|
| 51 |
+
<div className="hidden md:flex items-center gap-4">
|
| 52 |
+
{user ? (
|
| 53 |
+
<div className="flex items-center gap-3 bg-gray-900 border border-gray-800 rounded-full px-4 py-1.5">
|
| 54 |
+
{user.avatarUrl && <img src={user.avatarUrl} alt={user.preferred_username} className="w-6 h-6 rounded-full" />}
|
| 55 |
+
<span className="text-sm font-medium text-gray-300">{user.preferred_username}</span>
|
| 56 |
+
</div>
|
| 57 |
+
) : (
|
| 58 |
+
<Button variant="outline" size="sm" onClick={onLogin}>Sign in with HF</Button>
|
| 59 |
+
)}
|
| 60 |
+
<Button variant="primary" size="sm" onClick={onStart}>Start Building</Button>
|
| 61 |
+
</div>
|
| 62 |
+
|
| 63 |
+
{/* Mobile Toggle */}
|
| 64 |
+
<button
|
| 65 |
+
className="md:hidden text-gray-300 hover:text-white"
|
| 66 |
+
onClick={() => setIsMobileMenuOpen(!isMobileMenuOpen)}
|
| 67 |
+
>
|
| 68 |
+
{isMobileMenuOpen ? <X /> : <Menu />}
|
| 69 |
+
</button>
|
| 70 |
+
</div>
|
| 71 |
+
|
| 72 |
+
{/* Mobile Menu */}
|
| 73 |
+
{isMobileMenuOpen && (
|
| 74 |
+
<div className="md:hidden bg-black border-t border-gray-800 p-6 absolute top-full left-0 right-0">
|
| 75 |
+
<div className="flex flex-col gap-4">
|
| 76 |
+
{NAV_LINKS.map((link) => (
|
| 77 |
+
<a
|
| 78 |
+
key={link.label}
|
| 79 |
+
href={link.href}
|
| 80 |
+
className="text-lg font-medium text-gray-300 hover:text-white"
|
| 81 |
+
onClick={() => setIsMobileMenuOpen(false)}
|
| 82 |
+
>
|
| 83 |
+
{link.label}
|
| 84 |
+
</a>
|
| 85 |
+
))}
|
| 86 |
+
<div className="pt-4 flex flex-col gap-3">
|
| 87 |
+
{user ? (
|
| 88 |
+
<div className="flex items-center gap-3 bg-gray-900 border border-gray-800 rounded-lg px-4 py-3">
|
| 89 |
+
{user.avatarUrl && <img src={user.avatarUrl} alt={user.preferred_username} className="w-8 h-8 rounded-full" />}
|
| 90 |
+
<span className="font-medium text-gray-300">{user.preferred_username}</span>
|
| 91 |
+
</div>
|
| 92 |
+
) : (
|
| 93 |
+
<Button variant="outline" className="w-full" onClick={() => { setIsMobileMenuOpen(false); if(onLogin) onLogin(); }}>Sign in with HF</Button>
|
| 94 |
+
)}
|
| 95 |
+
<Button variant="primary" className="w-full" onClick={() => { setIsMobileMenuOpen(false); if(onStart) onStart(); }}>Start Building</Button>
|
| 96 |
+
</div>
|
| 97 |
+
</div>
|
| 98 |
+
</div>
|
| 99 |
+
)}
|
| 100 |
+
</nav>
|
| 101 |
+
);
|
| 102 |
+
};
|
| 103 |
+
|
| 104 |
+
export default Navbar;
|
components/Pricing.tsx
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React, { useState } from 'react';
|
| 2 |
+
import Button from './ui/Button';
|
| 3 |
+
import { Check } from 'lucide-react';
|
| 4 |
+
|
| 5 |
+
const Pricing: React.FC = () => {
|
| 6 |
+
const [isYearly, setIsYearly] = useState(false);
|
| 7 |
+
|
| 8 |
+
const plans = [
|
| 9 |
+
{
|
| 10 |
+
name: "Free",
|
| 11 |
+
price: "$0",
|
| 12 |
+
desc: "No cost to run your first experiments",
|
| 13 |
+
features: ["Access all features", "Configure your own focus groups", "3 Starting simulation credits"],
|
| 14 |
+
cta: "Select Free",
|
| 15 |
+
featured: false
|
| 16 |
+
},
|
| 17 |
+
{
|
| 18 |
+
name: "Pro",
|
| 19 |
+
price: "$55",
|
| 20 |
+
period: "/ mo",
|
| 21 |
+
desc: "Billed monthly",
|
| 22 |
+
features: ["Everything in Free", "Unlimited focus groups", "Unlimited simulation credits"],
|
| 23 |
+
cta: "Select Pro",
|
| 24 |
+
featured: true
|
| 25 |
+
},
|
| 26 |
+
{
|
| 27 |
+
name: "Enterprise",
|
| 28 |
+
price: "Get in Touch",
|
| 29 |
+
desc: "Custom builds for businesses",
|
| 30 |
+
features: ["Custom audience builds", "Custom contexts & segments", "Data & CRM integration", "API Access", "Dedicated Account Manager"],
|
| 31 |
+
cta: "Enquire",
|
| 32 |
+
featured: false
|
| 33 |
+
}
|
| 34 |
+
];
|
| 35 |
+
|
| 36 |
+
return (
|
| 37 |
+
<section id="pricing" className="py-24 bg-black">
|
| 38 |
+
<div className="max-w-7xl mx-auto px-6">
|
| 39 |
+
<div className="text-center mb-16">
|
| 40 |
+
<h2 className="text-4xl md:text-5xl font-semibold mb-6">Get started today</h2>
|
| 41 |
+
|
| 42 |
+
{/* Toggle */}
|
| 43 |
+
<div className="inline-flex items-center bg-gray-900 rounded-full p-1 border border-gray-800 relative">
|
| 44 |
+
<button
|
| 45 |
+
className={`px-6 py-2 rounded-full text-sm font-medium transition-all ${!isYearly ? 'bg-white text-black' : 'text-gray-400 hover:text-white'}`}
|
| 46 |
+
onClick={() => setIsYearly(false)}
|
| 47 |
+
>
|
| 48 |
+
Monthly
|
| 49 |
+
</button>
|
| 50 |
+
<button
|
| 51 |
+
className={`px-6 py-2 rounded-full text-sm font-medium transition-all ${isYearly ? 'bg-white text-black' : 'text-gray-400 hover:text-white'}`}
|
| 52 |
+
onClick={() => setIsYearly(true)}
|
| 53 |
+
>
|
| 54 |
+
Yearly
|
| 55 |
+
</button>
|
| 56 |
+
<span className="absolute -top-3 -right-6 bg-teal-900 text-teal-200 text-[10px] font-bold px-2 py-0.5 rounded-full border border-teal-700">
|
| 57 |
+
-30%
|
| 58 |
+
</span>
|
| 59 |
+
</div>
|
| 60 |
+
</div>
|
| 61 |
+
|
| 62 |
+
<div className="grid grid-cols-1 md:grid-cols-3 gap-8">
|
| 63 |
+
{plans.map((plan, idx) => (
|
| 64 |
+
<div
|
| 65 |
+
key={idx}
|
| 66 |
+
className={`flex flex-col p-8 rounded-2xl border ${plan.featured ? 'border-gray-600 bg-gray-900/40 relative' : 'border-gray-800 bg-black'}`}
|
| 67 |
+
>
|
| 68 |
+
<div className="mb-8">
|
| 69 |
+
<h3 className="text-lg font-medium text-white mb-2">{plan.name}</h3>
|
| 70 |
+
<p className="text-gray-500 text-sm">{plan.name === 'Free' ? 'Get started with simulations' : plan.name === 'Pro' ? 'For founders, creators and builders' : 'Custom builds for businesses'}</p>
|
| 71 |
+
</div>
|
| 72 |
+
|
| 73 |
+
<div className="mb-8">
|
| 74 |
+
<div className="flex items-baseline">
|
| 75 |
+
<span className="text-4xl font-bold text-white">{plan.price}</span>
|
| 76 |
+
{plan.period && <span className="text-gray-400 ml-1">{plan.period}</span>}
|
| 77 |
+
</div>
|
| 78 |
+
<p className="text-gray-500 text-sm mt-2">{plan.desc}</p>
|
| 79 |
+
</div>
|
| 80 |
+
|
| 81 |
+
<div className="flex-grow space-y-4 mb-8">
|
| 82 |
+
{plan.features.map((feature, fIdx) => (
|
| 83 |
+
<div key={fIdx} className="flex items-start gap-3">
|
| 84 |
+
<Check className="w-5 h-5 text-white shrink-0" />
|
| 85 |
+
<span className="text-gray-300 text-sm">{feature}</span>
|
| 86 |
+
</div>
|
| 87 |
+
))}
|
| 88 |
+
</div>
|
| 89 |
+
|
| 90 |
+
<Button
|
| 91 |
+
variant={plan.featured ? 'primary' : 'outline'}
|
| 92 |
+
className="w-full"
|
| 93 |
+
>
|
| 94 |
+
{plan.cta}
|
| 95 |
+
</Button>
|
| 96 |
+
</div>
|
| 97 |
+
))}
|
| 98 |
+
</div>
|
| 99 |
+
</div>
|
| 100 |
+
</section>
|
| 101 |
+
);
|
| 102 |
+
};
|
| 103 |
+
|
| 104 |
+
export default Pricing;
|
components/ProductGuide.tsx
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React, { useState } from 'react';
|
| 2 |
+
import { Book, Code, Terminal, Zap, ChevronRight, CheckCircle, Info } from 'lucide-react';
|
| 3 |
+
|
| 4 |
+
const ProductGuide: React.FC = () => {
|
| 5 |
+
return (
|
| 6 |
+
<div className="bg-black min-h-screen text-white p-8 md:p-16 max-w-5xl mx-auto font-sans">
|
| 7 |
+
<h1 className="text-4xl md:text-6xl font-bold mb-8 bg-gradient-to-r from-teal-400 to-blue-500 bg-clip-text text-transparent">
|
| 8 |
+
Product Guide & Documentation
|
| 9 |
+
</h1>
|
| 10 |
+
|
| 11 |
+
<p className="text-xl text-gray-400 mb-12 leading-relaxed">
|
| 12 |
+
Welcome to Branding Content Testing. This guide will help you understand how to use our agentic simulation platform to validate your brand narratives and marketing content before going live.
|
| 13 |
+
</p>
|
| 14 |
+
|
| 15 |
+
<div className="space-y-16">
|
| 16 |
+
{/* Section 1 */}
|
| 17 |
+
<section>
|
| 18 |
+
<div className="flex items-center gap-4 mb-6">
|
| 19 |
+
<div className="w-10 h-10 rounded-xl bg-teal-500/20 border border-teal-500/50 flex items-center justify-center text-teal-400">
|
| 20 |
+
<Zap size={20} />
|
| 21 |
+
</div>
|
| 22 |
+
<h2 className="text-2xl font-bold">Getting Started</h2>
|
| 23 |
+
</div>
|
| 24 |
+
<div className="prose prose-invert max-w-none text-gray-300 space-y-4">
|
| 25 |
+
<p>
|
| 26 |
+
To start using the platform, you must first authenticate with your Hugging Face account. This allows you to save your simulations, custom focus groups, and results.
|
| 27 |
+
</p>
|
| 28 |
+
<div className="bg-gray-900/50 border border-gray-800 rounded-xl p-6">
|
| 29 |
+
<h3 className="text-white font-semibold mb-2 flex items-center gap-2">
|
| 30 |
+
<CheckCircle size={16} className="text-green-500" />
|
| 31 |
+
Step 1: Sign in with Hugging Face
|
| 32 |
+
</h3>
|
| 33 |
+
<p className="text-sm">Click the "Sign in with Hugging Face" button in the sidebar or navbar. You will be redirected to Hugging Face to authorize the application.</p>
|
| 34 |
+
</div>
|
| 35 |
+
</div>
|
| 36 |
+
</section>
|
| 37 |
+
|
| 38 |
+
{/* Section 2 */}
|
| 39 |
+
<section>
|
| 40 |
+
<div className="flex items-center gap-4 mb-6">
|
| 41 |
+
<div className="w-10 h-10 rounded-xl bg-blue-500/20 border border-blue-500/50 flex items-center justify-center text-blue-400">
|
| 42 |
+
<Book size={20} />
|
| 43 |
+
</div>
|
| 44 |
+
<h2 className="text-2xl font-bold">Core Concepts</h2>
|
| 45 |
+
</div>
|
| 46 |
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-8">
|
| 47 |
+
<div className="bg-[#0a0a0a] border border-gray-800 p-6 rounded-2xl">
|
| 48 |
+
<h3 className="text-lg font-bold mb-3">Focus Groups</h3>
|
| 49 |
+
<p className="text-sm text-gray-400">AI-generated collectives of personas that mirror specific real-world audiences. You can create your own by describing your target customer and company profile.</p>
|
| 50 |
+
</div>
|
| 51 |
+
<div className="bg-[#0a0a0a] border border-gray-800 p-6 rounded-2xl">
|
| 52 |
+
<h3 className="text-lg font-bold mb-3">Simulations</h3>
|
| 53 |
+
<p className="text-sm text-gray-400">The process of running your content through a Focus Group to gather sentiment, engagement predictions, and feedback.</p>
|
| 54 |
+
</div>
|
| 55 |
+
</div>
|
| 56 |
+
</section>
|
| 57 |
+
|
| 58 |
+
{/* Section 3 */}
|
| 59 |
+
<section>
|
| 60 |
+
<div className="flex items-center gap-4 mb-6">
|
| 61 |
+
<div className="w-10 h-10 rounded-xl bg-purple-500/20 border border-purple-500/50 flex items-center justify-center text-purple-400">
|
| 62 |
+
<Terminal size={20} />
|
| 63 |
+
</div>
|
| 64 |
+
<h2 className="text-2xl font-bold">How to Create a Focus Group</h2>
|
| 65 |
+
</div>
|
| 66 |
+
<ul className="space-y-4 text-gray-400">
|
| 67 |
+
<li className="flex items-start gap-3">
|
| 68 |
+
<ChevronRight size={18} className="text-teal-500 mt-1" />
|
| 69 |
+
<span><strong>Customer Profile:</strong> Describe who your ideal customer is (e.g., "Tech founders in Europe interested in sustainability").</span>
|
| 70 |
+
</li>
|
| 71 |
+
<li className="flex items-start gap-3">
|
| 72 |
+
<ChevronRight size={18} className="text-teal-500 mt-1" />
|
| 73 |
+
<span><strong>Company Info:</strong> Provide context about your brand and what you offer.</span>
|
| 74 |
+
</li>
|
| 75 |
+
<li className="flex items-start gap-3">
|
| 76 |
+
<ChevronRight size={18} className="text-teal-500 mt-1" />
|
| 77 |
+
<span><strong>Persona Scale:</strong> Adjust the scale (1-100) to determine how many unique personas should be generated for the group.</span>
|
| 78 |
+
</li>
|
| 79 |
+
</ul>
|
| 80 |
+
</section>
|
| 81 |
+
|
| 82 |
+
{/* FAQ Section */}
|
| 83 |
+
<section className="bg-teal-950/10 border border-teal-900/30 rounded-3xl p-8 md:p-12">
|
| 84 |
+
<h2 className="text-3xl font-bold mb-8">Frequently Asked Questions</h2>
|
| 85 |
+
<div className="space-y-8">
|
| 86 |
+
<div>
|
| 87 |
+
<h4 className="text-teal-400 font-semibold mb-2">How long does a simulation take?</h4>
|
| 88 |
+
<p className="text-gray-400">Simulations run asynchronously and can take up to 30 minutes to fully process. Use the "Gather Results" button to fetch updates.</p>
|
| 89 |
+
</div>
|
| 90 |
+
<div>
|
| 91 |
+
<h4 className="text-teal-400 font-semibold mb-2">Can I upload images?</h4>
|
| 92 |
+
<p className="text-gray-400">Yes! You can upload local images or provide web image links to test visual brand assets and website layouts.</p>
|
| 93 |
+
</div>
|
| 94 |
+
</div>
|
| 95 |
+
</section>
|
| 96 |
+
</div>
|
| 97 |
+
|
| 98 |
+
<div className="mt-20 pt-12 border-t border-gray-900 text-center">
|
| 99 |
+
<p className="text-gray-500 text-sm mb-6">Need more help? Join our community or contact support.</p>
|
| 100 |
+
<div className="flex justify-center gap-4">
|
| 101 |
+
<div className="px-6 py-2 bg-white text-black rounded-full font-bold text-sm cursor-pointer hover:bg-gray-200 transition-colors">Contact Support</div>
|
| 102 |
+
<div className="px-6 py-2 border border-gray-700 rounded-full font-bold text-sm cursor-pointer hover:bg-gray-800 transition-colors">API Docs</div>
|
| 103 |
+
</div>
|
| 104 |
+
</div>
|
| 105 |
+
</div>
|
| 106 |
+
);
|
| 107 |
+
};
|
| 108 |
+
|
| 109 |
+
export default ProductGuide;
|
components/ProductOverview.tsx
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React from 'react';
|
| 2 |
+
import { Target, Maximize, Zap, Code2 } from 'lucide-react';
|
| 3 |
+
|
| 4 |
+
const ProductOverview: React.FC = () => {
|
| 5 |
+
const features = [
|
| 6 |
+
{
|
| 7 |
+
icon: <Target className="w-6 h-6" />,
|
| 8 |
+
title: "Targeted",
|
| 9 |
+
desc: "Accurately model even hard-to-reach audiences via API."
|
| 10 |
+
},
|
| 11 |
+
{
|
| 12 |
+
icon: <Maximize className="w-6 h-6" />,
|
| 13 |
+
title: "Scalable",
|
| 14 |
+
desc: "Run thousands of concurrent simulations."
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
icon: <Zap className="w-6 h-6" />,
|
| 18 |
+
title: "Low Latency",
|
| 19 |
+
desc: "Get actionable insights in your pipeline in seconds."
|
| 20 |
+
},
|
| 21 |
+
{
|
| 22 |
+
icon: <Code2 className="w-6 h-6" />,
|
| 23 |
+
title: "Free for Devs",
|
| 24 |
+
desc: "Generous free tier to build and test your integration."
|
| 25 |
+
}
|
| 26 |
+
];
|
| 27 |
+
|
| 28 |
+
return (
|
| 29 |
+
<section id="features" className="py-24 bg-black">
|
| 30 |
+
<div className="max-w-7xl mx-auto px-6">
|
| 31 |
+
<div className="flex justify-center mb-8">
|
| 32 |
+
<span className="px-4 py-1.5 rounded-full border border-gray-700 text-sm text-gray-300">Product Overview</span>
|
| 33 |
+
</div>
|
| 34 |
+
|
| 35 |
+
<h2 className="text-3xl md:text-5xl font-semibold text-center max-w-4xl mx-auto leading-tight mb-20">
|
| 36 |
+
Create realistic simulations of your target audience to instantly test brand narratives, voice, and campaign ideas
|
| 37 |
+
</h2>
|
| 38 |
+
|
| 39 |
+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
|
| 40 |
+
{features.map((feature, idx) => (
|
| 41 |
+
<div key={idx} className="p-8 border border-gray-800 rounded-2xl hover:border-gray-600 transition-colors bg-gray-900/20">
|
| 42 |
+
<div className="w-12 h-12 rounded-full border border-gray-700 flex items-center justify-center mb-6 text-white">
|
| 43 |
+
{feature.icon}
|
| 44 |
+
</div>
|
| 45 |
+
<h3 className="text-xl font-medium mb-3">{feature.title}</h3>
|
| 46 |
+
<p className="text-gray-400 leading-relaxed">{feature.desc}</p>
|
| 47 |
+
</div>
|
| 48 |
+
))}
|
| 49 |
+
</div>
|
| 50 |
+
</div>
|
| 51 |
+
</section>
|
| 52 |
+
);
|
| 53 |
+
};
|
| 54 |
+
|
| 55 |
+
export default ProductOverview;
|
components/RealNetworkGraph.tsx
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import React, { useEffect, useRef } from 'react';
|
| 3 |
+
import Plotly from 'plotly.js';
|
| 4 |
+
|
| 5 |
+
const RealNetworkGraph: React.FC = () => {
|
| 6 |
+
const graphDiv = useRef<HTMLDivElement>(null);
|
| 7 |
+
|
| 8 |
+
useEffect(() => {
|
| 9 |
+
if (!graphDiv.current) return;
|
| 10 |
+
|
| 11 |
+
// --- Data Generation Logic ---
|
| 12 |
+
const N = 80; // Node count
|
| 13 |
+
const radius = 0.22; // Connection threshold
|
| 14 |
+
const nodes = [];
|
| 15 |
+
|
| 16 |
+
// 1. Create nodes
|
| 17 |
+
for (let i = 0; i < N; i++) {
|
| 18 |
+
nodes.push({
|
| 19 |
+
x: Math.random(),
|
| 20 |
+
y: Math.random(),
|
| 21 |
+
connections: 0
|
| 22 |
+
});
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
// 2. Create edges
|
| 26 |
+
const edgeX: (number | null)[] = [];
|
| 27 |
+
const edgeY: (number | null)[] = [];
|
| 28 |
+
|
| 29 |
+
for (let i = 0; i < N; i++) {
|
| 30 |
+
for (let j = i + 1; j < N; j++) {
|
| 31 |
+
const dx = nodes[i].x - nodes[j].x;
|
| 32 |
+
const dy = nodes[i].y - nodes[j].y;
|
| 33 |
+
const dist = Math.sqrt(dx * dx + dy * dy);
|
| 34 |
+
|
| 35 |
+
if (dist < radius) {
|
| 36 |
+
nodes[i].connections++;
|
| 37 |
+
nodes[j].connections++;
|
| 38 |
+
edgeX.push(nodes[i].x, nodes[j].x, null);
|
| 39 |
+
edgeY.push(nodes[i].y, nodes[j].y, null);
|
| 40 |
+
}
|
| 41 |
+
}
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
const nodeX = nodes.map(n => n.x);
|
| 45 |
+
const nodeY = nodes.map(n => n.y);
|
| 46 |
+
const nodeColor = nodes.map(n => n.connections);
|
| 47 |
+
|
| 48 |
+
// --- Plotly Configuration ---
|
| 49 |
+
|
| 50 |
+
const edgeTrace = {
|
| 51 |
+
x: edgeX,
|
| 52 |
+
y: edgeY,
|
| 53 |
+
mode: 'lines',
|
| 54 |
+
line: { width: 0.5, color: '#4b5563' }, // gray-600
|
| 55 |
+
hoverinfo: 'none',
|
| 56 |
+
type: 'scatter'
|
| 57 |
+
};
|
| 58 |
+
|
| 59 |
+
const nodeTrace = {
|
| 60 |
+
x: nodeX,
|
| 61 |
+
y: nodeY,
|
| 62 |
+
mode: 'markers',
|
| 63 |
+
hoverinfo: 'none',
|
| 64 |
+
marker: {
|
| 65 |
+
showscale: false,
|
| 66 |
+
colorscale: 'Viridis',
|
| 67 |
+
color: nodeColor,
|
| 68 |
+
size: 8,
|
| 69 |
+
line: { width: 0 }
|
| 70 |
+
},
|
| 71 |
+
type: 'scatter'
|
| 72 |
+
};
|
| 73 |
+
|
| 74 |
+
const layout = {
|
| 75 |
+
showlegend: false,
|
| 76 |
+
hovermode: false,
|
| 77 |
+
margin: { b: 0, l: 0, r: 0, t: 0 },
|
| 78 |
+
xaxis: {
|
| 79 |
+
showgrid: false,
|
| 80 |
+
zeroline: false,
|
| 81 |
+
showticklabels: false,
|
| 82 |
+
range: [-0.05, 1.05],
|
| 83 |
+
fixedrange: true
|
| 84 |
+
},
|
| 85 |
+
yaxis: {
|
| 86 |
+
showgrid: false,
|
| 87 |
+
zeroline: false,
|
| 88 |
+
showticklabels: false,
|
| 89 |
+
range: [-0.05, 1.05],
|
| 90 |
+
fixedrange: true
|
| 91 |
+
},
|
| 92 |
+
paper_bgcolor: 'rgba(0,0,0,0)',
|
| 93 |
+
plot_bgcolor: 'rgba(0,0,0,0)',
|
| 94 |
+
autosize: true,
|
| 95 |
+
dragmode: false
|
| 96 |
+
};
|
| 97 |
+
|
| 98 |
+
const config = {
|
| 99 |
+
staticPlot: true, // Disables all interactions for a cleaner background look
|
| 100 |
+
displayModeBar: false,
|
| 101 |
+
responsive: true
|
| 102 |
+
};
|
| 103 |
+
|
| 104 |
+
// @ts-ignore - Plotly types can be tricky with ESM imports
|
| 105 |
+
Plotly.newPlot(graphDiv.current, [edgeTrace, nodeTrace], layout, config);
|
| 106 |
+
|
| 107 |
+
// Handle Resize
|
| 108 |
+
const resizeObserver = new ResizeObserver(() => {
|
| 109 |
+
if (graphDiv.current) {
|
| 110 |
+
// @ts-ignore
|
| 111 |
+
Plotly.Plots.resize(graphDiv.current);
|
| 112 |
+
}
|
| 113 |
+
});
|
| 114 |
+
resizeObserver.observe(graphDiv.current);
|
| 115 |
+
|
| 116 |
+
return () => {
|
| 117 |
+
resizeObserver.disconnect();
|
| 118 |
+
// @ts-ignore
|
| 119 |
+
if (graphDiv.current) Plotly.purge(graphDiv.current);
|
| 120 |
+
};
|
| 121 |
+
}, []);
|
| 122 |
+
|
| 123 |
+
return (
|
| 124 |
+
<div ref={graphDiv} className="w-full h-full" />
|
| 125 |
+
);
|
| 126 |
+
};
|
| 127 |
+
|
| 128 |
+
export default RealNetworkGraph;
|
components/SimulationGraph.tsx
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React, { useEffect, useRef, useState } from 'react';
|
| 2 |
+
import Plotly from 'plotly.js';
|
| 3 |
+
import { X, Linkedin, Globe, MapPin, User, Briefcase, Users, Loader2 } from 'lucide-react';
|
| 4 |
+
import Button from './ui/Button';
|
| 5 |
+
import { GradioService } from '../services/gradioService';
|
| 6 |
+
|
| 7 |
+
interface SimulationGraphProps {
|
| 8 |
+
isBuilding: boolean;
|
| 9 |
+
societyType: string;
|
| 10 |
+
viewMode: string;
|
| 11 |
+
onStartChat?: () => void;
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
const SimulationGraph: React.FC<SimulationGraphProps> = ({ isBuilding, societyType, viewMode, onStartChat }) => {
|
| 15 |
+
const graphDiv = useRef<HTMLDivElement>(null);
|
| 16 |
+
const [selectedProfile, setSelectedProfile] = useState<{ x: number, y: number, data: any } | null>(null);
|
| 17 |
+
|
| 18 |
+
// Close popup if building starts
|
| 19 |
+
useEffect(() => {
|
| 20 |
+
if (isBuilding) setSelectedProfile(null);
|
| 21 |
+
}, [isBuilding]);
|
| 22 |
+
|
| 23 |
+
useEffect(() => {
|
| 24 |
+
const renderGraph = async () => {
|
| 25 |
+
if (!graphDiv.current || isBuilding) return;
|
| 26 |
+
|
| 27 |
+
let nodes: any[] = [];
|
| 28 |
+
let edges: any[] = [];
|
| 29 |
+
|
| 30 |
+
try {
|
| 31 |
+
// Attempt to fetch real network data if societyType is provided
|
| 32 |
+
const networkData = societyType ? await GradioService.getNetworkGraph(societyType) : null;
|
| 33 |
+
if (networkData && networkData.nodes) {
|
| 34 |
+
nodes = networkData.nodes.map((n: any) => ({
|
| 35 |
+
...n,
|
| 36 |
+
x: n.x || Math.random(),
|
| 37 |
+
y: n.y || Math.random(),
|
| 38 |
+
role: n.name || n.id || 'Persona',
|
| 39 |
+
location: n.location || 'Unknown'
|
| 40 |
+
}));
|
| 41 |
+
edges = networkData.edges || [];
|
| 42 |
+
}
|
| 43 |
+
} catch (e) {
|
| 44 |
+
console.warn("Failed to fetch real network, falling back to mock.");
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
// Fallback to mock data if no real data
|
| 48 |
+
if (nodes.length === 0) {
|
| 49 |
+
const safeSocietyType = typeof societyType === 'string' ? societyType : '';
|
| 50 |
+
const isTech = safeSocietyType.includes('Tech') || safeSocietyType.includes('Founders');
|
| 51 |
+
const N = isTech ? 120 : 80;
|
| 52 |
+
const radius = isTech ? 0.18 : 0.22;
|
| 53 |
+
|
| 54 |
+
for (let i = 0; i < N; i++) {
|
| 55 |
+
nodes.push({
|
| 56 |
+
x: Math.random(),
|
| 57 |
+
y: Math.random(),
|
| 58 |
+
connections: 0,
|
| 59 |
+
role: isTech ? ['Founder', 'CTO', 'Product Lead', 'VC'][Math.floor(Math.random() * 4)] : ['Journalist', 'Reader', 'Editor', 'Subscriber'][Math.floor(Math.random() * 4)],
|
| 60 |
+
location: ['New York, USA', 'London, UK', 'Berlin, DE', 'Paris, FR'][Math.floor(Math.random() * 4)]
|
| 61 |
+
});
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
for (let i = 0; i < N; i++) {
|
| 65 |
+
for (let j = i + 1; j < N; j++) {
|
| 66 |
+
const dx = nodes[i].x - nodes[j].x;
|
| 67 |
+
const dy = nodes[i].y - nodes[j].y;
|
| 68 |
+
const dist = Math.sqrt(dx * dx + dy * dy);
|
| 69 |
+
if (dist < radius) {
|
| 70 |
+
nodes[i].connections++;
|
| 71 |
+
nodes[j].connections++;
|
| 72 |
+
edges.push({ source: i, target: j });
|
| 73 |
+
}
|
| 74 |
+
}
|
| 75 |
+
}
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
const edgeX: (number | null)[] = [];
|
| 79 |
+
const edgeY: (number | null)[] = [];
|
| 80 |
+
edges.forEach(edge => {
|
| 81 |
+
const source = nodes[edge.source];
|
| 82 |
+
const target = nodes[edge.target];
|
| 83 |
+
if (source && target) {
|
| 84 |
+
edgeX.push(source.x, target.x, null);
|
| 85 |
+
edgeY.push(source.y, target.y, null);
|
| 86 |
+
}
|
| 87 |
+
});
|
| 88 |
+
|
| 89 |
+
const nodeX = nodes.map(n => n.x);
|
| 90 |
+
const nodeY = nodes.map(n => n.y);
|
| 91 |
+
|
| 92 |
+
// Determine node colors based on viewMode
|
| 93 |
+
const nodeColor = nodes.map(n => {
|
| 94 |
+
if (viewMode === 'Sentiment') {
|
| 95 |
+
const s = n.sentiment || 'Neutral';
|
| 96 |
+
if (s === 'Positive') return 1;
|
| 97 |
+
if (s === 'Negative') return 2;
|
| 98 |
+
if (s === 'Mixed') return 3;
|
| 99 |
+
return 0; // Neutral
|
| 100 |
+
}
|
| 101 |
+
if (viewMode === 'Activity Level') {
|
| 102 |
+
const a = n.activity || 'Lurker';
|
| 103 |
+
if (a === 'Power User') return 1;
|
| 104 |
+
if (a === 'Daily Active') return 2;
|
| 105 |
+
if (a === 'Weekly Active') return 3;
|
| 106 |
+
return 0;
|
| 107 |
+
}
|
| 108 |
+
if (viewMode === 'Job Title') {
|
| 109 |
+
// Assign numeric index based on role string hash or predefined mapping
|
| 110 |
+
const roles = ["Founder", "Product Manager", "Engineer", "Investor", "Designer"];
|
| 111 |
+
const idx = roles.indexOf(n.role);
|
| 112 |
+
return idx >= 0 ? idx : (n.role ? n.role.length % 5 : 0);
|
| 113 |
+
}
|
| 114 |
+
if (viewMode === 'Country') {
|
| 115 |
+
const countries = ["United States", "United Kingdom", "Netherlands", "France", "India"];
|
| 116 |
+
const loc = n.location || '';
|
| 117 |
+
const idx = countries.findIndex(c => loc.includes(c));
|
| 118 |
+
return idx >= 0 ? idx : (loc ? loc.length % 5 : 0);
|
| 119 |
+
}
|
| 120 |
+
return n.connections || 0;
|
| 121 |
+
});
|
| 122 |
+
|
| 123 |
+
const edgeTrace = {
|
| 124 |
+
x: edgeX,
|
| 125 |
+
y: edgeY,
|
| 126 |
+
mode: 'lines',
|
| 127 |
+
line: { width: 0.5, color: '#4b5563' },
|
| 128 |
+
hoverinfo: 'none',
|
| 129 |
+
type: 'scatter'
|
| 130 |
+
};
|
| 131 |
+
|
| 132 |
+
const nodeTrace = {
|
| 133 |
+
x: nodeX,
|
| 134 |
+
y: nodeY,
|
| 135 |
+
mode: 'markers',
|
| 136 |
+
hoverinfo: 'none',
|
| 137 |
+
marker: {
|
| 138 |
+
showscale: false,
|
| 139 |
+
colorscale: 'Electric',
|
| 140 |
+
color: nodeColor,
|
| 141 |
+
size: 10,
|
| 142 |
+
line: { width: 0 }
|
| 143 |
+
},
|
| 144 |
+
type: 'scatter'
|
| 145 |
+
};
|
| 146 |
+
|
| 147 |
+
const layout = {
|
| 148 |
+
showlegend: false,
|
| 149 |
+
hovermode: 'closest',
|
| 150 |
+
margin: { b: 0, l: 0, r: 0, t: 0 },
|
| 151 |
+
xaxis: { showgrid: false, zeroline: false, showticklabels: false, range: [-0.05, 1.05], fixedrange: true },
|
| 152 |
+
yaxis: { showgrid: false, zeroline: false, showticklabels: false, range: [-0.05, 1.05], fixedrange: true },
|
| 153 |
+
paper_bgcolor: 'rgba(0,0,0,0)',
|
| 154 |
+
plot_bgcolor: 'rgba(0,0,0,0)',
|
| 155 |
+
autosize: true,
|
| 156 |
+
dragmode: false
|
| 157 |
+
};
|
| 158 |
+
|
| 159 |
+
const config = { staticPlot: false, displayModeBar: false, responsive: true };
|
| 160 |
+
|
| 161 |
+
// @ts-ignore
|
| 162 |
+
Plotly.newPlot(graphDiv.current, [edgeTrace, nodeTrace], layout, config).then((gd) => {
|
| 163 |
+
// @ts-ignore
|
| 164 |
+
gd.on('plotly_click', (data) => {
|
| 165 |
+
const point = data.points[0];
|
| 166 |
+
if (point) {
|
| 167 |
+
const nodeIndex = point.pointNumber;
|
| 168 |
+
const nodeData = nodes[nodeIndex];
|
| 169 |
+
setSelectedProfile({ x: point.x, y: point.y, data: nodeData });
|
| 170 |
+
}
|
| 171 |
+
});
|
| 172 |
+
});
|
| 173 |
+
};
|
| 174 |
+
|
| 175 |
+
renderGraph();
|
| 176 |
+
}, [isBuilding, societyType, viewMode]);
|
| 177 |
+
|
| 178 |
+
return (
|
| 179 |
+
<div className="relative w-full h-full bg-black">
|
| 180 |
+
{/* The Graph */}
|
| 181 |
+
<div ref={graphDiv} className="w-full h-full" />
|
| 182 |
+
|
| 183 |
+
{/* Profile Popup */}
|
| 184 |
+
{selectedProfile && !isBuilding && (
|
| 185 |
+
<div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-80 bg-gray-900/90 backdrop-blur-md border border-gray-700 rounded-2xl shadow-2xl overflow-hidden z-40 animate-in fade-in zoom-in-95 duration-200">
|
| 186 |
+
{/* Header */}
|
| 187 |
+
<div className="p-4 border-b border-gray-800 flex justify-between items-start">
|
| 188 |
+
<div className="flex items-center gap-3">
|
| 189 |
+
<div className="w-10 h-10 rounded-full bg-gradient-to-br from-teal-400 to-blue-600 flex items-center justify-center text-white font-bold text-lg">
|
| 190 |
+
{selectedProfile.data.role[0]}
|
| 191 |
+
</div>
|
| 192 |
+
<div>
|
| 193 |
+
<h3 className="text-white font-semibold text-sm">{selectedProfile.data.role}</h3>
|
| 194 |
+
<p className="text-gray-400 text-xs">Head of Product at BrightCore</p>
|
| 195 |
+
</div>
|
| 196 |
+
</div>
|
| 197 |
+
<button
|
| 198 |
+
onClick={() => setSelectedProfile(null)}
|
| 199 |
+
className="text-gray-500 hover:text-white"
|
| 200 |
+
>
|
| 201 |
+
<X size={16} />
|
| 202 |
+
</button>
|
| 203 |
+
</div>
|
| 204 |
+
|
| 205 |
+
{/* Body */}
|
| 206 |
+
<div className="p-4 space-y-4">
|
| 207 |
+
<div className="flex items-center gap-2 text-xs text-gray-400">
|
| 208 |
+
<span>Built from</span>
|
| 209 |
+
<Linkedin size={14} className="text-[#0077b5]" />
|
| 210 |
+
<Globe size={14} className="text-gray-300" />
|
| 211 |
+
</div>
|
| 212 |
+
|
| 213 |
+
<div className="flex flex-wrap gap-2">
|
| 214 |
+
<div className="flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg bg-gray-800 border border-gray-700 text-xs text-gray-300">
|
| 215 |
+
<MapPin size={12} /> {selectedProfile.data.location}
|
| 216 |
+
</div>
|
| 217 |
+
<div className="flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg bg-gray-800 border border-gray-700 text-xs text-gray-300">
|
| 218 |
+
<User size={12} /> Millennial
|
| 219 |
+
</div>
|
| 220 |
+
<div className="flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg bg-gray-800 border border-gray-700 text-xs text-gray-300">
|
| 221 |
+
<Briefcase size={12} /> Mid Level
|
| 222 |
+
</div>
|
| 223 |
+
<div className="flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg bg-gray-800 border border-gray-700 text-xs text-gray-300">
|
| 224 |
+
<Users size={12} /> Creative & Design
|
| 225 |
+
</div>
|
| 226 |
+
</div>
|
| 227 |
+
</div>
|
| 228 |
+
|
| 229 |
+
{/* Footer */}
|
| 230 |
+
<div className="p-4 pt-0">
|
| 231 |
+
<Button
|
| 232 |
+
className="w-full text-sm py-2"
|
| 233 |
+
onClick={onStartChat}
|
| 234 |
+
>
|
| 235 |
+
Start Conversation
|
| 236 |
+
</Button>
|
| 237 |
+
</div>
|
| 238 |
+
</div>
|
| 239 |
+
)}
|
| 240 |
+
</div>
|
| 241 |
+
);
|
| 242 |
+
};
|
| 243 |
+
|
| 244 |
+
export default SimulationGraph;
|
components/SimulationPage.tsx
ADDED
|
@@ -0,0 +1,641 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React, { useState, useEffect } from 'react';
|
| 2 |
+
import { ChevronDown, Plus, Info, MessageSquare, BookOpen, LogOut, PanelLeftClose, MessageCircle, Menu, PanelRightClose, RefreshCw } from 'lucide-react';
|
| 3 |
+
import SimulationGraph from './SimulationGraph';
|
| 4 |
+
import { GradioService } from '../services/gradioService';
|
| 5 |
+
|
| 6 |
+
interface SimulationPageProps {
|
| 7 |
+
onBack: () => void;
|
| 8 |
+
onOpenChat: () => void;
|
| 9 |
+
onOpenGuide: () => void;
|
| 10 |
+
user?: any;
|
| 11 |
+
onLogin?: () => void;
|
| 12 |
+
onLogout?: () => void;
|
| 13 |
+
simulationResult: any;
|
| 14 |
+
setSimulationResult: (res: any) => void;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
// Define the data structure for filters
|
| 18 |
+
const VIEW_FILTERS: Record<string, Array<{ label: string; color: string }>> = {
|
| 19 |
+
'Country': [
|
| 20 |
+
{ label: "United States", color: "bg-blue-600" },
|
| 21 |
+
{ label: "United Kingdom", color: "bg-purple-600" },
|
| 22 |
+
{ label: "Netherlands", color: "bg-teal-600" },
|
| 23 |
+
{ label: "France", color: "bg-orange-600" },
|
| 24 |
+
{ label: "India", color: "bg-pink-600" }
|
| 25 |
+
],
|
| 26 |
+
'Job Title': [
|
| 27 |
+
{ label: "Founder", color: "bg-indigo-500" },
|
| 28 |
+
{ label: "Product Manager", color: "bg-emerald-500" },
|
| 29 |
+
{ label: "Engineer", color: "bg-rose-500" },
|
| 30 |
+
{ label: "Investor", color: "bg-amber-500" },
|
| 31 |
+
{ label: "Designer", color: "bg-fuchsia-500" }
|
| 32 |
+
],
|
| 33 |
+
'Sentiment': [
|
| 34 |
+
{ label: "Positive", color: "bg-green-500" },
|
| 35 |
+
{ label: "Neutral", color: "bg-gray-500" },
|
| 36 |
+
{ label: "Negative", color: "bg-red-500" },
|
| 37 |
+
{ label: "Mixed", color: "bg-yellow-500" }
|
| 38 |
+
],
|
| 39 |
+
'Activity Level': [
|
| 40 |
+
{ label: "Power User", color: "bg-red-600" },
|
| 41 |
+
{ label: "Daily Active", color: "bg-orange-500" },
|
| 42 |
+
{ label: "Weekly Active", color: "bg-blue-500" },
|
| 43 |
+
{ label: "Lurker", color: "bg-slate-600" }
|
| 44 |
+
]
|
| 45 |
+
};
|
| 46 |
+
|
| 47 |
+
const SimulationPage: React.FC<SimulationPageProps> = ({
|
| 48 |
+
onBack, onOpenChat, onOpenGuide, user, onLogin, onLogout, simulationResult, setSimulationResult
|
| 49 |
+
}) => {
|
| 50 |
+
const [society, setSociety] = useState('');
|
| 51 |
+
const [societies, setSocieties] = useState<string[]>([]);
|
| 52 |
+
const [viewMode, setViewMode] = useState('Job Title');
|
| 53 |
+
const [isRefreshing, setIsRefreshing] = useState(false);
|
| 54 |
+
const [isBuilding, setIsBuilding] = useState(false);
|
| 55 |
+
const [isRightPanelOpen, setIsRightPanelOpen] = useState(window.innerWidth > 1200);
|
| 56 |
+
const [isLeftPanelOpen, setIsLeftPanelOpen] = useState(window.innerWidth > 768);
|
| 57 |
+
|
| 58 |
+
const [activeModal, setActiveModal] = useState<'none' | 'assemble' | 'feedback' | 'context' | 'test'>('none');
|
| 59 |
+
const [formData, setFormData] = useState({
|
| 60 |
+
customerProfile: '',
|
| 61 |
+
companyInfo: '',
|
| 62 |
+
personaScale: 50,
|
| 63 |
+
feedback: '',
|
| 64 |
+
context: '',
|
| 65 |
+
testName: ''
|
| 66 |
+
});
|
| 67 |
+
|
| 68 |
+
// Handle window resize for mobile responsiveness
|
| 69 |
+
useEffect(() => {
|
| 70 |
+
const handleResize = () => {
|
| 71 |
+
if (window.innerWidth < 768) {
|
| 72 |
+
setIsLeftPanelOpen(false);
|
| 73 |
+
setIsRightPanelOpen(false);
|
| 74 |
+
}
|
| 75 |
+
};
|
| 76 |
+
window.addEventListener('resize', handleResize);
|
| 77 |
+
|
| 78 |
+
// Fetch real focus groups
|
| 79 |
+
const fetchSocieties = async () => {
|
| 80 |
+
try {
|
| 81 |
+
let names: string[] = [];
|
| 82 |
+
|
| 83 |
+
// 1. Fetch from Gradio (Templates/Global)
|
| 84 |
+
const result = await GradioService.listSimulations();
|
| 85 |
+
const list = Array.isArray(result) ? result : (result?.data?.[0] || []);
|
| 86 |
+
// GradioService now returns the array of focus group objects directly
|
| 87 |
+
|
| 88 |
+
if (Array.isArray(list)) {
|
| 89 |
+
const gradioNames = list
|
| 90 |
+
.map((s: any) => {
|
| 91 |
+
if (typeof s === 'string') return s;
|
| 92 |
+
if (typeof s === 'object' && s !== null) return s.id || s.name || '';
|
| 93 |
+
return '';
|
| 94 |
+
})
|
| 95 |
+
// Filter out non-user groups as requested
|
| 96 |
+
.filter(name => name.length > 0 && !name.toLowerCase().includes('default') && !name.toLowerCase().includes('template') && !name.toLowerCase().includes('current'));
|
| 97 |
+
|
| 98 |
+
names = [...gradioNames];
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
// 2. Fetch User-created groups from local storage
|
| 102 |
+
if (user?.preferred_username) {
|
| 103 |
+
try {
|
| 104 |
+
const localResp = await fetch(`/api/list-data?type=assemble&user=${user.preferred_username}`);
|
| 105 |
+
if (localResp.ok) {
|
| 106 |
+
const localData = await localResp.json();
|
| 107 |
+
const localNames = localData.map((d: any) => d.data.customerProfile.substring(0, 20) + '...');
|
| 108 |
+
names = [...names, ...localNames];
|
| 109 |
+
}
|
| 110 |
+
} catch (e) {
|
| 111 |
+
console.error("Failed to fetch local groups", e);
|
| 112 |
+
}
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
// Remove duplicates
|
| 116 |
+
const uniqueNames = Array.from(new Set(names));
|
| 117 |
+
setSocieties(uniqueNames);
|
| 118 |
+
|
| 119 |
+
if (uniqueNames.length > 0) {
|
| 120 |
+
if (!society || !uniqueNames.includes(society)) {
|
| 121 |
+
setSociety(uniqueNames[0]);
|
| 122 |
+
}
|
| 123 |
+
} else {
|
| 124 |
+
setSociety('Standard Example');
|
| 125 |
+
}
|
| 126 |
+
} catch (e) {
|
| 127 |
+
console.error("Failed to fetch focus groups", e);
|
| 128 |
+
}
|
| 129 |
+
};
|
| 130 |
+
fetchSocieties();
|
| 131 |
+
|
| 132 |
+
return () => window.removeEventListener('resize', handleResize);
|
| 133 |
+
}, []);
|
| 134 |
+
|
| 135 |
+
// Function to simulate rebuilding the graph when settings change
|
| 136 |
+
const handleSettingChange = (setter: (val: string) => void, value: string) => {
|
| 137 |
+
if (value === society || (value === viewMode && setter === setViewMode)) return; // No change
|
| 138 |
+
|
| 139 |
+
setter(value);
|
| 140 |
+
setIsBuilding(true);
|
| 141 |
+
// Simulate network delay
|
| 142 |
+
setTimeout(() => {
|
| 143 |
+
setIsBuilding(false);
|
| 144 |
+
}, 1500);
|
| 145 |
+
};
|
| 146 |
+
|
| 147 |
+
const currentFilters = VIEW_FILTERS[viewMode] || VIEW_FILTERS['Country'];
|
| 148 |
+
|
| 149 |
+
return (
|
| 150 |
+
<div className="flex h-screen w-screen overflow-hidden bg-black text-white font-sans relative">
|
| 151 |
+
{/* Sidebar */}
|
| 152 |
+
<aside className={`fixed md:relative w-[300px] h-full flex-shrink-0 border-r border-gray-800 flex flex-col bg-[#0a0a0a] z-40 transition-all duration-300 ${isLeftPanelOpen ? 'translate-x-0' : '-translate-x-full md:-ml-[300px]'}`}>
|
| 153 |
+
{/* Header */}
|
| 154 |
+
<div className="p-4 h-16 border-b border-gray-800 flex items-center justify-between">
|
| 155 |
+
<div className="flex items-center gap-2 cursor-pointer" onClick={onBack}>
|
| 156 |
+
<div className="w-6 h-6 flex items-center justify-center font-bold text-white">Λ</div>
|
| 157 |
+
<span className="font-semibold tracking-tight text-xs">Branding Content Testing</span>
|
| 158 |
+
</div>
|
| 159 |
+
<button
|
| 160 |
+
onClick={() => setIsLeftPanelOpen(false)}
|
| 161 |
+
className="text-gray-500 hover:text-white"
|
| 162 |
+
>
|
| 163 |
+
<PanelLeftClose size={18}/>
|
| 164 |
+
</button>
|
| 165 |
+
</div>
|
| 166 |
+
|
| 167 |
+
{/* Scrollable Content */}
|
| 168 |
+
<div className="flex-1 overflow-y-auto p-4 space-y-6">
|
| 169 |
+
|
| 170 |
+
{/* Focus Group Control */}
|
| 171 |
+
<div className="space-y-2">
|
| 172 |
+
<label className="text-xs text-gray-500 font-medium uppercase tracking-wider">Focus Group</label>
|
| 173 |
+
<div className="relative group">
|
| 174 |
+
<select
|
| 175 |
+
value={society}
|
| 176 |
+
onChange={(e) => handleSettingChange(setSociety, e.target.value)}
|
| 177 |
+
className="w-full appearance-none bg-[#111] border border-gray-700 text-white rounded-lg px-3 py-2.5 text-sm focus:outline-none focus:border-teal-500 cursor-pointer"
|
| 178 |
+
>
|
| 179 |
+
{societies.map(s => <option key={s} value={s}>{s}</option>)}
|
| 180 |
+
</select>
|
| 181 |
+
<ChevronDown className="absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 pointer-events-none w-4 h-4" />
|
| 182 |
+
</div>
|
| 183 |
+
</div>
|
| 184 |
+
|
| 185 |
+
{/* Current View Control */}
|
| 186 |
+
<div className="space-y-2">
|
| 187 |
+
<label className="text-xs text-gray-500 font-medium uppercase tracking-wider">Current View</label>
|
| 188 |
+
<div className="relative">
|
| 189 |
+
<select
|
| 190 |
+
value={viewMode}
|
| 191 |
+
onChange={(e) => handleSettingChange(setViewMode, e.target.value)}
|
| 192 |
+
className="w-full appearance-none bg-[#111] border border-gray-700 text-white rounded-lg px-3 py-2.5 text-sm focus:outline-none focus:border-teal-500 cursor-pointer"
|
| 193 |
+
>
|
| 194 |
+
<option>Country</option>
|
| 195 |
+
<option>Job Title</option>
|
| 196 |
+
<option>Sentiment</option>
|
| 197 |
+
<option>Activity Level</option>
|
| 198 |
+
</select>
|
| 199 |
+
<ChevronDown className="absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 pointer-events-none w-4 h-4" />
|
| 200 |
+
</div>
|
| 201 |
+
</div>
|
| 202 |
+
|
| 203 |
+
<div className="h-px bg-gray-800 my-4" />
|
| 204 |
+
|
| 205 |
+
{/* Actions */}
|
| 206 |
+
<button
|
| 207 |
+
onClick={() => setActiveModal('assemble')}
|
| 208 |
+
className="w-full flex items-center justify-between text-left text-sm text-gray-300 hover:text-white group py-2 border-b border-gray-800/50 mb-1"
|
| 209 |
+
>
|
| 210 |
+
<span>Assemble new group</span>
|
| 211 |
+
<Plus size={18} className="text-gray-500 group-hover:text-white" />
|
| 212 |
+
</button>
|
| 213 |
+
|
| 214 |
+
<button
|
| 215 |
+
onClick={() => setActiveModal('test')}
|
| 216 |
+
className="w-full flex items-center justify-between text-left text-sm text-gray-300 hover:text-white group py-2 border-b border-gray-800/50 mb-1"
|
| 217 |
+
>
|
| 218 |
+
<span>Create a new test</span>
|
| 219 |
+
<Plus size={18} className="text-gray-500 group-hover:text-white" />
|
| 220 |
+
</button>
|
| 221 |
+
|
| 222 |
+
<button
|
| 223 |
+
onClick={() => setActiveModal('context')}
|
| 224 |
+
className="w-full flex items-center justify-between text-left text-sm text-gray-300 hover:text-white group py-2"
|
| 225 |
+
>
|
| 226 |
+
<span>Request new context</span>
|
| 227 |
+
<Plus size={18} className="text-gray-500 group-hover:text-white" />
|
| 228 |
+
</button>
|
| 229 |
+
|
| 230 |
+
{/* Global Chat Button (Sidebar) */}
|
| 231 |
+
<button
|
| 232 |
+
onClick={onOpenChat}
|
| 233 |
+
className="w-full flex items-center gap-3 px-4 py-3 bg-gray-800 hover:bg-gray-700 text-white rounded-lg transition-colors border border-gray-700"
|
| 234 |
+
>
|
| 235 |
+
<MessageCircle size={18} />
|
| 236 |
+
<span className="font-medium text-sm">Open Global Chat</span>
|
| 237 |
+
</button>
|
| 238 |
+
|
| 239 |
+
{/* Setup Warning / Info Box */}
|
| 240 |
+
<div className="bg-blue-900/30 border border-blue-700/50 rounded-xl p-4 mt-4">
|
| 241 |
+
<div className="flex items-center gap-2 text-blue-200 font-bold text-xs mb-1">
|
| 242 |
+
<Info size={14}/>
|
| 243 |
+
<span>Configuration Required</span>
|
| 244 |
+
</div>
|
| 245 |
+
<p className="text-blue-200/70 text-[10px] leading-relaxed">
|
| 246 |
+
Assemble new group and create a new test are required to be configured first before using any chat.
|
| 247 |
+
</p>
|
| 248 |
+
</div>
|
| 249 |
+
|
| 250 |
+
{/* History List */}
|
| 251 |
+
<div className="space-y-1 pt-4">
|
| 252 |
+
<label className="text-xs text-gray-500 font-medium uppercase tracking-wider mb-2 block">Recent Tests</label>
|
| 253 |
+
<div className="text-sm text-gray-400 py-2 px-2 hover:bg-gray-800/50 rounded cursor-pointer truncate">
|
| 254 |
+
Sustainable Luxury Narrative
|
| 255 |
+
</div>
|
| 256 |
+
<div className="text-sm text-gray-400 py-2 px-2 hover:bg-gray-800/50 rounded cursor-pointer truncate">
|
| 257 |
+
Radical Transparency Voice
|
| 258 |
+
</div>
|
| 259 |
+
<div className="text-sm text-gray-400 py-2 px-2 hover:bg-gray-800/50 rounded cursor-pointer truncate">
|
| 260 |
+
Gen-Z Greenwash Perception
|
| 261 |
+
</div>
|
| 262 |
+
</div>
|
| 263 |
+
</div>
|
| 264 |
+
|
| 265 |
+
{/* Footer */}
|
| 266 |
+
<div className="border-t border-gray-800 p-4 space-y-1 bg-[#0a0a0a]">
|
| 267 |
+
{user ? (
|
| 268 |
+
<div className="flex items-center gap-3 py-3 border-b border-gray-800 mb-2">
|
| 269 |
+
{user.avatarUrl && <img src={user.avatarUrl} alt={user.preferred_username} className="w-8 h-8 rounded-full border border-gray-700" />}
|
| 270 |
+
<div className="flex flex-col">
|
| 271 |
+
<span className="text-xs font-semibold text-gray-200">{user.preferred_username}</span>
|
| 272 |
+
<span className="text-[10px] text-gray-500">Credits: Unlimited</span>
|
| 273 |
+
</div>
|
| 274 |
+
</div>
|
| 275 |
+
) : (
|
| 276 |
+
<div className="py-2 border-b border-gray-800 mb-2">
|
| 277 |
+
<button
|
| 278 |
+
onClick={onLogin}
|
| 279 |
+
className="w-full py-2 bg-white text-black rounded-lg text-xs font-bold hover:bg-gray-200 transition-colors"
|
| 280 |
+
>
|
| 281 |
+
Sign in with Hugging Face
|
| 282 |
+
</button>
|
| 283 |
+
</div>
|
| 284 |
+
)}
|
| 285 |
+
|
| 286 |
+
<MenuItem icon={<MessageSquare size={16}/>} label="Leave Feedback" onClick={() => setActiveModal('feedback')} />
|
| 287 |
+
<MenuItem icon={<BookOpen size={16}/>} label="Product Guide" onClick={onOpenGuide} />
|
| 288 |
+
{user && <MenuItem icon={<LogOut size={16}/>} label="Log Out" onClick={onLogout} />}
|
| 289 |
+
|
| 290 |
+
<div className="pt-4 text-[10px] text-gray-600">Version 2.1</div>
|
| 291 |
+
</div>
|
| 292 |
+
</aside>
|
| 293 |
+
|
| 294 |
+
{/* Main Content Area */}
|
| 295 |
+
<main className="flex-1 flex flex-col relative bg-black overflow-hidden">
|
| 296 |
+
{/* Top Navigation Overlay */}
|
| 297 |
+
<div className="absolute top-4 left-4 right-4 z-30 flex justify-between items-center pointer-events-none">
|
| 298 |
+
{/* Left Toggle (when sidebar closed) */}
|
| 299 |
+
<button
|
| 300 |
+
onClick={() => setIsLeftPanelOpen(true)}
|
| 301 |
+
className={`pointer-events-auto p-2 bg-gray-900/80 border border-gray-700 rounded-lg text-gray-400 hover:text-white transition-opacity ${isLeftPanelOpen ? 'opacity-0 pointer-events-none' : 'opacity-100'}`}
|
| 302 |
+
>
|
| 303 |
+
<Menu size={20} />
|
| 304 |
+
</button>
|
| 305 |
+
|
| 306 |
+
{/* Right Toggle (when output closed) */}
|
| 307 |
+
<button
|
| 308 |
+
onClick={() => setIsRightPanelOpen(true)}
|
| 309 |
+
className={`pointer-events-auto p-2 bg-gray-900/80 border border-gray-700 rounded-lg text-gray-400 hover:text-white transition-opacity ml-auto ${isRightPanelOpen ? 'opacity-0 pointer-events-none' : 'opacity-100'}`}
|
| 310 |
+
>
|
| 311 |
+
<PanelRightClose size={20} className="rotate-180" />
|
| 312 |
+
</button>
|
| 313 |
+
</div>
|
| 314 |
+
|
| 315 |
+
<div className="absolute top-6 left-6 right-6 z-10 flex justify-center pointer-events-none">
|
| 316 |
+
{/* Legend / Filter Chips */}
|
| 317 |
+
<div className="flex flex-wrap justify-center gap-2 pointer-events-auto max-w-[60%]">
|
| 318 |
+
{currentFilters.map((filter, idx) => (
|
| 319 |
+
<FilterChip key={idx} color={filter.color} label={filter.label} />
|
| 320 |
+
))}
|
| 321 |
+
</div>
|
| 322 |
+
</div>
|
| 323 |
+
|
| 324 |
+
{/* Graph Container */}
|
| 325 |
+
<div className="flex-1 w-full h-full">
|
| 326 |
+
<SimulationGraph
|
| 327 |
+
isBuilding={isBuilding}
|
| 328 |
+
societyType={society}
|
| 329 |
+
viewMode={viewMode}
|
| 330 |
+
onStartChat={onOpenChat}
|
| 331 |
+
/>
|
| 332 |
+
</div>
|
| 333 |
+
|
| 334 |
+
{/* Modals */}
|
| 335 |
+
{activeModal !== 'none' && (
|
| 336 |
+
<div className="absolute inset-0 z-[60] flex items-center justify-center p-6 bg-black/60 backdrop-blur-sm">
|
| 337 |
+
<div className="bg-[#111] border border-gray-800 rounded-2xl w-full max-w-md overflow-hidden shadow-2xl">
|
| 338 |
+
<div className="p-6 border-b border-gray-800 flex items-center justify-between">
|
| 339 |
+
<h3 className="font-semibold text-lg">
|
| 340 |
+
{activeModal === 'assemble' && "Assemble New Group"}
|
| 341 |
+
{activeModal === 'feedback' && "Leave Feedback"}
|
| 342 |
+
{activeModal === 'context' && "Request New Context"}
|
| 343 |
+
{activeModal === 'test' && "Create New Test"}
|
| 344 |
+
</h3>
|
| 345 |
+
<button onClick={() => setActiveModal('none')} className="text-gray-500 hover:text-white">
|
| 346 |
+
<PanelRightClose size={20} />
|
| 347 |
+
</button>
|
| 348 |
+
</div>
|
| 349 |
+
|
| 350 |
+
<div className="p-6 space-y-4">
|
| 351 |
+
{activeModal === 'assemble' && (
|
| 352 |
+
<>
|
| 353 |
+
<div className="space-y-1.5">
|
| 354 |
+
<label className="text-xs text-gray-400 font-medium">Customer Profile</label>
|
| 355 |
+
<textarea
|
| 356 |
+
value={formData.customerProfile}
|
| 357 |
+
onChange={(e) => setFormData({...formData, customerProfile: e.target.value})}
|
| 358 |
+
className="w-full bg-black border border-gray-800 rounded-lg p-3 text-sm focus:border-teal-500 outline-none h-24 resize-none"
|
| 359 |
+
placeholder="Describe your ideal audience..."
|
| 360 |
+
/>
|
| 361 |
+
</div>
|
| 362 |
+
<div className="space-y-1.5">
|
| 363 |
+
<label className="text-xs text-gray-400 font-medium">Company Info</label>
|
| 364 |
+
<textarea
|
| 365 |
+
value={formData.companyInfo}
|
| 366 |
+
onChange={(e) => setFormData({...formData, companyInfo: e.target.value})}
|
| 367 |
+
className="w-full bg-black border border-gray-800 rounded-lg p-3 text-sm focus:border-teal-500 outline-none h-24 resize-none"
|
| 368 |
+
placeholder="Tell us about your brand..."
|
| 369 |
+
/>
|
| 370 |
+
</div>
|
| 371 |
+
<div className="space-y-1.5">
|
| 372 |
+
<div className="flex justify-between">
|
| 373 |
+
<label className="text-xs text-gray-400 font-medium">Persona Scale</label>
|
| 374 |
+
<span className="text-xs text-teal-500 font-bold">{formData.personaScale}</span>
|
| 375 |
+
</div>
|
| 376 |
+
<input
|
| 377 |
+
type="range" min="1" max="100"
|
| 378 |
+
value={formData.personaScale}
|
| 379 |
+
onChange={(e) => setFormData({...formData, personaScale: parseInt(e.target.value)})}
|
| 380 |
+
className="w-full accent-teal-500"
|
| 381 |
+
/>
|
| 382 |
+
<div className="flex justify-between text-[10px] text-gray-600 uppercase font-bold">
|
| 383 |
+
<span>Conservative</span>
|
| 384 |
+
<span>Radical</span>
|
| 385 |
+
</div>
|
| 386 |
+
</div>
|
| 387 |
+
</>
|
| 388 |
+
)}
|
| 389 |
+
|
| 390 |
+
{activeModal === 'feedback' && (
|
| 391 |
+
<div className="space-y-1.5">
|
| 392 |
+
<label className="text-xs text-gray-400 font-medium">Your Feedback</label>
|
| 393 |
+
<textarea
|
| 394 |
+
value={formData.feedback}
|
| 395 |
+
onChange={(e) => setFormData({...formData, feedback: e.target.value})}
|
| 396 |
+
className="w-full bg-black border border-gray-800 rounded-lg p-3 text-sm focus:border-teal-500 outline-none h-40 resize-none"
|
| 397 |
+
placeholder="How can we improve?"
|
| 398 |
+
/>
|
| 399 |
+
</div>
|
| 400 |
+
)}
|
| 401 |
+
|
| 402 |
+
{activeModal === 'context' && (
|
| 403 |
+
<div className="space-y-1.5">
|
| 404 |
+
<label className="text-xs text-gray-400 font-medium">New Context / Fuse Box</label>
|
| 405 |
+
<textarea
|
| 406 |
+
value={formData.context}
|
| 407 |
+
onChange={(e) => setFormData({...formData, context: e.target.value})}
|
| 408 |
+
className="w-full bg-black border border-gray-800 rounded-lg p-3 text-sm focus:border-teal-500 outline-none h-40 resize-none"
|
| 409 |
+
placeholder="Specify the testing environment or scenario..."
|
| 410 |
+
/>
|
| 411 |
+
</div>
|
| 412 |
+
)}
|
| 413 |
+
|
| 414 |
+
{activeModal === 'test' && (
|
| 415 |
+
<>
|
| 416 |
+
<div className="space-y-1.5">
|
| 417 |
+
<label className="text-xs text-gray-400 font-medium">Test Name</label>
|
| 418 |
+
<input
|
| 419 |
+
type="text"
|
| 420 |
+
value={formData.testName}
|
| 421 |
+
onChange={(e) => setFormData({...formData, testName: e.target.value})}
|
| 422 |
+
className="w-full bg-black border border-gray-800 rounded-lg p-3 text-sm focus:border-teal-500 outline-none"
|
| 423 |
+
placeholder="Campaign Launch 2024..."
|
| 424 |
+
/>
|
| 425 |
+
</div>
|
| 426 |
+
<div className="space-y-1.5">
|
| 427 |
+
<label className="text-xs text-gray-400 font-medium">Brand Asset for Testing</label>
|
| 428 |
+
<div className="flex items-center justify-center w-full">
|
| 429 |
+
<label className="flex flex-col items-center justify-center w-full h-32 border-2 border-gray-800 border-dashed rounded-lg cursor-pointer bg-black hover:bg-gray-900 transition-colors">
|
| 430 |
+
<div className="flex flex-col items-center justify-center pt-5 pb-6">
|
| 431 |
+
<Plus className="w-8 h-8 mb-4 text-gray-500" />
|
| 432 |
+
<p className="mb-2 text-sm text-gray-500"><span className="font-semibold">Click to upload</span> or drag and drop</p>
|
| 433 |
+
<p className="text-xs text-gray-500">SVG, PNG, JPG (MAX. 800x400px)</p>
|
| 434 |
+
</div>
|
| 435 |
+
<input type="file" className="hidden" multiple accept="image/*" />
|
| 436 |
+
</label>
|
| 437 |
+
</div>
|
| 438 |
+
</div>
|
| 439 |
+
</>
|
| 440 |
+
)}
|
| 441 |
+
</div>
|
| 442 |
+
|
| 443 |
+
<div className="p-6 border-t border-gray-800 flex gap-3">
|
| 444 |
+
<button
|
| 445 |
+
onClick={() => setActiveModal('none')}
|
| 446 |
+
className="flex-1 py-2.5 rounded-xl border border-gray-800 text-sm font-medium hover:bg-gray-900 transition-colors"
|
| 447 |
+
>
|
| 448 |
+
Cancel
|
| 449 |
+
</button>
|
| 450 |
+
<button
|
| 451 |
+
onClick={async () => {
|
| 452 |
+
if (activeModal === 'assemble') {
|
| 453 |
+
setIsBuilding(true);
|
| 454 |
+
setIsRightPanelOpen(true);
|
| 455 |
+
setActiveModal('none');
|
| 456 |
+
try {
|
| 457 |
+
// 1. Generate personas based on profile and company info
|
| 458 |
+
const jobRes = await GradioService.generatePersonas(formData.companyInfo, formData.customerProfile, Math.ceil(formData.personaScale / 20));
|
| 459 |
+
const personas = [jobRes.job_id];
|
| 460 |
+
|
| 461 |
+
// 2. Generate social network for these personas
|
| 462 |
+
const groupName = formData.customerProfile.substring(0, 20);
|
| 463 |
+
await GradioService.generateSocialNetwork(groupName, formData.personaScale, 'scale_free', groupName);
|
| 464 |
+
|
| 465 |
+
// 3. Save to backend
|
| 466 |
+
await fetch('/api/save-data', {
|
| 467 |
+
method: 'POST',
|
| 468 |
+
headers: { 'Content-Type': 'application/json' },
|
| 469 |
+
body: JSON.stringify({
|
| 470 |
+
type: 'assemble',
|
| 471 |
+
data: { ...formData, generatedPersonas: personas },
|
| 472 |
+
user: user?.preferred_username || 'anonymous'
|
| 473 |
+
})
|
| 474 |
+
});
|
| 475 |
+
|
| 476 |
+
// 4. Update UI
|
| 477 |
+
setSocieties(prev => [groupName, ...prev]);
|
| 478 |
+
setSociety(groupName);
|
| 479 |
+
alert('Focus group assembled and selected!');
|
| 480 |
+
} catch (e) {
|
| 481 |
+
console.error(e);
|
| 482 |
+
alert('Failed to assemble group via API.');
|
| 483 |
+
} finally {
|
| 484 |
+
setIsBuilding(false);
|
| 485 |
+
}
|
| 486 |
+
return;
|
| 487 |
+
}
|
| 488 |
+
|
| 489 |
+
// Save to backend logic for other modals
|
| 490 |
+
try {
|
| 491 |
+
const response = await fetch('/api/save-data', {
|
| 492 |
+
method: 'POST',
|
| 493 |
+
headers: { 'Content-Type': 'application/json' },
|
| 494 |
+
body: JSON.stringify({
|
| 495 |
+
type: activeModal,
|
| 496 |
+
data: formData,
|
| 497 |
+
user: user?.preferred_username || 'anonymous'
|
| 498 |
+
})
|
| 499 |
+
});
|
| 500 |
+
if (response.ok) {
|
| 501 |
+
alert('Successfully saved!');
|
| 502 |
+
setActiveModal('none');
|
| 503 |
+
}
|
| 504 |
+
} catch (e) {
|
| 505 |
+
console.error(e);
|
| 506 |
+
alert('Successfully submitted (Local simulation)');
|
| 507 |
+
setActiveModal('none');
|
| 508 |
+
}
|
| 509 |
+
}}
|
| 510 |
+
className="flex-1 py-2.5 rounded-xl bg-teal-600 text-white text-sm font-bold hover:bg-teal-500 transition-colors shadow-lg shadow-teal-900/20"
|
| 511 |
+
>
|
| 512 |
+
Confirm
|
| 513 |
+
</button>
|
| 514 |
+
</div>
|
| 515 |
+
</div>
|
| 516 |
+
</div>
|
| 517 |
+
)}
|
| 518 |
+
|
| 519 |
+
{/* Floating Chat Button (Bottom) */}
|
| 520 |
+
<div className="absolute bottom-8 left-1/2 -translate-x-1/2 z-30">
|
| 521 |
+
<button
|
| 522 |
+
onClick={onOpenChat}
|
| 523 |
+
className="flex items-center gap-2 bg-black/80 backdrop-blur-md border border-gray-700 text-white px-6 py-3 rounded-full shadow-2xl hover:bg-gray-900 transition-all hover:scale-105"
|
| 524 |
+
>
|
| 525 |
+
<MessageCircle size={20} />
|
| 526 |
+
<span className="font-medium">Open Simulation Chat</span>
|
| 527 |
+
</button>
|
| 528 |
+
</div>
|
| 529 |
+
</main>
|
| 530 |
+
|
| 531 |
+
{/* Right Sidebar (Output) */}
|
| 532 |
+
<aside className={`fixed right-0 md:relative w-[300px] h-full flex-shrink-0 border-l border-gray-800 flex flex-col bg-[#0a0a0a] z-40 transition-all duration-300 ${isRightPanelOpen ? 'translate-x-0' : 'translate-x-full md:-mr-[300px]'}`}>
|
| 533 |
+
<div className="p-4 h-16 border-b border-gray-800 flex items-center justify-between">
|
| 534 |
+
<span className="font-semibold tracking-tight uppercase text-xs text-gray-500">Output</span>
|
| 535 |
+
<button onClick={() => setIsRightPanelOpen(false)} className="text-gray-500 hover:text-white"><PanelRightClose size={18}/></button>
|
| 536 |
+
</div>
|
| 537 |
+
<div className="flex-1 overflow-y-auto p-4 space-y-4">
|
| 538 |
+
{isBuilding && (
|
| 539 |
+
<div className="bg-teal-900/20 border border-teal-500/30 rounded-xl p-4 mb-4 animate-in fade-in slide-in-from-top-2">
|
| 540 |
+
<div className="flex items-center gap-3">
|
| 541 |
+
<RefreshCw className="w-4 h-4 text-teal-400 animate-spin" />
|
| 542 |
+
<div className="flex flex-col">
|
| 543 |
+
<span className="text-xs font-bold text-teal-400">Assembling...</span>
|
| 544 |
+
<span className="text-[10px] text-teal-400/60 font-mono">Constructing network mesh</span>
|
| 545 |
+
</div>
|
| 546 |
+
</div>
|
| 547 |
+
</div>
|
| 548 |
+
)}
|
| 549 |
+
|
| 550 |
+
<div className="bg-gray-900/50 border border-gray-800 rounded-xl p-4">
|
| 551 |
+
<div className="flex items-center justify-between mb-2">
|
| 552 |
+
<p className="text-xs text-gray-500">Simulation Results</p>
|
| 553 |
+
{simulationResult && (
|
| 554 |
+
<button
|
| 555 |
+
onClick={async () => {
|
| 556 |
+
setIsRefreshing(true);
|
| 557 |
+
try {
|
| 558 |
+
// In SimulationPage we don't track the running simulation's job ID.
|
| 559 |
+
// To get the status, we would need the job ID returned by startSimulation.
|
| 560 |
+
// If we are polling for the group assembly job, we might need to store it.
|
| 561 |
+
// For now we try to poll with the group name, though it may fail if it's not a job ID.
|
| 562 |
+
// Ensure that we poll only if society contains a job ID. If it is a group name, getSimulationStatus will fail on the new API.
|
| 563 |
+
const status = await GradioService.getSimulationStatus(simulationResult?.job_id || society);
|
| 564 |
+
setSimulationResult({
|
| 565 |
+
status: "Updated",
|
| 566 |
+
message: "Latest status gathered from API.",
|
| 567 |
+
data: status
|
| 568 |
+
});
|
| 569 |
+
} catch (e) {
|
| 570 |
+
console.error(e);
|
| 571 |
+
} finally {
|
| 572 |
+
setIsRefreshing(false);
|
| 573 |
+
}
|
| 574 |
+
}}
|
| 575 |
+
className="p-1 hover:bg-gray-800 rounded text-gray-500 hover:text-white"
|
| 576 |
+
title="Refresh Status"
|
| 577 |
+
>
|
| 578 |
+
<RefreshCw size={12} className={isRefreshing ? "animate-spin" : ""} />
|
| 579 |
+
</button>
|
| 580 |
+
)}
|
| 581 |
+
</div>
|
| 582 |
+
|
| 583 |
+
{!simulationResult ? (
|
| 584 |
+
<div className="text-sm text-gray-400 italic text-center py-8">
|
| 585 |
+
Results will appear here after running a simulation.
|
| 586 |
+
</div>
|
| 587 |
+
) : (
|
| 588 |
+
<div className="space-y-3">
|
| 589 |
+
<div className="flex items-center gap-2 text-xs font-medium text-green-400">
|
| 590 |
+
<div className="w-1.5 h-1.5 rounded-full bg-green-500"></div>
|
| 591 |
+
{simulationResult.status}
|
| 592 |
+
</div>
|
| 593 |
+
<p className="text-[11px] text-gray-400">{simulationResult.message}</p>
|
| 594 |
+
{simulationResult.data && (
|
| 595 |
+
<pre className="text-[10px] bg-black/50 p-2 rounded max-h-96 overflow-y-auto custom-scrollbar whitespace-pre-wrap text-gray-300 border border-gray-800">
|
| 596 |
+
{JSON.stringify(simulationResult.data, null, 2)}
|
| 597 |
+
</pre>
|
| 598 |
+
)}
|
| 599 |
+
<p className="text-[10px] text-gray-600 mt-4 italic">
|
| 600 |
+
Note: Complete simulation results can take up to 30 minutes to be fully processed by the API.
|
| 601 |
+
</p>
|
| 602 |
+
</div>
|
| 603 |
+
)}
|
| 604 |
+
</div>
|
| 605 |
+
</div>
|
| 606 |
+
</aside>
|
| 607 |
+
</div>
|
| 608 |
+
);
|
| 609 |
+
};
|
| 610 |
+
|
| 611 |
+
// Helper Components
|
| 612 |
+
interface MenuItemProps {
|
| 613 |
+
icon: React.ReactNode;
|
| 614 |
+
label: string;
|
| 615 |
+
highlight?: boolean;
|
| 616 |
+
onClick?: () => void;
|
| 617 |
+
}
|
| 618 |
+
|
| 619 |
+
const MenuItem: React.FC<MenuItemProps> = ({ icon, label, highlight = false, onClick }) => (
|
| 620 |
+
<button
|
| 621 |
+
onClick={onClick}
|
| 622 |
+
className={`w-full flex items-center gap-3 px-2 py-2.5 rounded-md text-sm transition-colors ${highlight ? 'text-teal-400 hover:bg-teal-950/30' : 'text-gray-400 hover:bg-gray-800 hover:text-white'}`}
|
| 623 |
+
>
|
| 624 |
+
{icon}
|
| 625 |
+
<span>{label}</span>
|
| 626 |
+
</button>
|
| 627 |
+
);
|
| 628 |
+
|
| 629 |
+
interface FilterChipProps {
|
| 630 |
+
color: string;
|
| 631 |
+
label: string;
|
| 632 |
+
}
|
| 633 |
+
|
| 634 |
+
const FilterChip: React.FC<FilterChipProps> = ({ color, label }) => (
|
| 635 |
+
<button className="flex items-center gap-2 bg-gray-900/80 backdrop-blur border border-gray-700 rounded-full pl-2 pr-4 py-1.5 hover:border-gray-500 transition-colors">
|
| 636 |
+
<span className={`w-2.5 h-2.5 rounded-full ${color}`}></span>
|
| 637 |
+
<span className="text-xs font-medium text-gray-300">{label}</span>
|
| 638 |
+
</button>
|
| 639 |
+
);
|
| 640 |
+
|
| 641 |
+
export default SimulationPage;
|
components/Testimonials.tsx
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import React from 'react';
|
| 3 |
+
import { TESTIMONIALS } from '../constants';
|
| 4 |
+
import { ArrowLeft, ArrowRight } from 'lucide-react';
|
| 5 |
+
|
| 6 |
+
const Testimonials: React.FC = () => {
|
| 7 |
+
return (
|
| 8 |
+
<section className="py-24 bg-black border-y border-gray-900">
|
| 9 |
+
<div className="max-w-7xl mx-auto px-6">
|
| 10 |
+
<div className="flex justify-center mb-8">
|
| 11 |
+
<span className="px-4 py-1.5 rounded-full border border-gray-700 text-sm text-gray-300">Testimonials</span>
|
| 12 |
+
</div>
|
| 13 |
+
<h2 className="text-3xl md:text-5xl font-semibold text-center mb-16 max-w-3xl mx-auto">
|
| 14 |
+
Join thousands using Agentic User Experience (AUX) to run simulations and test ideas
|
| 15 |
+
</h2>
|
| 16 |
+
|
| 17 |
+
<div className="grid grid-cols-1 md:grid-cols-3 gap-8">
|
| 18 |
+
{TESTIMONIALS.map((t, idx) => (
|
| 19 |
+
<div key={idx} className="bg-gray-900/30 border border-gray-800 p-8 rounded-2xl flex flex-col justify-between h-full">
|
| 20 |
+
<p className="text-xl leading-relaxed text-gray-200 mb-8 font-light">"{t.quote}"</p>
|
| 21 |
+
<div className="flex items-center gap-4">
|
| 22 |
+
<div className="w-12 h-12 rounded-full bg-white text-black flex items-center justify-center font-bold text-lg">
|
| 23 |
+
{t.company[0]}
|
| 24 |
+
</div>
|
| 25 |
+
<div>
|
| 26 |
+
<div className="font-semibold">{t.company}</div>
|
| 27 |
+
<div className="text-sm text-gray-400">{t.author} • {t.role}</div>
|
| 28 |
+
</div>
|
| 29 |
+
</div>
|
| 30 |
+
</div>
|
| 31 |
+
))}
|
| 32 |
+
</div>
|
| 33 |
+
|
| 34 |
+
<div className="flex justify-center gap-4 mt-12">
|
| 35 |
+
<button className="w-12 h-12 rounded-full border border-gray-700 flex items-center justify-center hover:bg-white hover:text-black transition-colors">
|
| 36 |
+
<ArrowLeft size={20} />
|
| 37 |
+
</button>
|
| 38 |
+
<button className="w-12 h-12 rounded-full border border-gray-700 flex items-center justify-center hover:bg-white hover:text-black transition-colors">
|
| 39 |
+
<ArrowRight size={20} />
|
| 40 |
+
</button>
|
| 41 |
+
</div>
|
| 42 |
+
</div>
|
| 43 |
+
</section>
|
| 44 |
+
);
|
| 45 |
+
};
|
| 46 |
+
|
| 47 |
+
export default Testimonials;
|
components/TrustedBy.tsx
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React from 'react';
|
| 2 |
+
import { CheckCircle, Timer, Clock, ClipboardCheck, Smile, Gauge } from 'lucide-react';
|
| 3 |
+
|
| 4 |
+
const TrustedBy: React.FC = () => {
|
| 5 |
+
const metrics = [
|
| 6 |
+
{
|
| 7 |
+
icon: <CheckCircle size={20} />,
|
| 8 |
+
category: "Task Success Rate",
|
| 9 |
+
question: "Do users complete their goals?",
|
| 10 |
+
outcome: "Identify drop-off points in critical flows."
|
| 11 |
+
},
|
| 12 |
+
{
|
| 13 |
+
icon: <Timer size={20} />,
|
| 14 |
+
category: "Time-on-Task",
|
| 15 |
+
question: "How quickly do they finish?",
|
| 16 |
+
outcome: "Benchmark efficiency against previous versions."
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
icon: <Clock size={20} />,
|
| 20 |
+
category: "Session Duration",
|
| 21 |
+
question: "How long do they stay engaged?",
|
| 22 |
+
outcome: "Balance retention with efficient task completion."
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
icon: <ClipboardCheck size={20} />,
|
| 26 |
+
category: "System Usability Scale",
|
| 27 |
+
question: "Is the product usable?",
|
| 28 |
+
outcome: "Standardized scoring for overall usability."
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
icon: <Smile size={20} />,
|
| 32 |
+
category: "Customer Satisfaction",
|
| 33 |
+
question: "Are users happy with the experience?",
|
| 34 |
+
outcome: "Predict long-term retention and loyalty."
|
| 35 |
+
},
|
| 36 |
+
{
|
| 37 |
+
icon: <Gauge size={20} />,
|
| 38 |
+
category: "Customer Effort Score",
|
| 39 |
+
question: "Is it easy to get things done?",
|
| 40 |
+
outcome: "Reduce friction to increase conversion."
|
| 41 |
+
}
|
| 42 |
+
];
|
| 43 |
+
|
| 44 |
+
return (
|
| 45 |
+
<section className="py-24 border-t border-gray-800 bg-black">
|
| 46 |
+
<div className="max-w-7xl mx-auto px-6">
|
| 47 |
+
<h3 className="text-center text-3xl md:text-4xl font-semibold text-white mb-6">
|
| 48 |
+
Quantify your UX quality programmatically.
|
| 49 |
+
</h3>
|
| 50 |
+
<p className="text-center text-gray-400 mb-16 max-w-2xl mx-auto text-lg">
|
| 51 |
+
Developers use SyncUsers to predict performance on core metrics without waiting for live traffic data.
|
| 52 |
+
</p>
|
| 53 |
+
|
| 54 |
+
{/* UX Metrics Grid */}
|
| 55 |
+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mb-24">
|
| 56 |
+
{metrics.map((item, idx) => (
|
| 57 |
+
<div key={idx} className="group p-8 rounded-2xl border border-gray-800 bg-gray-900/20 hover:border-teal-900/50 hover:bg-gray-900/40 transition-all duration-300">
|
| 58 |
+
<div className="flex items-center gap-3 mb-5 text-gray-500 group-hover:text-teal-400 transition-colors">
|
| 59 |
+
{item.icon}
|
| 60 |
+
<span className="text-xs font-mono uppercase tracking-widest">{item.category}</span>
|
| 61 |
+
</div>
|
| 62 |
+
<div className="text-xl font-medium text-white mb-3 group-hover:translate-x-1 transition-transform duration-300">
|
| 63 |
+
{item.question}
|
| 64 |
+
</div>
|
| 65 |
+
<p className="text-sm text-gray-500 leading-relaxed group-hover:text-gray-400 transition-colors">
|
| 66 |
+
{item.outcome}
|
| 67 |
+
</p>
|
| 68 |
+
</div>
|
| 69 |
+
))}
|
| 70 |
+
</div>
|
| 71 |
+
|
| 72 |
+
{/* Stats Grid */}
|
| 73 |
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-8 max-w-4xl mx-auto">
|
| 74 |
+
{[
|
| 75 |
+
{ value: "2,000+", label: "Persona Database ready", color: "border-blue-900" },
|
| 76 |
+
{ value: "REST & GraphQL", label: "API Available", color: "border-teal-900" },
|
| 77 |
+
].map((stat, idx) => (
|
| 78 |
+
<div key={idx} className={`relative flex flex-col items-center justify-center py-16 rounded-full border border-t-2 ${stat.color} bg-gradient-to-b from-gray-900 to-black`}>
|
| 79 |
+
<h4 className="text-4xl md:text-5xl font-bold text-white mb-2">{stat.value}</h4>
|
| 80 |
+
<p className="text-gray-400">{stat.label}</p>
|
| 81 |
+
</div>
|
| 82 |
+
))}
|
| 83 |
+
</div>
|
| 84 |
+
</div>
|
| 85 |
+
</section>
|
| 86 |
+
);
|
| 87 |
+
};
|
| 88 |
+
|
| 89 |
+
export default TrustedBy;
|
components/UseCases.tsx
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React from 'react';
|
| 2 |
+
import { USE_CASES } from '../constants';
|
| 3 |
+
|
| 4 |
+
const UseCases: React.FC = () => {
|
| 5 |
+
return (
|
| 6 |
+
<section id="use-cases" className="py-24 bg-black">
|
| 7 |
+
<div className="max-w-7xl mx-auto px-6">
|
| 8 |
+
<div className="flex justify-center mb-8">
|
| 9 |
+
<span className="px-4 py-1.5 rounded-full border border-gray-700 text-sm text-gray-300">Use Cases</span>
|
| 10 |
+
</div>
|
| 11 |
+
<h2 className="text-3xl md:text-5xl font-semibold text-center mb-20">Solve high-stakes branding challenges</h2>
|
| 12 |
+
|
| 13 |
+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
| 14 |
+
{USE_CASES.map((useCase, idx) => (
|
| 15 |
+
<div key={idx} className="group p-8 border border-gray-800 rounded-2xl bg-gradient-to-br from-gray-900/50 to-black hover:border-gray-600 transition-all duration-300 hover:shadow-lg hover:shadow-gray-900/20">
|
| 16 |
+
<div className="mb-6">
|
| 17 |
+
<span className="inline-flex items-center gap-2 px-3 py-1 rounded-full bg-gray-800 text-xs font-medium text-gray-300 border border-gray-700">
|
| 18 |
+
<span className={`w-2 h-2 rounded-full ${useCase.color}`}></span>
|
| 19 |
+
{useCase.category}
|
| 20 |
+
</span>
|
| 21 |
+
</div>
|
| 22 |
+
<h3 className="text-2xl font-semibold mb-3 group-hover:text-white transition-colors">{useCase.title}</h3>
|
| 23 |
+
<p className="text-gray-400 leading-relaxed text-sm">{useCase.description}</p>
|
| 24 |
+
</div>
|
| 25 |
+
))}
|
| 26 |
+
</div>
|
| 27 |
+
</div>
|
| 28 |
+
</section>
|
| 29 |
+
);
|
| 30 |
+
};
|
| 31 |
+
|
| 32 |
+
export default UseCases;
|
components/ui/Button.tsx
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React from 'react';
|
| 2 |
+
|
| 3 |
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
| 4 |
+
variant?: 'primary' | 'secondary' | 'outline' | 'ghost';
|
| 5 |
+
size?: 'sm' | 'md' | 'lg';
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
const Button: React.FC<ButtonProps> = ({
|
| 9 |
+
children,
|
| 10 |
+
variant = 'primary',
|
| 11 |
+
size = 'md',
|
| 12 |
+
className = '',
|
| 13 |
+
...props
|
| 14 |
+
}) => {
|
| 15 |
+
const baseStyles = "inline-flex items-center justify-center rounded-full font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-black disabled:opacity-50 disabled:pointer-events-none";
|
| 16 |
+
|
| 17 |
+
const variants = {
|
| 18 |
+
primary: "bg-white text-black hover:bg-gray-200 border border-transparent",
|
| 19 |
+
secondary: "bg-gray-800 text-white hover:bg-gray-700 border border-transparent",
|
| 20 |
+
outline: "bg-transparent text-white border border-gray-600 hover:border-gray-400 hover:text-gray-200",
|
| 21 |
+
ghost: "bg-transparent text-white hover:bg-white/10"
|
| 22 |
+
};
|
| 23 |
+
|
| 24 |
+
const sizes = {
|
| 25 |
+
sm: "px-4 py-1.5 text-sm",
|
| 26 |
+
md: "px-6 py-2.5 text-base",
|
| 27 |
+
lg: "px-8 py-3.5 text-lg"
|
| 28 |
+
};
|
| 29 |
+
|
| 30 |
+
return (
|
| 31 |
+
<button
|
| 32 |
+
className={`${baseStyles} ${variants[variant]} ${sizes[size]} ${className}`}
|
| 33 |
+
{...props}
|
| 34 |
+
>
|
| 35 |
+
{children}
|
| 36 |
+
</button>
|
| 37 |
+
);
|
| 38 |
+
};
|
| 39 |
+
|
| 40 |
+
export default Button;
|
constants.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { NavLink, UseCase, UseCaseCategory, Testimonial, FaqItem } from './types';
|
| 2 |
+
|
| 3 |
+
export const NAV_LINKS: NavLink[] = [
|
| 4 |
+
{ label: 'Features', href: '#features' },
|
| 5 |
+
{ label: 'Use Cases', href: '#use-cases' },
|
| 6 |
+
{ label: 'How it Works', href: '#how-it-works' },
|
| 7 |
+
{ label: 'Accuracy', href: '#accuracy' },
|
| 8 |
+
{ label: 'Docs', href: '#docs' },
|
| 9 |
+
];
|
| 10 |
+
|
| 11 |
+
export const USE_CASES: UseCase[] = [
|
| 12 |
+
{
|
| 13 |
+
category: UseCaseCategory.PR_COMMS,
|
| 14 |
+
title: "Brand Narratives",
|
| 15 |
+
description: "Test different brand communication strategies via API to deliver the right emotional impact",
|
| 16 |
+
color: "bg-purple-500"
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
category: UseCaseCategory.PRODUCT,
|
| 20 |
+
title: "Market Positioning",
|
| 21 |
+
description: "Test how your target customers perceive your brand positioning and values",
|
| 22 |
+
color: "bg-teal-500"
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
category: UseCaseCategory.BRANDING,
|
| 26 |
+
title: "Visual Identity",
|
| 27 |
+
description: "Test how different visual brand assets and voice ideas resonate with your ideal buyer.",
|
| 28 |
+
color: "bg-pink-500"
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
category: UseCaseCategory.MARKETING,
|
| 32 |
+
title: "Generate Leads",
|
| 33 |
+
description: "Test marketing content in a simulation of your target customers",
|
| 34 |
+
color: "bg-orange-500"
|
| 35 |
+
},
|
| 36 |
+
{
|
| 37 |
+
category: UseCaseCategory.SOCIAL_MEDIA,
|
| 38 |
+
title: "Make Content",
|
| 39 |
+
description: "Test social content in simulations of your network and audience",
|
| 40 |
+
color: "bg-blue-500"
|
| 41 |
+
},
|
| 42 |
+
{
|
| 43 |
+
category: UseCaseCategory.JOURNALISM,
|
| 44 |
+
title: "Capture Attention",
|
| 45 |
+
description: "Test headlines, thumbnails, and article content to maximise reader attention",
|
| 46 |
+
color: "bg-yellow-500"
|
| 47 |
+
}
|
| 48 |
+
];
|
| 49 |
+
|
| 50 |
+
export const TESTIMONIALS: Testimonial[] = [];
|
| 51 |
+
|
| 52 |
+
export const FAQS: FaqItem[] = [
|
| 53 |
+
{
|
| 54 |
+
question: "Is the API free for developers?",
|
| 55 |
+
answer: "Yes. We offer a generous free tier specifically designed for developers and hobbyists to build, test, and integrate user simulations without upfront costs."
|
| 56 |
+
},
|
| 57 |
+
{
|
| 58 |
+
question: "What is a Focus Group?",
|
| 59 |
+
answer: "A Focus Group is a simulated collective of AI personas that mirror the behaviors, preferences, and interactions of a specific real-world audience."
|
| 60 |
+
},
|
| 61 |
+
{
|
| 62 |
+
question: "How do credits work in the free tier?",
|
| 63 |
+
answer: "Credits are used to run simulations. One credit equals one simulated interaction. The developer plan includes 1,000 free credits per month, refreshing automatically."
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
question: "Can I integrate this into my CI/CD?",
|
| 67 |
+
answer: "Absolutely. Our CLI tool and API are designed to run as part of your testing pipeline, allowing you to validate UX decisions before merging code."
|
| 68 |
+
},
|
| 69 |
+
{
|
| 70 |
+
question: "How do I get an API key?",
|
| 71 |
+
answer: "You need a Huggingface token with a valid account."
|
| 72 |
+
}
|
| 73 |
+
];
|
dist/assets/index-hfJc7AJb.js
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
dist/index.html
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
<!DOCTYPE html>
|
| 3 |
+
<html lang="en">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="UTF-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 7 |
+
<title>Branding Content Testing</title>
|
| 8 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
+
<style>
|
| 10 |
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
|
| 11 |
+
|
| 12 |
+
body {
|
| 13 |
+
font-family: 'Inter', sans-serif;
|
| 14 |
+
background-color: #050505;
|
| 15 |
+
color: #ffffff;
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
/* Custom Scrollbar */
|
| 19 |
+
|
| 20 |
+
::-webkit-scrollbar {
|
| 21 |
+
width: 8px;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
::-webkit-scrollbar-track {
|
| 25 |
+
background: #050505;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
::-webkit-scrollbar-thumb {
|
| 29 |
+
background: #333;
|
| 30 |
+
border-radius: 4px;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
::-webkit-scrollbar-thumb:hover {
|
| 34 |
+
background: #555;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
/* Utilities for gradients */
|
| 38 |
+
|
| 39 |
+
.bg-glass {
|
| 40 |
+
background: rgba(255, 255, 255, 0.05);
|
| 41 |
+
backdrop-filter: blur(10px);
|
| 42 |
+
-webkit-backdrop-filter: blur(10px);
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
.gradient-text {
|
| 46 |
+
background: linear-gradient(to right, #fff, #aaa);
|
| 47 |
+
-webkit-background-clip: text;
|
| 48 |
+
-webkit-text-fill-color: transparent;
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
/* Blink animation for cursor */
|
| 52 |
+
|
| 53 |
+
@keyframes blink {
|
| 54 |
+
0%, 100% { opacity: 1; }
|
| 55 |
+
50% { opacity: 0; }
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
.animate-blink {
|
| 59 |
+
animation: blink 1s step-end infinite;
|
| 60 |
+
}
|
| 61 |
+
</style>
|
| 62 |
+
|
| 63 |
+
<script type="importmap">
|
| 64 |
+
{
|
| 65 |
+
"imports": {
|
| 66 |
+
"react-dom/": "https://aistudiocdn.com/react-dom@^19.2.0/",
|
| 67 |
+
"react/": "https://aistudiocdn.com/react@^19.2.0/",
|
| 68 |
+
"react": "https://aistudiocdn.com/react@^19.2.0",
|
| 69 |
+
"lucide-react": "https://aistudiocdn.com/lucide-react@^0.555.0",
|
| 70 |
+
"recharts": "https://aistudiocdn.com/recharts@^3.5.0",
|
| 71 |
+
"plotly.js": "https://cdn.jsdelivr.net/npm/plotly.js-dist-min@2.30.0/+esm"
|
| 72 |
+
}
|
| 73 |
+
}
|
| 74 |
+
</script>
|
| 75 |
+
<script type="module" crossorigin src="/assets/index-hfJc7AJb.js"></script>
|
| 76 |
+
</head>
|
| 77 |
+
<body>
|
| 78 |
+
<div id="root"></div>
|
| 79 |
+
</body>
|
| 80 |
+
</html>
|
gradio_api.txt
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Loaded as API: https://auxteam-tiny-factory.hf.space
|
| 2 |
+
Client.predict() Usage Info
|
| 3 |
+
---------------------------
|
| 4 |
+
Named API endpoints: 18
|
| 5 |
+
|
| 6 |
+
- predict(business_description, customer_profile, num_personas, blablador_api_key, api_name="/generate_personas") -> output_generated_or_matched_persona
|
| 7 |
+
Parameters:
|
| 8 |
+
- [Textbox] business_description: str (required)
|
| 9 |
+
- [Textbox] customer_profile: str (required)
|
| 10 |
+
- [Number] num_personas: float (not required, defaults to: 1)
|
| 11 |
+
- [Textbox] blablador_api_key: str | None (not required, defaults to: None)
|
| 12 |
+
Returns:
|
| 13 |
+
- [Json] output_generated_or_matched_persona: str | float | bool | list | dict (any valid json)
|
| 14 |
+
|
| 15 |
+
- predict(criteria, api_name="/find_best_persona") -> output_generated_or_matched_persona
|
| 16 |
+
Parameters:
|
| 17 |
+
- [Textbox] criteria: str (required)
|
| 18 |
+
Returns:
|
| 19 |
+
- [Json] output_generated_or_matched_persona: str | float | bool | list | dict (any valid json)
|
| 20 |
+
|
| 21 |
+
- predict(context, api_name="/identify_personas") -> value_20
|
| 22 |
+
Parameters:
|
| 23 |
+
- [Textbox] context: str (required)
|
| 24 |
+
Returns:
|
| 25 |
+
- [Json] value_20: str | float | bool | list | dict (any valid json)
|
| 26 |
+
|
| 27 |
+
- predict(name, persona_count, network_type, focus_group_name, api_name="/generate_social_network") -> value_28
|
| 28 |
+
Parameters:
|
| 29 |
+
- [Textbox] name: str (required)
|
| 30 |
+
- [Number] persona_count: float (not required, defaults to: 10)
|
| 31 |
+
- [Dropdown] network_type: Literal['scale_free', 'small_world'] (not required, defaults to: scale_free)
|
| 32 |
+
- [Textbox] focus_group_name: str | None (not required, defaults to: None)
|
| 33 |
+
Returns:
|
| 34 |
+
- [Json] value_28: str | float | bool | list | dict (any valid json)
|
| 35 |
+
|
| 36 |
+
- predict(simulation_id, content_text, format, api_name="/predict_engagement") -> value_35
|
| 37 |
+
Parameters:
|
| 38 |
+
- [Textbox] simulation_id: str (required)
|
| 39 |
+
- [Textbox] content_text: str (required)
|
| 40 |
+
- [Textbox] format: str (not required, defaults to: text)
|
| 41 |
+
Returns:
|
| 42 |
+
- [Json] value_35: str | float | bool | list | dict (any valid json)
|
| 43 |
+
|
| 44 |
+
- predict(simulation_id, content_text, format, api_name="/start_simulation_async") -> value_42
|
| 45 |
+
Parameters:
|
| 46 |
+
- [Textbox] simulation_id: str (required)
|
| 47 |
+
- [Textbox] content_text: str (required)
|
| 48 |
+
- [Textbox] format: str (not required, defaults to: text)
|
| 49 |
+
Returns:
|
| 50 |
+
- [Json] value_42: str | float | bool | list | dict (any valid json)
|
| 51 |
+
|
| 52 |
+
- predict(simulation_id, api_name="/get_simulation_status") -> value_45
|
| 53 |
+
Parameters:
|
| 54 |
+
- [Textbox] simulation_id: str (required)
|
| 55 |
+
Returns:
|
| 56 |
+
- [Json] value_45: str | float | bool | list | dict (any valid json)
|
| 57 |
+
|
| 58 |
+
- predict(simulation_id, sender, message, api_name="/send_chat_message") -> value_53
|
| 59 |
+
Parameters:
|
| 60 |
+
- [Textbox] simulation_id: str (required)
|
| 61 |
+
- [Textbox] sender: str (not required, defaults to: User)
|
| 62 |
+
- [Textbox] message: str (required)
|
| 63 |
+
Returns:
|
| 64 |
+
- [Json] value_53: str | float | bool | list | dict (any valid json)
|
| 65 |
+
|
| 66 |
+
- predict(simulation_id, api_name="/get_chat_history") -> value_55
|
| 67 |
+
Parameters:
|
| 68 |
+
- [Textbox] simulation_id: str (required)
|
| 69 |
+
Returns:
|
| 70 |
+
- [Json] value_55: str | float | bool | list | dict (any valid json)
|
| 71 |
+
|
| 72 |
+
- predict(content_text, num_variants, api_name="/generate_variants") -> value_61
|
| 73 |
+
Parameters:
|
| 74 |
+
- [Textbox] content_text: str (required)
|
| 75 |
+
- [Number] num_variants: float (not required, defaults to: 5)
|
| 76 |
+
Returns:
|
| 77 |
+
- [Json] value_61: str | float | bool | list | dict (any valid json)
|
| 78 |
+
|
| 79 |
+
- predict(api_name="/list_simulations") -> value_65
|
| 80 |
+
Parameters:
|
| 81 |
+
- None
|
| 82 |
+
Returns:
|
| 83 |
+
- [Json] value_65: str | float | bool | list | dict (any valid json)
|
| 84 |
+
|
| 85 |
+
- predict(simulation_id, api_name="/list_personas") -> value_69
|
| 86 |
+
Parameters:
|
| 87 |
+
- [Textbox] simulation_id: str (required)
|
| 88 |
+
Returns:
|
| 89 |
+
- [Json] value_69: str | float | bool | list | dict (any valid json)
|
| 90 |
+
|
| 91 |
+
- predict(simulation_id, persona_name, api_name="/get_persona") -> value_75
|
| 92 |
+
Parameters:
|
| 93 |
+
- [Textbox] simulation_id: str (required)
|
| 94 |
+
- [Textbox] persona_name: str (required)
|
| 95 |
+
Returns:
|
| 96 |
+
- [Json] value_75: str | float | bool | list | dict (any valid json)
|
| 97 |
+
|
| 98 |
+
- predict(simulation_id, api_name="/delete_simulation") -> value_80
|
| 99 |
+
Parameters:
|
| 100 |
+
- [Textbox] simulation_id: str (required)
|
| 101 |
+
Returns:
|
| 102 |
+
- [Json] value_80: str | float | bool | list | dict (any valid json)
|
| 103 |
+
|
| 104 |
+
- predict(simulation_id, api_name="/export_simulation") -> value_85
|
| 105 |
+
Parameters:
|
| 106 |
+
- [Textbox] simulation_id: str (required)
|
| 107 |
+
Returns:
|
| 108 |
+
- [Json] value_85: str | float | bool | list | dict (any valid json)
|
| 109 |
+
|
| 110 |
+
- predict(simulation_id, api_name="/get_network_graph") -> value_90
|
| 111 |
+
Parameters:
|
| 112 |
+
- [Textbox] simulation_id: str (required)
|
| 113 |
+
Returns:
|
| 114 |
+
- [Json] value_90: str | float | bool | list | dict (any valid json)
|
| 115 |
+
|
| 116 |
+
- predict(api_name="/list_focus_groups") -> value_94
|
| 117 |
+
Parameters:
|
| 118 |
+
- None
|
| 119 |
+
Returns:
|
| 120 |
+
- [Json] value_94: str | float | bool | list | dict (any valid json)
|
| 121 |
+
|
| 122 |
+
- predict(name, simulation_id, api_name="/save_focus_group") -> value_98
|
| 123 |
+
Parameters:
|
| 124 |
+
- [Textbox] name: str (required)
|
| 125 |
+
- [Textbox] simulation_id: str (required)
|
| 126 |
+
Returns:
|
| 127 |
+
- [Json] value_98: str | float | bool | list | dict (any valid json)
|
| 128 |
+
|
| 129 |
+
None
|
index.html
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
<!DOCTYPE html>
|
| 3 |
+
<html lang="en">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="UTF-8" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 7 |
+
<title>Branding Content Testing</title>
|
| 8 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
+
<style>
|
| 10 |
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
|
| 11 |
+
|
| 12 |
+
body {
|
| 13 |
+
font-family: 'Inter', sans-serif;
|
| 14 |
+
background-color: #050505;
|
| 15 |
+
color: #ffffff;
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
/* Custom Scrollbar */
|
| 19 |
+
::-webkit-scrollbar {
|
| 20 |
+
width: 8px;
|
| 21 |
+
}
|
| 22 |
+
::-webkit-scrollbar-track {
|
| 23 |
+
background: #050505;
|
| 24 |
+
}
|
| 25 |
+
::-webkit-scrollbar-thumb {
|
| 26 |
+
background: #333;
|
| 27 |
+
border-radius: 4px;
|
| 28 |
+
}
|
| 29 |
+
::-webkit-scrollbar-thumb:hover {
|
| 30 |
+
background: #555;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
/* Utilities for gradients */
|
| 34 |
+
.bg-glass {
|
| 35 |
+
background: rgba(255, 255, 255, 0.05);
|
| 36 |
+
backdrop-filter: blur(10px);
|
| 37 |
+
-webkit-backdrop-filter: blur(10px);
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
.gradient-text {
|
| 41 |
+
background: linear-gradient(to right, #fff, #aaa);
|
| 42 |
+
-webkit-background-clip: text;
|
| 43 |
+
-webkit-text-fill-color: transparent;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
/* Blink animation for cursor */
|
| 47 |
+
@keyframes blink {
|
| 48 |
+
0%, 100% { opacity: 1; }
|
| 49 |
+
50% { opacity: 0; }
|
| 50 |
+
}
|
| 51 |
+
.animate-blink {
|
| 52 |
+
animation: blink 1s step-end infinite;
|
| 53 |
+
}
|
| 54 |
+
</style>
|
| 55 |
+
<script type="importmap">
|
| 56 |
+
{
|
| 57 |
+
"imports": {
|
| 58 |
+
"react-dom/": "https://aistudiocdn.com/react-dom@^19.2.0/",
|
| 59 |
+
"react/": "https://aistudiocdn.com/react@^19.2.0/",
|
| 60 |
+
"react": "https://aistudiocdn.com/react@^19.2.0",
|
| 61 |
+
"lucide-react": "https://aistudiocdn.com/lucide-react@^0.555.0",
|
| 62 |
+
"recharts": "https://aistudiocdn.com/recharts@^3.5.0",
|
| 63 |
+
"plotly.js": "https://cdn.jsdelivr.net/npm/plotly.js-dist-min@2.30.0/+esm"
|
| 64 |
+
}
|
| 65 |
+
}
|
| 66 |
+
</script>
|
| 67 |
+
</head>
|
| 68 |
+
<body>
|
| 69 |
+
<div id="root"></div>
|
| 70 |
+
<script type="module" src="/index.tsx"></script>
|
| 71 |
+
</body>
|
| 72 |
+
</html>
|
index.tsx
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React from 'react';
|
| 2 |
+
import ReactDOM from 'react-dom/client';
|
| 3 |
+
import App from './App';
|
| 4 |
+
|
| 5 |
+
const rootElement = document.getElementById('root');
|
| 6 |
+
if (!rootElement) {
|
| 7 |
+
throw new Error("Could not find root element to mount to");
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
const root = ReactDOM.createRoot(rootElement);
|
| 11 |
+
root.render(
|
| 12 |
+
<React.StrictMode>
|
| 13 |
+
<App />
|
| 14 |
+
</React.StrictMode>
|
| 15 |
+
);
|
node_modules/.bin/acorn
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env node
|
| 2 |
+
'use strict';
|
| 3 |
+
|
| 4 |
+
require('../dist/bin.js');
|
node_modules/.bin/baseline-browser-mapping
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env node
|
| 2 |
+
"use strict";const{getCompatibleVersions:e}=require("./index.cjs"),a=process.argv.slice(2),s={};for(let e=0;e<a.length;e++){const r=a[e];r&&("-h"===r||"--help"===r?s.help=!0:"--include-downstream-browsers"===r?s["include-downstream-browsers"]=!0:"--list-all-compatible-versions"===r?s["list-all-compatible-versions"]=!0:"--include-kaios"===r?s["include-kaios"]=!0:"--suppress-warnings"===r?s["suppress-warnings"]=!0:r.startsWith("--target-year=")?s["target-year"]=r.substring(14):"--target-year"===r?s["target-year"]=a[++e]:r.startsWith("--widely-available-on-date=")?s["widely-available-on-date"]=r.substring(27):"--widely-available-on-date"===r?s["widely-available-on-date"]=a[++e]:r.startsWith("--override-last-updated=")?s["override-last-updated"]=r.substring(24):"--override-last-updated"===r?s["override-last-updated"]=a[++e]:(console.error(`Unknown argument: ${r}`),process.exit(1)))}s.help&&(console.log("\nGet Baseline Widely available browser versions or Baseline year browser versions.\n\nUsage: baseline-browser-mapping [options]\n\nOptions:\n --target-year Pass a year between 2015 and the current year to get browser versions compatible \n with all Newly Available features as of the end of the year specified.\n --widely-available-on-date Pass a date in the format 'YYYY-MM-DD' to get versions compatible with Widely \n available on the specified date.\n --include-downstream-browsers Whether to include browsers that use the same engines as a core Baseline browser.\n --include-kaios Whether to include KaiOS in downstream browsers. Requires --include-downstream-browsers.\n --list-all-compatible-versions Whether to include only the minimum compatible browser versions or all compatible versions.\n --suppress-warnings Supress potential warnings about data staleness when using a very recent feature cut off date.\n --override-last-updated Override the last updated date for the baseline data for debugging purposes.\n -h, --help Show help\n\nExamples:\n npx baseline-browser-mapping --target-year 2020\n npx baseline-browser-mapping --widely-available-on-date 2023-04-05\n npx baseline-browser-mapping --include-downstream-browsers\n npx baseline-browser-mapping --list-all-compatible-versions\n".trim()),process.exit(0)),console.log(e({targetYear:s["target-year"]?Number.parseInt(s["target-year"]):void 0,widelyAvailableOnDate:s["widely-available-on-date"],includeDownstreamBrowsers:s["include-downstream-browsers"],listAllCompatibleVersions:s["list-all-compatible-versions"],includeKaiOS:s["include-kaios"],suppressWarnings:s["suppress-warnings"],overrideLastUpdated:s["override-last-updated"]?Number.parseInt(s["override-last-updated"]):void 0}));
|
node_modules/.bin/browserslist
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env node
|
| 2 |
+
|
| 3 |
+
var fs = require('fs')
|
| 4 |
+
var updateDb = require('update-browserslist-db')
|
| 5 |
+
|
| 6 |
+
var browserslist = require('./')
|
| 7 |
+
var pkg = require('./package.json')
|
| 8 |
+
|
| 9 |
+
var args = process.argv.slice(2)
|
| 10 |
+
|
| 11 |
+
var USAGE =
|
| 12 |
+
'Usage:\n' +
|
| 13 |
+
' npx browserslist\n' +
|
| 14 |
+
' npx browserslist "QUERIES"\n' +
|
| 15 |
+
' npx browserslist --json "QUERIES"\n' +
|
| 16 |
+
' npx browserslist --config="path/to/browserlist/file"\n' +
|
| 17 |
+
' npx browserslist --coverage "QUERIES"\n' +
|
| 18 |
+
' npx browserslist --coverage=US "QUERIES"\n' +
|
| 19 |
+
' npx browserslist --coverage=US,RU,global "QUERIES"\n' +
|
| 20 |
+
' npx browserslist --env="environment name defined in config"\n' +
|
| 21 |
+
' npx browserslist --stats="path/to/browserlist/stats/file"\n' +
|
| 22 |
+
' npx browserslist --mobile-to-desktop\n' +
|
| 23 |
+
' npx browserslist --ignore-unknown-versions\n'
|
| 24 |
+
|
| 25 |
+
function isArg(arg) {
|
| 26 |
+
return args.some(function (str) {
|
| 27 |
+
return str === arg || str.indexOf(arg + '=') === 0
|
| 28 |
+
})
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
function error(msg) {
|
| 32 |
+
process.stderr.write('browserslist: ' + msg + '\n')
|
| 33 |
+
process.exit(1)
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
if (isArg('--help') || isArg('-h')) {
|
| 37 |
+
process.stdout.write(pkg.description + '.\n\n' + USAGE + '\n')
|
| 38 |
+
} else if (isArg('--version') || isArg('-v')) {
|
| 39 |
+
process.stdout.write('browserslist ' + pkg.version + '\n')
|
| 40 |
+
} else if (isArg('--update-db')) {
|
| 41 |
+
/* c8 ignore next 8 */
|
| 42 |
+
process.stdout.write(
|
| 43 |
+
'The --update-db command is deprecated.\n' +
|
| 44 |
+
'Please use npx update-browserslist-db@latest instead.\n'
|
| 45 |
+
)
|
| 46 |
+
process.stdout.write('Browserslist DB update will still be made.\n')
|
| 47 |
+
updateDb(function (str) {
|
| 48 |
+
process.stdout.write(str)
|
| 49 |
+
})
|
| 50 |
+
} else {
|
| 51 |
+
var mode = 'browsers'
|
| 52 |
+
var opts = {}
|
| 53 |
+
var queries
|
| 54 |
+
var areas
|
| 55 |
+
|
| 56 |
+
for (var i = 0; i < args.length; i++) {
|
| 57 |
+
if (args[i][0] !== '-') {
|
| 58 |
+
queries = args[i].replace(/^["']|["']$/g, '')
|
| 59 |
+
continue
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
var arg = args[i].split('=')
|
| 63 |
+
var name = arg[0]
|
| 64 |
+
var value = arg[1]
|
| 65 |
+
|
| 66 |
+
if (value) value = value.replace(/^["']|["']$/g, '')
|
| 67 |
+
|
| 68 |
+
if (name === '--config' || name === '-b') {
|
| 69 |
+
opts.config = value
|
| 70 |
+
} else if (name === '--env' || name === '-e') {
|
| 71 |
+
opts.env = value
|
| 72 |
+
} else if (name === '--stats' || name === '-s') {
|
| 73 |
+
opts.stats = value
|
| 74 |
+
} else if (name === '--coverage' || name === '-c') {
|
| 75 |
+
if (mode !== 'json') mode = 'coverage'
|
| 76 |
+
if (value) {
|
| 77 |
+
areas = value.split(',')
|
| 78 |
+
} else {
|
| 79 |
+
areas = ['global']
|
| 80 |
+
}
|
| 81 |
+
} else if (name === '--json') {
|
| 82 |
+
mode = 'json'
|
| 83 |
+
} else if (name === '--mobile-to-desktop') {
|
| 84 |
+
/* c8 ignore next */
|
| 85 |
+
opts.mobileToDesktop = true
|
| 86 |
+
} else if (name === '--ignore-unknown-versions') {
|
| 87 |
+
/* c8 ignore next */
|
| 88 |
+
opts.ignoreUnknownVersions = true
|
| 89 |
+
} else {
|
| 90 |
+
error('Unknown arguments ' + args[i] + '.\n\n' + USAGE)
|
| 91 |
+
}
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
var browsers
|
| 95 |
+
try {
|
| 96 |
+
browsers = browserslist(queries, opts)
|
| 97 |
+
} catch (e) {
|
| 98 |
+
if (e.name === 'BrowserslistError') {
|
| 99 |
+
error(e.message)
|
| 100 |
+
} /* c8 ignore start */ else {
|
| 101 |
+
throw e
|
| 102 |
+
} /* c8 ignore end */
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
var coverage
|
| 106 |
+
if (mode === 'browsers') {
|
| 107 |
+
browsers.forEach(function (browser) {
|
| 108 |
+
process.stdout.write(browser + '\n')
|
| 109 |
+
})
|
| 110 |
+
} else if (areas) {
|
| 111 |
+
coverage = areas.map(function (area) {
|
| 112 |
+
var stats
|
| 113 |
+
if (area !== 'global') {
|
| 114 |
+
stats = area
|
| 115 |
+
} else if (opts.stats) {
|
| 116 |
+
stats = JSON.parse(fs.readFileSync(opts.stats))
|
| 117 |
+
}
|
| 118 |
+
var result = browserslist.coverage(browsers, stats)
|
| 119 |
+
var round = Math.round(result * 100) / 100.0
|
| 120 |
+
|
| 121 |
+
return [area, round]
|
| 122 |
+
})
|
| 123 |
+
|
| 124 |
+
if (mode === 'coverage') {
|
| 125 |
+
var prefix = 'These browsers account for '
|
| 126 |
+
process.stdout.write(prefix)
|
| 127 |
+
coverage.forEach(function (data, index) {
|
| 128 |
+
var area = data[0]
|
| 129 |
+
var round = data[1]
|
| 130 |
+
var end = 'globally'
|
| 131 |
+
if (area && area !== 'global') {
|
| 132 |
+
end = 'in the ' + area.toUpperCase()
|
| 133 |
+
} else if (opts.stats) {
|
| 134 |
+
end = 'in custom statistics'
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
if (index !== 0) {
|
| 138 |
+
process.stdout.write(prefix.replace(/./g, ' '))
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
process.stdout.write(round + '% of all users ' + end + '\n')
|
| 142 |
+
})
|
| 143 |
+
}
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
if (mode === 'json') {
|
| 147 |
+
var data = { browsers: browsers }
|
| 148 |
+
if (coverage) {
|
| 149 |
+
data.coverage = coverage.reduce(function (object, j) {
|
| 150 |
+
object[j[0]] = j[1]
|
| 151 |
+
return object
|
| 152 |
+
}, {})
|
| 153 |
+
}
|
| 154 |
+
process.stdout.write(JSON.stringify(data, null, ' ') + '\n')
|
| 155 |
+
}
|
| 156 |
+
}
|
node_modules/.bin/esbuild
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bab29b2ca7a9e89b67cf720b77b2d743f9f31f5cf0d5bd74ee8c8de30ced7014
|
| 3 |
+
size 10358936
|
node_modules/.bin/escodegen
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env node
|
| 2 |
+
/*
|
| 3 |
+
Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
|
| 4 |
+
|
| 5 |
+
Redistribution and use in source and binary forms, with or without
|
| 6 |
+
modification, are permitted provided that the following conditions are met:
|
| 7 |
+
|
| 8 |
+
* Redistributions of source code must retain the above copyright
|
| 9 |
+
notice, this list of conditions and the following disclaimer.
|
| 10 |
+
* Redistributions in binary form must reproduce the above copyright
|
| 11 |
+
notice, this list of conditions and the following disclaimer in the
|
| 12 |
+
documentation and/or other materials provided with the distribution.
|
| 13 |
+
|
| 14 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 15 |
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 16 |
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
| 17 |
+
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
| 18 |
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
| 19 |
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
| 20 |
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
| 21 |
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 22 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
| 23 |
+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 24 |
+
*/
|
| 25 |
+
|
| 26 |
+
/*jslint sloppy:true node:true */
|
| 27 |
+
|
| 28 |
+
var fs = require('fs'),
|
| 29 |
+
path = require('path'),
|
| 30 |
+
root = path.join(path.dirname(fs.realpathSync(__filename)), '..'),
|
| 31 |
+
esprima = require('esprima'),
|
| 32 |
+
escodegen = require(root),
|
| 33 |
+
optionator = require('optionator')({
|
| 34 |
+
prepend: 'Usage: escodegen [options] file...',
|
| 35 |
+
options: [
|
| 36 |
+
{
|
| 37 |
+
option: 'config',
|
| 38 |
+
alias: 'c',
|
| 39 |
+
type: 'String',
|
| 40 |
+
description: 'configuration json for escodegen'
|
| 41 |
+
}
|
| 42 |
+
]
|
| 43 |
+
}),
|
| 44 |
+
args = optionator.parse(process.argv),
|
| 45 |
+
files = args._,
|
| 46 |
+
options,
|
| 47 |
+
esprimaOptions = {
|
| 48 |
+
raw: true,
|
| 49 |
+
tokens: true,
|
| 50 |
+
range: true,
|
| 51 |
+
comment: true
|
| 52 |
+
};
|
| 53 |
+
|
| 54 |
+
if (files.length === 0) {
|
| 55 |
+
console.log(optionator.generateHelp());
|
| 56 |
+
process.exit(1);
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
if (args.config) {
|
| 60 |
+
try {
|
| 61 |
+
options = JSON.parse(fs.readFileSync(args.config, 'utf-8'));
|
| 62 |
+
} catch (err) {
|
| 63 |
+
console.error('Error parsing config: ', err);
|
| 64 |
+
}
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
files.forEach(function (filename) {
|
| 68 |
+
var content = fs.readFileSync(filename, 'utf-8'),
|
| 69 |
+
syntax = esprima.parse(content, esprimaOptions);
|
| 70 |
+
|
| 71 |
+
if (options.comment) {
|
| 72 |
+
escodegen.attachComments(syntax, syntax.comments, syntax.tokens);
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
console.log(escodegen.generate(syntax, options));
|
| 76 |
+
});
|
| 77 |
+
/* vim: set sw=4 ts=4 et tw=80 : */
|
node_modules/.bin/esgenerate
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env node
|
| 2 |
+
/*
|
| 3 |
+
Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
|
| 4 |
+
|
| 5 |
+
Redistribution and use in source and binary forms, with or without
|
| 6 |
+
modification, are permitted provided that the following conditions are met:
|
| 7 |
+
|
| 8 |
+
* Redistributions of source code must retain the above copyright
|
| 9 |
+
notice, this list of conditions and the following disclaimer.
|
| 10 |
+
* Redistributions in binary form must reproduce the above copyright
|
| 11 |
+
notice, this list of conditions and the following disclaimer in the
|
| 12 |
+
documentation and/or other materials provided with the distribution.
|
| 13 |
+
|
| 14 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 15 |
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 16 |
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
| 17 |
+
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
| 18 |
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
| 19 |
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
| 20 |
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
| 21 |
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 22 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
| 23 |
+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 24 |
+
*/
|
| 25 |
+
|
| 26 |
+
/*jslint sloppy:true node:true */
|
| 27 |
+
|
| 28 |
+
var fs = require('fs'),
|
| 29 |
+
path = require('path'),
|
| 30 |
+
root = path.join(path.dirname(fs.realpathSync(__filename)), '..'),
|
| 31 |
+
escodegen = require(root),
|
| 32 |
+
optionator = require('optionator')({
|
| 33 |
+
prepend: 'Usage: esgenerate [options] file.json ...',
|
| 34 |
+
options: [
|
| 35 |
+
{
|
| 36 |
+
option: 'config',
|
| 37 |
+
alias: 'c',
|
| 38 |
+
type: 'String',
|
| 39 |
+
description: 'configuration json for escodegen'
|
| 40 |
+
}
|
| 41 |
+
]
|
| 42 |
+
}),
|
| 43 |
+
args = optionator.parse(process.argv),
|
| 44 |
+
files = args._,
|
| 45 |
+
options;
|
| 46 |
+
|
| 47 |
+
if (files.length === 0) {
|
| 48 |
+
console.log(optionator.generateHelp());
|
| 49 |
+
process.exit(1);
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
if (args.config) {
|
| 53 |
+
try {
|
| 54 |
+
options = JSON.parse(fs.readFileSync(args.config, 'utf-8'))
|
| 55 |
+
} catch (err) {
|
| 56 |
+
console.error('Error parsing config: ', err);
|
| 57 |
+
}
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
files.forEach(function (filename) {
|
| 61 |
+
var content = fs.readFileSync(filename, 'utf-8');
|
| 62 |
+
console.log(escodegen.generate(JSON.parse(content), options));
|
| 63 |
+
});
|
| 64 |
+
/* vim: set sw=4 ts=4 et tw=80 : */
|
node_modules/.bin/esparse
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env node
|
| 2 |
+
/*
|
| 3 |
+
Copyright JS Foundation and other contributors, https://js.foundation/
|
| 4 |
+
|
| 5 |
+
Redistribution and use in source and binary forms, with or without
|
| 6 |
+
modification, are permitted provided that the following conditions are met:
|
| 7 |
+
|
| 8 |
+
* Redistributions of source code must retain the above copyright
|
| 9 |
+
notice, this list of conditions and the following disclaimer.
|
| 10 |
+
* Redistributions in binary form must reproduce the above copyright
|
| 11 |
+
notice, this list of conditions and the following disclaimer in the
|
| 12 |
+
documentation and/or other materials provided with the distribution.
|
| 13 |
+
|
| 14 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 15 |
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 16 |
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
| 17 |
+
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
| 18 |
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
| 19 |
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
| 20 |
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
| 21 |
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 22 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
| 23 |
+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 24 |
+
*/
|
| 25 |
+
|
| 26 |
+
/*jslint sloppy:true node:true rhino:true */
|
| 27 |
+
|
| 28 |
+
var fs, esprima, fname, forceFile, content, options, syntax;
|
| 29 |
+
|
| 30 |
+
if (typeof require === 'function') {
|
| 31 |
+
fs = require('fs');
|
| 32 |
+
try {
|
| 33 |
+
esprima = require('esprima');
|
| 34 |
+
} catch (e) {
|
| 35 |
+
esprima = require('../');
|
| 36 |
+
}
|
| 37 |
+
} else if (typeof load === 'function') {
|
| 38 |
+
try {
|
| 39 |
+
load('esprima.js');
|
| 40 |
+
} catch (e) {
|
| 41 |
+
load('../esprima.js');
|
| 42 |
+
}
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
// Shims to Node.js objects when running under Rhino.
|
| 46 |
+
if (typeof console === 'undefined' && typeof process === 'undefined') {
|
| 47 |
+
console = { log: print };
|
| 48 |
+
fs = { readFileSync: readFile };
|
| 49 |
+
process = { argv: arguments, exit: quit };
|
| 50 |
+
process.argv.unshift('esparse.js');
|
| 51 |
+
process.argv.unshift('rhino');
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
function showUsage() {
|
| 55 |
+
console.log('Usage:');
|
| 56 |
+
console.log(' esparse [options] [file.js]');
|
| 57 |
+
console.log();
|
| 58 |
+
console.log('Available options:');
|
| 59 |
+
console.log();
|
| 60 |
+
console.log(' --comment Gather all line and block comments in an array');
|
| 61 |
+
console.log(' --loc Include line-column location info for each syntax node');
|
| 62 |
+
console.log(' --range Include index-based range for each syntax node');
|
| 63 |
+
console.log(' --raw Display the raw value of literals');
|
| 64 |
+
console.log(' --tokens List all tokens in an array');
|
| 65 |
+
console.log(' --tolerant Tolerate errors on a best-effort basis (experimental)');
|
| 66 |
+
console.log(' -v, --version Shows program version');
|
| 67 |
+
console.log();
|
| 68 |
+
process.exit(1);
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
options = {};
|
| 72 |
+
|
| 73 |
+
process.argv.splice(2).forEach(function (entry) {
|
| 74 |
+
|
| 75 |
+
if (forceFile || entry === '-' || entry.slice(0, 1) !== '-') {
|
| 76 |
+
if (typeof fname === 'string') {
|
| 77 |
+
console.log('Error: more than one input file.');
|
| 78 |
+
process.exit(1);
|
| 79 |
+
} else {
|
| 80 |
+
fname = entry;
|
| 81 |
+
}
|
| 82 |
+
} else if (entry === '-h' || entry === '--help') {
|
| 83 |
+
showUsage();
|
| 84 |
+
} else if (entry === '-v' || entry === '--version') {
|
| 85 |
+
console.log('ECMAScript Parser (using Esprima version', esprima.version, ')');
|
| 86 |
+
console.log();
|
| 87 |
+
process.exit(0);
|
| 88 |
+
} else if (entry === '--comment') {
|
| 89 |
+
options.comment = true;
|
| 90 |
+
} else if (entry === '--loc') {
|
| 91 |
+
options.loc = true;
|
| 92 |
+
} else if (entry === '--range') {
|
| 93 |
+
options.range = true;
|
| 94 |
+
} else if (entry === '--raw') {
|
| 95 |
+
options.raw = true;
|
| 96 |
+
} else if (entry === '--tokens') {
|
| 97 |
+
options.tokens = true;
|
| 98 |
+
} else if (entry === '--tolerant') {
|
| 99 |
+
options.tolerant = true;
|
| 100 |
+
} else if (entry === '--') {
|
| 101 |
+
forceFile = true;
|
| 102 |
+
} else {
|
| 103 |
+
console.log('Error: unknown option ' + entry + '.');
|
| 104 |
+
process.exit(1);
|
| 105 |
+
}
|
| 106 |
+
});
|
| 107 |
+
|
| 108 |
+
// Special handling for regular expression literal since we need to
|
| 109 |
+
// convert it to a string literal, otherwise it will be decoded
|
| 110 |
+
// as object "{}" and the regular expression would be lost.
|
| 111 |
+
function adjustRegexLiteral(key, value) {
|
| 112 |
+
if (key === 'value' && value instanceof RegExp) {
|
| 113 |
+
value = value.toString();
|
| 114 |
+
}
|
| 115 |
+
return value;
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
function run(content) {
|
| 119 |
+
syntax = esprima.parse(content, options);
|
| 120 |
+
console.log(JSON.stringify(syntax, adjustRegexLiteral, 4));
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
try {
|
| 124 |
+
if (fname && (fname !== '-' || forceFile)) {
|
| 125 |
+
run(fs.readFileSync(fname, 'utf-8'));
|
| 126 |
+
} else {
|
| 127 |
+
var content = '';
|
| 128 |
+
process.stdin.resume();
|
| 129 |
+
process.stdin.on('data', function(chunk) {
|
| 130 |
+
content += chunk;
|
| 131 |
+
});
|
| 132 |
+
process.stdin.on('end', function() {
|
| 133 |
+
run(content);
|
| 134 |
+
});
|
| 135 |
+
}
|
| 136 |
+
} catch (e) {
|
| 137 |
+
console.log('Error: ' + e.message);
|
| 138 |
+
process.exit(1);
|
| 139 |
+
}
|
node_modules/.bin/esvalidate
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env node
|
| 2 |
+
/*
|
| 3 |
+
Copyright JS Foundation and other contributors, https://js.foundation/
|
| 4 |
+
|
| 5 |
+
Redistribution and use in source and binary forms, with or without
|
| 6 |
+
modification, are permitted provided that the following conditions are met:
|
| 7 |
+
|
| 8 |
+
* Redistributions of source code must retain the above copyright
|
| 9 |
+
notice, this list of conditions and the following disclaimer.
|
| 10 |
+
* Redistributions in binary form must reproduce the above copyright
|
| 11 |
+
notice, this list of conditions and the following disclaimer in the
|
| 12 |
+
documentation and/or other materials provided with the distribution.
|
| 13 |
+
|
| 14 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 15 |
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 16 |
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
| 17 |
+
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
| 18 |
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
| 19 |
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
| 20 |
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
| 21 |
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 22 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
| 23 |
+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 24 |
+
*/
|
| 25 |
+
|
| 26 |
+
/*jslint sloppy:true plusplus:true node:true rhino:true */
|
| 27 |
+
/*global phantom:true */
|
| 28 |
+
|
| 29 |
+
var fs, system, esprima, options, fnames, forceFile, count;
|
| 30 |
+
|
| 31 |
+
if (typeof esprima === 'undefined') {
|
| 32 |
+
// PhantomJS can only require() relative files
|
| 33 |
+
if (typeof phantom === 'object') {
|
| 34 |
+
fs = require('fs');
|
| 35 |
+
system = require('system');
|
| 36 |
+
esprima = require('./esprima');
|
| 37 |
+
} else if (typeof require === 'function') {
|
| 38 |
+
fs = require('fs');
|
| 39 |
+
try {
|
| 40 |
+
esprima = require('esprima');
|
| 41 |
+
} catch (e) {
|
| 42 |
+
esprima = require('../');
|
| 43 |
+
}
|
| 44 |
+
} else if (typeof load === 'function') {
|
| 45 |
+
try {
|
| 46 |
+
load('esprima.js');
|
| 47 |
+
} catch (e) {
|
| 48 |
+
load('../esprima.js');
|
| 49 |
+
}
|
| 50 |
+
}
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
// Shims to Node.js objects when running under PhantomJS 1.7+.
|
| 54 |
+
if (typeof phantom === 'object') {
|
| 55 |
+
fs.readFileSync = fs.read;
|
| 56 |
+
process = {
|
| 57 |
+
argv: [].slice.call(system.args),
|
| 58 |
+
exit: phantom.exit,
|
| 59 |
+
on: function (evt, callback) {
|
| 60 |
+
callback();
|
| 61 |
+
}
|
| 62 |
+
};
|
| 63 |
+
process.argv.unshift('phantomjs');
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
// Shims to Node.js objects when running under Rhino.
|
| 67 |
+
if (typeof console === 'undefined' && typeof process === 'undefined') {
|
| 68 |
+
console = { log: print };
|
| 69 |
+
fs = { readFileSync: readFile };
|
| 70 |
+
process = {
|
| 71 |
+
argv: arguments,
|
| 72 |
+
exit: quit,
|
| 73 |
+
on: function (evt, callback) {
|
| 74 |
+
callback();
|
| 75 |
+
}
|
| 76 |
+
};
|
| 77 |
+
process.argv.unshift('esvalidate.js');
|
| 78 |
+
process.argv.unshift('rhino');
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
function showUsage() {
|
| 82 |
+
console.log('Usage:');
|
| 83 |
+
console.log(' esvalidate [options] [file.js...]');
|
| 84 |
+
console.log();
|
| 85 |
+
console.log('Available options:');
|
| 86 |
+
console.log();
|
| 87 |
+
console.log(' --format=type Set the report format, plain (default) or junit');
|
| 88 |
+
console.log(' -v, --version Print program version');
|
| 89 |
+
console.log();
|
| 90 |
+
process.exit(1);
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
options = {
|
| 94 |
+
format: 'plain'
|
| 95 |
+
};
|
| 96 |
+
|
| 97 |
+
fnames = [];
|
| 98 |
+
|
| 99 |
+
process.argv.splice(2).forEach(function (entry) {
|
| 100 |
+
|
| 101 |
+
if (forceFile || entry === '-' || entry.slice(0, 1) !== '-') {
|
| 102 |
+
fnames.push(entry);
|
| 103 |
+
} else if (entry === '-h' || entry === '--help') {
|
| 104 |
+
showUsage();
|
| 105 |
+
} else if (entry === '-v' || entry === '--version') {
|
| 106 |
+
console.log('ECMAScript Validator (using Esprima version', esprima.version, ')');
|
| 107 |
+
console.log();
|
| 108 |
+
process.exit(0);
|
| 109 |
+
} else if (entry.slice(0, 9) === '--format=') {
|
| 110 |
+
options.format = entry.slice(9);
|
| 111 |
+
if (options.format !== 'plain' && options.format !== 'junit') {
|
| 112 |
+
console.log('Error: unknown report format ' + options.format + '.');
|
| 113 |
+
process.exit(1);
|
| 114 |
+
}
|
| 115 |
+
} else if (entry === '--') {
|
| 116 |
+
forceFile = true;
|
| 117 |
+
} else {
|
| 118 |
+
console.log('Error: unknown option ' + entry + '.');
|
| 119 |
+
process.exit(1);
|
| 120 |
+
}
|
| 121 |
+
});
|
| 122 |
+
|
| 123 |
+
if (fnames.length === 0) {
|
| 124 |
+
fnames.push('');
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
if (options.format === 'junit') {
|
| 128 |
+
console.log('<?xml version="1.0" encoding="UTF-8"?>');
|
| 129 |
+
console.log('<testsuites>');
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
count = 0;
|
| 133 |
+
|
| 134 |
+
function run(fname, content) {
|
| 135 |
+
var timestamp, syntax, name;
|
| 136 |
+
try {
|
| 137 |
+
if (typeof content !== 'string') {
|
| 138 |
+
throw content;
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
if (content[0] === '#' && content[1] === '!') {
|
| 142 |
+
content = '//' + content.substr(2, content.length);
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
timestamp = Date.now();
|
| 146 |
+
syntax = esprima.parse(content, { tolerant: true });
|
| 147 |
+
|
| 148 |
+
if (options.format === 'junit') {
|
| 149 |
+
|
| 150 |
+
name = fname;
|
| 151 |
+
if (name.lastIndexOf('/') >= 0) {
|
| 152 |
+
name = name.slice(name.lastIndexOf('/') + 1);
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
console.log('<testsuite name="' + fname + '" errors="0" ' +
|
| 156 |
+
' failures="' + syntax.errors.length + '" ' +
|
| 157 |
+
' tests="' + syntax.errors.length + '" ' +
|
| 158 |
+
' time="' + Math.round((Date.now() - timestamp) / 1000) +
|
| 159 |
+
'">');
|
| 160 |
+
|
| 161 |
+
syntax.errors.forEach(function (error) {
|
| 162 |
+
var msg = error.message;
|
| 163 |
+
msg = msg.replace(/^Line\ [0-9]*\:\ /, '');
|
| 164 |
+
console.log(' <testcase name="Line ' + error.lineNumber + ': ' + msg + '" ' +
|
| 165 |
+
' time="0">');
|
| 166 |
+
console.log(' <error type="SyntaxError" message="' + error.message + '">' +
|
| 167 |
+
error.message + '(' + name + ':' + error.lineNumber + ')' +
|
| 168 |
+
'</error>');
|
| 169 |
+
console.log(' </testcase>');
|
| 170 |
+
});
|
| 171 |
+
|
| 172 |
+
console.log('</testsuite>');
|
| 173 |
+
|
| 174 |
+
} else if (options.format === 'plain') {
|
| 175 |
+
|
| 176 |
+
syntax.errors.forEach(function (error) {
|
| 177 |
+
var msg = error.message;
|
| 178 |
+
msg = msg.replace(/^Line\ [0-9]*\:\ /, '');
|
| 179 |
+
msg = fname + ':' + error.lineNumber + ': ' + msg;
|
| 180 |
+
console.log(msg);
|
| 181 |
+
++count;
|
| 182 |
+
});
|
| 183 |
+
|
| 184 |
+
}
|
| 185 |
+
} catch (e) {
|
| 186 |
+
++count;
|
| 187 |
+
if (options.format === 'junit') {
|
| 188 |
+
console.log('<testsuite name="' + fname + '" errors="1" failures="0" tests="1" ' +
|
| 189 |
+
' time="' + Math.round((Date.now() - timestamp) / 1000) + '">');
|
| 190 |
+
console.log(' <testcase name="' + e.message + '" ' + ' time="0">');
|
| 191 |
+
console.log(' <error type="ParseError" message="' + e.message + '">' +
|
| 192 |
+
e.message + '(' + fname + ((e.lineNumber) ? ':' + e.lineNumber : '') +
|
| 193 |
+
')</error>');
|
| 194 |
+
console.log(' </testcase>');
|
| 195 |
+
console.log('</testsuite>');
|
| 196 |
+
} else {
|
| 197 |
+
console.log(fname + ':' + e.lineNumber + ': ' + e.message.replace(/^Line\ [0-9]*\:\ /, ''));
|
| 198 |
+
}
|
| 199 |
+
}
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
fnames.forEach(function (fname) {
|
| 203 |
+
var content = '';
|
| 204 |
+
try {
|
| 205 |
+
if (fname && (fname !== '-' || forceFile)) {
|
| 206 |
+
content = fs.readFileSync(fname, 'utf-8');
|
| 207 |
+
} else {
|
| 208 |
+
fname = '';
|
| 209 |
+
process.stdin.resume();
|
| 210 |
+
process.stdin.on('data', function(chunk) {
|
| 211 |
+
content += chunk;
|
| 212 |
+
});
|
| 213 |
+
process.stdin.on('end', function() {
|
| 214 |
+
run(fname, content);
|
| 215 |
+
});
|
| 216 |
+
return;
|
| 217 |
+
}
|
| 218 |
+
} catch (e) {
|
| 219 |
+
content = e;
|
| 220 |
+
}
|
| 221 |
+
run(fname, content);
|
| 222 |
+
});
|
| 223 |
+
|
| 224 |
+
process.on('exit', function () {
|
| 225 |
+
if (options.format === 'junit') {
|
| 226 |
+
console.log('</testsuites>');
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
if (count > 0) {
|
| 230 |
+
process.exit(1);
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
if (count === 0 && typeof phantom === 'object') {
|
| 234 |
+
process.exit(0);
|
| 235 |
+
}
|
| 236 |
+
});
|
node_modules/.bin/findup
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env node
|
| 2 |
+
|
| 3 |
+
var findup = require('..'),
|
| 4 |
+
path = require('path'),
|
| 5 |
+
pkg = require('../package'),
|
| 6 |
+
program = require('commander'),
|
| 7 |
+
options = {},
|
| 8 |
+
optionKeys = ['name', 'dir', 'maxdepth', 'verbose'],
|
| 9 |
+
EXIT_FAILURE = -1;
|
| 10 |
+
|
| 11 |
+
program
|
| 12 |
+
.version(pkg.version)
|
| 13 |
+
.option('--name <name>', 'The name of the file to find', String)
|
| 14 |
+
.option('--dir <dir>', 'The directoy where we will start walking up', process.cwd(), path)
|
| 15 |
+
.option('--maxdepth <levels>', 'Ascend at most <levels> levels before giving up. -1 means no limit', -1, Number)
|
| 16 |
+
.option('--verbose', 'print log', false, Boolean)
|
| 17 |
+
.parse(process.argv);
|
| 18 |
+
|
| 19 |
+
optionKeys.forEach(function(optionKey){
|
| 20 |
+
if (optionKey === 'maxdepth') {
|
| 21 |
+
options[optionKey] = +program[optionKey];
|
| 22 |
+
} else {
|
| 23 |
+
options[optionKey] = program[optionKey];
|
| 24 |
+
}
|
| 25 |
+
});
|
| 26 |
+
|
| 27 |
+
if(program.args && program.args.length >=1 && !options.name){
|
| 28 |
+
options.name = program.args[0];
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
if(!options.name) {
|
| 32 |
+
program.outputHelp();
|
| 33 |
+
process.exit(EXIT_FAILURE);
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
var file = options.name;
|
| 37 |
+
|
| 38 |
+
findup(options.dir, file, options, function(err, dir){
|
| 39 |
+
if(err) return console.error(err.message ? err.message : err);
|
| 40 |
+
console.log(path.join(dir, file));
|
| 41 |
+
});
|
node_modules/.bin/geo2svg
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env node
|
| 2 |
+
|
| 3 |
+
var os = require("os"),
|
| 4 |
+
commander = require("commander"),
|
| 5 |
+
d3 = Object.assign({}, require("d3-geo"), require("../")),
|
| 6 |
+
read = require("./read"),
|
| 7 |
+
write = require("./write");
|
| 8 |
+
|
| 9 |
+
commander
|
| 10 |
+
.version(require("../package.json").version)
|
| 11 |
+
.usage("[options] [file]")
|
| 12 |
+
.description("Convert GeoJSON to SVG.")
|
| 13 |
+
.option("-o, --out <file>", "output file name; defaults to “-” for stdout", "-")
|
| 14 |
+
.option("-w, --width <value>", "output width", 960)
|
| 15 |
+
.option("-h, --height <value>", "output height", 500)
|
| 16 |
+
.option("-p, --precision <value>", "number of output digits after the decimal point", 6)
|
| 17 |
+
.option("-n, --newline-delimited", "accept newline-delimited JSON")
|
| 18 |
+
.option("--fill <value>", "default fill", "none")
|
| 19 |
+
.option("--stroke <value>", "default stroke", "black")
|
| 20 |
+
.option("-r, --radius <value>", "default point radius", 4.5)
|
| 21 |
+
.parse(process.argv);
|
| 22 |
+
|
| 23 |
+
if (commander.args.length === 0) commander.args[0] = "-";
|
| 24 |
+
else if (commander.args.length !== 1) {
|
| 25 |
+
console.error();
|
| 26 |
+
console.error(" error: multiple input files");
|
| 27 |
+
console.error();
|
| 28 |
+
process.exit(1);
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
var reader = read(commander.args[0], commander.newlineDelimited, transform).then(end).catch(abort),
|
| 32 |
+
writer = write(commander.out),
|
| 33 |
+
path = d3.geoPath().pointRadius(function(d) { var p = d.properties, v; return p && (v = p["point-radius"] || p.pointRadius) != null ? v : commander.radius; }),
|
| 34 |
+
render = commander.precision == null ? path : function(d) { return path(d3.geoQuantize(d, commander.precision)); };
|
| 35 |
+
|
| 36 |
+
writer.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>" + os.EOL
|
| 37 |
+
+ "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">" + os.EOL
|
| 38 |
+
+ "<!-- Generated by geo2svg " + require("../package.json").version + ". https://d3js.org/d3-geo-projection/ -->" + os.EOL
|
| 39 |
+
+ "<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\""
|
| 40 |
+
+ " width=\"" + +commander.width + "\""
|
| 41 |
+
+ " height=\"" + +commander.height + "\""
|
| 42 |
+
+ " viewBox=\"0 0 " + +commander.width + " " + +commander.height + "\""
|
| 43 |
+
+ (commander.fill != "black" ? " fill=\"" + attr(commander.fill) + "\"" : "")
|
| 44 |
+
+ (commander.stroke != "none" ? " stroke=\"" + attr(commander.stroke) + "\"" : "")
|
| 45 |
+
+ ">" + os.EOL);
|
| 46 |
+
|
| 47 |
+
function transform(d) {
|
| 48 |
+
var p = d.properties, v;
|
| 49 |
+
return writer.write(" <path"
|
| 50 |
+
+ ((v = d.id) != null ? " id=\"" + attr(v + "") + "\"" : "")
|
| 51 |
+
+ (p ? ((v = p["fill"]) != null ? " fill=\"" + attr(v + "") + "\"" : "")
|
| 52 |
+
+ ((v = p["fill-rule"] || p.fillRule) != null ? " fill-rule=\"" + attr(v + "") + "\"" : "")
|
| 53 |
+
+ ((v = p["fill-opacity"] || p.fillOpacity) != null ? " fill-opacity=\"" + attr(v + "") + "\"" : "")
|
| 54 |
+
+ ((v = p["stroke"]) != null ? " stroke=\"" + attr(v + "") + "\"" : "")
|
| 55 |
+
+ ((v = p["stroke-width"] || p.strokeWidth) != null ? " stroke-width=\"" + attr(v + "") + "\"" : "")
|
| 56 |
+
+ ((v = p["stroke-linecap"] || p.strokeLinecap) != null ? " stroke-linecap=\"" + attr(v + "") + "\"" : "")
|
| 57 |
+
+ ((v = p["stroke-linejoin"] || p.strokeLinejoin) != null ? " stroke-linejoin=\"" + attr(v + "") + "\"" : "")
|
| 58 |
+
+ ((v = p["stroke-miterlimit"] || p.strokeMiterlimit) != null ? " stroke-miterlimit=\"" + attr(v + "") + "\"" : "")
|
| 59 |
+
+ ((v = p["stroke-dasharray"] || p.strokeDasharray) != null ? " stroke-dasharray=\"" + attr(v + "") + "\"" : "")
|
| 60 |
+
+ ((v = p["stroke-dashoffset"] || p.strokeDashoffset) != null ? " stroke-dashoffset=\"" + attr(v + "") + "\"" : "")
|
| 61 |
+
+ ((v = p["stroke-opacity"] || p.strokeOpacity) != null ? " stroke-opacity=\"" + attr(v + "") + "\"" : "")
|
| 62 |
+
: "")
|
| 63 |
+
+ (v = render(d), v ? " d=\"" + v + "\"" : "")
|
| 64 |
+
+ ">"
|
| 65 |
+
+ ((v = p && p["title"]) != null ? "<title>" + text(v + "") + "</title>" : "")
|
| 66 |
+
+ "</path>" + os.EOL);
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
function end() {
|
| 70 |
+
return writer.write("</svg>" + os.EOL);
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
function abort(error) {
|
| 74 |
+
console.error(error.stack);
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
function text(string) {
|
| 78 |
+
return string.replace(/[&<>]/g, function(character) {
|
| 79 |
+
switch (character) {
|
| 80 |
+
case "&": return "&";
|
| 81 |
+
case "<": return "<";
|
| 82 |
+
case ">": return ">";
|
| 83 |
+
}
|
| 84 |
+
});
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
function attr(string) {
|
| 88 |
+
return string.replace(/"/g, """);
|
| 89 |
+
}
|
node_modules/.bin/geograticule
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env node
|
| 2 |
+
|
| 3 |
+
var commander = require("commander"),
|
| 4 |
+
graticule = require("d3-geo").geoGraticule(),
|
| 5 |
+
write = require("./write");
|
| 6 |
+
|
| 7 |
+
commander
|
| 8 |
+
.version(require("../package.json").version)
|
| 9 |
+
.usage("[options]")
|
| 10 |
+
.description("Generate a GeoJSON graticule.")
|
| 11 |
+
.option("-o, --out <file>", "output file name; defaults to “-” for stdout", "-")
|
| 12 |
+
.option("--extent <value>", "the major and minor extent", parseExtent)
|
| 13 |
+
.option("--extent-minor <value>", "the minor extent; defaults to " + graticule.extentMajor(), parseExtent)
|
| 14 |
+
.option("--extent-major <value>", "the major extent; defaults to " + graticule.extentMinor(), parseExtent)
|
| 15 |
+
.option("--step <value>", "the major and minor step", parseStep)
|
| 16 |
+
.option("--step-minor <value>", "the minor step; defaults to " + graticule.stepMinor(), parseStep)
|
| 17 |
+
.option("--step-major <value>", "the major step; defaults to " + graticule.stepMajor(), parseStep)
|
| 18 |
+
.option("--precision <value>", "the precision; defaults to " + graticule.precision(), graticule.precision)
|
| 19 |
+
.parse(process.argv);
|
| 20 |
+
|
| 21 |
+
if (commander.args.length !== 0) {
|
| 22 |
+
console.error();
|
| 23 |
+
console.error(" error: unexpected arguments");
|
| 24 |
+
console.error();
|
| 25 |
+
process.exit(1);
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
if (commander.extent != null) {
|
| 29 |
+
if (commander.extentMinor == null) commander.extentMinor = commander.extent;
|
| 30 |
+
if (commander.extentMajor == null) commander.extentMajor = commander.extent;
|
| 31 |
+
}
|
| 32 |
+
if (commander.step != null) {
|
| 33 |
+
if (commander.stepMinor == null) commander.stepMinor = commander.step;
|
| 34 |
+
if (commander.stepMajor == null) commander.stepMajor = commander.step;
|
| 35 |
+
}
|
| 36 |
+
if (commander.extentMinor != null) graticule.extentMinor(commander.extentMinor);
|
| 37 |
+
if (commander.extentMajor != null) graticule.extentMajor(commander.extentMajor);
|
| 38 |
+
if (commander.stepMinor != null) graticule.stepMinor(commander.stepMinor);
|
| 39 |
+
if (commander.stepMajor != null) graticule.stepMajor(commander.stepMajor);
|
| 40 |
+
|
| 41 |
+
var writer = write(commander.out);
|
| 42 |
+
writer.write(JSON.stringify(graticule()) + "\n");
|
| 43 |
+
writer.end().catch(abort);
|
| 44 |
+
|
| 45 |
+
function parseStep(x) {
|
| 46 |
+
return x = x.split(","), x.length === 1 ? [+x[0], +x[0]] : [+x[0], +x[1]];
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
function parseExtent(x) {
|
| 50 |
+
return x = x.split(","), [[+x[0], +x[1]], [+x[2], +x[3]]];
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
function abort(error) {
|
| 54 |
+
console.error(error.stack);
|
| 55 |
+
}
|
node_modules/.bin/geojson-rewind
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env node
|
| 2 |
+
|
| 3 |
+
var rewind = require('./'),
|
| 4 |
+
getStream = require('get-stream'),
|
| 5 |
+
fs = require('fs'),
|
| 6 |
+
argv = require('minimist')(process.argv.slice(2), {
|
| 7 |
+
boolean: 'clockwise'
|
| 8 |
+
});
|
| 9 |
+
|
| 10 |
+
const help = `
|
| 11 |
+
usage:
|
| 12 |
+
|
| 13 |
+
geojson-rewind < foo.geojson > foo.geojson
|
| 14 |
+
geojson-rewind foo.geojson > bar.geojson
|
| 15 |
+
|
| 16 |
+
options:
|
| 17 |
+
|
| 18 |
+
--clockwise
|
| 19 |
+
|
| 20 |
+
if specified, set outer ring to clockwise
|
| 21 |
+
and inner rings to counterclockwise`.trim();
|
| 22 |
+
|
| 23 |
+
if (process.stdin.isTTY && !argv._[0]) {
|
| 24 |
+
console.log(help);
|
| 25 |
+
process.exit(1);
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
getStream(argv._.length ? fs.createReadStream(argv._[0]) : process.stdin)
|
| 29 |
+
.then(convert);
|
| 30 |
+
|
| 31 |
+
function convert(data) {
|
| 32 |
+
process.stdout.write(JSON.stringify(rewind(JSON.parse(data), argv.clockwise)));
|
| 33 |
+
}
|
node_modules/.bin/geoproject
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env node
|
| 2 |
+
|
| 3 |
+
var commander = require("commander"),
|
| 4 |
+
vm = require("vm"),
|
| 5 |
+
d3 = Object.assign({}, require("d3-geo"), require("../")),
|
| 6 |
+
read = require("./read"),
|
| 7 |
+
requires = require("./requires"),
|
| 8 |
+
write = require("./write");
|
| 9 |
+
|
| 10 |
+
commander
|
| 11 |
+
.version(require("../package.json").version)
|
| 12 |
+
.usage("[options] <projection> [file]")
|
| 13 |
+
.description("Transform GeoJSON, such as to project from spherical to planar coordinates.")
|
| 14 |
+
.option("-o, --out <file>", "output file name; defaults to “-” for stdout", "-")
|
| 15 |
+
.option("-p, --precision <value>", "number of output digits after the decimal point")
|
| 16 |
+
.option("-n, --newline-delimited", "use newline-delimited JSON")
|
| 17 |
+
.option("-r, --require <[name=]module>", "require a module", requires, {d3: d3, d: undefined, i: -1})
|
| 18 |
+
.parse(process.argv);
|
| 19 |
+
|
| 20 |
+
if (commander.args.length < 1) {
|
| 21 |
+
console.error();
|
| 22 |
+
console.error(" error: missing projection");
|
| 23 |
+
console.error();
|
| 24 |
+
process.exit(1);
|
| 25 |
+
} else if (commander.args.length > 2) {
|
| 26 |
+
console.error();
|
| 27 |
+
console.error(" error: multiple input files");
|
| 28 |
+
console.error();
|
| 29 |
+
process.exit(1);
|
| 30 |
+
} else if (commander.args.length === 1) {
|
| 31 |
+
commander.args.push("-");
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
var sandbox = commander.require,
|
| 35 |
+
context = new vm.createContext(sandbox),
|
| 36 |
+
projection = new vm.Script("(" + commander.args[0] + ")"),
|
| 37 |
+
reader = read(commander.args[1], commander.newlineDelimited, project).then(end).catch(abort),
|
| 38 |
+
writer = write(commander.out);
|
| 39 |
+
|
| 40 |
+
function project(d, i) {
|
| 41 |
+
sandbox.d = d, sandbox.i = i;
|
| 42 |
+
d = d3.geoProject(d, projection.runInContext(context));
|
| 43 |
+
if (commander.precision != null) d = d3.geoQuantize(d, commander.precision);
|
| 44 |
+
return writer.write(JSON.stringify(d) + "\n");
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
function end() {
|
| 48 |
+
return writer.end();
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
function abort(error) {
|
| 52 |
+
console.error(error.stack);
|
| 53 |
+
}
|
node_modules/.bin/geoquantize
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env node
|
| 2 |
+
|
| 3 |
+
var commander = require("commander"),
|
| 4 |
+
d3 = Object.assign({}, require("d3-geo"), require("../")),
|
| 5 |
+
read = require("./read"),
|
| 6 |
+
write = require("./write");
|
| 7 |
+
|
| 8 |
+
commander
|
| 9 |
+
.version(require("../package.json").version)
|
| 10 |
+
.usage("[options] [file]")
|
| 11 |
+
.description("Quantize GeoJSON.")
|
| 12 |
+
.option("-o, --out <file>", "output file name; defaults to “-” for stdout", "-")
|
| 13 |
+
.option("-p, --precision <value>", "number of output digits after the decimal point")
|
| 14 |
+
.option("-n, --newline-delimited", "use newline-delimited JSON")
|
| 15 |
+
.parse(process.argv);
|
| 16 |
+
|
| 17 |
+
if (commander.args.length > 1) {
|
| 18 |
+
console.error();
|
| 19 |
+
console.error(" error: multiple input files");
|
| 20 |
+
console.error();
|
| 21 |
+
process.exit(1);
|
| 22 |
+
} else if (commander.args.length === 0) {
|
| 23 |
+
commander.args.push("-");
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
var reader = read(commander.args[0], commander.newlineDelimited, quantize).then(end).catch(abort),
|
| 27 |
+
writer = write(commander.out);
|
| 28 |
+
|
| 29 |
+
function quantize(d, i) {
|
| 30 |
+
if (commander.precision != null) d = d3.geoQuantize(d, commander.precision);
|
| 31 |
+
return writer.write(JSON.stringify(d) + "\n");
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
function end() {
|
| 35 |
+
return writer.end();
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
function abort(error) {
|
| 39 |
+
console.error(error.stack);
|
| 40 |
+
}
|
node_modules/.bin/geostitch
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env node
|
| 2 |
+
|
| 3 |
+
var commander = require("commander"),
|
| 4 |
+
d3 = require("../"),
|
| 5 |
+
read = require("./read"),
|
| 6 |
+
write = require("./write");
|
| 7 |
+
|
| 8 |
+
commander
|
| 9 |
+
.version(require("../package.json").version)
|
| 10 |
+
.usage("[options] [file]")
|
| 11 |
+
.description("Stitch equirectangular GeoJSON in degrees, removing antimeridian and polar cuts.")
|
| 12 |
+
.option("-o, --out <file>", "output file name; defaults to “-” for stdout", "-")
|
| 13 |
+
.option("-n, --newline-delimited", "use newline-delimited JSON")
|
| 14 |
+
.parse(process.argv);
|
| 15 |
+
|
| 16 |
+
if (commander.args.length === 0) commander.args[0] = "-";
|
| 17 |
+
else if (commander.args.length !== 1) {
|
| 18 |
+
console.error();
|
| 19 |
+
console.error(" error: multiple input files");
|
| 20 |
+
console.error();
|
| 21 |
+
process.exit(1);
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
var reader = read(commander.args[0], commander.newlineDelimited, stitch).then(end).catch(abort),
|
| 25 |
+
writer = write(commander.out);
|
| 26 |
+
|
| 27 |
+
function stitch(d) {
|
| 28 |
+
return writer.write(JSON.stringify(d3.geoStitch(d)) + "\n");
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
function end() {
|
| 32 |
+
return writer.end();
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
function abort(error) {
|
| 36 |
+
console.error(error.stack);
|
| 37 |
+
}
|
node_modules/.bin/glslify
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env node
|
| 2 |
+
|
| 3 |
+
const glslifyBundle = require('glslify-bundle')
|
| 4 |
+
const glslifyDeps = require('glslify-deps')
|
| 5 |
+
const glslResolve = require('glsl-resolve')
|
| 6 |
+
const minimist = require('minimist')
|
| 7 |
+
const path = require('path')
|
| 8 |
+
const bl = require('bl')
|
| 9 |
+
const fs = require('fs')
|
| 10 |
+
|
| 11 |
+
const depper = glslifyDeps()
|
| 12 |
+
const argv = minimist(process.argv.slice(2), {
|
| 13 |
+
alias: {
|
| 14 |
+
t: 'transform',
|
| 15 |
+
g: 'global',
|
| 16 |
+
p: 'post',
|
| 17 |
+
o: 'output',
|
| 18 |
+
v: 'version',
|
| 19 |
+
h: 'help'
|
| 20 |
+
}
|
| 21 |
+
})
|
| 22 |
+
|
| 23 |
+
var input = ''
|
| 24 |
+
if (argv.version) {
|
| 25 |
+
const version = require('./package.json').version
|
| 26 |
+
process.stdout.write('v' + version + '\n')
|
| 27 |
+
process.exit(0)
|
| 28 |
+
}
|
| 29 |
+
if (argv.help) return help()
|
| 30 |
+
if (!argv._.length && process.stdin.isTTY) return help()
|
| 31 |
+
|
| 32 |
+
// Apply source transforms
|
| 33 |
+
argv.t = argv.t || []
|
| 34 |
+
argv.t = Array.isArray(argv.t) ? argv.t : [argv.t]
|
| 35 |
+
argv.t.forEach(function(tr) {
|
| 36 |
+
depper.transform(tr)
|
| 37 |
+
})
|
| 38 |
+
|
| 39 |
+
argv.g = argv.g || []
|
| 40 |
+
argv.g = Array.isArray(argv.g) ? argv.g : [argv.g]
|
| 41 |
+
argv.g.forEach(function(tr) {
|
| 42 |
+
depper.transform(tr, { global: true })
|
| 43 |
+
})
|
| 44 |
+
|
| 45 |
+
argv.p = argv.p || []
|
| 46 |
+
argv.p = Array.isArray(argv.p) ? argv.p : [argv.p]
|
| 47 |
+
|
| 48 |
+
//
|
| 49 |
+
// Build dependency tree, then output
|
| 50 |
+
//
|
| 51 |
+
if (argv._.length) {
|
| 52 |
+
return depper.add(argv._[0], output)
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
process.stdin.pipe(bl(function(err, src) {
|
| 56 |
+
if (err) throw err
|
| 57 |
+
|
| 58 |
+
depper.inline(src, process.cwd(), output)
|
| 59 |
+
}))
|
| 60 |
+
|
| 61 |
+
//
|
| 62 |
+
// Logs --help information out to stderr.
|
| 63 |
+
//
|
| 64 |
+
function help() {
|
| 65 |
+
fs.createReadStream(path.join(__dirname, 'usage.txt'))
|
| 66 |
+
.once('close', function() {
|
| 67 |
+
console.error()
|
| 68 |
+
process.exit(1)
|
| 69 |
+
})
|
| 70 |
+
.pipe(process.stderr)
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
//
|
| 74 |
+
// Finally, apply shared functions for --post transforms
|
| 75 |
+
// and output the result to either stdout or the output
|
| 76 |
+
// file.
|
| 77 |
+
//
|
| 78 |
+
function output(err, tree) {
|
| 79 |
+
if (err) throw err
|
| 80 |
+
var src = String(glslifyBundle(tree))
|
| 81 |
+
|
| 82 |
+
next()
|
| 83 |
+
function next() {
|
| 84 |
+
var tr = argv.p.shift()
|
| 85 |
+
if (!tr) return done()
|
| 86 |
+
var transform = require(tr)
|
| 87 |
+
|
| 88 |
+
transform(null, src, {
|
| 89 |
+
post: true
|
| 90 |
+
}, function(err, data) {
|
| 91 |
+
if (err) throw err
|
| 92 |
+
if (data) src = data
|
| 93 |
+
next()
|
| 94 |
+
})
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
function done() {
|
| 98 |
+
if (!argv.output) return process.stdout.write(src)
|
| 99 |
+
fs.writeFileSync(argv.output, src)
|
| 100 |
+
}
|
| 101 |
+
}
|
node_modules/.bin/hfjs
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|