import WheelPage from '@/components/wheel/WheelPage'
import { templates } from '@/libs/WheelConstants'
import React, { useEffect } from 'react'
import { useConfigStore } from '../../../../../config-store-provider';
import WheelQAs from '@/components/WheelQAs';
import { GetStaticPaths, GetStaticProps, Metadata } from 'next';
import { getMessages, unstable_setRequestLocale } from 'next-intl/server';
import { useTranslations } from 'next-intl';
import languages from '@/libs/languages';
import {routing} from '@/i18n/routing';
export async function generateStaticParams() {
const locales = routing.locales.map((locale) => ({locale})).map((item) => item.locale);
console.log("locales===>", locales);
const tpls = templates.map(t => t.id);
return tpls.flatMap((template) =>
locales.map((locale) => ({
export async function generateMetadata({ params }: { params: { template: string, locale: string} }): Promise<Metadata> {
const template = templates.find(t => t.id === params.template);
const messages = await getMessages({ locale: params.locale });
// 确保 messages 是包含 WheelController 的类型
const wheelTemplates = (messages as any).WheelController.templates;
const siteTitle = (messages as any).Site.title;
const siteDescription = (messages as any).Site.description;
const title = wheelTemplates.find((t: { id: string }) => t.id === params.template)?.name;
title: title ? `${title} - ${siteTitle}` : siteTitle,
description: siteDescription,
function page({ params }: { params: { template: string, locale: string } }) {
unstable_setRequestLocale(params.locale);
const template = templates.find(t => t.id === params.template)
{/* <span>{params.locale}</span> */}
<WheelPage template={template as WheelTemplate}/>