"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LinkStyle = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
/*
 *  This file is part of CoCalc: Copyright © 2021 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */
const link_1 = __importDefault(require("next/link"));
const logo_square_1 = __importDefault(require("components/logo-square"));
const A_1 = __importDefault(require("components/misc/A"));
const path_1 = require("path");
const antd_1 = require("antd");
const customize_1 = require("lib/customize");
const base_path_1 = __importDefault(require("lib/base-path"));
const sub_nav_1 = __importDefault(require("./sub-nav"));
const analytics_1 = __importDefault(require("components/analytics"));
const navtab_1 = __importDefault(require("components/account/navtab"));
const icon_1 = require("@cocalc/frontend/components/icon");
const GAP = "4%";
exports.LinkStyle = {
    color: "white",
    marginRight: GAP,
    display: "inline-block",
};
const SelectedStyle = {
    ...exports.LinkStyle,
    color: "#c7d9f5",
    fontWeight: "bold",
    borderBottom: "5px solid #c7d9f5",
};
function Header({ page, subPage }) {
    const { isCommercial, anonymousSignup, siteName, termsOfServiceURL, shareServer, landingPages, account, imprintOrPolicies, } = (0, customize_1.useCustomize)();
    if (base_path_1.default == null)
        return null;
    return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(analytics_1.default, {}), (0, jsx_runtime_1.jsxs)(antd_1.Layout.Header, { style: {
                    minHeight: "64px",
                    height: "auto",
                    lineHeight: "32px",
                    padding: "16px",
                    textAlign: "center",
                }, children: [isCommercial && ((0, jsx_runtime_1.jsxs)(antd_1.Button, { type: "primary", size: "large", href: "/support/new?hideExtra=true&type=question&subject=&body=&title=Ask%20Us%20Anything!", title: "Ask a question", style: { float: "left" }, children: [(0, jsx_runtime_1.jsx)(icon_1.Icon, { name: "question-circle" }), " Ask Us Anything!"] })), " ", (0, jsx_runtime_1.jsx)(A_1.default, { href: "/", children: (0, jsx_runtime_1.jsx)("div", { style: {
                                position: "relative",
                                display: "inline-block",
                                height: "40px",
                                width: "40px",
                                marginTop: "-30px",
                                marginRight: "64px",
                            }, children: (0, jsx_runtime_1.jsx)(logo_square_1.default, { style: {
                                    height: "40px",
                                    width: "40px",
                                    position: "absolute",
                                    top: "15px",
                                } }) }) }), account && ((0, jsx_runtime_1.jsx)("a", { style: exports.LinkStyle, href: (0, path_1.join)(base_path_1.default, "projects"), title: "View your projects", children: "Your Projects" })), landingPages && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isCommercial && ((0, jsx_runtime_1.jsx)(A_1.default, { href: "/store", style: page == "store" ? SelectedStyle : exports.LinkStyle, children: "Store" })), (0, jsx_runtime_1.jsx)(A_1.default, { href: "/features/", style: page == "features" ? SelectedStyle : exports.LinkStyle, children: "Features" })] })), !landingPages && termsOfServiceURL && ((0, jsx_runtime_1.jsx)(A_1.default, { style: exports.LinkStyle, href: termsOfServiceURL, title: "View the terms of service and other legal documents.", children: "Legal" })), (0, jsx_runtime_1.jsx)(A_1.default, { style: page == "info" ? SelectedStyle : exports.LinkStyle, href: "/info", title: "Documentation and links to resources for learning more about CoCalc", children: "Docs" }), shareServer && ((0, jsx_runtime_1.jsx)(link_1.default, { href: "/share/public_paths/page/1", children: (0, jsx_runtime_1.jsx)("a", { style: page == "share" ? SelectedStyle : exports.LinkStyle, title: "View files that people have published.", children: "Share" }) })), (0, jsx_runtime_1.jsx)(A_1.default, { style: page == "support" ? SelectedStyle : exports.LinkStyle, href: "/support", title: "Create and view support tickets", children: "Support" }), " ", !account && anonymousSignup && ((0, jsx_runtime_1.jsx)(A_1.default, { style: page == "try" ? SelectedStyle : exports.LinkStyle, href: "/auth/try", title: `Try ${siteName} immediately without creating an account.`, children: "Try" })), " ", account ? ((0, jsx_runtime_1.jsx)(navtab_1.default, { style: page == "account" ? SelectedStyle : exports.LinkStyle })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(A_1.default, { style: page == "sign-in" ? SelectedStyle : exports.LinkStyle, href: "/auth/sign-in", title: `Sign in to ${siteName} or create an account.`, children: "Sign In" }), (0, jsx_runtime_1.jsx)(A_1.default, { style: page == "sign-up" ? SelectedStyle : exports.LinkStyle, href: "/auth/sign-up", title: `Sign up for a ${siteName} account.`, children: "Sign Up" })] }))] }), (landingPages || imprintOrPolicies) && page && ((0, jsx_runtime_1.jsx)(sub_nav_1.default, { page: page, subPage: subPage }))] }));
}
exports.default = Header;
//# sourceMappingURL=header.js.map