diff --git a/web/next.config.mjs b/web/next.config.mjs index 781cc7e..8f767b0 100644 --- a/web/next.config.mjs +++ b/web/next.config.mjs @@ -1,6 +1,22 @@ /* esline-env node */ /** @type {import('next').NextConfig} */ -const nextConfig = { -}; +let nextConfig = {}; + +if (process.env.NODE_ENV === 'production') { + nextConfig = { + output: 'export', + basePath: '/replay', + assetPrefix: '/replay', + env: { + NEXT_PUBLIC_BASE_PATH: '/replay', + }, + }; +} else { + nextConfig = { + env: { + NEXT_PUBLIC_BASE_PATH: '' + } + }; +} export default nextConfig; diff --git a/web/src/app/[sim_id]/page.tsx b/web/src/app/[sim_id]/page.tsx deleted file mode 100644 index 9cccc20..0000000 --- a/web/src/app/[sim_id]/page.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import RenderLevel from '@/components/RenderLevel'; - -export default async function Page({ params }: { params: { sim_id: string } }) { - //const data = await getData(params.sim_id); - - return ( - - ); -} diff --git a/web/src/app/api/simulations/[id]/route.ts b/web/src/app/api/simulations/[id]/route.ts index 6074e8d..4ebe4fa 100644 --- a/web/src/app/api/simulations/[id]/route.ts +++ b/web/src/app/api/simulations/[id]/route.ts @@ -52,12 +52,21 @@ function sortSteps(a: any, b: any) { return a.step - b.step; } +// Return a list of `params` to populate the [slug] dynamic segment +export async function generateStaticParams() { + return [{id: 'skip'}]; +} + export async function GET( request: NextRequest, { params }: { params: { id: string } } ) { const id = params.id; + if (id === 'skip'){ + return Response.json([]); + } + const fromIndex = Number(request.nextUrl.searchParams.get('fromIndex')) || 0; const [totalSteps, allSteps] = await getStepsFromRedis(id, fromIndex); diff --git a/web/src/components/AgentSprite.tsx b/web/src/components/AgentSprite.tsx index 0420aa6..df1d931 100644 --- a/web/src/components/AgentSprite.tsx +++ b/web/src/components/AgentSprite.tsx @@ -1,21 +1,20 @@ import React from "react"; -import Image from "next/image"; import styles from './Agent.module.css'; const AgentSprite: React.FC<{ agentName: string, isTalking: boolean, isThinking: boolean }> = ({ agentName, isTalking, isThinking }) => { return (
- Talking {isThinking && ( - Thinking )}
- {agentName} = ({ simId }) => { } }; - const interval = setInterval(fetchData, 6000); + fetchData(); + const interval = setInterval(fetchData, 12000); return () => { isMounted = false; @@ -104,7 +105,7 @@ const RenderLevel: React.FC<{simId: string}> = ({ simId }) => {
- Default Map + Default Map <> {renderAgents()}