Skip to content

A self-hosted media server and file management system

fix: app manifest card doesnt let user copy text and always navigates to github

aminnausin0d65e1ffb533
diff --git a/resources/js/components/cards/data/AppManifestCard.vue b/resources/js/components/cards/data/AppManifestCard.vue
index 89709092..418df4f0 100644
--- a/resources/js/components/cards/data/AppManifestCard.vue
+++ b/resources/js/components/cards/data/AppManifestCard.vue
@@ -1,23 +1,45 @@
<script setup lang="ts">
import { useAppStore } from '@/stores/AppStore';
import { storeToRefs } from 'pinia';
+import { toast } from '@aminnausin/cedar-ui';
import DashboardSidebarCard from '@/components/cards/sidebar/DashboardSidebarCard.vue';
import ProiconsGithub from '~icons/proicons/github';
const { appManifest } = storeToRefs(useAppStore());
+
+const copyToClipboard = async () => {
+ const version = appManifest.value.version;
+ if (!version) {
+ toast.error('Error', { description: 'This version is a placeholder.' });
+ return;
+ }
+ try {
+ await navigator.clipboard.writeText(version);
+ toast.success('Success', { description: `Copied version ${version}` });
+ } catch (error) {
+ toast.error('Error', { description: `Unable to copy version ${version}` });
+ console.error(error);
+ }
+};
</script>
<template>
- <DashboardSidebarCard target="_blank" :href="`${appManifest?.commit ? `https://github.com/aminnausin/mediaServer/commit/${appManifest.commit}` : ''}`" :disabled="false">
+ <DashboardSidebarCard class="pointer-default">
<template #header>
- <h3 :title="'Source Code'" class="truncate">MediaServer</h3>
- <ProiconsGithub class="ml-auto size-5 shrink-0" />
+ <a title="GitHub" class="hover:text-primary dark:hover:text-primary-muted contents" href="https://github.com/aminnausin/mediaServer/" target="_blank">
+ <h3 :title="'Source Code'" class="truncate">MediaServer</h3>
+ <ProiconsGithub class="ml-auto size-5 shrink-0" />
+ </a>
</template>
<template #body>
- <h4 title="App Version" class="w-full flex-1 text-nowrap sm:truncate">V{{ appManifest.version ?? '0.1.15b' }}</h4>
- <h4 v-if="appManifest.commit" title="Latest Commit" class="w-fit truncate text-nowrap">#{{ appManifest.commit }}</h4>
+ <h4 title="App Version - Click to copy" class="hover:text-primary dark:hover:text-primary-muted w-full flex-1 text-nowrap sm:truncate" @click.prevent="copyToClipboard">
+ V{{ appManifest.version ?? '0.1.15b' }}
+ </h4>
+ <a v-if="appManifest.commit" target="_blank" :href="`https://github.com/aminnausin/mediaServer/commit/${appManifest.commit}`">
+ <h4 title="Latest Commit" class="hover:text-primary dark:hover:text-primary-muted w-fit truncate text-nowrap">#{{ appManifest.commit }}</h4>
+ </a>
</template>
</DashboardSidebarCard>
</template>
diff --git a/resources/js/components/cards/sidebar/SidebarCard.vue b/resources/js/components/cards/sidebar/SidebarCard.vue
index 914afae1..2b7744ef 100644
--- a/resources/js/components/cards/sidebar/SidebarCard.vue
+++ b/resources/js/components/cards/sidebar/SidebarCard.vue
@@ -12,7 +12,7 @@ const props = defineProps<{
}>();
const wrapper = computed(() => {
- if (props.disabled) return 'div';
+ if (props.disabled || (!props.to && !props.href)) return 'div';
return props.to ? RouterLink : 'a';
});