fix context error

This commit is contained in:
2025-08-03 14:04:10 +02:00
parent 7ad74db834
commit 28ee97782c
4 changed files with 26 additions and 20 deletions
+2 -18
View File
@@ -1,29 +1,13 @@
"use client";
import "./style.css";
import { useState, createContext, useContext } from "react";
import { useState } from "react";
import { AuthProvider } from "react-oidc-context";
import { oidcConfig, userManager } from "muzak/config/auth";
import { Source_Sans_3, Nunito } from "next/font/google";
import AuthStatus from "muzak/components/AuthStatus";
import NavigationBar from "muzak/components/NavigationBar";
import Quota from "muzak/components/Quota";
interface AnimationContextType {
isAnimate: boolean;
setIsAnimate: React.Dispatch<React.SetStateAction<boolean>>;
}
const AnimationContext = createContext<AnimationContextType | undefined>(
undefined,
);
export const useAnimation = () => {
const context = useContext(AnimationContext);
if (context === undefined) {
throw new Error("useAnimation must be used within an AnimationProvider");
}
return context;
};
import { AnimationContext } from "muzak/contexts/AnimationContext";
const nunito = Nunito({
subsets: ["latin"],
+1 -1
View File
@@ -2,7 +2,7 @@
import { useState } from "react";
import { Nunito } from "next/font/google";
import { api } from "muzak/data/fetcher";
import { useAnimation } from "../layout";
import { useAnimation } from "muzak/contexts/AnimationContext";
const nunito = Nunito({
weight: "900",
@@ -0,0 +1,21 @@
"use client";
import { createContext, useContext } from "react";
interface AnimationContextType {
isAnimate: boolean;
setIsAnimate: React.Dispatch<React.SetStateAction<boolean>>;
}
const AnimationContext = createContext<AnimationContextType | undefined>(
undefined,
);
export const useAnimation = () => {
const context = useContext(AnimationContext);
if (context === undefined) {
throw new Error("useAnimation must be used within an AnimationProvider");
}
return context;
};
export { AnimationContext };