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: 2 additions & 0 deletions app/layouts/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ html, body { margin: 0; padding: 0; height: 100%; }
.rh-sidebar-footer { padding:24px; }
.rh-back-link { font-size:14px; color:#94a3b8; font-weight:500; text-decoration:none; }
.rh-back-link:hover { color:#64748b; }
.rh-logout-link { display:block; margin-top:12px; font-size:14px; color:#94a3b8; font-weight:500; background:none; border:none; padding:0; cursor:pointer; font-family:inherit; }
.rh-logout-link:hover { color:#ef4444; }

/* ── Main ── */
.rh-main { flex:1; overflow-y:auto; padding:24px 32px; }
Expand Down
15 changes: 15 additions & 0 deletions app/layouts/admin.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
<!-- layouts/admin.vue -->
<script setup lang="ts">
import { authClient } from '~/utils/auth-client'

const route = useRoute()

async function logout() {
const confirmed = confirm('Are you sure you want to log out?')
if (!confirmed) return

try {
await authClient.signOut()
window.location.href = '/auth'
} catch (error) {
console.error('Logout failed:', error)
}
}
</script>

<template>
Expand All @@ -27,6 +41,7 @@ const route = useRoute()

<div class="rh-sidebar-footer">
<NuxtLink to="/" class="rh-back-link">← Back to Portal</NuxtLink>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

new addition makes this redundant, remove it

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

^^new addition being logout button

<button class="rh-logout-link" @click="logout">⎋ Logout</button>
</div>
</aside>

Expand Down
9 changes: 5 additions & 4 deletions app/pages/reader/forms.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ const isCurrentComponentCorrect = computed(() => {
if (q.questionType !== 'mcq') return true
const options = q.questionOptions as any
if (!options || !options.choices) return true
const choice = options.choices.find((c: any) => c.text === answers.value[q.id])
const choiceIndex = Number(answers.value[q.id])
const choice = options.choices[choiceIndex]
return choice ? choice.correct : false
})

Expand Down Expand Up @@ -396,14 +397,14 @@ function getBadgeClass(type: string) {
<div v-else-if="currentComponent.questionType === 'mcq'" class="space-y-3">
<button
v-for="(choice, ci) in (currentComponent.questionOptions as any)?.choices" :key="ci"
@click="answers[currentComponent.id] = (choice as any).text"
@click="answers[currentComponent.id] = String(ci)"
class="w-full text-left p-5 rounded-2xl font-bold text-lg border-2 transition-all"
:style="answers[currentComponent.id] === (choice as any).text
:style="answers[currentComponent.id] === String(ci)
? 'border-color:var(--brand-indigo); background:rgba(224,96,77,0.1); color:var(--brand-indigo); transform:scale(1.02)'
: 'border-color:#f1f5f9; background:white; color:#374151'"
>
<span class="inline-flex items-center justify-center w-8 h-8 rounded-full mr-3 text-sm font-black"
:style="answers[currentComponent.id] === (choice as any).text
:style="answers[currentComponent.id] === String(ci)
? 'background:var(--brand-indigo); color:white'
: 'background:#f1f5f9; color:#6b7280'"
>{{ String.fromCharCode(65 + Number(ci)) }}</span>
Expand Down