Skip to content

Commit

Permalink
Readd ts to CorpusUpdates
Browse files Browse the repository at this point in the history
This reverts commit 0136589.
  • Loading branch information
arildm committed Oct 23, 2024
1 parent 8491791 commit f0d4b91
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions app/scripts/components/CorpusUpdates.vue
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
<!-- @format -->
<script setup>
<script setup lang="ts">
import { computed, ref } from "vue"
import moment from "moment"
import settings from "@/settings"
import { loc, locObj } from "@/i18n"
import { rootScope } from "@/vue-services"
import { CorpusTransformed } from "@/settings/config-transformed.types"

const LIMIT = 5
const lang = ref(rootScope.lang)
const recentUpdates = ref()
const lang = ref<string>(rootScope.lang)
const recentUpdates = ref<CorpusTransformed[]>([])
const expanded = ref(false)

const recentUpdatesFiltered = computed(() => recentUpdates.value.slice(0, expanded.value ? undefined : LIMIT))

rootScope.$watch("lang", (value) => (lang.value = value))
rootScope.$watch("lang", (value: string) => (lang.value = value))

if (settings.frontpage?.corpus_updates) {
const limitDate = moment().subtract(6, "months")
// Find most recently updated corpora
recentUpdates.value = settings.corpusListing.corpora
.filter((corpus) => corpus.info.Updated && moment(corpus.info.Updated).isSameOrAfter(limitDate))
.sort((a, b) => b.info.Updated.localeCompare(a.info.Updated))
.sort((a, b) => b.info.Updated!.localeCompare(a.info.Updated!))
}
</script>

Expand Down

0 comments on commit f0d4b91

Please sign in to comment.