mirror of
https://github.com/bitbaum/evig.git
synced 2026-12-04 22:27:12 +01:00
chore: clean feedback system, fix typing focus, wire contact form to suggestions API, email both addresses; remove legacy components and .bak pages; promote refactored pages for services and revamp-ux
This commit is contained in:
1 parent
40a7f6e5b3
commit
2daebf0f07
7 files changed
+308
-2045
No files matched your search
@@ -218,7 +218,10 @@ Copy the above prompt and use it with your AI development agent.`
|
||||
|
||||
const mailOptions = {
|
||||
from: process.env.EMAIL_FROM || 'noreply@revamp-it.ch',
|
||||
to: 'georgy.butaev@revamp-it.ch',
|
||||
to: [
|
||||
'georgy.butaev@revamp-it.ch',
|
||||
'butaeff@gmail.com'
|
||||
],
|
||||
subject: `📝 RevampIT Verbesserungsvorschlag - ${suggestion.pageTitle || suggestion.page}`,
|
||||
html: emailHtml,
|
||||
text: `
|
||||
@@ -265,7 +268,7 @@ TECHNISCHE DETAILS:
|
||||
console.log(`Kontakt: ${suggestion.contact || 'Anonym'}`)
|
||||
console.log(`IP: ${suggestion.ip}`)
|
||||
console.log(`Vorschlag: ${suggestion.suggestion}`)
|
||||
console.log(`E-Mail an: georgy.butaev@revamp-it.ch`)
|
||||
console.log(`E-Mail an: georgy.butaev@revamp-it.ch, butaeff@gmail.com`)
|
||||
console.log('===============================')
|
||||
|
||||
// Send email
|
||||
@@ -352,4 +355,4 @@ export async function POST(request: NextRequest) {
|
||||
{ status: 500 }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
'use client'
|
||||
|
||||
import { useState } from 'react'
|
||||
import { Mail, MessageSquare, Send, User } from 'lucide-react'
|
||||
|
||||
export default function ContactForm() {
|
||||
const [name, setName] = useState('')
|
||||
const [email, setEmail] = useState('')
|
||||
const [subject, setSubject] = useState('')
|
||||
const [message, setMessage] = useState('')
|
||||
const [status, setStatus] = useState<'idle' | 'submitting' | 'success' | 'error'>('idle')
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
|
||||
const handleSubmit = async (e: React.FormEvent) => {
|
||||
e.preventDefault()
|
||||
if (!message.trim()) return
|
||||
setStatus('submitting')
|
||||
setError(null)
|
||||
try {
|
||||
const payload = {
|
||||
suggestion: subject.trim() ? `${subject.trim()}\n\n${message.trim()}` : message.trim(),
|
||||
contact: [name.trim(), email.trim()].filter(Boolean).join(' | '),
|
||||
page: '/contact',
|
||||
url: typeof window !== 'undefined' ? window.location.href : 'https://revamp-it.ch/contact',
|
||||
pageTitle: 'Contact',
|
||||
pageSection: 'Contact',
|
||||
feedbackScope: 'page',
|
||||
selectedElements: [],
|
||||
timestamp: new Date().toISOString()
|
||||
}
|
||||
const res = await fetch('/api/suggestions', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(payload)
|
||||
})
|
||||
if (!res.ok) {
|
||||
const data = await res.json().catch(() => ({}))
|
||||
throw new Error(data.error || `Submit failed (${res.status})`)
|
||||
}
|
||||
setStatus('success')
|
||||
setName('')
|
||||
setEmail('')
|
||||
setSubject('')
|
||||
setMessage('')
|
||||
} catch (err: any) {
|
||||
setStatus('error')
|
||||
setError(err?.message || 'Fehler beim Senden. Bitte später erneut versuchen.')
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="bg-white rounded-xl shadow-lg p-8">
|
||||
<h2 className="text-3xl font-bold mb-6 text-center">Senden Sie uns eine Nachricht</h2>
|
||||
{status === 'success' && (
|
||||
<div className="mb-6 rounded-lg border border-green-200 bg-green-50 px-4 py-3 text-green-800 text-sm">
|
||||
Vielen Dank! Ihre Nachricht wurde gesendet.
|
||||
</div>
|
||||
)}
|
||||
{status === 'error' && (
|
||||
<div className="mb-6 rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-red-700 text-sm">
|
||||
{error}
|
||||
</div>
|
||||
)}
|
||||
<form className="space-y-6" onSubmit={handleSubmit}>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<div>
|
||||
<label htmlFor="name" className="block text-sm font-medium text-gray-700 mb-2">
|
||||
Name
|
||||
</label>
|
||||
<div className="relative">
|
||||
<div className="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
||||
<User className="h-5 w-5 text-gray-400" />
|
||||
</div>
|
||||
<input
|
||||
type="text"
|
||||
id="name"
|
||||
name="name"
|
||||
value={name}
|
||||
onChange={(e) => setName(e.target.value)}
|
||||
className="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500"
|
||||
placeholder="Ihr Name"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label htmlFor="email" className="block text-sm font-medium text-gray-700 mb-2">
|
||||
E-Mail
|
||||
</label>
|
||||
<div className="relative">
|
||||
<div className="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
||||
<Mail className="h-5 w-5 text-gray-400" />
|
||||
</div>
|
||||
<input
|
||||
type="email"
|
||||
id="email"
|
||||
name="email"
|
||||
value={email}
|
||||
onChange={(e) => setEmail(e.target.value)}
|
||||
className="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500"
|
||||
placeholder="ihre@email.com"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label htmlFor="subject" className="block text-sm font-medium text-gray-700 mb-2">
|
||||
Betreff
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="subject"
|
||||
name="subject"
|
||||
value={subject}
|
||||
onChange={(e) => setSubject(e.target.value)}
|
||||
className="block w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500"
|
||||
placeholder="Worum geht es?"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label htmlFor="message" className="block text-sm font-medium text-gray-700 mb-2">
|
||||
Nachricht
|
||||
</label>
|
||||
<div className="relative">
|
||||
<div className="absolute top-3 left-3 pointer-events-none">
|
||||
<MessageSquare className="h-5 w-5 text-gray-400" />
|
||||
</div>
|
||||
<textarea
|
||||
id="message"
|
||||
name="message"
|
||||
rows={4}
|
||||
value={message}
|
||||
onChange={(e) => setMessage(e.target.value)}
|
||||
className="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500"
|
||||
placeholder="Ihre Nachricht..."
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex justify-center">
|
||||
<button
|
||||
type="submit"
|
||||
disabled={status === 'submitting'}
|
||||
className="inline-flex items-center px-6 py-3 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors duration-200 disabled:opacity-60"
|
||||
>
|
||||
<Send className="w-5 h-5 mr-2" />
|
||||
{status === 'submitting' ? 'Wird gesendet…' : 'Nachricht senden'}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,14 +1,6 @@
|
||||
import { Metadata } from 'next'
|
||||
import Link from 'next/link'
|
||||
import {
|
||||
Mail,
|
||||
Phone,
|
||||
MapPin,
|
||||
Clock,
|
||||
MessageSquare,
|
||||
User,
|
||||
Send
|
||||
} from 'lucide-react'
|
||||
import { Mail, Phone, MapPin, Clock } from 'lucide-react'
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: 'Kontakt | RevampIT',
|
||||
@@ -41,6 +33,8 @@ const contactInfo = [
|
||||
}
|
||||
]
|
||||
|
||||
import ContactForm from './ContactForm'
|
||||
|
||||
export default function ContactPage() {
|
||||
return (
|
||||
<main>
|
||||
@@ -87,85 +81,7 @@ export default function ContactPage() {
|
||||
<section className="py-20 bg-gray-50">
|
||||
<div className="container mx-auto px-4">
|
||||
<div className="max-w-2xl mx-auto">
|
||||
<div className="bg-white rounded-xl shadow-lg p-8">
|
||||
<h2 className="text-3xl font-bold mb-8 text-center">Senden Sie uns eine Nachricht</h2>
|
||||
<form className="space-y-6">
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<div>
|
||||
<label htmlFor="name" className="block text-sm font-medium text-gray-700 mb-2">
|
||||
Name
|
||||
</label>
|
||||
<div className="relative">
|
||||
<div className="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
||||
<User className="h-5 w-5 text-gray-400" />
|
||||
</div>
|
||||
<input
|
||||
type="text"
|
||||
id="name"
|
||||
name="name"
|
||||
className="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500"
|
||||
placeholder="Ihr Name"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label htmlFor="email" className="block text-sm font-medium text-gray-700 mb-2">
|
||||
E-Mail
|
||||
</label>
|
||||
<div className="relative">
|
||||
<div className="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
||||
<Mail className="h-5 w-5 text-gray-400" />
|
||||
</div>
|
||||
<input
|
||||
type="email"
|
||||
id="email"
|
||||
name="email"
|
||||
className="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500"
|
||||
placeholder="ihre@email.com"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label htmlFor="subject" className="block text-sm font-medium text-gray-700 mb-2">
|
||||
Betreff
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="subject"
|
||||
name="subject"
|
||||
className="block w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500"
|
||||
placeholder="Worum geht es?"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label htmlFor="message" className="block text-sm font-medium text-gray-700 mb-2">
|
||||
Nachricht
|
||||
</label>
|
||||
<div className="relative">
|
||||
<div className="absolute top-3 left-3 pointer-events-none">
|
||||
<MessageSquare className="h-5 w-5 text-gray-400" />
|
||||
</div>
|
||||
<textarea
|
||||
id="message"
|
||||
name="message"
|
||||
rows={4}
|
||||
className="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-lg focus:ring-green-500 focus:border-green-500"
|
||||
placeholder="Ihre Nachricht..."
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex justify-center">
|
||||
<button
|
||||
type="submit"
|
||||
className="inline-flex items-center px-6 py-3 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors duration-200"
|
||||
>
|
||||
<Send className="w-5 h-5 mr-2" />
|
||||
Nachricht senden
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<ContactForm />
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -203,4 +119,4 @@ export default function ContactPage() {
|
||||
</section>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
}
|
||||
+1
-1037
File diff suppressed because it is too large.
Load diff
+1
-440
@@ -1,440 +1 @@
|
||||
'use client'
|
||||
|
||||
import { useState } from 'react'
|
||||
import {
|
||||
Wrench,
|
||||
HardDrive,
|
||||
Server,
|
||||
Shield,
|
||||
ArrowRight,
|
||||
CheckCircle2,
|
||||
Zap,
|
||||
Clock,
|
||||
ShieldCheck,
|
||||
Code,
|
||||
Globe,
|
||||
Brain,
|
||||
Filter,
|
||||
Monitor,
|
||||
Cloud,
|
||||
Cpu,
|
||||
Settings
|
||||
} from 'lucide-react'
|
||||
import Link from 'next/link'
|
||||
|
||||
const services = [
|
||||
// Hardware Services
|
||||
{
|
||||
title: 'Computerreparatur & Aufrüstungen',
|
||||
description: 'Expertenreparaturen für alle Arten von Computern und Komponenten. Wir spezialisieren uns darauf zu reparieren, was andere nicht koennen, einschliesslich Motherboard-Reparaturen und Bauteil-Level-Fixes.',
|
||||
icon: Wrench,
|
||||
category: 'Hardware-Dienstleistungen',
|
||||
features: [
|
||||
'Bauteil-Level-Reparaturen',
|
||||
'Hardware-Aufrüstungen',
|
||||
'Diagnosedienste',
|
||||
'Professionelle Bewertung'
|
||||
],
|
||||
pricing: 'CHF 70/hour + parts',
|
||||
highlight: 'Professional assessment required',
|
||||
href: '/services/computer-repair-upgrades',
|
||||
available: true
|
||||
},
|
||||
{
|
||||
title: 'Datenrettung & Transfer',
|
||||
description: 'Sichere und zuverlässige Datentransferdienste für alle Arten von Speichermedien. Wir können Daten von beschädigten Geräten wiederherstellen und auf moderne Speicherlösungen übertragen.',
|
||||
icon: HardDrive,
|
||||
category: 'Hardware-Dienstleistungen',
|
||||
features: [
|
||||
'Sicherer Datentransfer',
|
||||
'Datenwiederherstellung von beschädigten Geräten',
|
||||
'Unterstützung für Legacy-Medien (Disketten, ZIP-Laufwerke, MO-Laufwerke, SCSI/IDE-Laufwerke)',
|
||||
'Komplette Datensicherheit'
|
||||
],
|
||||
pricing: 'CHF 70/hour',
|
||||
highlight: 'Evaluation required before recovery',
|
||||
href: '/services/data-recovery-transfer',
|
||||
available: true
|
||||
},
|
||||
{
|
||||
title: 'Hardware-Recycling',
|
||||
description: 'Verantwortungsvolles Recycling und Aufbereitung von IT-Geräten. Wir geben Ihren alten Geräten ein neues Leben und sorgen für sichere Datenlöschung.',
|
||||
icon: Shield,
|
||||
category: 'Hardware-Dienstleistungen',
|
||||
features: [
|
||||
'Sichere Datenlöschung',
|
||||
'Geräteaufbereitung',
|
||||
'Komponenten-Recycling',
|
||||
'Kostenloser Abholservice'
|
||||
],
|
||||
pricing: 'Free for most items',
|
||||
highlight: 'Free pickup service available',
|
||||
href: '/services/hardware-recycling',
|
||||
available: true
|
||||
},
|
||||
|
||||
// Software Solutions
|
||||
{
|
||||
title: 'Webdesign & Entwicklung',
|
||||
description: 'Professionelle Webdesign- und Entwicklungsdienstleistungen mit modernen Open-Source-Technologien. Schnelle, responsive Websites mit Next.js, Headless CMS und nachhaltigen Praktiken.',
|
||||
icon: Globe,
|
||||
category: 'Software-Lösungen',
|
||||
features: [
|
||||
'Moderne Frameworks (Next.js, React)',
|
||||
'Headless CMS (Strapi, Payload, Tina)',
|
||||
'Responsive Design & Tailwind CSS',
|
||||
'E-Commerce-Lösungen (Medusa.js, Shopware 6)',
|
||||
'SEO-Optimierung & Performance'
|
||||
],
|
||||
pricing: 'CHF 70/hour',
|
||||
highlight: 'Free initial consultation',
|
||||
href: '/services/web-design-development',
|
||||
available: true
|
||||
},
|
||||
{
|
||||
title: 'Linux & Open Source',
|
||||
description: 'Professionelle Linux-Installation, -Konfiguration und -Support-Dienstleistungen. Wir helfen Ihnen, das Beste aus Ihrem Linux-System mit fachkundiger Anleitung und Wartung herauszuholen.',
|
||||
icon: Server,
|
||||
category: 'Software-Lösungen',
|
||||
features: [
|
||||
'Linux-Installation & Konfiguration',
|
||||
'Systemoptimierung & Wartung',
|
||||
'Sicherheitshärtung',
|
||||
'Performance-Tuning'
|
||||
],
|
||||
pricing: 'CHF 70/hour',
|
||||
highlight: 'Professional assessment required',
|
||||
href: '/services/linux-open-source',
|
||||
available: true
|
||||
},
|
||||
{
|
||||
title: 'Open Source Solutions',
|
||||
description: 'Fachkundige Implementierung und Support für Open-Source-Software. Wir helfen Ihnen beim Übergang zu und der Wartung von Open-Source-Lösungen für Ihre Geschäftsanforderungen.',
|
||||
icon: Code,
|
||||
category: 'Software-Lösungen',
|
||||
features: [
|
||||
'Open-Source-Beratung',
|
||||
'Maßgeschneiderte Entwicklung',
|
||||
'Community-Integration',
|
||||
'Sicherheit & Compliance'
|
||||
],
|
||||
pricing: 'CHF 70/hour',
|
||||
highlight: 'Free initial consultation',
|
||||
href: '/services/open-source-solutions',
|
||||
available: true
|
||||
},
|
||||
|
||||
// Coming Soon
|
||||
{
|
||||
title: 'Build Your Computer',
|
||||
description: 'Erhalten Sie einen maßgeschneiderten Computer für Ihre spezifischen Bedürfnisse, unterstützt durch KI-Analyse unseres umfangreichen Inventars. Wir beziehen Teile global und bieten professionelle Montage.',
|
||||
icon: Cpu,
|
||||
category: 'Bald verfügbar',
|
||||
features: [
|
||||
'KI-gestützte Build-Empfehlungen',
|
||||
'Globales Teile-Beschaffungsnetzwerk',
|
||||
'Professionelle Montage und Tests',
|
||||
'Qualitätsgarantie und Gewährleistung'
|
||||
],
|
||||
pricing: '',
|
||||
highlight: 'Bald verfügbar',
|
||||
href: '/services/build-your-computer',
|
||||
available: false,
|
||||
badge: 'Soon'
|
||||
},
|
||||
{
|
||||
title: 'Enterprise AI Solutions',
|
||||
description: 'Private, vor-Ort KI-Systeme für professionelle Unternehmen. GPT-4-Level-Performance mit vollständigem Datenschutz und DSGVO-Compliance.',
|
||||
icon: Brain,
|
||||
category: 'Bald verfügbar',
|
||||
features: [
|
||||
'Selbstgehostete Llama 3 70B-Bereitstellung',
|
||||
'RAG-unterstützte Dokumentensuche',
|
||||
'Vollständiger Datenschutz & DSGVO-Compliance',
|
||||
'Maßgeschneiderte Schulung auf Ihren Dokumenten'
|
||||
],
|
||||
pricing: '',
|
||||
highlight: 'Bald verfügbar',
|
||||
href: '/services/enterprise-ai-solutions',
|
||||
available: false,
|
||||
badge: 'Soon'
|
||||
},
|
||||
{
|
||||
title: 'Cloud Infrastructure',
|
||||
description: 'Nachhaltige Cloud-Hosting- und Infrastrukturlösungen. Wir bieten skalierbare, umweltfreundliche Hosting-Lösungen mit erneuerbarer Energie und Open-Source-Technologien.',
|
||||
icon: Cloud,
|
||||
category: 'Bald verfügbar',
|
||||
features: [
|
||||
'Hosting mit erneuerbarer Energie',
|
||||
'Open-Source-Infrastruktur',
|
||||
'Skalierbare Lösungen',
|
||||
'Professionelle Überwachung'
|
||||
],
|
||||
pricing: '',
|
||||
highlight: 'Bald verfügbar',
|
||||
href: '/services/cloud-infrastructure',
|
||||
available: false,
|
||||
badge: 'Soon'
|
||||
},
|
||||
{
|
||||
title: 'Server Management',
|
||||
description: 'Professionelle Server-Setup- und Wartungsdienste. Wir verwalten Ihre Server, damit Sie sich auf Ihr Geschäft konzentrieren können.',
|
||||
icon: Monitor,
|
||||
category: 'Bald verfügbar',
|
||||
features: [
|
||||
'Server-Setup & Konfiguration',
|
||||
'24/7-Überwachung',
|
||||
'Sicherheitsverwaltung',
|
||||
'Performance-Optimierung'
|
||||
],
|
||||
pricing: '',
|
||||
highlight: 'Bald verfügbar',
|
||||
href: '/services/server-management',
|
||||
available: false,
|
||||
badge: 'Soon'
|
||||
},
|
||||
{
|
||||
title: 'IoT Solutions',
|
||||
description: 'Internet-of-Things-Lösungen mit Open-Source-Hardware. Erstellen Sie vernetzte Geräte, die Ihre Privatsphäre und Dateneigentum respektieren.',
|
||||
icon: Settings,
|
||||
category: 'Bald verfügbar',
|
||||
features: [
|
||||
'Open-Source-Hardware',
|
||||
'Datenschutz-fokussiertes Design',
|
||||
'Maßgeschneiderte IoT-Entwicklung',
|
||||
'Dateneigentum garantiert'
|
||||
],
|
||||
pricing: '',
|
||||
highlight: 'Bald verfügbar',
|
||||
href: '/services/iot-solutions',
|
||||
available: false,
|
||||
badge: 'Soon'
|
||||
}
|
||||
]
|
||||
|
||||
// Get unique categories for filtering
|
||||
const getUniqueCategories = () => {
|
||||
// Define the order we want: All, Hardware Services, Software Solutions, Coming Soon
|
||||
const categoryOrder = ['Alle', 'Hardware-Dienstleistungen', 'Software-Lösungen', 'Bald verfügbar']
|
||||
const categories = services.map(service => service.category)
|
||||
const uniqueCategories = Array.from(new Set(categories))
|
||||
|
||||
// Return categories in the specified order
|
||||
return categoryOrder.filter(cat => cat === 'Alle' || uniqueCategories.includes(cat))
|
||||
}
|
||||
|
||||
export default function ServicesPage() {
|
||||
const [selectedCategory, setSelectedCategory] = useState('Alle')
|
||||
const categories = getUniqueCategories()
|
||||
|
||||
const filteredServices = selectedCategory === 'Alle'
|
||||
? services
|
||||
: services.filter(service => service.category === selectedCategory)
|
||||
|
||||
const handleCategoryToggle = (category: string) => {
|
||||
setSelectedCategory(prev => prev === category ? 'Alle' : category)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<script
|
||||
type="application/ld+json"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: JSON.stringify({
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'Service',
|
||||
'name': 'Computer Repair & IT Services',
|
||||
'description': 'Professional computer repair, web development, data recovery, Linux support, and hardware recycling services.',
|
||||
'provider': {
|
||||
'@type': 'Organization',
|
||||
'name': 'RevampIT',
|
||||
'url': 'https://revampit.org',
|
||||
'logo': 'https://revampit.org/logo.png'
|
||||
},
|
||||
'serviceType': [
|
||||
'Computer Repair',
|
||||
'Web Design & Development',
|
||||
'Data Recovery',
|
||||
'Linux Support',
|
||||
'Hardware Recycling',
|
||||
'Open Source Solutions',
|
||||
'Enterprise AI Solutions'
|
||||
],
|
||||
'areaServed': {
|
||||
'@type': 'City',
|
||||
'name': 'Your City'
|
||||
}
|
||||
})
|
||||
}}
|
||||
/>
|
||||
<main className="min-h-screen bg-gray-50">
|
||||
{/* Hero Section */}
|
||||
<section className="relative bg-gradient-to-br from-green-700 via-green-800 to-green-900 text-white py-24 overflow-hidden">
|
||||
<div className="absolute inset-0 bg-[url('/grid.svg')] opacity-10"></div>
|
||||
<div className="container mx-auto px-4 relative">
|
||||
<div className="max-w-3xl">
|
||||
<h1 className="text-5xl md:text-6xl font-bold mb-6 leading-tight">Experten-IT-Dienstleistungen</h1>
|
||||
<h2 className="text-2xl md:text-3xl font-semibold mb-8 text-green-200">Nachhaltige Lösungen für Ihre Technologiebedürfnisse</h2>
|
||||
<p className="text-xl text-green-100">Wir kombinieren technische Expertise mit Umweltverantwortung, um umfassende IT-Lösungen zu bieten, die Ihnen Geld sparen und Elektroschrott reduzieren.</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Services Section with Filtering */}
|
||||
<section className="py-20">
|
||||
<div className="container mx-auto px-4">
|
||||
<div className="max-w-3xl mx-auto text-center mb-12">
|
||||
<h2 className="text-3xl font-bold mb-6">Unsere Dienstleistungen</h2>
|
||||
<p className="text-lg text-gray-600 mb-8">
|
||||
Die Reparaturdauer variiert je nach Teileverfügbarkeit und dauert in der Regel einige Wochen.
|
||||
</p>
|
||||
|
||||
{/* Service Filter */}
|
||||
<div className="flex flex-wrap justify-center gap-3 mb-12">
|
||||
<div className="flex items-center text-gray-500 mr-4 mb-2">
|
||||
<Filter className="w-4 h-4 mr-2" />
|
||||
<span className="text-sm font-medium">Nach Kategorie filtern:</span>
|
||||
</div>
|
||||
{categories.map((category) => (
|
||||
<button
|
||||
key={category}
|
||||
onClick={() => category === 'Alle' ? setSelectedCategory(category) : handleCategoryToggle(category)}
|
||||
className={`px-4 py-2 rounded-full text-sm font-medium transition-all duration-300 ${
|
||||
selectedCategory === category
|
||||
? 'bg-green-600 text-white shadow-lg transform scale-105'
|
||||
: 'bg-gray-100 text-gray-600 hover:bg-gray-200 hover:text-gray-800'
|
||||
}`}
|
||||
>
|
||||
{category}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Services Grid with Animation */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-8">
|
||||
{filteredServices.map((service, index) => (
|
||||
<div
|
||||
key={`${service.title}-${selectedCategory}`}
|
||||
className="group bg-white rounded-xl shadow-lg hover:shadow-2xl transition-all duration-300 overflow-hidden flex flex-col h-full animate-fadeIn"
|
||||
style={{ animationDelay: `${index * 100}ms` }}
|
||||
>
|
||||
<div className="p-8 flex flex-col h-full">
|
||||
<div className="flex items-start mb-6">
|
||||
<div className={`p-3 rounded-lg mr-4 transition-colors duration-300 ${
|
||||
service.available
|
||||
? 'bg-green-100 text-green-600 group-hover:bg-green-600 group-hover:text-white'
|
||||
: 'bg-gray-100 text-gray-400'
|
||||
}`}>
|
||||
<service.icon className="w-8 h-8" />
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<div className="flex items-center gap-2 mb-2">
|
||||
<h3 className="text-2xl font-bold">{service.title}</h3>
|
||||
{service.badge && (
|
||||
<span className="inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-700">
|
||||
{service.badge}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<div className={`flex items-center font-semibold mb-4 ${
|
||||
service.available ? 'text-green-600' : 'text-gray-400'
|
||||
}`}>
|
||||
<Zap className="w-4 h-4 mr-2" />
|
||||
<span>{service.highlight}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p className="text-gray-600 mb-6 flex-grow">{service.description}</p>
|
||||
<div className="space-y-3 mb-6">
|
||||
{service.features.map((feature, i) => (
|
||||
<div key={i} className="flex items-center text-gray-600">
|
||||
<CheckCircle2 className={`w-5 h-5 mr-3 flex-shrink-0 ${
|
||||
service.available ? 'text-green-500' : 'text-gray-400'
|
||||
}`} />
|
||||
<span>{feature}</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<div className="mt-auto pt-6 border-t border-gray-200 flex items-center justify-between">
|
||||
{service.pricing ? (
|
||||
<span className={`text-lg font-semibold ${
|
||||
service.available ? 'text-green-600' : 'text-gray-400'
|
||||
}`}>
|
||||
{service.pricing}
|
||||
</span>
|
||||
) : (
|
||||
<span className="text-gray-400 text-sm">Pricing TBD</span>
|
||||
)}
|
||||
<Link
|
||||
href={service.href}
|
||||
className={`inline-flex items-center font-medium transition-colors duration-300 group ${
|
||||
service.available
|
||||
? 'text-green-600 hover:text-green-700'
|
||||
: 'text-gray-400 hover:text-gray-500'
|
||||
}`}
|
||||
>
|
||||
<span>{service.available ? 'Details anzeigen' : 'Mehr erfahren'}</span>
|
||||
<ArrowRight className="w-4 h-4 ml-2 transform group-hover:translate-x-1 transition-transform duration-300" />
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Results count */}
|
||||
<div className="text-center mt-8">
|
||||
<p className="text-gray-500 text-sm">
|
||||
{filteredServices.length} von {services.length} Dienstleistungen
|
||||
{selectedCategory !== 'Alle' && ` in "${selectedCategory}"`}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* CTA Section */}
|
||||
<section className="py-20 bg-gradient-to-r from-green-700 to-green-800 text-white">
|
||||
<div className="container mx-auto px-4 text-center">
|
||||
<h2 className="text-4xl font-bold mb-6">Bereit, Ihre Technologie zu erneuern?</h2>
|
||||
<p className="text-xl mb-8 max-w-2xl mx-auto text-green-100">Kontaktieren Sie uns heute für eine kostenlose Beratung und entdecken Sie, wie wir Ihnen helfen können, das Beste aus Ihren Geräten herauszuholen.</p>
|
||||
<div className="flex flex-col sm:flex-row gap-4 justify-center">
|
||||
<Link
|
||||
href="/contact"
|
||||
className="inline-block bg-white text-green-800 px-8 py-4 rounded-lg font-semibold hover:bg-green-50 transition-colors duration-300 text-lg"
|
||||
>
|
||||
Kontaktieren Sie uns
|
||||
</Link>
|
||||
<Link
|
||||
href="https://www.revamp-it.ch/index.php/de/shop-de"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-block border-2 border-white text-white px-8 py-4 rounded-lg font-semibold hover:bg-white/10 transition-colors duration-300 text-lg"
|
||||
>
|
||||
Inventar durchsuchen
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Add custom CSS for animations */}
|
||||
<style jsx>{`
|
||||
@keyframes fadeIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(20px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
.animate-fadeIn {
|
||||
animation: fadeIn 0.6s ease-out forwards;
|
||||
}
|
||||
`}</style>
|
||||
</main>
|
||||
</>
|
||||
)
|
||||
}
|
||||
export { default } from './page-refactored'
|
||||
@@ -1,11 +1,13 @@
|
||||
'use client'
|
||||
|
||||
import { ReactNode } from 'react'
|
||||
import dynamic from 'next/dynamic'
|
||||
import { Header } from './Header'
|
||||
import Footer from './Footer'
|
||||
import SuggestionButton from '@/components/ui/SuggestionButton'
|
||||
import RevampCopilot from '@/components/ui/RevampCopilot'
|
||||
import { SuggestionProvider } from '@/contexts/SuggestionContext'
|
||||
|
||||
const RevampCopilot = dynamic(() => import('@/components/ui/RevampCopilot'), { ssr: false })
|
||||
// Cleaned: use the refactored SuggestionButton (renamed to canonical path)
|
||||
const SuggestionButton = dynamic(() => import('@/components/ui/SuggestionButton'), { ssr: false })
|
||||
|
||||
interface MainLayoutProps {
|
||||
children: ReactNode
|
||||
@@ -13,7 +15,6 @@ interface MainLayoutProps {
|
||||
|
||||
export default function MainLayout({ children }: MainLayoutProps) {
|
||||
return (
|
||||
<SuggestionProvider>
|
||||
<div className="min-h-screen bg-gradient-to-b from-white to-gray-50">
|
||||
<Header />
|
||||
|
||||
@@ -29,6 +30,5 @@ export default function MainLayout({ children }: MainLayoutProps) {
|
||||
{/* Page Improvement Suggestions - Right Side (Upper Third) */}
|
||||
<SuggestionButton />
|
||||
</div>
|
||||
</SuggestionProvider>
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,280 +1,112 @@
|
||||
/**
|
||||
* Refactored SuggestionButton Component
|
||||
* @fileoverview Modular, maintainable suggestion system with proper separation of concerns
|
||||
*/
|
||||
|
||||
'use client'
|
||||
|
||||
import { useState, useEffect, useRef, useCallback } from 'react'
|
||||
import { Button } from './button'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { Edit3, X, ChevronLeft, ChevronRight, Brain, Info, ExternalLink, Sparkles } from 'lucide-react'
|
||||
import { Edit3, X, Info } from 'lucide-react'
|
||||
import { useSuggestionContext } from '@/contexts/SuggestionContext'
|
||||
import Link from 'next/link'
|
||||
|
||||
interface SelectedElement {
|
||||
element: Element
|
||||
elementType: string
|
||||
elementText: string
|
||||
selector: string
|
||||
}
|
||||
|
||||
interface SuggestionFormData {
|
||||
suggestion: string
|
||||
contact?: string
|
||||
selectedElements?: SelectedElement[]
|
||||
}
|
||||
|
||||
type FeedbackScope = 'page' | 'element' | 'site'
|
||||
|
||||
const CONTEXTUAL_SUGGESTIONS = {
|
||||
site: ["Navigation verbessern", "Design modernisieren", "Performance optimieren", "Mobile verbessern"],
|
||||
page: ["Details hinzufügen", "Link reparieren", "Layout verbessern", "Inhalt aktualisieren"],
|
||||
element: (count: number) => count > 0 ? [
|
||||
"Besser sichtbar machen",
|
||||
"Neu positionieren",
|
||||
"Text ändern",
|
||||
"Entfernen"
|
||||
] : ["Element auswählen"]
|
||||
} as const
|
||||
|
||||
// Utility functions for cleaner code
|
||||
const clearSelectedElements = () => {
|
||||
document.querySelectorAll('.suggestion-selected-element').forEach(el => {
|
||||
el.classList.remove('suggestion-selected-element')
|
||||
})
|
||||
}
|
||||
// Import modular components and hooks
|
||||
import { SuggestionTextarea, FeedbackScopeSelector, QuickSuggestions } from './suggestion/components'
|
||||
import { useSuggestionForm, useElementSelection } from './suggestion/hooks'
|
||||
import { FeedbackScope } from './suggestion/types'
|
||||
|
||||
export default function SuggestionButton() {
|
||||
const { currentPage, isVisible } = useSuggestionContext()
|
||||
const [isExpanded, setIsExpanded] = useState(false)
|
||||
const [isSubmitting, setIsSubmitting] = useState(false)
|
||||
const [feedbackScope, setFeedbackScope] = useState<FeedbackScope>('page')
|
||||
const [isElementSelectionMode, setIsElementSelectionMode] = useState(false)
|
||||
const [selectedElements, setSelectedElements] = useState<SelectedElement[]>([])
|
||||
const [formData, setFormData] = useState<SuggestionFormData>({
|
||||
suggestion: '',
|
||||
contact: '',
|
||||
selectedElements: []
|
||||
})
|
||||
const [submitted, setSubmitted] = useState(false)
|
||||
const [submitError, setSubmitError] = useState<string | null>(null)
|
||||
|
||||
const panelRef = useRef<HTMLDivElement>(null)
|
||||
const textareaRef = useRef<HTMLTextAreaElement>(null)
|
||||
const closeButtonRef = useRef<HTMLButtonElement>(null)
|
||||
const handleSubmitRef = useRef<((e: any) => Promise<void>) | null>(null)
|
||||
|
||||
// Custom hooks for better separation of concerns
|
||||
const {
|
||||
formData,
|
||||
isSubmitting,
|
||||
submitError,
|
||||
updateSuggestion,
|
||||
updateContact,
|
||||
resetForm,
|
||||
submitSuggestion,
|
||||
setSubmitError
|
||||
} = useSuggestionForm({
|
||||
onSuccess: () => {
|
||||
setSubmitted(true)
|
||||
setTimeout(() => {
|
||||
closePanelAndReset()
|
||||
}, 2000)
|
||||
}
|
||||
})
|
||||
|
||||
const {
|
||||
selectedElements,
|
||||
isElementSelectionMode,
|
||||
toggleElementSelection,
|
||||
resetSelection,
|
||||
setIsElementSelectionMode
|
||||
} = useElementSelection({ panelRef })
|
||||
|
||||
// Handle focus management when panel opens
|
||||
useEffect(() => {
|
||||
if (isExpanded && !submitted) {
|
||||
// Auto-focus textarea after panel opens
|
||||
if (isExpanded && !submitted && feedbackScope !== 'element') {
|
||||
const timeoutId = setTimeout(() => {
|
||||
if (textareaRef.current && feedbackScope !== 'element') {
|
||||
textareaRef.current.focus()
|
||||
}
|
||||
textareaRef.current?.focus()
|
||||
}, 300)
|
||||
return () => clearTimeout(timeoutId)
|
||||
}
|
||||
}, [isExpanded, feedbackScope, submitted])
|
||||
|
||||
// Reset form when page changes (but not when just opening/closing)
|
||||
// Reset form when page changes or panel closes
|
||||
useEffect(() => {
|
||||
if (!isExpanded) {
|
||||
setFormData(prev => ({ ...prev, suggestion: '', contact: '' }))
|
||||
resetForm()
|
||||
setSubmitted(false)
|
||||
setSelectedElements([])
|
||||
resetSelection()
|
||||
setFeedbackScope('page')
|
||||
setIsElementSelectionMode(false)
|
||||
setSubmitError(null)
|
||||
}
|
||||
}, [currentPage.path, isExpanded])
|
||||
}, [currentPage.path, isExpanded, resetForm, resetSelection, setSubmitError])
|
||||
|
||||
// Component-specific utility functions - must be defined before use
|
||||
// Component-specific utility functions
|
||||
const resetToPageScope = useCallback(() => {
|
||||
setFeedbackScope('page')
|
||||
setSelectedElements([])
|
||||
setIsElementSelectionMode(false)
|
||||
clearSelectedElements()
|
||||
}, [])
|
||||
resetSelection()
|
||||
}, [resetSelection])
|
||||
|
||||
const closePanelAndReset = useCallback(() => {
|
||||
setIsExpanded(false)
|
||||
setIsElementSelectionMode(false)
|
||||
setSelectedElements([])
|
||||
resetSelection()
|
||||
setFeedbackScope('page')
|
||||
setSubmitError(null)
|
||||
clearSelectedElements()
|
||||
}, [])
|
||||
}, [resetSelection, setSubmitError, setIsElementSelectionMode])
|
||||
|
||||
// Handle outside click to close and keyboard shortcuts
|
||||
// Handle outside click to close
|
||||
const handleClickOutside = useCallback((event: MouseEvent) => {
|
||||
// If in element selection mode, don't handle outside clicks
|
||||
if (isElementSelectionMode) {
|
||||
return
|
||||
}
|
||||
if (isElementSelectionMode) return
|
||||
|
||||
if (panelRef.current && !panelRef.current.contains(event.target as Node)) {
|
||||
closePanelAndReset()
|
||||
}
|
||||
}, [isElementSelectionMode, closePanelAndReset])
|
||||
|
||||
|
||||
// Handle element selection mode
|
||||
useEffect(() => {
|
||||
if (isElementSelectionMode) {
|
||||
|
||||
const handleElementClick = (event: MouseEvent) => {
|
||||
const target = event.target as Element
|
||||
|
||||
// Check if the click is on the panel itself - if so, ignore it
|
||||
if (panelRef.current?.contains(target)) {
|
||||
return
|
||||
}
|
||||
|
||||
// Check if the click is on the element selection overlay - if so, ignore it
|
||||
const overlay = document.querySelector('[data-element-selection-overlay]')
|
||||
if (overlay?.contains(target)) {
|
||||
return
|
||||
}
|
||||
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
|
||||
// Check if element is already selected
|
||||
const isAlreadySelected = selectedElements.some(selected => selected.element === target)
|
||||
|
||||
if (isAlreadySelected) {
|
||||
// Deselect the element
|
||||
setSelectedElements(prev => prev.filter(selected => selected.element !== target))
|
||||
target.classList.remove('suggestion-selected-element')
|
||||
} else {
|
||||
// Select the element
|
||||
|
||||
// Extract element information
|
||||
const elementType = target.tagName.toLowerCase()
|
||||
const elementText = target.textContent?.substring(0, 100) || ''
|
||||
const elementClasses = Array.from(target.classList).join(' ')
|
||||
const elementId = target.id || ''
|
||||
|
||||
const newSelectedElement: SelectedElement = {
|
||||
element: target,
|
||||
elementType,
|
||||
elementText,
|
||||
selector: elementId ? `#${elementId}` : `.${elementClasses.split(' ')[0]}`
|
||||
}
|
||||
|
||||
setSelectedElements(prev => [...prev, newSelectedElement])
|
||||
|
||||
// Add visual marker
|
||||
target.classList.add('suggestion-selected-element')
|
||||
}
|
||||
}
|
||||
|
||||
const handleMouseOver = (event: MouseEvent) => {
|
||||
const target = event.target as HTMLElement
|
||||
if (target && !panelRef.current?.contains(target)) {
|
||||
target.style.outline = '2px solid #10b981'
|
||||
target.style.outlineOffset = '2px'
|
||||
}
|
||||
}
|
||||
|
||||
const handleMouseOut = (event: MouseEvent) => {
|
||||
const target = event.target as HTMLElement
|
||||
if (target) {
|
||||
target.style.outline = ''
|
||||
target.style.outlineOffset = ''
|
||||
}
|
||||
}
|
||||
|
||||
// Add a small delay to ensure the panel is rendered before attaching listeners
|
||||
const timeoutId = setTimeout(() => {
|
||||
document.addEventListener('click', handleElementClick, true)
|
||||
document.addEventListener('mouseover', handleMouseOver)
|
||||
document.addEventListener('mouseout', handleMouseOut)
|
||||
}, 100)
|
||||
|
||||
return () => {
|
||||
clearTimeout(timeoutId)
|
||||
document.removeEventListener('click', handleElementClick, true)
|
||||
document.removeEventListener('mouseover', handleMouseOver)
|
||||
document.removeEventListener('mouseout', handleMouseOut)
|
||||
// Clean up any remaining outlines
|
||||
document.querySelectorAll('[style*="outline"]').forEach(el => {
|
||||
const htmlEl = el as HTMLElement
|
||||
htmlEl.style.outline = ''
|
||||
htmlEl.style.outlineOffset = ''
|
||||
})
|
||||
}
|
||||
// Form submission handler
|
||||
const handleSubmit = useCallback(async () => {
|
||||
const success = await submitSuggestion(feedbackScope, selectedElements)
|
||||
if (success) {
|
||||
setSubmitted(true)
|
||||
}
|
||||
}, [isElementSelectionMode, selectedElements])
|
||||
|
||||
const handleSubmit = useCallback(async (e: React.FormEvent) => {
|
||||
e.preventDefault()
|
||||
if (!formData.suggestion.trim()) return
|
||||
|
||||
setIsSubmitting(true)
|
||||
setSubmitError(null)
|
||||
|
||||
try {
|
||||
const response = await fetch('/api/suggestions', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
suggestion: formData.suggestion,
|
||||
contact: formData.contact,
|
||||
page: currentPage.path,
|
||||
url: typeof window !== 'undefined' ? window.location.href : '',
|
||||
pageTitle: currentPage.title,
|
||||
pageSection: currentPage.section,
|
||||
feedbackScope,
|
||||
selectedElements: selectedElements.map(el => ({
|
||||
elementType: el.elementType,
|
||||
elementText: el.elementText,
|
||||
selector: el.selector
|
||||
})),
|
||||
timestamp: new Date().toISOString(),
|
||||
}),
|
||||
})
|
||||
|
||||
if (response.ok) {
|
||||
setSubmitted(true)
|
||||
setFormData(prev => ({ ...prev, suggestion: '', contact: '', selectedElements: [] }))
|
||||
setTimeout(() => {
|
||||
setIsExpanded(false)
|
||||
setSubmitted(false)
|
||||
setSelectedElements([])
|
||||
setFeedbackScope('page')
|
||||
setIsElementSelectionMode(false)
|
||||
}, 2000)
|
||||
} else {
|
||||
const errorData = await response.json().catch(() => ({}))
|
||||
setSubmitError(errorData.message || `Fehler beim Senden (${response.status})`)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to submit suggestion:', error)
|
||||
setSubmitError('Netzwerkfehler. Bitte versuchen Sie es später erneut.')
|
||||
} finally {
|
||||
setIsSubmitting(false)
|
||||
}
|
||||
}, [formData.suggestion, formData.contact, currentPage.path, currentPage.title, currentPage.section, feedbackScope, selectedElements])
|
||||
|
||||
// Update handleSubmit ref
|
||||
useEffect(() => {
|
||||
handleSubmitRef.current = handleSubmit
|
||||
}, [handleSubmit])
|
||||
|
||||
// Memoized handlers to prevent unnecessary re-renders
|
||||
const handleSuggestionChange = useCallback((e: React.ChangeEvent<HTMLTextAreaElement>) => {
|
||||
const newValue = e.target.value
|
||||
setFormData(prev => ({ ...prev, suggestion: newValue }))
|
||||
}, [])
|
||||
|
||||
const handleContactChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const newValue = e.target.value
|
||||
setFormData(prev => ({ ...prev, contact: newValue }))
|
||||
}, [])
|
||||
|
||||
const handleQuickSuggestion = useCallback((suggestion: string) => {
|
||||
setFormData(prev => ({ ...prev, suggestion }))
|
||||
}, [])
|
||||
}, [submitSuggestion, feedbackScope, selectedElements])
|
||||
|
||||
// Handle keyboard shortcuts
|
||||
const handleKeyDown = useCallback((event: KeyboardEvent) => {
|
||||
if (event.key === 'Escape') {
|
||||
closePanelAndReset()
|
||||
@@ -283,10 +115,10 @@ export default function SuggestionButton() {
|
||||
if (event.key === 'Enter' && event.ctrlKey && isExpanded && !isElementSelectionMode) {
|
||||
event.preventDefault()
|
||||
if (formData.suggestion.trim() && !(feedbackScope === 'element' && selectedElements.length === 0)) {
|
||||
handleSubmitRef.current?.(event as any)
|
||||
handleSubmit()
|
||||
}
|
||||
}
|
||||
}, [isExpanded, isElementSelectionMode, formData.suggestion, feedbackScope, selectedElements, closePanelAndReset, handleSubmitRef])
|
||||
}, [isExpanded, isElementSelectionMode, formData.suggestion, feedbackScope, selectedElements, closePanelAndReset, handleSubmit])
|
||||
|
||||
useEffect(() => {
|
||||
if (isExpanded) {
|
||||
@@ -301,120 +133,6 @@ export default function SuggestionButton() {
|
||||
|
||||
if (!isVisible) return null
|
||||
|
||||
// Feedback scope selector component - Compact version
|
||||
const FeedbackScopeSelector = () => (
|
||||
<div className="mb-2">
|
||||
<h4 className="text-sm font-medium text-gray-700 mb-1.5">Was möchten Sie verbessern?</h4>
|
||||
<div className="flex gap-1">
|
||||
<button
|
||||
type="button"
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
if (feedbackScope !== 'site') {
|
||||
setFeedbackScope('site')
|
||||
setSelectedElements([])
|
||||
setIsElementSelectionMode(false)
|
||||
clearSelectedElements()
|
||||
}
|
||||
}}
|
||||
className={cn(
|
||||
"flex-1 p-1.5 rounded-md border transition-all duration-200 text-center text-xs",
|
||||
feedbackScope === 'site'
|
||||
? "border-purple-500 bg-purple-50 text-purple-900 font-medium"
|
||||
: "border-gray-200 bg-white text-gray-700 hover:border-purple-300 hover:bg-purple-25"
|
||||
)}
|
||||
>
|
||||
<div className="font-medium">Website</div>
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
if (feedbackScope !== 'page') {
|
||||
resetToPageScope()
|
||||
}
|
||||
}}
|
||||
className={cn(
|
||||
"flex-1 p-1.5 rounded-md border transition-all duration-200 text-center text-xs",
|
||||
feedbackScope === 'page'
|
||||
? "border-green-500 bg-green-50 text-green-900 font-medium"
|
||||
: "border-gray-200 bg-white text-gray-700 hover:border-green-300 hover:bg-green-25"
|
||||
)}
|
||||
>
|
||||
<div className="font-medium">Diese Seite</div>
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
if (feedbackScope !== 'element') {
|
||||
setFeedbackScope('element')
|
||||
setIsElementSelectionMode(true)
|
||||
setSelectedElements([])
|
||||
clearSelectedElements()
|
||||
} else {
|
||||
// Toggle element selection mode
|
||||
setIsElementSelectionMode(!isElementSelectionMode)
|
||||
}
|
||||
}}
|
||||
className={cn(
|
||||
"flex-1 p-1.5 rounded-md border transition-all duration-200 text-center text-xs",
|
||||
feedbackScope === 'element'
|
||||
? "border-blue-500 bg-blue-50 text-blue-900 font-medium"
|
||||
: "border-gray-200 bg-white text-gray-700 hover:border-blue-300 hover:bg-blue-25"
|
||||
)}
|
||||
>
|
||||
<div className="font-medium">Element</div>
|
||||
{selectedElements.length > 0 && (
|
||||
<div className="text-xs mt-0.5 text-blue-600">{selectedElements.length}</div>
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
// Quick suggestions component - now context-aware
|
||||
const ContextualQuickSuggestions = () => {
|
||||
const suggestions = feedbackScope === 'element'
|
||||
? CONTEXTUAL_SUGGESTIONS.element(selectedElements.length)
|
||||
: CONTEXTUAL_SUGGESTIONS[feedbackScope] || []
|
||||
|
||||
return (
|
||||
<div className="mb-2">
|
||||
<h4 className="text-xs font-medium text-gray-700 mb-1">
|
||||
{feedbackScope === 'element' && selectedElements.length === 0
|
||||
? 'Element auswählen'
|
||||
: 'Schnelle Ideen'
|
||||
}:
|
||||
</h4>
|
||||
<div className="grid grid-cols-2 gap-0.5">
|
||||
{suggestions.map((suggestion, idx) => (
|
||||
<button
|
||||
key={idx}
|
||||
type="button"
|
||||
onClick={() => handleQuickSuggestion(suggestion)}
|
||||
className={cn(
|
||||
"text-left py-1 px-1.5 text-xs bg-gray-50 hover:bg-green-50 border border-gray-200 hover:border-green-300 rounded transition-colors truncate",
|
||||
feedbackScope === 'site' && "hover:bg-purple-50 hover:border-purple-300",
|
||||
feedbackScope === 'element' && "hover:bg-blue-50 hover:border-blue-300"
|
||||
)}
|
||||
disabled={feedbackScope === 'element' && selectedElements.length === 0}
|
||||
title={suggestion}
|
||||
>
|
||||
{suggestion}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
// Success message component
|
||||
const SuccessMessage = () => (
|
||||
<div className="text-center py-8">
|
||||
@@ -431,75 +149,45 @@ export default function SuggestionButton() {
|
||||
</div>
|
||||
)
|
||||
|
||||
// Form component - Compact version
|
||||
// Form component
|
||||
const SuggestionForm = () => (
|
||||
<form onSubmit={handleSubmit} className="space-y-2">
|
||||
<FeedbackScopeSelector />
|
||||
<ContextualQuickSuggestions />
|
||||
<form onSubmit={(e) => { e.preventDefault(); handleSubmit(); }} className="space-y-2">
|
||||
<FeedbackScopeSelector
|
||||
feedbackScope={feedbackScope}
|
||||
selectedElements={selectedElements}
|
||||
onScopeChange={setFeedbackScope}
|
||||
onElementSelectionToggle={toggleElementSelection}
|
||||
onResetToPageScope={resetToPageScope}
|
||||
isElementSelectionMode={isElementSelectionMode}
|
||||
/>
|
||||
|
||||
<div>
|
||||
<label htmlFor="suggestion" className="block text-xs font-medium text-gray-700 mb-1">
|
||||
Ihre Verbesserungsvorschlag *
|
||||
</label>
|
||||
<textarea
|
||||
ref={textareaRef}
|
||||
id="suggestion"
|
||||
value={formData.suggestion}
|
||||
onChange={handleSuggestionChange}
|
||||
className={cn(
|
||||
"w-full px-2 py-1.5 border border-gray-300 rounded focus:outline-none focus:ring-1 focus:border-transparent resize-none text-xs transition-colors",
|
||||
feedbackScope === 'site' && "focus:ring-purple-500",
|
||||
feedbackScope === 'page' && "focus:ring-green-500",
|
||||
feedbackScope === 'element' && "focus:ring-blue-500"
|
||||
)}
|
||||
rows={2}
|
||||
maxLength={500}
|
||||
placeholder={
|
||||
feedbackScope === 'site'
|
||||
? "Idee für Website..."
|
||||
: feedbackScope === 'page'
|
||||
? "Was soll verbessert werden?"
|
||||
: selectedElements.length > 0
|
||||
? `${selectedElements.length} Element${selectedElements.length > 1 ? 'e' : ''} ausgewählt - Verbesserungsvorschlag?`
|
||||
: "Element zuerst auswählen..."
|
||||
}
|
||||
required
|
||||
disabled={feedbackScope === 'element' && selectedElements.length === 0}
|
||||
/>
|
||||
<div className="flex justify-between items-center mt-0.5">
|
||||
{feedbackScope === 'element' && selectedElements.length > 0 && (
|
||||
<p className="text-xs text-blue-600">🎯 {selectedElements.length} Element{selectedElements.length > 1 ? 'e' : ''} ausgewählt</p>
|
||||
)}
|
||||
<p className={cn(
|
||||
"text-xs ml-auto",
|
||||
formData.suggestion.length > 450
|
||||
? "text-orange-600"
|
||||
: formData.suggestion.length > 480
|
||||
? "text-red-600"
|
||||
: "text-gray-500"
|
||||
)}>
|
||||
{formData.suggestion.length}/500
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<QuickSuggestions
|
||||
feedbackScope={feedbackScope}
|
||||
selectedElements={selectedElements}
|
||||
onQuickSuggestion={updateSuggestion}
|
||||
/>
|
||||
|
||||
<SuggestionTextarea
|
||||
ref={textareaRef}
|
||||
value={formData.suggestion}
|
||||
onChange={updateSuggestion}
|
||||
feedbackScope={feedbackScope}
|
||||
selectedElements={selectedElements}
|
||||
disabled={feedbackScope === 'element' && selectedElements.length === 0}
|
||||
error={submitError}
|
||||
/>
|
||||
|
||||
<div>
|
||||
<input
|
||||
type="text"
|
||||
id="contact"
|
||||
value={formData.contact || ''}
|
||||
onChange={handleContactChange}
|
||||
onChange={(e) => updateContact(e.target.value)}
|
||||
className="w-full px-2 py-1 border border-gray-300 rounded focus:outline-none focus:ring-1 focus:ring-green-500 focus:border-green-500 text-xs"
|
||||
placeholder="Name/E-Mail (optional)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{submitError && (
|
||||
<div className="text-red-600 text-xs bg-red-50 border border-red-200 rounded px-2 py-1">
|
||||
{submitError}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="flex space-x-1.5">
|
||||
<Button
|
||||
type="submit"
|
||||
@@ -517,11 +205,7 @@ export default function SuggestionButton() {
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
closePanelAndReset()
|
||||
}}
|
||||
onClick={closePanelAndReset}
|
||||
disabled={isSubmitting}
|
||||
className="px-2 py-1 text-xs rounded border-gray-300 hover:bg-gray-50"
|
||||
>
|
||||
@@ -563,7 +247,7 @@ export default function SuggestionButton() {
|
||||
}
|
||||
`}</style>
|
||||
|
||||
{/* Element Selection Overlay - shown when in selection mode */}
|
||||
{/* Element Selection Overlay */}
|
||||
{isElementSelectionMode && (
|
||||
<div
|
||||
data-element-selection-overlay
|
||||
@@ -584,7 +268,6 @@ export default function SuggestionButton() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Selected elements counter */}
|
||||
{selectedElements.length > 0 && (
|
||||
<div className="absolute top-20 left-4 bg-green-600 text-white px-3 py-2 rounded-lg shadow-lg text-sm font-medium">
|
||||
✅ {selectedElements.length} Element{selectedElements.length > 1 ? 'e' : ''} ausgewählt
|
||||
@@ -593,10 +276,7 @@ export default function SuggestionButton() {
|
||||
|
||||
<div className="absolute top-4 right-4 flex space-x-2">
|
||||
<button
|
||||
onClick={() => {
|
||||
setIsElementSelectionMode(false)
|
||||
// Keep the selected elements
|
||||
}}
|
||||
onClick={() => setIsElementSelectionMode(false)}
|
||||
className="bg-green-600 text-white px-3 py-2 rounded-lg shadow-lg text-sm font-medium hover:bg-green-700 transition-colors"
|
||||
>
|
||||
✅ Fertig ({selectedElements.length})
|
||||
@@ -614,7 +294,7 @@ export default function SuggestionButton() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Small Floating Button - only show when closed */}
|
||||
{/* Floating Button */}
|
||||
{!isExpanded && !isElementSelectionMode && isVisible && (
|
||||
<div className="fixed right-4 top-1/2 z-50 -translate-y-1/2">
|
||||
<button
|
||||
@@ -635,27 +315,19 @@ export default function SuggestionButton() {
|
||||
tabIndex={0}
|
||||
>
|
||||
<Edit3 className="w-5 h-5" />
|
||||
{/* Pulse effect when element selection is active */}
|
||||
{isElementSelectionMode && (
|
||||
<div className="absolute inset-0 rounded-full bg-blue-400 animate-ping opacity-20"></div>
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Backdrop for outside click closing - only when expanded */}
|
||||
{/* Backdrop */}
|
||||
{isExpanded && (
|
||||
<div
|
||||
className="fixed inset-0 bg-black bg-opacity-25 z-35 cursor-pointer"
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
closePanelAndReset()
|
||||
}}
|
||||
onClick={closePanelAndReset}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Expandable Side Panel - only render when expanded */}
|
||||
{/* Side Panel */}
|
||||
{isExpanded && (
|
||||
<div className="fixed right-0 top-1/2 -translate-y-1/2 z-40">
|
||||
<div
|
||||
@@ -664,6 +336,7 @@ export default function SuggestionButton() {
|
||||
aria-modal="true"
|
||||
aria-labelledby="suggestion-panel-title"
|
||||
aria-describedby="suggestion-panel-description"
|
||||
data-suggestion-panel
|
||||
className={cn(
|
||||
"bg-white shadow-2xl border border-gray-200 w-80 sm:w-96 rounded-l-2xl overflow-hidden flex flex-col",
|
||||
"fixed right-0 top-1/2 -translate-y-1/2 max-h-[70vh] h-auto",
|
||||
@@ -671,59 +344,53 @@ export default function SuggestionButton() {
|
||||
)}
|
||||
style={isElementSelectionMode ? { pointerEvents: 'auto' } : undefined}
|
||||
>
|
||||
{/* Header */}
|
||||
<div className="bg-gradient-to-r from-green-50 to-blue-50 border-b border-gray-200 px-4 py-3 flex-shrink-0">
|
||||
<div className="flex justify-between items-center">
|
||||
<div className="flex items-center space-x-2">
|
||||
<Edit3 className="w-4 h-4 text-green-600" />
|
||||
<h3 id="suggestion-panel-title" className="font-semibold text-gray-900 text-sm">Verbesserungen vorschlagen</h3>
|
||||
</div>
|
||||
<button
|
||||
ref={closeButtonRef}
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
closePanelAndReset()
|
||||
}}
|
||||
className="text-gray-400 hover:text-gray-600 transition-colors p-1 hover:bg-gray-100 rounded-full"
|
||||
aria-label="Panel schließen"
|
||||
type="button"
|
||||
>
|
||||
<X className="w-4 h-4" />
|
||||
</button>
|
||||
</div>
|
||||
<div id="suggestion-panel-description" className="mt-2 text-xs text-gray-600">
|
||||
Aktuelle Seite: <span className="font-medium text-gray-900">
|
||||
{currentPage.path === '/' ? 'Startseite' : currentPage.title || currentPage.path}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Panel Content - Scrollable */}
|
||||
<div className="flex-1 overflow-y-auto min-h-0">
|
||||
<div className="p-4 pb-2">
|
||||
{submitted ? (
|
||||
<SuccessMessage />
|
||||
) : (
|
||||
<SuggestionForm />
|
||||
)}
|
||||
</div>
|
||||
{/* Header */}
|
||||
<div className="bg-gradient-to-r from-green-50 to-blue-50 border-b border-gray-200 px-4 py-3 flex-shrink-0">
|
||||
<div className="flex justify-between items-center">
|
||||
<div className="flex items-center space-x-2">
|
||||
<Edit3 className="w-4 h-4 text-green-600" />
|
||||
<h3 id="suggestion-panel-title" className="font-semibold text-gray-900 text-sm">
|
||||
Verbesserungen vorschlagen
|
||||
</h3>
|
||||
</div>
|
||||
<button
|
||||
ref={closeButtonRef}
|
||||
onClick={closePanelAndReset}
|
||||
className="text-gray-400 hover:text-gray-600 transition-colors p-1 hover:bg-gray-100 rounded-full"
|
||||
aria-label="Panel schließen"
|
||||
type="button"
|
||||
>
|
||||
<X className="w-4 h-4" />
|
||||
</button>
|
||||
</div>
|
||||
<div id="suggestion-panel-description" className="mt-2 text-xs text-gray-600">
|
||||
Aktuelle Seite: <span className="font-medium text-gray-900">
|
||||
{currentPage.path === '/' ? 'Startseite' : currentPage.title || currentPage.path}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Footer with link */}
|
||||
<div className="border-t border-gray-200 px-4 py-3 bg-gray-50 flex-shrink-0">
|
||||
<Link
|
||||
href="/revamp-ux#wie-funktioniert"
|
||||
className="text-xs text-blue-600 hover:text-blue-800 underline flex items-center space-x-1 justify-center"
|
||||
>
|
||||
<Info className="w-3 h-3" />
|
||||
<span>Wie funktioniert's?</span>
|
||||
</Link>
|
||||
{/* Panel Content */}
|
||||
<div className="flex-1 overflow-y-auto min-h-0">
|
||||
<div className="p-4 pb-2">
|
||||
{submitted ? <SuccessMessage /> : <SuggestionForm />}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Footer */}
|
||||
<div className="border-t border-gray-200 px-4 py-3 bg-gray-50 flex-shrink-0">
|
||||
<Link
|
||||
href="/revamp-ux#wie-funktioniert"
|
||||
className="text-xs text-blue-600 hover:text-blue-800 underline flex items-center space-x-1 justify-center"
|
||||
>
|
||||
<Info className="w-3 h-3" />
|
||||
<span>Wie funktioniert's?</span>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
</>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user