<commit_before>/*
 * decaffeinate suggestions:
 * DS102: Remove unnecessary code created because of implicit returns
 * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
 */
/*
Share server top-level landing page.
*/

import { React, Component, Rendered } from "../app-framework";

import { SITE_NAME, BASE_URL, DNS } from "smc-util/theme";

//import { r_join } from "../r_misc";
const { r_join } = require("../r_misc");

const CDN_LINKS = [
  {
    href:
      "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css",
    integrity:
      "<KEY>"
  },
  // codemirror CDN -- https://cdnjs.com/libraries/codemirror
  {
    href:
      "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.40.2/codemirror.min.css",
    integrity: "<KEY>
  },
  {
    href: "https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.10.2/katex.min.css",
    integrity: "<KEY>
  }
];

export type IsPublicFunction = (project_id: string, path: string) => boolean;

interface PageProps {
  site_name?: string;
  base_url: string;
  path: string; // the path with no base url to the currently displayed file, directory, etc.
  viewer: string; // 'share' or 'embed'
  project_id?: string; // only defined if we are viewing something in a project
  subtitle?: string;
  google_analytics?: string; // optional, and if set just the token
  notranslate?: boolean;
  is_public: IsPublicFunction;
}

export class Page extends Component<PageProps> {
  static defaultProps = {
    base_url: BASE_URL,
    site_name: SITE_NAME
  };

  private render_viewport(): Rendered {
    return (
      <meta name="viewport" content="width=device-width, initial-scale=1" />
    );
  }

  private render_title(): Rendered {
    let title = "Shared";
    if (this.props.subtitle) {
      title += ` - ${this.props.subtitle}`;
    }
    return <title>{title}</title>;
  }

  private render_cocalc_link(): Rendered {
    if (this.props.viewer === "embed") {
      return (
        <div
          style={{
            right: 0,
            position: "absolute",
            fontSize: "8pt",
            border: "1px solid #aaa",
            padding: "2px"
          }}
        >
          <a href={"https://cocalc.com"} target={"_blank"} rel={"noopener"}>
            Powered by CoCalc
          </a>
        </div>
      );
    } else {
      return (
        <div
          style={{
            position: "absolute",
            left: "50%",
            transform: "translate(-50%)",
            fontSize: "12pt",
            maxHeight: "68px",
            overflowY: "hidden",
            background: "white",
            padding: "0 5px",
            border: "1px solid #aaa"
          }}
        >
          <a
            href={"https://cocalc.com/doc/features.html"}
            target={"_blank"}
            rel={"noopener"}
          >
            CoCalc
          </a>
        </div>
      );
    }
  }

  private render_notranslate(): Rendered {
    // don't translate the index pages
    if (!this.props.notranslate) {
      return;
    }
    return <meta name="google" content="notranslate" />;
  }

  private render_noindex(): Rendered {
    if (this.props.viewer === "share") {
      // we want share to be indexed
      return;
    }
  }<commit_msg>the features page changed/moved, which broke share link<commit_after>/*
 * decaffeinate suggestions:
 * DS102: Remove unnecessary code created because of implicit returns
 * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
 */
/*
Share server top-level landing page.
*/

import { React, Component, Rendered } from "../app-framework";

import { SITE_NAME, BASE_URL, DNS } from "smc-util/theme";

//import { r_join } from "../r_misc";
const { r_join } = require("../r_misc");

const CDN_LINKS = [
  {
    href:
      "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css",
    integrity:
      "<KEY>"
  },
  // codemirror CDN -- https://cdnjs.com/libraries/codemirror
  {
    href:
      "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.40.2/codemirror.min.css",
    integrity: "<KEY>
  },
  {
    href: "https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.10.2/katex.min.css",
    integrity: "<KEY>
  }
];

export type IsPublicFunction = (project_id: string, path: string) => boolean;

interface PageProps {
  site_name?: string;
  base_url: string;
  path: string; // the path with no base url to the currently displayed file, directory, etc.
  viewer: string; // 'share' or 'embed'
  project_id?: string; // only defined if we are viewing something in a project
  subtitle?: string;
  google_analytics?: string; // optional, and if set just the token
  notranslate?: boolean;
  is_public: IsPublicFunction;
}

export class Page extends Component<PageProps> {
  static defaultProps = {
    base_url: BASE_URL,
    site_name: SITE_NAME
  };

  private render_viewport(): Rendered {
    return (
      <meta name="viewport" content="width=device-width, initial-scale=1" />
    );
  }

  private render_title(): Rendered {
    let title = "Shared";
    if (this.props.subtitle) {
      title += ` - ${this.props.subtitle}`;
    }
    return <title>{title}</title>;
  }

  private render_cocalc_link(): Rendered {
    if (this.props.viewer === "embed") {
      return (
        <div
          style={{
            right: 0,
            position: "absolute",
            fontSize: "8pt",
            border: "1px solid #aaa",
            padding: "2px"
          }}
        >
          <a href={"https://cocalc.com"} target={"_blank"} rel={"noopener"}>
            Powered by CoCalc
          </a>
        </div>
      );
    } else {
      return (
        <div
          style={{
            position: "absolute",
            left: "50%",
            transform: "translate(-50%)",
            fontSize: "12pt",
            maxHeight: "68px",
            overflowY: "hidden",
            background: "white",
            padding: "0 5px",
            border: "1px solid #aaa"
          }}
        >
          <a
            href={"https://cocalc.com/doc/"}
            target={"_blank"}
            rel={"noopener"}
          >
            CoCalc
          </a>
        </div>
      );
    }
  }

  private render_notranslate(): Rendered {
    // don't translate the index pages
    if (!this.props.notranslate) {
      return;
    }
    return <meta name="google" content="notranslate" />;
  }

  private render_noindex(): Rendered {
    if (this.props.viewer === "share") {
      // we want share to be indexed
      return;
    }
  }
{'fraction_non_alphanumeric': 0.14495188636016496, 'fraction_numerical': 0.009164502825721704, 'mean_word_length': 2.1420345489443378, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 37, 'https://': 14, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3371347', 'n_tokens_mistral': 2177, 'n_tokens_neox': 2095, 'n_words': 483}