Skip to content

Commit

Permalink
Merge branch 'SciSharp:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
visagang authored Jan 18, 2024
2 parents a49d946 + f4973ab commit 11e7693
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
13 changes: 13 additions & 0 deletions src/routes/page/plugin/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,26 @@
import Plugins from './plugin-list.svelte';
import { onMount } from 'svelte';
import { getPlugins } from '$lib/services/plugin-service';
import { PUBLIC_PLUGIN_DEFAULT_ICON } from '$env/static/public';
/** @type {import('$types').PluginDefModel[]} */
let plugins = [];
onMount(async () => {
plugins = await getPlugins();
plugins.forEach(element => {
element.icon_url = getIconUrl(element);
});
});
/** @param {import('$types').PluginDefModel} plugin */
function getIconUrl(plugin) {
if (plugin.is_core) {
return '/images/logo.png';
} else {
return plugin.icon_url ? plugin.icon_url : PUBLIC_PLUGIN_DEFAULT_ICON;
}
}
</script>

<HeadTitle title="Plugins Grid" />
Expand Down
3 changes: 1 addition & 2 deletions src/routes/page/plugin/plugin-list.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
} from '@sveltestrap/sveltestrap';
import { enablePlugin, disablePlugin } from '$lib/services/plugin-service';
import { goto } from '$app/navigation';
import { PUBLIC_PLUGIN_DEFAULT_ICON } from '$env/static/public';
/** @type {import('$types').PluginDefModel[]} */
export let plugins;
Expand Down Expand Up @@ -43,7 +42,7 @@
<div class="favorite-icon">
<Link href="#"><i class="uil uil-heart-alt fs-18" /></Link>
</div>
<img src={item.icon_url ? item.icon_url : PUBLIC_PLUGIN_DEFAULT_ICON} alt="{item.name}" height="35" class="mb-3" />
<img src={item.icon_url} alt="{item.name}" height="35" class="mb-3" />
<h5 class="fs-17 mb-2">
<Link href="#" class="text-dark">{item.name}</Link>
<small class="text-muted fw-normal">plugin</small>
Expand Down

0 comments on commit 11e7693

Please sign in to comment.