some fixes

This commit is contained in:
2025-10-31 01:05:57 +01:00
parent 0e1e77c2dd
commit f98145d6db
12 changed files with 136 additions and 98 deletions
+13 -29
View File
@@ -1,19 +1,20 @@
<script setup lang="ts">
import { ref, onMounted, computed } from 'vue'
import PuzzleCard from './components/PuzzleCard.vue'
import SubmissionForm from './components/SubmissionForm.vue'
import AdminPanel from './components/AdminPanel.vue'
import { apiService, errorHelpers } from './services/apiService'
import { usePuzzlesStore } from './stores/puzzles'
import { useSubmissionsStore } from './stores/submissions'
import type { SteamCollection, PuzzleResponse, UserInfo } from './types'
import { ref, onMounted, computed, defineProps } from 'vue'
import PuzzleCard from '@/components/PuzzleCard.vue'
import SubmissionForm from '@/components/SubmissionForm.vue'
import AdminPanel from '@/components/AdminPanel.vue'
import { apiService, errorHelpers } from '@/services/apiService'
import { usePuzzlesStore } from '@/stores/puzzles'
import { useSubmissionsStore } from '@/stores/submissions'
import type { SteamCollection, PuzzleResponse, UserInfo } from '@/types'
const props = defineProps<{collectionTitle: string, collectionUrl: string, collectionDescription: string}>()
// Pinia stores
const puzzlesStore = usePuzzlesStore()
const submissionsStore = useSubmissionsStore()
// Local state
const collections = ref<SteamCollection[]>([])
const userInfo = ref<UserInfo | null>(null)
const isLoading = ref(true)
const error = ref<string>('')
@@ -63,23 +64,6 @@ onMounted(async () => {
await puzzlesStore.loadPuzzles()
console.log('Puzzles loaded:', puzzlesStore.puzzles.length)
// Create mock collection from loaded puzzles for display
if (puzzlesStore.puzzles.length > 0) {
collections.value = [{
id: 1,
steam_id: '3479142989',
title: 'PolyLAN 41',
description: 'Puzzle collection for PolyLAN 41 fil rouge',
author_name: 'Flame Legrems',
total_items: puzzlesStore.puzzles.length,
unique_visitors: 31,
current_favorites: 1,
created_at: new Date().toISOString(),
updated_at: new Date().toISOString()
}]
console.log('Collection created')
}
// Load existing submissions using store
console.log('Loading submissions...')
await submissionsStore.loadSubmissions()
@@ -204,11 +188,11 @@ const reloadPage = () => {
<!-- Main Content -->
<div v-else class="space-y-8">
<!-- Collection Info -->
<div v-if="collections.length > 0" class="mb-8">
<div class="mb-8">
<div class="card bg-base-100 shadow-lg">
<div class="card-body">
<h2 class="card-title text-2xl">{{ collections[0].title }}</h2>
<p class="text-base-content/70">{{ collections[0].description }}</p>
<h2 class="card-title text-2xl">{{ props.collectionTitle }}</h2>
<p class="text-base-content/70">{{ props.collectionDescription }}</p>
<div class="flex flex-wrap gap-4 mt-4">
<button
@click="openSubmissionModal"