<commit_before>import preact from "preact"
import Page from "../../../framework/components/Page"
import StoreListenerComponent from "../../../framework/utils/dom"
import CardCollection from "../../../framework/components/card/CardCollection";
import {RichContent} from "../../../framework/components/RichContent";
import {Card, CardAction, CardContent} from "../../../framework/components/card/Card";
import Loading from "../../../framework/components/Loading";
import messages from "../../../framework/messages";
import {ShowPageState, showPageStore} from "./showPageStore";
import {deletePlay, findCompany, findPlaysByShow, findShow} from "../companyApi";
import * as actions from "./showPageActions";
import {Company, Play, Show} from "../companyModel";
import {PrimaryButton} from "../../../framework/components/buttons";
import {isAfterNow, longDateTimeFormat} from "../../../framework/utils/dates";

export interface ShowPageProps {
  path: string
  company?: string
  id?: string
}

export default class ShowPage extends StoreListenerComponent<ShowPageProps, ShowPageState> {
  constructor() {
    super(showPageStore())
  }

  componentDidMount() {
    super.componentDidMount()
    this.initialize()
  }

  initialize() {
    Promise.all([
      findCompany(this.props.company),
      findShow(this.props.company, this.props.id),
      findPlaysByShow(this.props.company, this.props.id)
    ])
      .then(([company, show, plays]) => actions.initialize({company, show, plays}))
  }

  render(props: ShowPageProps, state: ShowPageState) {
    if (this.mounted) {
      return (
        <Page title={state.company ? state.company.name : ""} role="admin">
          <Loading loading={state.loading} message={messages.production.company.show.page.loading}>
            {!state.loading && this.renderShow(state)}
            {!state.loading && this.renderPlays(state)}
          </Loading>
        </Page>
      )
    } else {
      return null
    }
  }

  renderShow(state: ShowPageState) {
    return (
      <section>
        <h2>Présentation de {state.show.title}</h2>
        <div class="row">
          <div class="col-4">
            {this.renderShowContent(state.show)}
          </div>
          <div class="col-1">
            {this.renderShowCard(state.show)}
            {this.renderCompanyCard(state.company)}
          </div>
        </div>
      </section>
    )
  }<commit_msg>Correct the title of the page<commit_after>import preact from "preact"
import Page from "../../../framework/components/Page"
import StoreListenerComponent from "../../../framework/utils/dom"
import CardCollection from "../../../framework/components/card/CardCollection";
import {RichContent} from "../../../framework/components/RichContent";
import {Card, CardAction, CardContent} from "../../../framework/components/card/Card";
import Loading from "../../../framework/components/Loading";
import messages from "../../../framework/messages";
import {ShowPageState, showPageStore} from "./showPageStore";
import {deletePlay, findCompany, findPlaysByShow, findShow} from "../companyApi";
import * as actions from "./showPageActions";
import {Company, Play, Show} from "../companyModel";
import {PrimaryButton} from "../../../framework/components/buttons";
import {isAfterNow, longDateTimeFormat} from "../../../framework/utils/dates";

export interface ShowPageProps {
  path: string
  company?: string
  id?: string
}

export default class ShowPage extends StoreListenerComponent<ShowPageProps, ShowPageState> {
  constructor() {
    super(showPageStore())
  }

  componentDidMount() {
    super.componentDidMount()
    this.initialize()
  }

  initialize() {
    Promise.all([
      findCompany(this.props.company),
      findShow(this.props.company, this.props.id),
      findPlaysByShow(this.props.company, this.props.id)
    ])
      .then(([company, show, plays]) => actions.initialize({company, show, plays}))
  }

  render(props: ShowPageProps, state: ShowPageState) {
    if (this.mounted) {
      return (
        <Page title={state.show ? state.show.title : ""} role="admin">
          <Loading loading={state.loading} message={messages.production.company.show.page.loading}>
            {!state.loading && this.renderShow(state)}
            {!state.loading && this.renderPlays(state)}
          </Loading>
        </Page>
      )
    } else {
      return null
    }
  }

  renderShow(state: ShowPageState) {
    return (
      <section>
        <h2>Présentation de {state.show.title}</h2>
        <div class="row">
          <div class="col-4">
            {this.renderShowContent(state.show)}
          </div>
          <div class="col-1">
            {this.renderShowCard(state.show)}
            {this.renderCompanyCard(state.company)}
          </div>
        </div>
      </section>
    )
  }
{'fraction_non_alphanumeric': 0.1605991262741835, 'fraction_numerical': 0.0016642396505096733, 'mean_word_length': 2.9025974025974026, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 35, 'https://': 0, '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': '2367871', 'n_tokens_mistral': 1343, 'n_tokens_neox': 1346, 'n_words': 291}