<commit_before><template lang="pug">
q-card(flat bordered)
  q-card-section.row.no-wrap.items-center(v-if="errorMessage")
    q-icon.q-mr-sm(name="warning" size="24px" color="negative")
    div {{ errorMessage }}
  template(v-else)
    q-tabs.text-grey-7(v-model="currentPackage" align="left" active-color="primary" active-bg-color="blue-1" indicator-color="primary")
      q-tab(v-for="(packageReleases, packageName) in packages" :label="packageName" :name="packageName" :key="packageName")
    q-separator
    q-tab-panels.packages-container(v-model="currentPackage" animated)
      q-tab-panel.q-pa-none(v-for="(packageReleases, packageName) in packages" :key="packageName" :name="packageName")
        package-releases(:latest-version="versions[packageName]" :releases="packageReleases")
</template>

<script>
import { date } from 'quasar'
import PackageReleases from './PackageReleases'

const { extractDate } = date

export default {
  name: 'QuasarReleases',

  components: {
    PackageReleases
  },

  data () {
    return {
      loading: false,
      errorMessage: '',

      packages: {
        quasar: [],
        '@quasar/app': [],
        '@quasar/cli': [],
        '@quasar/extras': []
      },

      currentPackage: 'quasar',
      versions: {}
    }
  },

  mounted () {
    this.queryReleases()
  },

  methods: {
    queryReleases (page = 1) {
      const latestVersions = {}
      this.loading = true

      const self = this,
        xhrQuasar = new XMLHttpRequest()

      xhrQuasar.addEventListener('load', function () {
        const releases = JSON.parse(this.responseText)
        self.errorMessage = null

        if (releases.length === 0) {
          this.loading = false
          return
        }

        let stopQuery = false

        for (const release of releases) {
          if (release.name.indexOf('babel-preset-app') > -1) {
            continue
          }

          const [ packageName, version ] = release.name.split('-v')

          if (!version) {
            stopQuery = true
            continue
          }

          if (self.packages[packageName] === void 0) {
            self.packages[packageName] = []
          }

          const releaseInfo = {
            version,
            date: extractDate(release.created_at, 'YYYY-MM-DD').toLocaleDateString(),
            body: release.body,
            label: `${packageName} v${version}`
          }
          self.packages[packageName].push(releaseInfo)

          if (latestVersions[packageName] === void 0) {
            latestVersions[packageName] = releaseInfo.label
          }
        }

        if (!stopQuery) {
          self.queryReleases(page + 1)
        }

        self.versions = Object.assign(latestVersions, self.versions)
        self.$forceUpdate()
      })

      xhrQuasar.addEventListener('error', () => {
        this.loading = false
        this.errorMessage = 'Cannot connect to GitHub. Please try again later.'
      })

      xhrQuasar.open('GET', `https://api.github.com/repos/quasarframework/quasar/releases?page=${page}&per_page=100`)
      xhrQuasar.send()
    }
  }
}
</script>

<style lang="sass">
.packages-container .q-tab-panel
  padding-right: 0
  padding-top: 0
</style><commit_msg>feat(docs): Further improvements of release notes page #6840<commit_after><template lang="pug">
q-card(flat bordered)
  q-card-section.row.no-wrap.items-center(v-if="error")
    q-icon.q-mr-sm(name="warning" size="24px" color="negative")
    div Cannot connect to GitHub. Please try again later.
  q-card-section.row.no-wrap.items-center(v-else-if="loading")
    q-spinner.q-mr-sm(size="24px" color="primary")
    div Loading release notes from Github...
  template(v-else)
    q-tabs.text-grey-7(v-model="currentPackage" align="left" active-color="primary" active-bg-color="blue-1" indicator-color="primary")
      q-tab(v-for="(packageReleases, packageName) in packages" :label="packageName" :name="packageName" :key="packageName")
    q-separator
    q-tab-panels.packages-container(v-model="currentPackage" animated)
      q-tab-panel.q-pa-none(v-for="(packageReleases, packageName) in packages" :key="packageName" :name="packageName")
        package-releases(:latest-version="versions[packageName]" :releases="packageReleases")
</template>

<script>
import { date } from 'quasar'
import PackageReleases from './PackageReleases'

const { extractDate } = date

export default {
  name: 'QuasarReleases',

  components: {
    PackageReleases
  },

  data () {
    return {
      loading: true,
      error: false,

      packages: {
        quasar: [],
        '@quasar/app': [],
        '@quasar/cli': [],
        '@quasar/extras': []
      },

      currentPackage: 'quasar',
      versions: {}
    }
  },

  mounted () {
    this.queryReleases()
  },

  methods: {
    queryReleases (page = 1) {
      this.loading = true
      this.error = false

      const latestVersions = {}

      const self = this,
        xhrQuasar = new XMLHttpRequest()

      xhrQuasar.addEventListener('load', function () {
        self.loading = false
        const releases = JSON.parse(this.responseText)

        if (releases.length === 0) {
          return
        }

        let stopQuery = false

        for (const release of releases) {
          if (release.name.indexOf('babel-preset-app') > -1) {
            continue
          }

          const [ packageName, version ] = release.name.split('-v')

          if (!version) {
            stopQuery = true
            continue
          }

          if (self.packages[packageName] === void 0) {
            self.packages[packageName] = []
          }

          const releaseInfo = {
            version,
            date: extractDate(release.created_at, 'YYYY-MM-DD').toLocaleDateString(),
            body: release.body,
            label: `${packageName} v${version}`
          }
          self.packages[packageName].push(releaseInfo)

          if (latestVersions[packageName] === void 0) {
            latestVersions[packageName] = releaseInfo.label
          }
        }

        if (!stopQuery) {
          self.queryReleases(page + 1)
        }

        self.versions = Object.assign(latestVersions, self.versions)
        self.$forceUpdate()
      })

      xhrQuasar.addEventListener('error', () => {
        this.error = true
      })

      xhrQuasar.open('GET', `https://api.github.com/repos/quasarframework/quasar/releases?page=${page}&per_page=100`)
      xhrQuasar.send()
    }
  }
}
</script>

<style lang="sass">
.packages-container .q-tab-panel
  padding-right: 0
  padding-top: 0
</style>
{'fraction_non_alphanumeric': 0.14307435000760224, 'fraction_numerical': 0.005473620191576707, 'mean_word_length': 2.387229660144181, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 19, 'https://': 2, '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': '7389152', 'n_tokens_mistral': 2086, 'n_tokens_neox': 2001, 'n_words': 360}