Files
element-web/src/contexts/CurrentRightPanelPhaseContext.tsx
renovate[bot] 4a381c2a10 Update all non-major dependencies (#29194)
* Update all non-major dependencies

* Delint

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Iterate

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Prettier

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
2025-02-05 13:25:06 +00:00

35 lines
995 B
TypeScript

/*
Copyright 2025 New Vector Ltd.
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
*/
import React, { createContext } from "react";
import { useCurrentPhase } from "../hooks/right-panel/useCurrentPhase";
import { type RightPanelPhases } from "../stores/right-panel/RightPanelStorePhases";
type Context = {
isPanelOpen: boolean;
currentPhase: RightPanelPhases | null;
};
export const CurrentRightPanelPhaseContext = createContext<Context | null>(null);
type Props = {
roomId: string;
};
export const CurrentRightPanelPhaseContextProvider: React.FC<React.PropsWithChildren<Props>> = ({
roomId,
children,
}) => {
const { currentPhase, isOpen } = useCurrentPhase(roomId);
return (
<CurrentRightPanelPhaseContext.Provider value={{ currentPhase, isPanelOpen: isOpen }}>
{children}
</CurrentRightPanelPhaseContext.Provider>
);
};