<commit_before><template>
  <plant-component>
    <feather-book slot="icon" />
    <h2 slot="title">Notebook</h2>
    <div slot="content">
      <app-modal :show="showNotes" @close-modal="closeNotes">
        <h1 slot="headline">Notebook</h1>
        <div slot="content">
          <textarea
            @change="emitContentChange"
            v-model="textContent">
          </textarea>
        </div>
      </app-modal>

      <div v-if="!content">
        <p>Seems like you haven't added any notes yet.</p>
        <button @click="toggleNotes">Add notes</button>
      </div>
      <div v-else>
        <button @click="toggleNotes">Show notes</button>
      </div>
    </div>
  </plant-component>
</template>

<script>
  import Modal from '@/components/Modal'
  import PlantComponent from './PlantComponent'
  export default {
    name: 'PlantNotes',

    components: {
      'app-modal': Modal,
      'plant-component': PlantComponent,
      'feather-book': () =>
        import('vue-feather-icon/components/book' /* webpackChunkName: "plant" */)
    },

    props: {
      content: {
        type: String,
        default: 'Add your notes here!'
      }
    },

    data () {
      return {
        showNotes: false,
        textContent: this.content
      }
    },

    methods: {
      toggleNotes () {
        this.showNotes = !this.showNotes
      },
      closeNotes () {
        this.showNotes = false
        this.emitContentChange()
      },
      emitContentChange () {
        this.$emit('update-plant', { type: 'notes', payload: this.textContent })
      }
    }
  }
</script>

<style lang="scss" scoped>
  @import "~styles/layout";
  @import "~styles/colors";
  @import "~styles/z-index";

  p {
    color: $text-color-secondary;
    margin-bottom: $base-gap;<commit_msg>:ambulance: (plant) Fixes non-showing notes in modal<commit_after><template>
  <plant-component>
    <feather-book slot="icon" />
    <h2 slot="title">Notebook</h2>
    <div slot="content">
      <app-modal :show="showNotes" @close-modal="closeNotes">
        <h1 slot="headline">Notebook</h1>
        <div slot="content">
          <textarea
            @change="updateContent"
            :value="content">
          </textarea>
        </div>
      </app-modal>

      <div v-if="!content">
        <p>Seems like you haven't added any notes yet.</p>
        <button @click="toggleNotes">Add notes</button>
      </div>
      <div v-else>
        <button @click="toggleNotes">Show notes</button>
      </div>
    </div>
  </plant-component>
</template>

<script>
  import Modal from '@/components/Modal'
  import PlantComponent from './PlantComponent'
  export default {
    name: 'PlantNotes',

    components: {
      'app-modal': Modal,
      'plant-component': PlantComponent,
      'feather-book': () =>
        import('vue-feather-icon/components/book' /* webpackChunkName: "plant" */)
    },

    props: {
      content: {
        type: String,
        default: 'Add your notes here!'
      }
    },

    data () {
      return {
        showNotes: false,
        textContent: this.content
      }
    },

    methods: {
      toggleNotes () {
        this.showNotes = !this.showNotes
      },
      closeNotes () {
        this.showNotes = false
        this.emitContentChange()
      },
      updateContent (event) {
        if (!event.target.value) return
        this.textContent = event.target.value
      },
      emitContentChange () {
        this.$emit('update-plant', { type: 'notes', payload: this.textContent })
      }
    }
  }
</script>

<style lang="scss" scoped>
  @import "~styles/layout";
  @import "~styles/colors";
  @import "~styles/z-index";

  p {
    color: $text-color-secondary;
    margin-bottom: $base-gap;
{'fraction_non_alphanumeric': 0.15617465845164746, 'fraction_numerical': 0.0021430484864720066, 'mean_word_length': 2.175170068027211, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 65, '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': '6526635', 'n_tokens_mistral': 1209, 'n_tokens_neox': 1158, 'n_words': 232}