<commit_before>import { Window } from 'inferno';
import { useBackend } from '../backend';
import { Button, LabeledList, Section, Tabs, Input } from '../components';


export const ClockworkSlab = props => {
  const { act, data } = useBackend(props);
  const {
    recollection,
    rec_text,
    recollection_categories,
    rec_section,
    rec_binds,
  } = data;

  return (
    <Window
      theme="clockwork"
      resizable>
      <Section>
        <Button
          content={recollection ? "Recital" : "Recollection"}
          onClick={() => act('toggle')}
        />
      </Section>
      {!!recollection && (
        <Section title="Recollection">
          {rec_text}
          {recollection_categories.map(categories => {
            return (
              <Window key={rec_section} >
                <br />
                <Button
                  content={`${categories.name} - ${categories.desc}`}
                  onClick={() => act('rec_category', {
                    "category": categories.name,
                  })} />
              </Window>
            );
          })}
          {rec_section}
          {rec_binds}
        </Section>
      )}
      {recollection && (
        <Window>
          <Section title="Power">
            {data.power}
          </Section>
          <Section title="Recital">
            {data.tier_info}
            {data.scripturecolors}
            <Tabs>
              <Tabs.Tab
                key="driver"
                label="Driver">
                {() => (
                  <Section>
                    <LabeledList>
                      {data.scripture.driver.map(script => {
                        return (
                          <LabeledList.Item
                            key={script.name}
                            label={script.name}
                            buttons={(
                              <Window>
                                <Button
                                  content={`Recite (${script.required} W)`}
                                  onClick={() => act('recite', {
                                    'category': script.name,
                                  })} />
                                <Button
                                  content={script.quickbind
                                    ? `Unbind ${script.quickbind}`
                                    : 'Quickbind'}
                                  onClick={() => act('bind', {
                                    'category': script.name,
                                  })} />
                              </Window>
                            )}>
                            {`${script.descname} ${script.invokers}`}
                          </LabeledList.Item>
                        );
                      })}
                    </LabeledList>
                  </Section>
                )}
              </Tabs.Tab>
              <Tabs.Tab
                key="script"
                label="Script">
                {() => (
                  <Section>
                    <LabeledList>
                      {data.scripture.script.map(script => {
                        return (
                          <LabeledList.Item
                            key={script.name}
                            label={script.name}
                            buttons={(
                              <Window>
                                <Button
                                  content={`Recite (${script.required} W)`}
                                  onClick={() => act('recite', {
                                    'category': script.name,
                                  })} />
                                <Button
                                  content={script.quickbind
                                    ? `Unbind ${script.quickbind}`
                                    : 'Quickbind'}
                                  onClick={() => act('bind', {
                                    'category': script.name,
                                  })} />
                              </Window>
                            )}>
                            {`${script.descname} ${script.invokers}`}
                          </LabeledList.Item>
                        );
                      })}
                    </LabeledList>
                  </Section>
                )}
              </Tabs.Tab>
              <Tabs.Tab
                key="application"
                label="Application">
                {() => (
                  <Section>
                    <LabeledList>
                      {data.scripture.application.map(script => {
                        return (
                          <LabeledList.Item
                            key={script.name}
                            label={script.name}
                            buttons={(
                              <Window>
                                <Button
                                  content={`Recite (${script.required} W)`}
                                  onClick={() => act('recite', {
                                    'category': script.name,
                                  })} />
                                <Button
                                  content={script.quickbind
                                    ? `Unbind ${script.quickbind}`
                                    : 'Quickbind'}
                                  onClick={() => act('bind', {
                                    'category': script.name,
                                  })} />
                              </Window>
                            )}>
                            {`${script.descname} ${script.invokers}`}
                          </LabeledList.Item>
                        );
                      })}
                    </LabeledList>
                  </Section>
                )}
              </Tabs.Tab>
            </Tabs>
          </Section>
        </Window>
      )}<commit_msg>Updates clockworkslab<commit_after>import { useBackend } from '../backend';
import { round } from 'common/math';
import { map } from 'common/collections';
import { Section, Tabs, LabeledList, Button } from '../components';
import { Fragment } from 'inferno';
import { Window } from '../layouts';

export const ClockworkSlab = (props, context) => {
  const { act, data } = useBackend(context);
  const {
    recollection = true,
    recollection_categories = [],
    scripture = null,
    power = 0,
  } = data;
  return (
    <Window>
      <Window.Content>
        <Fragment theme="clockwork">
          <Section>
            <Button
              content={recollection
                ? "Recital"
                : "Recollection"}
              onClick={() => act('toggle')}
            />
          </Section>
          {recollection ? ( // tutorial
            <Section title="Recollection">
              {data.rec_text}
              {recollection_categories.map(cat => {
                return (
                  <Fragment key={cat.name} >
                    <br />
                    <Button
                      content={`${cat.name} - ${cat.desc}`}
                      onClick={() => act('rec_category', {
                        "category": cat.name,
                      })} />
                  </Fragment>
                );
              })}
              {data.rec_section}
              {data.rec_binds}
            </Section>
          ) : (
            <Fragment>
              <Section title="Power">
                <b>
                  {power <= 1000 ? (
                    `${power} W`
                  ) : (
                    `${round(power/1000, 2)} kW`
                  )}
                </b>
              </Section>
              <Section title="Recital">
                {data.tier_info}
                {data.scripturecolors}
                <Tabs>
                  {map((cat_contents, category) => {
                    const contents = cat_contents || [];
                    return (
                      <Tabs.Tab
                        key={category}
                        label={category}>
                        <Section>
                          <LabeledList>
                            {contents.map(script => {
                              return (
                                <LabeledList.Item
                                  key={script.name}
                                  label={script.name}
                                  buttons={(
                                    <Fragment>
                                      <Button
                                        content={`Recite
                                        (${script.required} W)`}
                                        disabled={script.required < power}
                                        onClick={() => act('recite', {
                                          'script': script.name,
                                        })} />
                                      <Button
                                        content={script.quickbind ? (
                                          `Unbind ${script.quickbind}`
                                        ) : (
                                          'Quickbind'
                                        )}
                                        onClick={() => act('bind', {
                                          'script': script.name,
                                        })} />
                                    </Fragment>
                                  )}>
                                  {`${script.descname} ${script.invokers}`}
                                </LabeledList.Item>
                              );
                            })}
                          </LabeledList>
                        </Section>
                      </Tabs.Tab>
                    );
                  })(scripture)}
                </Tabs>
              </Section>
            </Fragment>
          )}
        </Fragment>
      </Window.Content>
{'fraction_non_alphanumeric': 0.10903674280039721, 'fraction_numerical': 0.0009930486593843098, 'mean_word_length': 0.6762649800266312, 'pattern_counts': {'":': 2, '<': 95, '<?xml version=': 0, '>': 117, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 57, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4255841', 'n_tokens_mistral': 2195, 'n_tokens_neox': 2060, 'n_words': 333}