Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/apps/web/components/SiteHeader.tsx
blob: 23187e5512d87110d931b40654ad6fed7040b657 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// SPDX-FileCopyrightText: 2026 Progmasoft <support@progmasoft.com>
// SPDX-License-Identifier: AGPL-3.0-or-later WITH AdditionRef-Progmasoft-Patent-Grant-1.1

import Link from "next/link";
import { getHomeMessages } from "@/lib/home-messages";
import { getMessages, type Locale } from "@/lib/localization";
import { Brand } from "./Brand";
import { PreferenceControls } from "./PreferenceControls";

interface SiteHeaderProps {
  account?: boolean;
  locale: Locale;
  signedInName?: string;
}

export function SiteHeader({
  account = false,
  locale,
  signedInName,
}: SiteHeaderProps) {
  const { navigation } = getMessages(locale);
  const site = getHomeMessages(locale).navigation;
  return (
    <header className="site-header">
      <div className="shell header-inner">
        <Brand account={account} accountLabel={navigation.account} />
        <nav className="primary-nav" aria-label={navigation.primary}>
          {account ? (
            <>
              <Link href="https://progmasoft.com/">
                {navigation.organization}
              </Link>
              {signedInName ? (
                <Link
                  className="button button-small"
                  href={`/${signedInName}/dashboard`}
                >
                  {navigation.dashboard}
                </Link>
              ) : (
                <>
                  <Link href="/login">{navigation.signIn}</Link>
                  <Link className="button button-small" href="/register">
                    {navigation.createAccount}
                  </Link>
                </>
              )}
            </>
          ) : (
            <>
              <a href="https://progmasoft.com/#technology">{site.technology}</a>
              <a href="https://product.progmasoft.com/">{site.products}</a>
              <a href="https://console.progmasoft.com/">{site.developers}</a>
              <a href="https://github.com/Progmasoft">GitHub</a>
              <Link
                className="button button-small"
                href="https://account.progmasoft.com/"
              >
                {navigation.account}
              </Link>
            </>
          )}
          <PreferenceControls locale={locale} labels={navigation} />
        </nav>
      </div>
    </header>
  );
}