From dd34853373686916db066e05ca3d45e88edd004d Mon Sep 17 00:00:00 2001 From: arabcoders Date: Mon, 20 Oct 2025 19:28:34 +0300 Subject: [PATCH] add filter for changelog --- ui/app/pages/changelog.vue | 69 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 67 insertions(+), 2 deletions(-) diff --git a/ui/app/pages/changelog.vue b/ui/app/pages/changelog.vue index 63f83ded..daeb1cb4 100644 --- a/ui/app/pages/changelog.vue +++ b/ui/app/pages/changelog.vue @@ -22,6 +22,23 @@ hr { CHANGELOG +
+
+

+ + +

+ +

+ +

+
+
+
This page display the latest changes and updates from the project.
@@ -36,9 +53,9 @@ hr { @@ -82,6 +109,7 @@ import type { changelogs, changeset } from '~/types/changelogs' const toast = useNotification() const config = useConfigStore() +const isMobile = useMediaQuery({ maxWidth: 1024 }) useHead({ title: 'CHANGELOG' }) @@ -94,6 +122,43 @@ const app_version = ref('') const app_branch = ref('') const app_sha = ref('') const isLoading = ref(true) +const query = ref('') +const toggleFilter = ref(false) + +watch(toggleFilter, () => { + if (!toggleFilter.value) { + query.value = '' + } +}) + +const filteredLogs = computed(() => { + const q = query.value?.toLowerCase() + if (!q) return logs.value + + return logs.value + .map(log => { + // Check if tag matches + const tagMatches = log.tag.toLowerCase().includes(q) + + // Filter commits that match the query + const filteredCommits = log.commits?.filter(commit => + commit.message.toLowerCase().includes(q) || + commit.author.toLowerCase().includes(q) || + commit.full_sha.toLowerCase().includes(q) + ) ?? [] + + // Return log only if tag matches OR if there are matching commits + if (tagMatches || filteredCommits.length > 0) { + return { + ...log, + commits: tagMatches ? log.commits : filteredCommits + } + } + + return null + }) + .filter((log): log is changeset => log !== null) +}) const loadContent = async () => { if ('' === app_version.value || logs.value.length > 0) {