Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/.storybook/preview-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Roboto+Slab:wght@300;400;600&display=swap"
/>
<script src="https://kit.fontawesome.com/d65f54d9ea.js"></script>

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SPDX-License-Identifier: MIT
<!-- SPDX-License-Identifier: MIT -->
<template>
<nuxt-link
:to="mention.url"
:to="safeMentionUrl"
target="_blank"
rel="noopener noreferrer"
>
Expand All @@ -16,13 +16,13 @@ SPDX-License-Identifier: MIT
<div class="flex flex-col md:gap-5 gap-3">
<slot>
<!-- Header Section -->
<lfx-community-card-header :mention="mention" />
<lfx-community-card-header :mention="props.mention" />

<!-- Content Section -->
<lfx-community-card-content :mention="mention" />
<lfx-community-card-content :mention="props.mention" />

<!-- Relevance Comment Section -->
<lfx-community-card-footer :mention="mention" />
<lfx-community-card-footer :mention="props.mention" />
</slot>
</div>
</lfx-card>
Expand All @@ -31,15 +31,26 @@ SPDX-License-Identifier: MIT

<script setup lang="ts">
// Default card display component for community mentions
import { computed } from 'vue';
import LfxCommunityCardHeader from '../fragments/card-header.vue';
import LfxCommunityCardContent from '../fragments/card-content.vue';
import LfxCommunityCardFooter from '../fragments/card-footer.vue';
import type { CommunityMentions } from '~~/types/community/community';
import LfxCard from '~/components/uikit/card/card.vue';

defineProps<{
const props = defineProps<{
mention: CommunityMentions;
}>();

const safeMentionUrl = computed(() => {
try {
const parsedUrl = new URL(props.mention?.url);

return ['http:', 'https:'].includes(parsedUrl.protocol) ? parsedUrl.toString() : '#';
} catch {
return '#';
}
});
</script>

<script lang="ts">
Expand Down