Skip to content
Merged
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
8 changes: 4 additions & 4 deletions apps/content/.vitepress/theme/components/AsideSponsors.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ const containerIsVisible = useElementVisibility(container)

const { sponsors } = useSponsors(containerIsVisible)

const normalSponsors = computed(() => sponsors.value.filter(s => s.rideSidebarSize === 'normal'))
const smallSponsors = computed(() => sponsors.value.filter(s => s.rideSidebarSize === 'small'))
const normalSponsors = computed(() => sponsors.value.filter(s => s.rightSidebarSize === 'normal'))
const smallSponsors = computed(() => sponsors.value.filter(s => s.rightSidebarSize === 'small'))
Comment on lines +11 to +12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using string literals like 'normal' and 'small' for filtering can be error-prone and harder to maintain. Consider defining these values as constants or an enum in composables/sponsors.ts alongside the JSONSponsor interface and importing them here. This improves type safety and makes future changes easier.

</script>

<template>
<div ref="container" class="aside-container">
<a class="aside-sponsors-title" href="https://github.com/sponsors/dinwwwh" target="_blank" rel="noopener">SPONSORS</a>

<div class="aside-sponsors-list">
<a v-for="sponsor in normalSponsors" :key="sponsor.login" class="aside-sponsor" target="_blank" :href="sponsor.rideSidebarLink">
<a v-for="sponsor in normalSponsors" :key="sponsor.login" class="aside-sponsor" target="_blank" :href="sponsor.rightSidebarLink">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The rightSidebarLink property is optional. If it's missing, this <a> tag will not be a functional link. To provide a fallback, consider using the optional link property from the JSONSponsor interface as well.

      <a v-for="sponsor in normalSponsors" :key="sponsor.login" class="aside-sponsor" target="_blank" :href="sponsor.rightSidebarLink || sponsor.link">

<img :src="sponsor.rightSidebarLogo" :alt="sponsor.name">
</a>

Expand All @@ -26,7 +26,7 @@ const smallSponsors = computed(() => sponsors.value.filter(s => s.rideSidebarSiz
</a>

<div class="aside-sponsors-small">
<a v-for="sponsor in smallSponsors" :key="sponsor.login" class="aside-sponsor" target="_blank" :href="sponsor.rideSidebarLink">
<a v-for="sponsor in smallSponsors" :key="sponsor.login" class="aside-sponsor" target="_blank" :href="sponsor.rightSidebarLink">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Similar to the comment above, rightSidebarLink is optional. Consider providing sponsor.link as a fallback to ensure this link is always functional.

        <a v-for="sponsor in smallSponsors" :key="sponsor.login" class="aside-sponsor" target="_blank" :href="sponsor.rightSidebarLink || sponsor.link">

<img :src="sponsor.rightSidebarLogo" :alt="sponsor.name">
</a>
</div>
Expand Down
4 changes: 2 additions & 2 deletions apps/content/.vitepress/theme/composables/sponsors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export interface JSONSponsor {
amount: number
link?: string
org: boolean
rideSidebarSize: 'normal' | 'small' | 'none'
rideSidebarLink?: string
rightSidebarSize: 'normal' | 'small' | 'none'
rightSidebarLink?: string
rightSidebarLogo: string
}

Expand Down
Loading