Fix favicon and add authentication state to main page with logout/create sermon buttons

This commit is contained in:
2025-10-01 22:25:35 -04:00
parent 22f7c6f8ad
commit 71e39cceb1
4 changed files with 33 additions and 7 deletions

BIN
logos/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -16,7 +16,7 @@ export default defineNuxtConfig({
{ name: 'description', content: 'Weekly sermons from New Life Christian Church' } { name: 'description', content: 'Weekly sermons from New Life Christian Church' }
], ],
link: [ link: [
{ rel: 'icon', type: 'image/png', href: '/logos/favicon.png' }, { rel: 'icon', type: 'image/x-icon', href: '/logos/favicon.ico' },
{ rel: 'preconnect', href: 'https://fonts.googleapis.com' }, { rel: 'preconnect', href: 'https://fonts.googleapis.com' },
{ rel: 'preconnect', href: 'https://fonts.gstatic.com', crossorigin: '' }, { rel: 'preconnect', href: 'https://fonts.gstatic.com', crossorigin: '' },
{ rel: 'stylesheet', href: 'https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap' } { rel: 'stylesheet', href: 'https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap' }

View File

@@ -7,13 +7,30 @@
<div class="flex items-center space-x-4"> <div class="flex items-center space-x-4">
<img src="/logos/logo.png" alt="New Life Christian Church" class="h-16 w-auto" /> <img src="/logos/logo.png" alt="New Life Christian Church" class="h-16 w-auto" />
</div> </div>
<div class="flex items-center gap-4">
<template v-if="isAuthenticated">
<NuxtLink <NuxtLink
to="/admin"
class="px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 font-medium text-sm"
>
Create New Sermon
</NuxtLink>
<button
@click="handleLogout"
class="text-sm font-medium text-red-600 hover:text-red-700"
>
Logout
</button>
</template>
<NuxtLink
v-else
to="/login" to="/login"
class="text-sm font-medium text-blue-600 hover:text-blue-700" class="text-sm font-medium text-blue-600 hover:text-blue-700"
> >
Admin Login Admin Login
</NuxtLink> </NuxtLink>
</div> </div>
</div>
<div class="text-center mt-6"> <div class="text-center mt-6">
<h1 class="text-3xl font-bold text-gray-900"> <h1 class="text-3xl font-bold text-gray-900">
Welcome to New Life! Please choose the sermon you'd like to see. Welcome to New Life! Please choose the sermon you'd like to see.
@@ -73,6 +90,10 @@
<script setup lang="ts"> <script setup lang="ts">
const showOlder = ref(false) const showOlder = ref(false)
// Check authentication status
const { data: authData } = await useFetch('/api/auth/verify')
const isAuthenticated = computed(() => authData.value?.authenticated || false)
// Fetch all sermons // Fetch all sermons
const { data: allSermons } = await useFetch('/api/sermons') const { data: allSermons } = await useFetch('/api/sermons')
@@ -96,4 +117,9 @@ const olderSermons = computed(() => {
return sermonDate < threeMonthsAgo return sermonDate < threeMonthsAgo
}) })
}) })
async function handleLogout() {
await $fetch('/api/auth/logout', { method: 'POST' })
await navigateTo('/login')
}
</script> </script>