GitFOSS
~app/const.ts
.ts
TypeScript
(application/typescript)
// beware to imports in this file, they must work in both server/client sides.

import type { AppThemeScheme, SectionsPagesIndex } from "./types";

type Const = {
  APP_NAME: string;
  DEFAULT_THEME_SCHEME: AppThemeScheme;
  SECTIONS_WITH_PAGES: SectionsPagesIndex;
  SECTIONS_TITLES: Record<string, string>;
  SECTIONS_SUMMARIES: Record<string, string>;
  SESSION_TTL_SECONDS: number;
  SSR_CACHE_MAX_SIZE_BYTES: number;
};

export const Const: Const = {
  APP_NAME: "GitFOSS",
  DEFAULT_THEME_SCHEME: "dark",
  SESSION_TTL_SECONDS: 24 * (60 * 60), // 1 day in seconds
  SSR_CACHE_MAX_SIZE_BYTES: 50_000_000, // 50Mb in bytes
  // TODO(refactor): all of this will move into folder/index.yml
  SECTIONS_WITH_PAGES: {
    ["getting-started"]: [
      "the-monolith-architecture",
      "tooling-typescript",
      "generate-project-cli",
    ],
    ["server-configuration"]: ["server-file-explained", "options"],
    ["declarative-routing"]: ["routes-file-explained", "options"],
    ["controllers"]: ["what-is-a-controller"],
    ["views-and-islands"]: ["what-is-a-view", "what-is-an-island"],
    ["seo-and-a11y"]: ["meta-tags", "accessibility"],
    ["faq-and-known-issues"]: ["islands-cannot-share-react-context"],
  },
  SECTIONS_TITLES: {
    "getting-started": "Getting Started",
    "server-configuration": "Server Configuration",
    "declarative-routing": "Declarative Routing",
    controllers: "Controllers",
    "views-and-islands": "Views and Islands",
    "seo-and-a11y": "SEO & A11Y",
    "faq-and-known-issues": "FAQ & Known Issues",
  },
  SECTIONS_SUMMARIES: {
    "getting-started":
      "Discover the concepts behind React Monolith and how to use them so they benefit to your websites and web applications.",
    "server-configuration":
      "Learn about the server file and how you can use the options it provides to develop an application that fit your needs in a fast way.",
    "declarative-routing":
      "Navigation handling couldn’t be made easier thanks to a simple JSX declarative routes file that contains all your route/controller mappings.",
    controllers:
      "Discover how you can implement your business logic on the server-side and reply by streaming React views as a response to the client request.",
    "views-and-islands":
      "Learn more about the two types ReactView and ReactIsland and how they help you to create interactivity in area where you need it.",
    "seo-and-a11y":
      "Learn how you can leverage the ViewContext to generate meta-tags that improve your search engine ranking and accessibility for your users.",
    "faq-and-known-issues":
      "Frequently Asked Questions and Known Issues around the React Monolith Framework and its underlying fastify-stream-react-views plugin (which does most of the SSR/Islands work).",
  },
};