Skip to content

Commit

Permalink
chore: plugins compatibility info
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredotoselli committed Nov 7, 2024
1 parent 5e8838a commit 41345e9
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"animate.css": "^4.1.1",
"apexcharts": "^3.54.1",
"axios": "^1.7.7",
"ccat-api": "github:cheshire-cat-ai/api-client-ts#develop",
"ccat-api": "github:alfredotoselli/cheshire-cat-api-client-ts#plugin-comp-versions",
"daisyui": "^4.12.13",
"highlight.js": "^11.10.0",
"jwt-decode": "^4.0.0",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 31 additions & 9 deletions src/views/PluginsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,21 @@ const queryPlugins = async () => {
filteredList.value = [...new Set([...(list?.installed ?? []), ...(list?.registry ?? [])])]
}
const getCompatibleVersionText = (item: Plugin) => {
const minVersion = item.min_cat_version
const maxVersion = item.max_cat_version
if (minVersion && maxVersion) {
return `v${minVersion} ➡ v${maxVersion}`
} else if (minVersion) {
return `≥ v${minVersion}`
} else if (maxVersion) {
return `≤ v${maxVersion}`
} else {
return null
}
}
watchEffect(() => {
// TODO: Improve filtering rules and code logic
const filters = pluginsFilters.value
Expand Down Expand Up @@ -183,15 +198,22 @@ watchEffect(() => {
</button>
</div>
</div>
<div class="flex h-6 items-center gap-1 text-sm font-medium text-neutral">
<span>by</span>
<a
:href="item.author_url"
target="_blank"
class="link"
:class="{ 'pointer-events-none no-underline': item.author_url === '' }">
{{ item.author_name }}
</a>
<div class="flex items-center justify-between">
<div class="flex h-6 items-center gap-1 text-sm font-medium text-neutral">
<span>by</span>
<a
:href="item.author_url"
target="_blank"
class="link"
:class="{ 'pointer-events-none no-underline': item.author_url === '' }">
{{ item.author_name }}
</a>
</div>
<div v-if="getCompatibleVersionText(item)" class="flex gap-2">
<span class="text-xs opacity-75">
Tested with Cat {{ getCompatibleVersionText(item) }}
</span>
</div>
</div>
<p class="my-2 text-sm" v-html="md.render(item.description)" />
<div class="flex h-8 items-center justify-between gap-4">
Expand Down

0 comments on commit 41345e9

Please sign in to comment.