From 8448a865a7bd1f091c6f08caf58b6148192ef0b3 Mon Sep 17 00:00:00 2001 From: Mark Hoekveen Date: Wed, 6 Aug 2025 20:57:07 +0200 Subject: [PATCH] disable nominate when quota 0 --- frontend/src/app/nominations/page.tsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/nominations/page.tsx b/frontend/src/app/nominations/page.tsx index c06082f..a394a3e 100644 --- a/frontend/src/app/nominations/page.tsx +++ b/frontend/src/app/nominations/page.tsx @@ -1,5 +1,5 @@ "use client"; -import { useState } from "react"; +import { useState, useEffect } from "react"; import { Nunito } from "next/font/google"; import { api } from "muzak/data/fetcher"; import { useAnimation } from "muzak/contexts/AnimationContext"; @@ -15,6 +15,7 @@ export default function Nominations() { const [songURL, setSongURL] = useState(""); const [isLoading, setIsLoading] = useState(false); const [message, setMessage] = useState(""); + const [canNominate, setCanNominate] = useState(true); const isSpotifyURL = /^https:\/\/open\.spotify\.com\/track\/[a-zA-Z0-9]{22}(\?.*)?$/.test( songURL, @@ -36,6 +37,14 @@ export default function Nominations() { } } + useEffect(() => { + if (quota > 0) { + setCanNominate(true); + } else { + setCanNominate(false); + } + }, [quota]); + return (

{ e.preventDefault(); if (!songURL.trim()) return;