"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AccountHomePage = void 0;
const contexts_1 = require("../../../contexts/index.js");
const hooks_1 = require("../../../hooks/index.js");
const react_1 = __importStar(require("react"));
const react_i18next_1 = require("react-i18next");
const react_router_dom_1 = require("react-router-dom");
const Translation_1 = require("translations/Translation");
const BEButton_1 = __importDefault(require("../../../components/generic/BEButton"));
const IconNavCard_1 = require("../../../components/generic/Card/IconNavCard/IconNavCard");
const Headline_1 = __importDefault(require("../../../components/generic/Headline"));
const Icon_1 = require("../../../components/generic/Icon/Icon");
const Text_1 = __importStar(require("../../../components/generic/Text"));
const EmptyGraphic_1 = __importDefault(require("../../../components/graphics/EmptyGraphic"));
const ReservationItem_1 = __importDefault(require("../../../components/reservation/ReservationItem"));
const AccountRoutes_1 = require("../AccountRoutes");
const Color_1 = require("../../../util/Color");
const ScreenSize_1 = __importDefault(require("../../../util/ScreenSize"));
const StepManager_1 = __importDefault(require("../../../util/StepManager"));
const AccountHomePage = () => {
    const { user, upcomingBookings } = (0, hooks_1.useMember)();
    const { isMemberPaymentInformationAvailable } = (0, hooks_1.useCurrentHotel)();
    const { t } = (0, react_i18next_1.useTranslation)();
    const context = (0, react_1.useContext)(contexts_1.BookingEngineContext);
    const isMobile = context.screenSize <= ScreenSize_1.default.Large;
    const firstStepUrl = StepManager_1.default.getFirstStep().getStepUrl();
    const hasBookings = (upcomingBookings === null || upcomingBookings === void 0 ? void 0 : upcomingBookings.length) > 0;
    const quickLinkColSize = isMemberPaymentInformationAvailable ? 3 : 4;
    return (react_1.default.createElement("div", null,
        react_1.default.createElement("div", { className: "u-marg-top--heavy@m u-marg-top@m- u-marg-bottom" },
            react_1.default.createElement(react_router_dom_1.Link, { to: StepManager_1.default.getFirstStep().getStepUrl() },
                react_1.default.createElement(BEButton_1.default, { isText: true, icon: Icon_1.IconType.ArrowLeft, size: "small" }, t(Translation_1.Translation.UserPortal.HomeScreen.BackToBooking)))),
        react_1.default.createElement("div", { className: "u-marg-bottom--heavy u-pad-top@m" },
            react_1.default.createElement(Headline_1.default, { size: "extra-large", className: "u-marg-bottom" }, t((user === null || user === void 0 ? void 0 : user.forename) ? Translation_1.Translation.UserPortal.HomeScreen.Title : Translation_1.Translation.UserPortal.HomeScreen.TitleEmpty, { name: user === null || user === void 0 ? void 0 : user.forename })),
            hasBookings ? (react_1.default.createElement(Text_1.default, { type: Text_1.TextType.Body }, t(Translation_1.Translation.UserPortal.HomeScreen.Subtitle))) : (react_1.default.createElement(Text_1.default, { className: "u-marg-top" }, t(Translation_1.Translation.Reservation.EmptyPage.SubTitle)))),
        react_1.default.createElement("div", { className: "u-marg-bottom--heavy" }, hasBookings ? (react_1.default.createElement(ReservationItem_1.default, { itineraryItem: upcomingBookings === null || upcomingBookings === void 0 ? void 0 : upcomingBookings[0], defaultEventsExpanded: true, navPath: AccountRoutes_1.EReservationStatusNavPath.UpcomingStays })) : (react_1.default.createElement("div", { className: "u-marg-top--heavy u-flex u-flex-align-center u-flex-direction-column@l- u-flex-gap" },
            react_1.default.createElement("div", null,
                react_1.default.createElement(EmptyGraphic_1.default, { className: "mw-100" })),
            react_1.default.createElement("div", { className: "u-marg-top--heavy@m-" },
                react_1.default.createElement(Headline_1.default, { size: "large" }, t(Translation_1.Translation.Reservation.EmptyPage.Message)),
                react_1.default.createElement(Text_1.default, { color: Color_1.Color.DarkGrey, type: Text_1.TextType.Small, className: "u-marg-top--light" }, t(Translation_1.Translation.Reservation.EmptyPage.SubMessage)),
                react_1.default.createElement("div", { className: "u-marg-top--heavy u-flex u-flex-flex-start u-flex-gap--light u-flex-direction-column@l-" },
                    react_1.default.createElement(react_router_dom_1.Link, { to: firstStepUrl },
                        react_1.default.createElement(BEButton_1.default, { wide: isMobile, rounded: true, filled: true, icon: Icon_1.IconType.ArrowRight, iconPosition: "right", primary: true }, t(Translation_1.Translation.Reservation.EmptyPage.SearchRooms)))))))),
        react_1.default.createElement("div", { className: "row" },
            react_1.default.createElement("div", { className: `col-md-${quickLinkColSize}` },
                react_1.default.createElement(IconNavCard_1.IconNavCard, { icon: Icon_1.IconType.Subtitle, title: t(Translation_1.Translation.UserPortal.HomeScreen.Bookings), description: react_1.default.createElement(react_i18next_1.Trans, { i18nKey: Translation_1.Translation.UserPortal.HomeScreen.BookingsDescription, components: { 1: react_1.default.createElement("div", null) } }), link: {
                        text: 'See list',
                        pathTo: AccountRoutes_1.AccountRoutes.Reservations.path,
                        icon: 'arrow',
                        color: Color_1.Color.Accent,
                    } })),
            react_1.default.createElement("div", { className: `col-md-${quickLinkColSize}` },
                react_1.default.createElement(IconNavCard_1.IconNavCard, { icon: Icon_1.IconType.Person, title: t(Translation_1.Translation.Navigation.Menu.ProfileInformation), description: react_1.default.createElement(react_i18next_1.Trans, { i18nKey: Translation_1.Translation.UserPortal.HomeScreen.ProfileInformationDescription, components: { 1: react_1.default.createElement("div", null) } }), link: {
                        text: 'Edit Info',
                        pathTo: AccountRoutes_1.AccountRoutes.ProfileDetails.path,
                        icon: 'arrow',
                        color: Color_1.Color.Accent,
                    } })),
            isMemberPaymentInformationAvailable && (react_1.default.createElement("div", { className: "col-md-3" },
                react_1.default.createElement(IconNavCard_1.IconNavCard, { icon: Icon_1.IconType.CreditCard, title: t(Translation_1.Translation.Navigation.Menu.PaymentInformation), description: react_1.default.createElement(react_i18next_1.Trans, { i18nKey: Translation_1.Translation.UserPortal.HomeScreen.PaymentInformationDescription, components: { 1: react_1.default.createElement("div", null) } }), link: {
                        text: 'Manage cards',
                        pathTo: AccountRoutes_1.AccountRoutes.CardDetails.path,
                        icon: 'arrow',
                        color: Color_1.Color.Accent,
                    } }))),
            react_1.default.createElement("div", { className: `col-md-${quickLinkColSize}` },
                react_1.default.createElement(IconNavCard_1.IconNavCard, { icon: Icon_1.IconType.ProgressHelp, title: t(Translation_1.Translation.Navigation.Menu.NeedHelp), description: react_1.default.createElement(react_i18next_1.Trans, { i18nKey: Translation_1.Translation.UserPortal.HomeScreen.NeedHelpDescription, components: { 1: react_1.default.createElement("div", null) } }), link: {
                        text: 'Contact now',
                        pathTo: AccountRoutes_1.AccountRoutes.Help.path,
                        icon: 'arrow',
                        color: Color_1.Color.Accent,
                    } })))));
};
exports.AccountHomePage = AccountHomePage;
//# sourceMappingURL=AccountHomePage.js.map