mirror of
https://github.com/randyjc/Rahoot.git
synced 2026-03-13 20:15:35 +01:00
bug fixing
This commit is contained in:
@@ -6,16 +6,20 @@ import type { Metadata } from "next"
|
|||||||
import { Montserrat } from "next/font/google"
|
import { Montserrat } from "next/font/google"
|
||||||
import { PropsWithChildren } from "react"
|
import { PropsWithChildren } from "react"
|
||||||
import "./globals.css"
|
import "./globals.css"
|
||||||
|
import { getTheme } from "@rahoot/web/server/theme"
|
||||||
|
|
||||||
const montserrat = Montserrat({
|
const montserrat = Montserrat({
|
||||||
variable: "--font-montserrat",
|
variable: "--font-montserrat",
|
||||||
subsets: ["latin"],
|
subsets: ["latin"],
|
||||||
})
|
})
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export async function generateMetadata(): Promise<Metadata> {
|
||||||
title: "Rahoot !",
|
const theme = getTheme()
|
||||||
|
return {
|
||||||
|
title: theme.brandName || "Rahoot",
|
||||||
icons: "/icon.svg",
|
icons: "/icon.svg",
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const RootLayout = ({ children }: PropsWithChildren) => (
|
const RootLayout = ({ children }: PropsWithChildren) => (
|
||||||
<html lang="en" suppressHydrationWarning={true} data-lt-installed="true">
|
<html lang="en" suppressHydrationWarning={true} data-lt-installed="true">
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ const GameWrapper = ({
|
|||||||
const { isConnected } = useSocket()
|
const { isConnected } = useSocket()
|
||||||
const { player } = usePlayerStore()
|
const { player } = usePlayerStore()
|
||||||
const { questionStates, setQuestionStates } = useQuestionStore()
|
const { questionStates, setQuestionStates } = useQuestionStore()
|
||||||
const { backgroundUrl } = useThemeStore()
|
const { backgroundUrl, brandName, setBackground, setBrandName } = useThemeStore()
|
||||||
const [isDisabled, setIsDisabled] = useState(false)
|
const [isDisabled, setIsDisabled] = useState(false)
|
||||||
const next = statusName ? MANAGER_SKIP_BTN[statusName] : null
|
const next = statusName ? MANAGER_SKIP_BTN[statusName] : null
|
||||||
|
|
||||||
@@ -52,6 +52,27 @@ const GameWrapper = ({
|
|||||||
setIsDisabled(false)
|
setIsDisabled(false)
|
||||||
}, [statusName])
|
}, [statusName])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const loadTheme = async () => {
|
||||||
|
try {
|
||||||
|
const res = await fetch("/api/theme", { cache: "no-store" })
|
||||||
|
const data = await res.json()
|
||||||
|
if (res.ok && data.theme) {
|
||||||
|
if (typeof data.theme.backgroundUrl === "string") {
|
||||||
|
setBackground(data.theme.backgroundUrl || null)
|
||||||
|
}
|
||||||
|
if (typeof data.theme.brandName === "string") {
|
||||||
|
setBrandName(data.theme.brandName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Failed to load theme", error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
loadTheme()
|
||||||
|
}, [setBackground, setBrandName])
|
||||||
|
|
||||||
const handleNext = () => {
|
const handleNext = () => {
|
||||||
setIsDisabled(true)
|
setIsDisabled(true)
|
||||||
onNext?.()
|
onNext?.()
|
||||||
@@ -88,6 +109,12 @@ const GameWrapper = ({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
<div className="flex flex-1 items-center justify-center">
|
||||||
|
<span className="rounded-md bg-white/90 px-3 py-1 text-sm font-semibold text-gray-800 shadow">
|
||||||
|
{brandName}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
{manager && next && (
|
{manager && next && (
|
||||||
<Button
|
<Button
|
||||||
className={clsx("self-end bg-white px-4 text-black!", {
|
className={clsx("self-end bg-white px-4 text-black!", {
|
||||||
|
|||||||
Reference in New Issue
Block a user