link donate externally

This commit is contained in:
Yisroel Baum 2026-06-14 22:24:14 +03:00
parent 195c06417e
commit 46fe32969f
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
3 changed files with 53 additions and 9 deletions

View file

@ -1,12 +1,22 @@
<script setup lang="ts"> <script setup lang="ts">
import { RouterLink } from 'vue-router' import { RouterLink } from 'vue-router'
import { donateLinkAttributes } from '@/content/donateLink'
import { socialLinks, type SocialLinkLabel } from '@/content/socialLinks' import { socialLinks, type SocialLinkLabel } from '@/content/socialLinks'
interface FooterLink { interface RouteFooterLink {
kind: 'route'
label: string label: string
to: string to: string
} }
interface ExternalFooterLink {
kind: 'external'
label: string
linkAttributes: typeof donateLinkAttributes
}
type FooterLink = RouteFooterLink | ExternalFooterLink
const signatureImage = { const signatureImage = {
src: '/assets/signature.png', src: '/assets/signature.png',
alt: "R' Yehoshua Gerzi", alt: "R' Yehoshua Gerzi",
@ -27,12 +37,16 @@ const footerSocialLinks = socialLinks.map((socialLink) => {
const footerLinkColumns: FooterLink[][] = [ const footerLinkColumns: FooterLink[][] = [
[ [
{ label: 'Torah Media', to: '/media' }, { kind: 'route', label: 'Torah Media', to: '/media' },
{ label: 'About', to: '/about' }, { kind: 'route', label: 'About', to: '/about' },
], ],
[ [
{ label: 'Donate', to: '/donate' }, {
{ label: 'Contact', to: '/contact' }, kind: 'external',
label: 'Donate',
linkAttributes: donateLinkAttributes,
},
{ kind: 'route', label: 'Contact', to: '/contact' },
], ],
] ]
</script> </script>
@ -62,10 +76,13 @@ const footerLinkColumns: FooterLink[][] = [
:key="footerLinkColumnIndex" :key="footerLinkColumnIndex"
class="site-footer__link-column" class="site-footer__link-column"
> >
<li v-for="footerLink in footerLinkColumn" :key="footerLink.to"> <li v-for="footerLink in footerLinkColumn" :key="footerLink.label">
<RouterLink :to="footerLink.to"> <RouterLink v-if="footerLink.kind === 'route'" :to="footerLink.to">
{{ footerLink.label }} {{ footerLink.label }}
</RouterLink> </RouterLink>
<a v-else v-bind="footerLink.linkAttributes">
{{ footerLink.label }}
</a>
</li> </li>
</ul> </ul>
</nav> </nav>

View file

@ -1,6 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, onMounted } from 'vue' import { computed, onMounted } from 'vue'
import { RouterLink, useRoute, type RouteLocationRaw } from 'vue-router' import { RouterLink, useRoute, type RouteLocationRaw } from 'vue-router'
import { donateLinkAttributes } from '@/content/donateLink'
import { useAuthStore } from '@/stores/auth' import { useAuthStore } from '@/stores/auth'
interface ContextualNavAction { interface ContextualNavAction {
@ -8,6 +9,15 @@ interface ContextualNavAction {
to: RouteLocationRaw to: RouteLocationRaw
} }
interface HeaderNavItem {
label: string
icon: string
}
interface InternalHeaderNavItem extends HeaderNavItem {
href: string
}
const authStore = useAuthStore() const authStore = useAuthStore()
const route = useRoute() const route = useRoute()
@ -24,13 +34,17 @@ async function handleLogout(): Promise<void> {
await authStore.logout() await authStore.logout()
} }
const navItems = [ const navItems: InternalHeaderNavItem[] = [
{ label: 'Torah Media', href: '/media', icon: '▶' }, { label: 'Torah Media', href: '/media', icon: '▶' },
{ label: 'About', href: '/about', icon: 'ⓘ' }, { label: 'About', href: '/about', icon: 'ⓘ' },
{ label: 'Contact', href: '/contact', icon: '➤' }, { label: 'Contact', href: '/contact', icon: '➤' },
{ label: 'Donate', href: '/donate', icon: '♡' },
] ]
const donateNavItem: HeaderNavItem = {
label: 'Donate',
icon: '♡',
}
const routeElementId = computed(() => { const routeElementId = computed(() => {
const currentRouteElementId = route.params.id const currentRouteElementId = route.params.id
@ -85,6 +99,12 @@ const contextualNavAction = computed<ContextualNavAction | null>(() => {
</span> </span>
<span>{{ item.label }}</span> <span>{{ item.label }}</span>
</RouterLink> </RouterLink>
<a v-bind="donateLinkAttributes" class="site-header__nav-link">
<span class="site-header__nav-icon" aria-hidden="true">
{{ donateNavItem.icon }}
</span>
<span>{{ donateNavItem.label }}</span>
</a>
<RouterLink <RouterLink
v-if="contextualNavAction !== null" v-if="contextualNavAction !== null"
:to="contextualNavAction.to" :to="contextualNavAction.to"

View file

@ -0,0 +1,7 @@
export const donateHref = 'https://causematch.com/pilzno_donate'
export const donateLinkAttributes = {
href: donateHref,
target: '_blank',
rel: 'noopener',
}