"use client";

import { ReactNode } from "react";
import { Provider } from "react-redux";
import { PersistGate } from "redux-persist/integration/react";
import { Center, Loader } from "@mantine/core";
import { persistor, store } from "@/lib/store/store";

type Props = {
    children: ReactNode;
};

export default function ReduxProvider({ children }: Props) {
    return (
        <Provider store={store}>
            <PersistGate
                loading={
                    <Center h="100vh">
                        <Loader size="sm" />
                    </Center>
                }
                persistor={persistor}>
                {children}
            </PersistGate>
        </Provider>
    );
}
