import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
import { ContentState } from '../ContentState';
import { Loader } from '../Loader';
import { useLogic } from './hooks';
import { FirstStep, Greeting, GreetingWrapper, LastStep, ProductWrapper, UserName, } from './styles';
export const WelcomeScreen = ({ logo, productName, userName, errorMsg, isSuccess, isLoading, isError, children, onRetry, }) => {
    const { isShowLoader, isShowGreetings, isShowContent } = useLogic({
        isSuccess,
        isLoading,
        isError,
    });
    return (_jsxs(ContentState, { isLoading: isLoading, isError: isError, loadingContent: 
        // Лоадер отображается с задержкой, указанной в константе LOADING_DISPLAY_DELAY_MS
        // biome-ignore lint/complexity/noUselessFragments: Фрагмент необходим по типизации
        isShowLoader ? _jsx(Loader, {}) : _jsx(_Fragment, {}), errorState: { errorList: [errorMsg || ''], onRetry }, children: [isShowGreetings && (_jsxs(_Fragment, { children: [_jsx(FirstStep, { children: _jsxs(ProductWrapper, { children: [logo, productName] }) }), _jsxs(LastStep, { children: [_jsxs(ProductWrapper, { children: [logo, productName] }), _jsxs(GreetingWrapper, { children: [_jsxs(Greeting, { variant: "h2", color: "grey", colorIntensity: "500", children: ["\u0414\u043E\u0431\u0440\u043E \u043F\u043E\u0436\u0430\u043B\u043E\u0432\u0430\u0442\u044C", userName ? ',' : ''] }), userName && (_jsx(UserName, { variant: "h1", color: "textSecondary", children: userName }))] })] })] })), isShowContent && _jsx(_Fragment, { children: children })] }));
};
