<commit_before><template>

  <KIcon :icon="icon" />

</template>


<script>

  import { LearningActivities } from 'kolibri.coreVue.vuex.constants';

  const AllActivitiesIcon = 'allActivities';
  const LearningActivityKindToIconMap = {
    [LearningActivities.CREATE]: 'create',
    [LearningActivities.LISTEN]: 'listen',
    [LearningActivities.REFLECT]: 'reflect',
    [LearningActivities.PRACTICE]: 'practice',
    [LearningActivities.READ]: 'read',
    [LearningActivities.WATCH]: 'watch',
    [LearningActivities.EXPLORE]: 'interact',
  };

  /**
   * Displays a corresponding icon for a single learning activity
   * or an icon for more activities if more than one learning
   * activity is provided.
   */
  export default {
    name: 'LearningActivityIcon',
    props: {
      /**
       * Learning activity constant(s)
       * Can be one constant or an array of constants
       */
      kind: {
        type: [String, Array],
        required: true,
        validator(value) {
          const isValidLearningActivity = v => Object.values(LearningActivities).includes(v);

          if (Array.isArray(value) && value.length > 0) {
            return value.every(isValidLearningActivity);
          } else if (typeof value === 'string') {
            return isValidLearningActivity(value);
          } else {
            return false;
          }
        },
      },
      /**
       * Icon is solid by default.
       * Set to `true` to make it shaded.
       */
      shaded: {
        type: Boolean,
        required: false,
        default: false,
      },
    },
    computed: {
      icon() {
        // more activities
        if (Array.isArray(this.kind) && this.kind.length > 1) {
          return AllActivitiesIcon;
        }

        let kind = this.kind;
        // one activity but as an array
        if (Array.isArray(this.kind) && this.kind.length === 1) {
          kind = this.kind[0];
        }

        const icon = LearningActivityKindToIconMap[kind];
        if (this.shaded) {
          return icon + 'Shaded';
        }
        return icon + 'Solid';
      },
    },
  };

</script><commit_msg>Simplify naming<commit_after><template>

  <KIcon :icon="icon" />

</template>


<script>

  import { LearningActivities } from 'kolibri.coreVue.vuex.constants';

  const AllActivitiesIcon = 'allActivities';
  const LearningActivityToIconMap = {
    [LearningActivities.CREATE]: 'create',
    [LearningActivities.LISTEN]: 'listen',
    [LearningActivities.REFLECT]: 'reflect',
    [LearningActivities.PRACTICE]: 'practice',
    [LearningActivities.READ]: 'read',
    [LearningActivities.WATCH]: 'watch',
    [LearningActivities.EXPLORE]: 'interact',
  };

  /**
   * Displays a corresponding icon for a single learning activity
   * or an icon for more activities if more than one learning
   * activity is provided.
   */
  export default {
    name: 'LearningActivityIcon',
    props: {
      /**
       * Learning activity constant(s)
       * Can be one constant or an array of constants
       */
      kind: {
        type: [String, Array],
        required: true,
        validator(value) {
          const isValidLearningActivity = v => Object.values(LearningActivities).includes(v);

          if (Array.isArray(value) && value.length > 0) {
            return value.every(isValidLearningActivity);
          } else if (typeof value === 'string') {
            return isValidLearningActivity(value);
          } else {
            return false;
          }
        },
      },
      /**
       * Icon is solid by default.
       * Set to `true` to make it shaded.
       */
      shaded: {
        type: Boolean,
        required: false,
        default: false,
      },
    },
    computed: {
      icon() {
        // more activities
        if (Array.isArray(this.kind) && this.kind.length > 1) {
          return AllActivitiesIcon;
        }

        let kind = this.kind;
        // one activity but as an array
        if (Array.isArray(this.kind) && this.kind.length === 1) {
          kind = this.kind[0];
        }

        const icon = LearningActivityToIconMap[kind];
        if (this.shaded) {
          return icon + 'Shaded';
        }
        return icon + 'Solid';
      },
    },
  };

</script>
{'fraction_non_alphanumeric': 0.12146892655367232, 'fraction_numerical': 0.0018832391713747645, 'mean_word_length': 2.070086705202312, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 19, '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': '1371732', 'n_tokens_mistral': 1276, 'n_tokens_neox': 1206, 'n_words': 302}