feat(projects): migrate haumdaucherde website into monorepo and document in AGENTS.md

This commit is contained in:
Moritz Graf
2026-10-12 10:42:30 +02:00
parent f225d4fe4e
commit 3b190988be
76 changed files with 16748 additions and 0 deletions
@@ -0,0 +1,397 @@
<script setup lang="ts">
import { ref, onMounted, onUnmounted, computed } from 'vue'
const props = defineProps<{
t: (key: string) => string
theme: string
}>()
const emit = defineEmits(['close', 'unlock-nat'])
const canvas = ref<HTMLCanvasElement | null>(null)
const gameState = ref<'start' | 'playing' | 'gameOver' | 'win'>('start')
const score = ref(0)
const level = ref(1)
const TOTAL_LEVELS = 10
let ctx: CanvasRenderingContext2D | null = null
let animationId: number
let playerX = 180
const playerY = 500
const playerWidth = 40
const playerHeight = 40
// Theme-based configurations
const themeConfig = computed(() => {
switch (props.theme) {
case 'unicorn':
return {
bg: '#fff0fb',
player: '🦄',
obstacles: { trash: '🍬', boat: '🍭', boar: '🧁' },
waves: 'rgba(255, 105, 180, 0.3)'
}
case 'luxury':
return {
bg: '#0a0a0a',
player: '👑',
obstacles: { trash: '💎', boat: '💍', boar: '💰' },
waves: 'rgba(212, 175, 55, 0.4)'
}
case 'win95':
return {
bg: '#c0c0c0',
player: '🖱️',
obstacles: { trash: '🗑️', boat: '📁', boar: '💣' },
waves: 'rgba(0,0,0,0.1)'
}
case 'nat':
return {
bg: '#1a2f1a',
player: '🐗',
obstacles: { trash: '🪵', boat: '🛶', boar: '🦢' },
waves: 'rgba(255,255,255,0.1)'
}
default:
return {
bg: '#1e3a8a',
player: '🦢',
obstacles: { trash: '🗑️', boat: '🚤', boar: '🐗' },
waves: 'rgba(255,255,255,0.2)'
}
}
})
interface Obstacle {
x: number
y: number
type: 'trash' | 'boat' | 'boar'
speed: number
}
const obstacles = ref<Obstacle[]>([])
const keys = ref<Record<string, boolean>>({})
// Touch handling
const handleTouchMove = (e: TouchEvent) => {
if (gameState.value !== 'playing') return
const touchX = e.touches[0].clientX
const canvasRect = canvas.value?.getBoundingClientRect()
if (canvasRect) {
playerX = Math.max(0, Math.min(360, (touchX - canvasRect.left) * (400 / canvasRect.width) - (playerWidth / 2)))
}
}
const initGame = () => {
gameState.value = 'playing'
score.value = 0
level.value = 1
obstacles.value = []
playerX = 180
gameLoop()
}
const gameLoop = () => {
if (gameState.value !== 'playing') return
update()
draw()
animationId = requestAnimationFrame(gameLoop)
}
const update = () => {
// Move player (Keyboard)
const speed = 7 // Made slightly faster for easier control
if (keys.value['ArrowLeft'] && playerX > 0) playerX -= speed
if (keys.value['ArrowRight'] && playerX < 360) playerX += speed
// Spawn obstacles - Adjusted frequency for better balance
const spawnChance = 0.01 + level.value * 0.002
if (Math.random() < spawnChance) {
const type = level.value === TOTAL_LEVELS ? 'boar' : (Math.random() > 0.6 ? 'trash' : 'boat')
obstacles.value.push({
x: Math.random() * 370,
y: -50,
type: type,
speed: 1.5 + level.value * 0.45 // Slightly slower for level 1 but scales up
})
}
// Move and filter obstacles
obstacles.value.forEach(obs => {
obs.y += obs.speed
// Collision detection (with a bit of buffer for better feel)
const buffer = 10
if (
playerX + buffer < obs.x + 30 &&
playerX + playerWidth - buffer > obs.x &&
playerY + buffer < obs.y + 30 &&
playerY + playerHeight - buffer > obs.y
) {
gameState.value = 'gameOver'
}
})
obstacles.value = obstacles.value.filter(obs => obs.y < 650)
// Score and level up
score.value += 1
if (score.value % 500 === 0 && level.value < TOTAL_LEVELS) {
level.value += 1
}
// Win condition
if (score.value >= TOTAL_LEVELS * 500 + 500) {
gameState.value = 'win'
emit('unlock-nat')
}
}
const draw = () => {
if (!ctx) return
ctx.clearRect(0, 0, 400, 600)
// Draw Background
ctx.fillStyle = themeConfig.value.bg
ctx.fillRect(0, 0, 400, 600)
// Draw Waves
ctx.strokeStyle = themeConfig.value.waves
ctx.lineWidth = 2
for (let i = 0; i < 5; i++) {
const y = (Date.now() / 20 + i * 120) % 650
ctx.beginPath()
ctx.moveTo(0, y)
ctx.bezierCurveTo(100, y - 10, 300, y + 10, 400, y)
ctx.stroke()
}
// Draw Player
ctx.font = '40px Arial'
ctx.textAlign = 'left'
ctx.textBaseline = 'top'
ctx.fillText(themeConfig.value.player, playerX, playerY)
// Draw Obstacles
obstacles.value.forEach(obs => {
const emoji = themeConfig.value.obstacles[obs.type]
ctx.fillText(emoji, obs.x, obs.y)
})
}
const handleKeydown = (e: KeyboardEvent) => keys.value[e.key] = true
const handleKeyup = (e: KeyboardEvent) => keys.value[e.key] = false
onMounted(() => {
if (canvas.value) {
ctx = canvas.value.getContext('2d')
window.addEventListener('keydown', handleKeydown)
window.addEventListener('keyup', handleKeyup)
}
})
onUnmounted(() => {
cancelAnimationFrame(animationId)
window.removeEventListener('keydown', handleKeydown)
window.removeEventListener('keyup', handleKeyup)
})
</script>
<template>
<div class="game-overlay fancy-glass">
<div class="game-window">
<div class="game-header">
<span>{{ t('game.title') }}</span>
<button @click="emit('close')">X</button>
</div>
<div class="canvas-container">
<canvas
ref="canvas"
width="400"
height="600"
@touchmove.prevent="handleTouchMove"
></canvas>
<div v-if="gameState === 'start'" class="overlay-content">
<h2>{{ t('game.title') }}</h2>
<p>Weich am Schmarrn in da Donau aus!</p>
<p style="font-size: 0.8rem; margin-top: 10px; opacity: 0.8;">Desktop: Pfeile | Mobile: Wischen</p>
<button @click="initGame">{{ t('game.start') }}</button>
</div>
<div v-if="gameState === 'gameOver'" class="overlay-content">
<h2 style="color: #ff4444; margin-bottom: 5px;">{{ t('game.gameOver') }}</h2>
<p>Level: {{ level }} / {{ TOTAL_LEVELS }}</p>
<p>Score: {{ score }}</p>
<button @click="initGame">No amoi!</button>
</div>
<div v-if="gameState === 'win'" class="overlay-content">
<h2 style="color: #44ff44; margin-bottom: 10px;">🏆 {{ t('game.win') }}</h2>
<p>Du hosd an NATinator bsiegt!</p>
<p style="color: #ffd700; font-weight: bold; margin-top: 10px;">🐗 NAT-Modus freigschaltet!</p>
<button @click="emit('close')">Zruck zur Website</button>
</div>
<div v-if="gameState === 'playing'" class="game-stats">
<div class="stats-left">
<span class="level-badge">{{ t('game.level') }} {{ level }}/{{ TOTAL_LEVELS }}</span>
<span v-if="level === TOTAL_LEVELS" class="boar-alert">🐗 BOAR RAIN! 🐗</span>
</div>
<span class="score-display">Score: {{ score }}</span>
</div>
<!-- Progress Bar -->
<div v-if="gameState === 'playing'" class="progress-container">
<div class="progress-bar" :style="{ width: (score / (TOTAL_LEVELS * 500 + 500)) * 100 + '%' }"></div>
</div>
</div>
</div>
</div>
</template>
<style scoped>
.game-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 2000;
display: flex;
align-items: center;
justify-content: center;
background: rgba(0,0,0,0.8);
}
.game-window {
background: #c0c0c0;
border: 3px solid;
border-color: #ffffff #808080 #808080 #ffffff;
padding: 4px;
width: 420px;
}
.game-header {
background: #000080;
color: white;
padding: 4px 8px;
display: flex;
justify-content: space-between;
align-items: center;
font-weight: bold;
margin-bottom: 4px;
}
.game-header button {
background: #c0c0c0;
border: 2px solid;
border-color: #ffffff #808080 #808080 #ffffff;
padding: 0 6px;
cursor: pointer;
color: black;
}
.canvas-container {
position: relative;
border: 2px solid #000;
}
canvas {
display: block;
background: #1e3a8a;
}
.overlay-content {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.7);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: white;
text-align: center;
padding: 20px;
}
.overlay-content h2 { margin-bottom: 20px; }
.overlay-content button {
background: #c0c0c0;
border: 3px solid;
border-color: #ffffff #808080 #808080 #ffffff;
padding: 10px 20px;
font-weight: bold;
cursor: pointer;
margin-top: 20px;
}
.game-stats {
position: absolute;
top: 10px;
left: 10px;
right: 10px;
display: flex;
justify-content: space-between;
align-items: center;
color: white;
font-weight: bold;
background: rgba(0,0,0,0.6);
padding: 8px 12px;
pointer-events: none;
font-size: 0.9rem;
}
.stats-left {
display: flex;
flex-direction: column;
gap: 4px;
}
.level-badge {
color: #fbbf24;
}
.boar-alert {
color: #ff4444;
font-size: 0.7rem;
animation: blink 0.5s infinite;
}
@keyframes blink {
50% { opacity: 0; }
}
.progress-container {
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 4px;
background: rgba(0,0,0,0.3);
}
.progress-bar {
height: 100%;
background: #4ade80;
transition: width 0.3s;
}
@media (max-width: 450px) {
.game-window {
width: 95vw;
}
.canvas-container {
width: 100%;
}
canvas {
width: 100%;
height: auto;
}
}
</style>
@@ -0,0 +1,338 @@
<script setup lang="ts">
import { useAuth } from '../../composables/useAuth'
import { watch, ref } from 'vue'
const props = defineProps<{
currentTheme: string
isNatUnlocked: boolean
t: (key: string) => string
}>()
const emit = defineEmits(['update:theme', 'open:game'])
const themes = ['classic', 'dark', 'nat']
const { user, login, logout, error } = useAuth()
const showSettings = ref(false)
watch(user, (u) => {
console.log("👤 Header: User changed:", u ? u.email : "null")
})
</script>
<template>
<header class="fancy-glass header-top">
<div class="container top-content">
<!-- Logo & Status Area -->
<div class="branding-area">
<div class="logo-text">HAUMDAUCHER</div>
<div v-if="user" class="status-message">
<span class="desktop-msg">{{ isNatUnlocked ? 'Du bist a Haumdaucher 🫵 🍻' : 'Vielleicht... bist du a Haumdaucher' }}</span>
<span class="mobile-msg">{{ isNatUnlocked ? 'Haumdaucher! 🫵' : 'Vielleicht... 🤔' }}</span>
</div>
</div>
<div class="controls">
<!-- Mobile Settings Toggle -->
<button class="settings-toggle" @click="showSettings = !showSettings">
⚙️
</button>
<!-- Auth Control (Always Visible) -->
<div class="auth-control">
<div v-if="error" class="auth-error" :title="error">⚠️</div>
<button v-if="!user" @click="login" class="login-btn">
Login
</button>
<div v-else class="user-menu">
<button @click="logout" class="logout-btn">Exit</button>
<img :src="user.photoURL || ''" class="avatar" :title="user.displayName || ''" />
</div>
</div>
<!-- Theme switch -->
<div class="control-wrapper" :class="{ 'show-mobile': showSettings }">
<div class="switch-group">
<template v-for="th in themes">
<button
v-if="th !== 'nat' || isNatUnlocked"
:key="th"
:class="{ active: currentTheme === th }"
@click="emit('update:theme', th)"
class="theme-btn"
:title="t('themes.' + th)"
>
<span v-if="th === 'classic'">☀️</span>
<span v-if="th === 'dark'">🌙</span>
<span v-if="th === 'nat'">🐗</span>
</button>
</template>
</div>
</div>
</div>
</div>
</header>
<!-- Mobile Bottom Nav -->
<nav class="fancy-glass mobile-nav">
<a href="#home" class="nav-item">🏠<span>{{ t('nav.home') }}</span></a>
<a href="#spirit" class="nav-item">✨<span>{{ t('nav.spirit') }}</span></a>
<button class="nav-item game-btn" @click="emit('open:game')">🕹️<span>{{ t('nav.game') }}</span></button>
<a href="#impressum" class="nav-item">⚖️<span>Impressum</span></a>
</nav>
<!-- Desktop Side Nav / Links -->
<nav class="desktop-links">
<div class="container">
<a href="#spirit">{{ t('nav.spirit') }}</a>
<a href="#impressum">Impressum</a>
<a href="#datenschutz">Datenschutz</a>
<button class="game-nav-btn" @click="emit('open:game')">{{ t('nav.game') }}</button>
</div>
</nav>
</template>
<style scoped>
.header-top {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 1000;
padding: 10px 0;
}
.top-content {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 10px;
}
.logo-text {
font-weight: 900;
letter-spacing: 1px;
font-size: 0.9rem;
white-space: nowrap;
}
/* Base Layout */
.branding-area {
display: flex;
align-items: center;
}
.controls {
display: flex;
align-items: center;
justify-content: flex-end;
flex: 1;
}
.control-wrapper {
display: flex;
gap: 8px;
align-items: center;
}
.status-message {
font-size: 0.8rem;
font-weight: bold;
margin-left: 15px;
color: #555;
white-space: nowrap;
}
.mobile-msg { display: none; }
.settings-toggle { display: none; } /* Hidden on desktop */
/* Mobile adjustments */
@media (max-width: 480px) {
.branding-area {
flex-direction: column;
align-items: flex-start;
}
.status-message {
margin-left: 0;
margin-top: 2px;
}
.desktop-msg { display: none; }
.mobile-msg { display: inline; }
/* Settings Toggle Logic */
.control-wrapper {
display: none; /* Hidden by default on mobile */
position: absolute;
top: 60px;
right: 10px;
background: var(--header-bg);
padding: 10px;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
flex-direction: column;
align-items: flex-end;
border: 1px solid var(--glass-border);
backdrop-filter: blur(10px);
}
.control-wrapper.show-mobile {
display: flex;
}
.settings-toggle {
display: block;
font-size: 1.2rem;
padding: 5px;
margin-left: 5px;
}
}
.switch-group {
display: flex;
background: rgba(0,0,0,0.05);
padding: 2px;
border-radius: 8px;
}
button {
background: none;
border: none;
padding: 4px 8px;
border-radius: 6px;
cursor: pointer;
font-weight: bold;
font-size: 0.7rem;
color: inherit;
opacity: 0.5;
transition: all 0.2s;
}
button.active {
background: var(--primary-color);
color: #fff;
opacity: 1;
}
/* Mobile Nav Styles */
.mobile-nav {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 65px;
z-index: 1000;
display: flex;
justify-content: space-around;
align-items: center;
padding-bottom: var(--safe-area-bottom);
border-radius: 20px 20px 0 0;
}
.nav-item {
text-decoration: none;
color: inherit;
font-size: 1.2rem;
display: flex;
flex-direction: column;
align-items: center;
gap: 2px;
background: none;
border: none;
}
.nav-item span {
font-size: 0.6rem;
font-weight: 500;
opacity: 0.7;
}
.desktop-links {
display: none;
}
/* Desktop Overrides */
@media (min-width: 768px) {
.logo-text { font-size: 1.2rem; }
.mobile-nav { display: none; }
.desktop-links {
display: block;
position: fixed;
top: 60px;
left: 0;
right: 0;
z-index: 999;
background: transparent;
padding: 10px 0;
text-align: center;
}
.desktop-links div {
display: flex;
justify-content: center;
gap: 30px;
align-items: center;
}
.desktop-links a {
text-decoration: none;
color: inherit;
font-weight: 500;
opacity: 0.8;
}
.desktop-links a:hover { opacity: 1; }
}
.game-nav-btn {
background: var(--primary-color);
color: white;
border: none;
padding: 8px 16px;
border-radius: 20px;
cursor: pointer;
font-weight: bold;
transition: transform 0.2s;
}
.auth-control {
margin-right: 15px;
display: flex;
align-items: center;
}
.login-btn {
background: rgba(255, 255, 255, 0.2);
color: inherit;
font-weight: bold;
padding: 6px 12px;
border-radius: 20px;
border: 1px solid rgba(255,255,255,0.1);
}
.user-menu {
display: flex;
align-items: center;
gap: 8px;
}
.avatar {
width: 28px;
height: 28px;
border-radius: 50%;
border: 2px solid var(--primary-color);
}
.logout-btn {
font-size: 0.7rem;
opacity: 0.7;
}
.auth-error {
color: #ff4444;
margin-right: 8px;
cursor: help;
font-size: 1.2rem;
}
</style>