mirror of
https://github.com/bitbaum/evig.git
synced 2026-12-03 20:27:02 +01:00
feat: add marketplace, ai-cms, services pages and UI component updates
New components and pages:
- src/components/dashboard/OnboardingChecklist: role-aware onboarding steps
- src/components/marketplace/{hooks,sections,modals}: full marketplace UI layer
including useAISearch hook, listing sections, and marketplace index exports
- src/app/ai-cms/: marketing page for the contextual website improvement system
(9 section components: Hero, Problem, Workflow, AccessControl, Features,
SuggestionTypes, Comparison, Status, CTA)
- src/app/services/: service pages (individual service routes)
- src/app/about/: about page
- scripts/db/migrations/004_ai_inventory_system.sql
- scripts/db/migrations/005_messaging_system.sql
Bug fixes:
- src/lib/constants.ts: restore SSOT imports from @/config/org instead of
inlining values (prior change had wrong SUPPORT_EMAIL fallback)
UI updates:
- Dashboard pages (main, seller, workshops): integrate OnboardingChecklist
- Admin layout/services: permission-gated service management
- MainLayout, ResponsiveHero: layout consistency improvements
- Service components (AppointmentBookingForm, ServiceCTA, ServiceFeatures,
ServicePricing, ServiceProcess): UI refinements
- ProjectCallToAction, ProjectHero, ProjectSection: project page components
- ProductManagement: admin product management improvements
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
9c82541177
commit
e920eb231d
50 files changed
+4471
-557
No files matched your search
@@ -0,0 +1,402 @@
|
||||
-- Migration: 004_ai_inventory_system
|
||||
-- Description: AI-powered inventory management system with automated data extraction
|
||||
|
||||
-- ============================================================================
|
||||
-- AI PRODUCT EXTRACTION SYSTEM
|
||||
-- ============================================================================
|
||||
|
||||
-- Create table for AI-extracted product data
|
||||
CREATE TABLE IF NOT EXISTS ai_extracted_products (
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
original_image_url TEXT,
|
||||
extracted_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
-- Basic product information
|
||||
product_name TEXT,
|
||||
product_name_confidence DECIMAL(3,2) CHECK (product_name_confidence >= 0 AND product_name_confidence <= 1),
|
||||
brand TEXT,
|
||||
brand_confidence DECIMAL(3,2) CHECK (brand_confidence >= 0 AND brand_confidence <= 1),
|
||||
model TEXT,
|
||||
model_confidence DECIMAL(3,2) CHECK (model_confidence >= 0 AND model_confidence <= 1),
|
||||
|
||||
-- Categorization
|
||||
category TEXT,
|
||||
category_confidence DECIMAL(3,2) CHECK (category_confidence >= 0 AND category_confidence <= 1),
|
||||
subcategory TEXT,
|
||||
subcategory_confidence DECIMAL(3,2) CHECK (subcategory_confidence >= 0 AND subcategory_confidence <= 1),
|
||||
|
||||
-- Pricing and condition
|
||||
estimated_price_chf DECIMAL(10,2),
|
||||
price_confidence DECIMAL(3,2) CHECK (price_confidence >= 0 AND price_confidence <= 1),
|
||||
condition TEXT CHECK (condition IN ('new', 'like_new', 'good', 'fair', 'poor', 'damaged')),
|
||||
condition_confidence DECIMAL(3,2) CHECK (condition_confidence >= 0 AND condition_confidence <= 1),
|
||||
|
||||
-- Technical specifications
|
||||
specifications JSONB DEFAULT '{}',
|
||||
specs_confidence DECIMAL(3,2) CHECK (specs_confidence >= 0 AND specs_confidence <= 1),
|
||||
|
||||
-- Additional metadata
|
||||
color TEXT,
|
||||
color_confidence DECIMAL(3,2) CHECK (color_confidence >= 0 AND color_confidence <= 1),
|
||||
material TEXT,
|
||||
material_confidence DECIMAL(3,2) CHECK (material_confidence >= 0 AND material_confidence <= 1),
|
||||
dimensions JSONB DEFAULT '{}', -- {width: 10, height: 20, depth: 5, unit: 'cm'}
|
||||
weight_grams INTEGER,
|
||||
weight_confidence DECIMAL(3,2) CHECK (weight_confidence >= 0 AND weight_confidence <= 1),
|
||||
|
||||
-- AI processing metadata
|
||||
ai_provider TEXT DEFAULT 'openai', -- 'openai', 'anthropic', 'google', etc.
|
||||
ai_model TEXT DEFAULT 'gpt-4-vision-preview',
|
||||
processing_time_ms INTEGER,
|
||||
total_confidence DECIMAL(3,2) CHECK (total_confidence >= 0 AND total_confidence <= 1),
|
||||
|
||||
-- Raw AI response for debugging/analysis
|
||||
raw_ai_response JSONB DEFAULT '{}',
|
||||
|
||||
-- User and processing status
|
||||
created_by UUID REFERENCES users(id),
|
||||
status TEXT DEFAULT 'pending_review' CHECK (status IN ('pending_review', 'approved', 'rejected', 'processed')),
|
||||
reviewed_by UUID REFERENCES users(id),
|
||||
reviewed_at TIMESTAMP WITH TIME ZONE,
|
||||
review_notes TEXT,
|
||||
|
||||
-- Integration fields
|
||||
kivitendo_article_number TEXT,
|
||||
medusa_product_id TEXT,
|
||||
marketplace_listing_id TEXT,
|
||||
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- ============================================================================
|
||||
-- SUSTAINABILITY SCORING SYSTEM
|
||||
-- ============================================================================
|
||||
|
||||
-- Create sustainability scoring table
|
||||
CREATE TABLE IF NOT EXISTS sustainability_scores (
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
product_id UUID REFERENCES ai_extracted_products(id) ON DELETE CASCADE,
|
||||
|
||||
-- Overall sustainability score (0-100)
|
||||
overall_score INTEGER CHECK (overall_score >= 0 AND overall_score <= 100),
|
||||
|
||||
-- Component scores
|
||||
environmental_score INTEGER CHECK (environmental_score >= 0 AND environmental_score <= 100),
|
||||
social_score INTEGER CHECK (social_score >= 0 AND social_score <= 100),
|
||||
economic_score INTEGER CHECK (economic_score >= 0 AND economic_score <= 100),
|
||||
|
||||
-- Detailed factors
|
||||
factors JSONB DEFAULT '{}', -- {recyclability: 85, energy_efficiency: 70, fair_trade: 60, ...}
|
||||
|
||||
-- AI analysis
|
||||
ai_analysis JSONB DEFAULT '{}',
|
||||
ai_provider TEXT DEFAULT 'openai',
|
||||
ai_model TEXT,
|
||||
|
||||
-- Recommendations
|
||||
recommendations TEXT[],
|
||||
improvement_suggestions TEXT[],
|
||||
|
||||
-- Metadata
|
||||
assessed_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
assessed_by TEXT DEFAULT 'ai', -- 'ai', 'expert', 'user'
|
||||
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- ============================================================================
|
||||
-- PRODUCT CATEGORIES AND ATTRIBUTES
|
||||
-- ============================================================================
|
||||
|
||||
-- Enhanced product categories table
|
||||
CREATE TABLE IF NOT EXISTS product_categories (
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
slug VARCHAR(100) NOT NULL UNIQUE,
|
||||
name VARCHAR(150) NOT NULL,
|
||||
description TEXT,
|
||||
parent_id UUID REFERENCES product_categories(id),
|
||||
level INTEGER DEFAULT 1, -- 1 = main category, 2 = subcategory, etc.
|
||||
|
||||
-- Display and SEO
|
||||
icon TEXT,
|
||||
color VARCHAR(7), -- hex color
|
||||
seo_title TEXT,
|
||||
seo_description TEXT,
|
||||
|
||||
-- Metadata
|
||||
is_active BOOLEAN DEFAULT true,
|
||||
sort_order INTEGER DEFAULT 0,
|
||||
ai_detection_keywords TEXT[], -- Keywords for AI recognition
|
||||
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- Product attributes (for structured data)
|
||||
CREATE TABLE IF NOT EXISTS product_attributes (
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
category_id UUID REFERENCES product_categories(id),
|
||||
name VARCHAR(100) NOT NULL,
|
||||
display_name VARCHAR(150),
|
||||
data_type VARCHAR(20) DEFAULT 'text' CHECK (data_type IN ('text', 'number', 'boolean', 'select', 'multiselect', 'date')),
|
||||
unit VARCHAR(20), -- 'cm', 'kg', 'GB', etc.
|
||||
is_required BOOLEAN DEFAULT false,
|
||||
is_filterable BOOLEAN DEFAULT false,
|
||||
options TEXT[] DEFAULT '{}', -- For select/multiselect types
|
||||
|
||||
-- AI extraction
|
||||
ai_extraction_prompt TEXT,
|
||||
ai_confidence_threshold DECIMAL(3,2) DEFAULT 0.7,
|
||||
|
||||
-- Display
|
||||
sort_order INTEGER DEFAULT 0,
|
||||
is_active BOOLEAN DEFAULT true,
|
||||
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
UNIQUE(category_id, name)
|
||||
);
|
||||
|
||||
-- ============================================================================
|
||||
-- INVENTORY MANAGEMENT
|
||||
-- ============================================================================
|
||||
|
||||
-- Inventory items table (links AI extraction to physical inventory)
|
||||
CREATE TABLE IF NOT EXISTS inventory_items (
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
ai_product_id UUID REFERENCES ai_extracted_products(id),
|
||||
|
||||
-- Legacy system integration
|
||||
kivitendo_article_number TEXT UNIQUE,
|
||||
legacy_csv_data JSONB DEFAULT '{}',
|
||||
|
||||
-- Physical inventory tracking
|
||||
location TEXT, -- Warehouse location
|
||||
quantity_available INTEGER DEFAULT 0,
|
||||
quantity_reserved INTEGER DEFAULT 0,
|
||||
quantity_sold INTEGER DEFAULT 0,
|
||||
|
||||
-- Status tracking
|
||||
status TEXT DEFAULT 'available' CHECK (status IN ('available', 'reserved', 'sold', 'damaged', 'missing')),
|
||||
condition_override TEXT CHECK (condition_override IN ('new', 'like_new', 'good', 'fair', 'poor', 'damaged')),
|
||||
condition_notes TEXT,
|
||||
|
||||
-- Pricing
|
||||
acquisition_cost_chf DECIMAL(10,2),
|
||||
selling_price_chf DECIMAL(10,2),
|
||||
min_selling_price_chf DECIMAL(10,2),
|
||||
|
||||
-- Marketplace integration
|
||||
medusa_product_id TEXT UNIQUE,
|
||||
marketplace_status TEXT DEFAULT 'draft' CHECK (marketplace_status IN ('draft', 'published', 'sold', 'archived')),
|
||||
|
||||
-- User assignments
|
||||
assigned_to UUID REFERENCES users(id), -- Who is responsible for this item
|
||||
assigned_at TIMESTAMP WITH TIME ZONE,
|
||||
assignment_notes TEXT,
|
||||
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- ============================================================================
|
||||
-- PRODUCT IMAGES AND MEDIA
|
||||
-- ============================================================================
|
||||
|
||||
-- Enhanced product images table
|
||||
CREATE TABLE IF NOT EXISTS product_images (
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
product_id UUID REFERENCES ai_extracted_products(id) ON DELETE CASCADE,
|
||||
|
||||
-- File information
|
||||
filename TEXT NOT NULL,
|
||||
original_filename TEXT,
|
||||
file_path TEXT NOT NULL,
|
||||
file_size_bytes INTEGER,
|
||||
mime_type TEXT,
|
||||
|
||||
-- AI analysis
|
||||
ai_description TEXT,
|
||||
ai_tags TEXT[],
|
||||
is_primary BOOLEAN DEFAULT false,
|
||||
|
||||
-- Image metadata
|
||||
width INTEGER,
|
||||
height INTEGER,
|
||||
dominant_colors TEXT[], -- ['#FF0000', '#00FF00', etc.]
|
||||
image_quality DECIMAL(3,2), -- AI-assessed quality score
|
||||
|
||||
-- Processing status
|
||||
upload_status TEXT DEFAULT 'processing' CHECK (upload_status IN ('uploading', 'processing', 'ready', 'failed')),
|
||||
processed_at TIMESTAMP WITH TIME ZONE,
|
||||
|
||||
-- User and permissions
|
||||
uploaded_by UUID REFERENCES users(id),
|
||||
is_public BOOLEAN DEFAULT true,
|
||||
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- ============================================================================
|
||||
-- AI PROCESSING LOGS AND ANALYTICS
|
||||
-- ============================================================================
|
||||
|
||||
-- AI processing logs for debugging and improvement
|
||||
CREATE TABLE IF NOT EXISTS ai_processing_logs (
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
product_id UUID REFERENCES ai_extracted_products(id),
|
||||
|
||||
-- Request details
|
||||
request_type TEXT NOT NULL, -- 'image_analysis', 'text_extraction', 'sustainability_scoring'
|
||||
provider TEXT NOT NULL,
|
||||
model TEXT NOT NULL,
|
||||
input_data JSONB DEFAULT '{}',
|
||||
|
||||
-- Response details
|
||||
response_data JSONB DEFAULT '{}',
|
||||
processing_time_ms INTEGER,
|
||||
tokens_used INTEGER,
|
||||
cost_cents DECIMAL(8,4),
|
||||
|
||||
-- Quality metrics
|
||||
confidence_score DECIMAL(3,2),
|
||||
accuracy_rating DECIMAL(3,2), -- User-provided feedback
|
||||
error_message TEXT,
|
||||
|
||||
-- Metadata
|
||||
user_id UUID REFERENCES users(id),
|
||||
ip_address INET,
|
||||
user_agent TEXT,
|
||||
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- ============================================================================
|
||||
-- MARKETPLACE INTEGRATION
|
||||
-- ============================================================================
|
||||
|
||||
-- Marketplace listings table
|
||||
CREATE TABLE IF NOT EXISTS marketplace_listings (
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
inventory_item_id UUID REFERENCES inventory_items(id) ON DELETE CASCADE,
|
||||
|
||||
-- Listing details
|
||||
title TEXT NOT NULL,
|
||||
description TEXT,
|
||||
price_chf DECIMAL(10,2) NOT NULL,
|
||||
|
||||
-- Platform integration
|
||||
platform TEXT NOT NULL, -- 'medusa', 'external_api', etc.
|
||||
platform_listing_id TEXT,
|
||||
platform_url TEXT,
|
||||
|
||||
-- Status and visibility
|
||||
status TEXT DEFAULT 'draft' CHECK (status IN ('draft', 'published', 'sold', 'paused', 'expired')),
|
||||
is_featured BOOLEAN DEFAULT false,
|
||||
views_count INTEGER DEFAULT 0,
|
||||
favorites_count INTEGER DEFAULT 0,
|
||||
|
||||
-- Sales tracking
|
||||
sold_at TIMESTAMP WITH TIME ZONE,
|
||||
sold_price_chf DECIMAL(10,2),
|
||||
buyer_info JSONB DEFAULT '{}', -- Anonymized buyer data
|
||||
|
||||
-- Metadata
|
||||
published_at TIMESTAMP WITH TIME ZONE,
|
||||
expires_at TIMESTAMP WITH TIME ZONE,
|
||||
created_by UUID REFERENCES users(id),
|
||||
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- ============================================================================
|
||||
-- INDEXES FOR PERFORMANCE
|
||||
-- ============================================================================
|
||||
|
||||
-- AI extracted products indexes
|
||||
CREATE INDEX IF NOT EXISTS idx_ai_products_status ON ai_extracted_products(status);
|
||||
CREATE INDEX IF NOT EXISTS idx_ai_products_brand ON ai_extracted_products(brand);
|
||||
CREATE INDEX IF NOT EXISTS idx_ai_products_category ON ai_extracted_products(category);
|
||||
CREATE INDEX IF NOT EXISTS idx_ai_products_created_by ON ai_extracted_products(created_by);
|
||||
CREATE INDEX IF NOT EXISTS idx_ai_products_kivitendo ON ai_extracted_products(kivitendo_article_number);
|
||||
|
||||
-- Inventory items indexes
|
||||
CREATE INDEX IF NOT EXISTS idx_inventory_status ON inventory_items(status);
|
||||
CREATE INDEX IF NOT EXISTS idx_inventory_location ON inventory_items(location);
|
||||
CREATE INDEX IF NOT EXISTS idx_inventory_kivitendo ON inventory_items(kivitendo_article_number);
|
||||
CREATE INDEX IF NOT EXISTS idx_inventory_assigned_to ON inventory_items(assigned_to);
|
||||
|
||||
-- Product categories indexes
|
||||
CREATE INDEX IF NOT EXISTS idx_categories_parent ON product_categories(parent_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_categories_level ON product_categories(level);
|
||||
CREATE INDEX IF NOT EXISTS idx_categories_active ON product_categories(is_active);
|
||||
|
||||
-- Marketplace listings indexes
|
||||
CREATE INDEX IF NOT EXISTS idx_listings_status ON marketplace_listings(status);
|
||||
CREATE INDEX IF NOT EXISTS idx_listings_platform ON marketplace_listings(platform);
|
||||
CREATE INDEX IF NOT EXISTS idx_listings_created_by ON marketplace_listings(created_by);
|
||||
|
||||
-- ============================================================================
|
||||
-- UPDATED AT TRIGGERS
|
||||
-- ============================================================================
|
||||
|
||||
-- Add updated_at triggers for new tables
|
||||
DO $$
|
||||
DECLARE
|
||||
tbl_name text;
|
||||
trigger_name text;
|
||||
BEGIN
|
||||
-- List of tables that need updated_at triggers
|
||||
FOR tbl_name IN
|
||||
SELECT unnest(ARRAY[
|
||||
'ai_extracted_products', 'sustainability_scores', 'product_categories',
|
||||
'product_attributes', 'inventory_items', 'product_images',
|
||||
'ai_processing_logs', 'marketplace_listings'
|
||||
])
|
||||
LOOP
|
||||
trigger_name := 'update_' || tbl_name || '_updated_at';
|
||||
|
||||
IF EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = tbl_name) AND
|
||||
EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name = tbl_name AND column_name = 'updated_at') THEN
|
||||
IF NOT EXISTS (SELECT 1 FROM pg_trigger WHERE tgname = trigger_name) THEN
|
||||
EXECUTE format('CREATE TRIGGER %I BEFORE UPDATE ON %I FOR EACH ROW EXECUTE FUNCTION update_updated_at_column();', trigger_name, tbl_name);
|
||||
END IF;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END $$;
|
||||
|
||||
-- ============================================================================
|
||||
-- DEFAULT DATA INSERTION
|
||||
-- ============================================================================
|
||||
|
||||
-- Insert default product categories
|
||||
INSERT INTO product_categories (slug, name, description, level, icon, color, ai_detection_keywords) VALUES
|
||||
('electronics', 'Elektronik', 'Computer, Smartphones, Tablets und Zubehör', 1, 'computer', '#3B82F6', ARRAY['computer', 'laptop', 'smartphone', 'tablet', 'elektronik', 'electronic']),
|
||||
('components', 'Computer-Komponenten', 'CPUs, RAM, Festplatten, Mainboards', 2, 'cpu', '#10B981', ARRAY['ram', 'cpu', 'motherboard', 'ssd', 'hdd', 'grafikkarte', 'graphics card']),
|
||||
('peripherals', 'Peripheriegeräte', 'Monitore, Tastaturen, Mäuse, Drucker', 2, 'monitor', '#F59E0B', ARRAY['monitor', 'keyboard', 'mouse', 'printer', 'tastatur', 'maus', 'bildschirm']),
|
||||
('networking', 'Netzwerk', 'Router, Switches, Netzwerkkarten', 2, 'wifi', '#8B5CF6', ARRAY['router', 'switch', 'network', 'netzwerk', 'wifi', 'ethernet']),
|
||||
('audio', 'Audio', 'Lautsprecher, Kopfhörer, Mikrofone', 2, 'headphones', '#EF4444', ARRAY['speaker', 'headphone', 'microphone', 'audio', 'lautsprecher', 'kopfhörer']),
|
||||
('office', 'Büroartikel', 'Büromaterial, Organisation, Büroelektronik', 1, 'briefcase', '#6B7280', ARRAY['office', 'büro', 'printer', 'scanner', 'kopierer'])
|
||||
ON CONFLICT (slug) DO NOTHING;
|
||||
|
||||
-- Insert default product attributes for electronics category
|
||||
INSERT INTO product_attributes (category_id, name, display_name, data_type, unit, is_required, is_filterable, options, ai_extraction_prompt) VALUES
|
||||
((SELECT id FROM product_categories WHERE slug = 'electronics'), 'brand', 'Marke', 'text', NULL, true, true, '{}', 'Extract the brand/manufacturer name from the product image and text'),
|
||||
((SELECT id FROM product_categories WHERE slug = 'electronics'), 'model', 'Modell', 'text', NULL, false, true, '{}', 'Extract the model number or name from the product'),
|
||||
((SELECT id FROM product_categories WHERE slug = 'electronics'), 'color', 'Farbe', 'text', NULL, false, true, '{}', 'Identify the primary color of the product'),
|
||||
((SELECT id FROM product_categories WHERE slug = 'electronics'), 'condition', 'Zustand', 'select', NULL, true, true, ARRAY['new', 'like_new', 'good', 'fair', 'poor'], 'Assess the physical condition of the product'),
|
||||
((SELECT id FROM product_categories WHERE slug = 'electronics'), 'weight_grams', 'Gewicht', 'number', 'g', false, false, '{}', 'Estimate the weight of the product in grams')
|
||||
ON CONFLICT (category_id, name) DO NOTHING;
|
||||
|
||||
-- Insert attributes for computer components
|
||||
INSERT INTO product_attributes (category_id, name, display_name, data_type, unit, is_required, is_filterable, ai_extraction_prompt) VALUES
|
||||
((SELECT id FROM product_categories WHERE slug = 'components'), 'capacity', 'Kapazität', 'number', 'GB', false, true, 'Extract storage capacity for drives or memory size for RAM'),
|
||||
((SELECT id FROM product_categories WHERE slug = 'components'), 'speed', 'Geschwindigkeit', 'text', NULL, false, true, 'Extract speed specifications (MHz, GHz, etc.)'),
|
||||
((SELECT id FROM product_categories WHERE slug = 'components'), 'interface', 'Schnittstelle', 'text', NULL, false, true, 'Extract interface type (SATA, PCIe, DDR4, etc.)'),
|
||||
((SELECT id FROM product_categories WHERE slug = 'components'), 'form_factor', 'Formfaktor', 'text', NULL, false, false, 'Identify the physical form factor (2.5", DIMM, etc.)')
|
||||
ON CONFLICT (category_id, name) DO NOTHING;
|
||||
@@ -0,0 +1,298 @@
|
||||
-- Migration: 005_messaging_system
|
||||
-- Description: Real-time messaging system for buyer-seller and customer-repairer communication
|
||||
|
||||
-- ============================================================================
|
||||
-- MESSAGING SYSTEM
|
||||
-- ============================================================================
|
||||
|
||||
-- Conversations table - represents a conversation thread
|
||||
CREATE TABLE IF NOT EXISTS conversations (
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
title TEXT, -- Optional title for the conversation
|
||||
type TEXT NOT NULL CHECK (type IN ('direct', 'appointment', 'marketplace', 'service')),
|
||||
context_id TEXT, -- ID of related entity (appointment_id, marketplace_listing_id, etc.)
|
||||
|
||||
-- Participants
|
||||
participant_1 UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
participant_2 UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
|
||||
-- Metadata
|
||||
last_message_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
last_message_preview TEXT,
|
||||
unread_count_1 INTEGER DEFAULT 0, -- Unread messages for participant_1
|
||||
unread_count_2 INTEGER DEFAULT 0, -- Unread messages for participant_2
|
||||
|
||||
-- Status
|
||||
is_active BOOLEAN DEFAULT true,
|
||||
archived_by_1 BOOLEAN DEFAULT false,
|
||||
archived_by_2 BOOLEAN DEFAULT false,
|
||||
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
-- Ensure participants are different and ordered consistently
|
||||
CONSTRAINT different_participants CHECK (participant_1 != participant_2),
|
||||
CONSTRAINT ordered_participants CHECK (participant_1 < participant_2),
|
||||
|
||||
UNIQUE(participant_1, participant_2, type, context_id)
|
||||
);
|
||||
|
||||
-- Messages table - individual messages within conversations
|
||||
CREATE TABLE IF NOT EXISTS messages (
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
conversation_id UUID NOT NULL REFERENCES conversations(id) ON DELETE CASCADE,
|
||||
|
||||
sender_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
recipient_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
|
||||
content TEXT NOT NULL,
|
||||
message_type TEXT DEFAULT 'text' CHECK (message_type IN ('text', 'image', 'file', 'system')),
|
||||
|
||||
-- Attachments (optional)
|
||||
attachment_url TEXT,
|
||||
attachment_name TEXT,
|
||||
attachment_size INTEGER,
|
||||
|
||||
-- Status
|
||||
is_read BOOLEAN DEFAULT false,
|
||||
read_at TIMESTAMP WITH TIME ZONE,
|
||||
|
||||
-- Delivery status
|
||||
delivery_status TEXT DEFAULT 'sent' CHECK (delivery_status IN ('sent', 'delivered', 'read', 'failed')),
|
||||
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- Message reactions (optional feature)
|
||||
CREATE TABLE IF NOT EXISTS message_reactions (
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
message_id UUID NOT NULL REFERENCES messages(id) ON DELETE CASCADE,
|
||||
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
reaction TEXT NOT NULL, -- emoji or reaction type
|
||||
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
UNIQUE(message_id, user_id, reaction)
|
||||
);
|
||||
|
||||
-- ============================================================================
|
||||
-- NOTIFICATION SYSTEM INTEGRATION
|
||||
-- ============================================================================
|
||||
|
||||
-- Notification preferences for users
|
||||
CREATE TABLE IF NOT EXISTS user_notification_preferences (
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
|
||||
-- Email notifications
|
||||
email_new_messages BOOLEAN DEFAULT true,
|
||||
email_appointment_updates BOOLEAN DEFAULT true,
|
||||
email_marketplace_updates BOOLEAN DEFAULT true,
|
||||
|
||||
-- In-app notifications
|
||||
in_app_messages BOOLEAN DEFAULT true,
|
||||
in_app_appointments BOOLEAN DEFAULT true,
|
||||
in_app_marketplace BOOLEAN DEFAULT true,
|
||||
|
||||
-- SMS notifications (for urgent matters)
|
||||
sms_urgent_messages BOOLEAN DEFAULT false,
|
||||
sms_appointment_reminders BOOLEAN DEFAULT false,
|
||||
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
UNIQUE(user_id)
|
||||
);
|
||||
|
||||
-- Notification history
|
||||
CREATE TABLE IF NOT EXISTS notifications (
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
|
||||
type TEXT NOT NULL CHECK (type IN ('message', 'appointment', 'marketplace', 'system', 'marketing')),
|
||||
title TEXT NOT NULL,
|
||||
content TEXT NOT NULL,
|
||||
|
||||
-- Related entity
|
||||
related_type TEXT, -- 'conversation', 'appointment', 'marketplace_listing', etc.
|
||||
related_id TEXT,
|
||||
|
||||
-- Delivery methods
|
||||
sent_email BOOLEAN DEFAULT false,
|
||||
sent_sms BOOLEAN DEFAULT false,
|
||||
sent_in_app BOOLEAN DEFAULT false,
|
||||
|
||||
-- Status
|
||||
is_read BOOLEAN DEFAULT false,
|
||||
read_at TIMESTAMP WITH TIME ZONE,
|
||||
|
||||
-- Scheduling (for delayed notifications)
|
||||
scheduled_for TIMESTAMP WITH TIME ZONE,
|
||||
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- ============================================================================
|
||||
-- INDEXES FOR PERFORMANCE
|
||||
-- ============================================================================
|
||||
|
||||
-- Conversation indexes
|
||||
CREATE INDEX IF NOT EXISTS idx_conversations_participants ON conversations(participant_1, participant_2);
|
||||
CREATE INDEX IF NOT EXISTS idx_conversations_type_context ON conversations(type, context_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_conversations_last_message ON conversations(last_message_at DESC);
|
||||
CREATE INDEX IF NOT EXISTS idx_conversations_active ON conversations(is_active);
|
||||
|
||||
-- Message indexes
|
||||
CREATE INDEX IF NOT EXISTS idx_messages_conversation ON messages(conversation_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_messages_sender ON messages(sender_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_messages_recipient ON messages(recipient_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_messages_created ON messages(created_at DESC);
|
||||
CREATE INDEX IF NOT EXISTS idx_messages_unread ON messages(recipient_id, is_read) WHERE is_read = false;
|
||||
|
||||
-- Notification indexes
|
||||
CREATE INDEX IF NOT EXISTS idx_notifications_user ON notifications(user_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_notifications_type ON notifications(type);
|
||||
CREATE INDEX IF NOT EXISTS idx_notifications_read ON notifications(is_read);
|
||||
CREATE INDEX IF NOT EXISTS idx_notifications_scheduled ON notifications(scheduled_for) WHERE scheduled_for IS NOT NULL;
|
||||
|
||||
-- ============================================================================
|
||||
-- UPDATED AT TRIGGERS
|
||||
-- ============================================================================
|
||||
|
||||
-- Add updated_at triggers for new tables
|
||||
DO $$
|
||||
DECLARE
|
||||
tbl_name text;
|
||||
trigger_name text;
|
||||
BEGIN
|
||||
-- List of tables that need updated_at triggers
|
||||
FOR tbl_name IN
|
||||
SELECT unnest(ARRAY[
|
||||
'conversations', 'messages', 'message_reactions',
|
||||
'user_notification_preferences', 'notifications'
|
||||
])
|
||||
LOOP
|
||||
trigger_name := 'update_' || tbl_name || '_updated_at';
|
||||
|
||||
IF EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = tbl_name) AND
|
||||
EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name = tbl_name AND column_name = 'updated_at') THEN
|
||||
IF NOT EXISTS (SELECT 1 FROM pg_trigger WHERE tgname = trigger_name) THEN
|
||||
EXECUTE format('CREATE TRIGGER %I BEFORE UPDATE ON %I FOR EACH ROW EXECUTE FUNCTION update_updated_at_column();', trigger_name, tbl_name);
|
||||
END IF;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END $$;
|
||||
|
||||
-- ============================================================================
|
||||
-- DEFAULT NOTIFICATION PREFERENCES
|
||||
-- ============================================================================
|
||||
|
||||
-- Insert default notification preferences for existing users
|
||||
INSERT INTO user_notification_preferences (
|
||||
user_id, email_new_messages, email_appointment_updates, email_marketplace_updates,
|
||||
in_app_messages, in_app_appointments, in_app_marketplace
|
||||
)
|
||||
SELECT
|
||||
id,
|
||||
true, true, true, -- email preferences
|
||||
true, true, true -- in-app preferences
|
||||
FROM users
|
||||
ON CONFLICT (user_id) DO NOTHING;
|
||||
|
||||
-- ============================================================================
|
||||
-- SYSTEM CONVERSATIONS FOR EXISTING APPOINTMENTS
|
||||
-- ============================================================================
|
||||
|
||||
-- Create conversations for existing service appointments
|
||||
INSERT INTO conversations (
|
||||
title,
|
||||
type,
|
||||
context_id,
|
||||
participant_1,
|
||||
participant_2,
|
||||
last_message_at,
|
||||
last_message_preview
|
||||
)
|
||||
SELECT
|
||||
CONCAT('Service: ', st.name),
|
||||
'appointment',
|
||||
sa.id::text,
|
||||
-- Ensure consistent ordering of participants
|
||||
CASE WHEN sa.user_id < '00000000-0000-0000-0000-000000000000'::uuid THEN sa.user_id ELSE '00000000-0000-0000-0000-000000000000'::uuid END,
|
||||
CASE WHEN sa.user_id < '00000000-0000-0000-0000-000000000000'::uuid THEN '00000000-0000-0000-0000-000000000000'::uuid ELSE sa.user_id END,
|
||||
sa.created_at,
|
||||
COALESCE(sa.description, 'Neue Service-Anfrage')
|
||||
FROM service_appointments sa
|
||||
JOIN service_types st ON sa.service_type_id = st.id
|
||||
-- Only create if participants are different (avoid self-conversations)
|
||||
WHERE sa.user_id != '00000000-0000-0000-0000-000000000000'::uuid
|
||||
ON CONFLICT (participant_1, participant_2, type, context_id) DO NOTHING;
|
||||
|
||||
-- ============================================================================
|
||||
-- HELPER FUNCTIONS
|
||||
-- ============================================================================
|
||||
|
||||
-- Function to update conversation metadata when a new message is added
|
||||
CREATE OR REPLACE FUNCTION update_conversation_on_message()
|
||||
RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
-- Update conversation's last message info
|
||||
UPDATE conversations
|
||||
SET
|
||||
last_message_at = NEW.created_at,
|
||||
last_message_preview = LEFT(NEW.content, 100),
|
||||
-- Update unread counts
|
||||
unread_count_1 = CASE
|
||||
WHEN participant_1 = NEW.recipient_id THEN unread_count_1 + 1
|
||||
ELSE unread_count_1
|
||||
END,
|
||||
unread_count_2 = CASE
|
||||
WHEN participant_2 = NEW.recipient_id THEN unread_count_2 + 1
|
||||
ELSE unread_count_2
|
||||
END,
|
||||
updated_at = CURRENT_TIMESTAMP
|
||||
WHERE id = NEW.conversation_id;
|
||||
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
-- Trigger to automatically update conversation when messages are added
|
||||
CREATE TRIGGER trigger_update_conversation_on_message
|
||||
AFTER INSERT ON messages
|
||||
FOR EACH ROW
|
||||
EXECUTE FUNCTION update_conversation_on_message();
|
||||
|
||||
-- Function to reset unread count when messages are marked as read
|
||||
CREATE OR REPLACE FUNCTION reset_unread_count()
|
||||
RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
IF NEW.is_read = true AND OLD.is_read = false THEN
|
||||
UPDATE conversations
|
||||
SET
|
||||
unread_count_1 = CASE
|
||||
WHEN participant_1 = NEW.recipient_id THEN GREATEST(unread_count_1 - 1, 0)
|
||||
ELSE unread_count_1
|
||||
END,
|
||||
unread_count_2 = CASE
|
||||
WHEN participant_2 = NEW.recipient_id THEN GREATEST(unread_count_2 - 1, 0)
|
||||
ELSE unread_count_2
|
||||
END,
|
||||
updated_at = CURRENT_TIMESTAMP
|
||||
WHERE id = NEW.conversation_id;
|
||||
END IF;
|
||||
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
-- Trigger to reset unread count when messages are read
|
||||
CREATE TRIGGER trigger_reset_unread_count
|
||||
AFTER UPDATE OF is_read ON messages
|
||||
FOR EACH ROW
|
||||
EXECUTE FUNCTION reset_unread_count();
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,512 @@
|
||||
'use client'
|
||||
|
||||
import { useState } from 'react'
|
||||
import Image from 'next/image'
|
||||
import { ResponsiveHero } from '@/components/layout/ResponsiveHero'
|
||||
import AboutSubNav from '@/components/about/AboutSubNav'
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { IMPACT_METRICS, getEnvironmentalSummary, getSocialSummary, type ImpactMetric } from '@/data/impact-metrics'
|
||||
import { getDefaultValue, getDefaultNumeric } from '@/lib/org-numbers.defaults'
|
||||
// Simple Badge component replacement
|
||||
const Badge = ({ children, className = "" }: { children: React.ReactNode, className?: string }) => (
|
||||
<span className={`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${className}`}>
|
||||
{children}
|
||||
</span>
|
||||
)
|
||||
|
||||
// Simple Tabs replacement using state
|
||||
const SimpleTabs = ({
|
||||
tabs,
|
||||
defaultValue,
|
||||
children
|
||||
}: {
|
||||
tabs: { value: string, label: string, icon?: React.ReactNode }[],
|
||||
defaultValue: string,
|
||||
children: (value: string) => React.ReactNode
|
||||
}) => {
|
||||
const [activeTab, setActiveTab] = useState(defaultValue)
|
||||
|
||||
return (
|
||||
<div className="w-full">
|
||||
<div className="flex space-x-1 bg-gray-100 p-1 rounded-lg mb-6">
|
||||
{tabs.map((tab) => (
|
||||
<button
|
||||
key={tab.value}
|
||||
onClick={() => setActiveTab(tab.value)}
|
||||
className={`flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-colors flex-1 ${
|
||||
activeTab === tab.value
|
||||
? 'bg-white text-gray-900 shadow-sm'
|
||||
: 'text-gray-600 hover:text-gray-900'
|
||||
}`}
|
||||
>
|
||||
{tab.icon}
|
||||
{tab.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<div>
|
||||
{children(activeTab)}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
import {
|
||||
Heart,
|
||||
Leaf,
|
||||
Users,
|
||||
TrendingUp,
|
||||
Award,
|
||||
Target,
|
||||
CheckCircle,
|
||||
ArrowRight,
|
||||
Download,
|
||||
Calendar,
|
||||
MapPin
|
||||
} from 'lucide-react'
|
||||
import {
|
||||
EWasteProblemSection,
|
||||
ZeroWasteSolutionSection,
|
||||
CommunitySpaceSection
|
||||
} from '@/components/impact'
|
||||
|
||||
interface DonationMethod {
|
||||
id: string
|
||||
name: string
|
||||
description: string
|
||||
amount?: string
|
||||
icon: React.ReactNode
|
||||
benefits: string[]
|
||||
ctaText: string
|
||||
popular?: boolean
|
||||
}
|
||||
|
||||
export default function ImpactPageContent() {
|
||||
const [selectedDonationMethod, setSelectedDonationMethod] = useState<string | null>(null)
|
||||
const envSummary = getEnvironmentalSummary()
|
||||
const socialSummary = getSocialSummary()
|
||||
|
||||
const donationMethods: DonationMethod[] = [
|
||||
{
|
||||
id: 'monthly',
|
||||
name: 'Monatliche Spende',
|
||||
description: 'Regelmässige Unterstützung für nachhaltige Wirkung',
|
||||
amount: 'Ab CHF 20/Monat',
|
||||
icon: <Heart className="h-6 w-6" />,
|
||||
benefits: [
|
||||
'Kontinuierliche Finanzierung unserer Programme',
|
||||
'Planbare Ressourcen für langfristige Projekte',
|
||||
'Exklusive Updates über unsere Wirkung',
|
||||
'Einladungen zu besonderen Veranstaltungen'
|
||||
],
|
||||
ctaText: 'Monatlich spenden',
|
||||
popular: true
|
||||
},
|
||||
{
|
||||
id: 'one-time',
|
||||
name: 'Einmalige Spende',
|
||||
description: 'Direkte Unterstützung für spezifische Projekte',
|
||||
amount: 'Frei wählbar',
|
||||
icon: <Target className="h-6 w-6" />,
|
||||
benefits: [
|
||||
'Sofortige Wirkung für laufende Projekte',
|
||||
'Flexibilität bei der Spendenhöhe',
|
||||
'Spendenbescheinigung für Steuerzwecke',
|
||||
'Möglichkeit zur Projektbindung'
|
||||
],
|
||||
ctaText: 'Jetzt spenden'
|
||||
},
|
||||
{
|
||||
id: 'corporate',
|
||||
name: 'Unternehmenspartnerschaft',
|
||||
description: 'Strategische Partnerschaft für nachhaltige IT',
|
||||
amount: 'Ab CHF 5000/Jahr',
|
||||
icon: <Award className="h-6 w-6" />,
|
||||
benefits: [
|
||||
'Nachhaltigkeitsbericht für Ihr Unternehmen',
|
||||
'Mitarbeiter-Workshops zu nachhaltiger IT',
|
||||
'Logo-Platzierung auf unserer Website',
|
||||
'Jährlicher Impact-Report'
|
||||
],
|
||||
ctaText: 'Partner werden'
|
||||
},
|
||||
{
|
||||
id: 'equipment',
|
||||
name: 'Geräte-Spende',
|
||||
description: 'Spenden Sie funktionsfähige IT-Geräte',
|
||||
icon: <Leaf className="h-6 w-6" />,
|
||||
benefits: [
|
||||
'Steuerliche Absetzbarkeit der Geräte',
|
||||
'Professionelle Datenlöschung garantiert',
|
||||
'Nachhaltigkeitszertifikat für Ihr Unternehmen',
|
||||
'Sichtbare Wirkung durch Geräte-Tracking'
|
||||
],
|
||||
ctaText: 'Geräte spenden'
|
||||
}
|
||||
]
|
||||
|
||||
const getCategoryIcon = (category: ImpactMetric['category']) => {
|
||||
switch (category) {
|
||||
case 'environmental': return <Leaf className="h-5 w-5 text-green-600" />
|
||||
case 'social': return <Users className="h-5 w-5 text-blue-600" />
|
||||
case 'economic': return <TrendingUp className="h-5 w-5 text-purple-600" />
|
||||
}
|
||||
}
|
||||
|
||||
const getCategoryColor = (category: ImpactMetric['category']) => {
|
||||
switch (category) {
|
||||
case 'environmental': return 'bg-green-50 border-green-200'
|
||||
case 'social': return 'bg-blue-50 border-blue-200'
|
||||
case 'economic': return 'bg-purple-50 border-purple-200'
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<main className="min-h-screen">
|
||||
{/* Hero Section */}
|
||||
<ResponsiveHero
|
||||
title="Unsere messbare Wirkung"
|
||||
description="Entdecken Sie, wie RevampIT seit 2003 die Schweizer IT-Landschaft nachhaltig verändert – transparent, messbar und wirksam."
|
||||
/>
|
||||
|
||||
{/* Sub Navigation */}
|
||||
<AboutSubNav />
|
||||
|
||||
{/* E-Waste Problem Section */}
|
||||
<EWasteProblemSection />
|
||||
|
||||
{/* Zero-Waste Solution Section */}
|
||||
<ZeroWasteSolutionSection />
|
||||
|
||||
{/* Community Space Section */}
|
||||
<CommunitySpaceSection />
|
||||
|
||||
{/* Impact Overview */}
|
||||
<section className="py-16 px-4 max-w-7xl mx-auto">
|
||||
<div className="text-center mb-12">
|
||||
<h2 className="text-3xl font-bold mb-4">Warum Transparenz wichtig ist</h2>
|
||||
<p className="text-lg text-gray-600 max-w-3xl mx-auto">
|
||||
Als gemeinnütziger Verein legen wir grössten Wert auf Transparenz. Jede unserer Zahlen ist nachvollziehbar dokumentiert,
|
||||
damit Sie als Spender:in genau verstehen, wie Ihre Unterstützung wirkt.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Key Metrics Cards */}
|
||||
<div className="grid md:grid-cols-2 lg:grid-cols-3 gap-6 mb-12">
|
||||
{IMPACT_METRICS.map((metric) => (
|
||||
<Card key={metric.id} className={`${getCategoryColor(metric.category)} border-2`}>
|
||||
<CardHeader className="pb-3">
|
||||
<div className="flex items-center justify-between">
|
||||
{getCategoryIcon(metric.category)}
|
||||
{metric.verified && (
|
||||
<Badge className="bg-green-100 text-green-800">
|
||||
<CheckCircle className="h-3 w-3 mr-1" />
|
||||
Verifiziert
|
||||
</Badge>
|
||||
)}
|
||||
</div>
|
||||
<CardTitle className="text-2xl font-bold">{metric.value}</CardTitle>
|
||||
<CardDescription className="font-medium">{metric.title}</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p className="text-sm text-gray-600 mb-3">{metric.description}</p>
|
||||
<details className="text-xs text-gray-500">
|
||||
<summary className="cursor-pointer font-medium mb-2">Methodik & Berechnung</summary>
|
||||
<p className="mb-2">{metric.methodology}</p>
|
||||
<p className="text-gray-500">Letzte Aktualisierung: {metric.lastUpdated}</p>
|
||||
</details>
|
||||
</CardContent>
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Impact Stories */}
|
||||
<div className="bg-gray-50 rounded-lg p-8">
|
||||
<h3 className="text-2xl font-bold mb-6 text-center">Wirkung in Zahlen verstehen</h3>
|
||||
<SimpleTabs
|
||||
defaultValue="environmental"
|
||||
tabs={[
|
||||
{ value: 'environmental', label: 'Umwelt', icon: <Leaf className="h-4 w-4" /> },
|
||||
{ value: 'social', label: 'Sozial', icon: <Users className="h-4 w-4" /> },
|
||||
{ value: 'economic', label: 'Wirtschaftlich', icon: <TrendingUp className="h-4 w-4" /> }
|
||||
]}
|
||||
>
|
||||
{(activeTab) => (
|
||||
<>
|
||||
{activeTab === 'environmental' && (
|
||||
<div className="grid md:grid-cols-2 gap-6">
|
||||
<div>
|
||||
<h4 className="text-lg font-semibold mb-3">Umweltwirkung im Detail</h4>
|
||||
<ul className="space-y-2 text-sm">
|
||||
<li className="flex items-start gap-2">
|
||||
<CheckCircle className="h-4 w-4 text-green-600 mt-0.5 flex-shrink-0" />
|
||||
<span>Jedes gerettete Gerät spart durchschnittlich {envSummary.co2PerDevice}kg CO₂-Emissionen</span>
|
||||
</li>
|
||||
<li className="flex items-start gap-2">
|
||||
<CheckCircle className="h-4 w-4 text-green-600 mt-0.5 flex-shrink-0" />
|
||||
<span>Wir vermeiden {envSummary.ewastePreventedTons.toFixed(1)} Tonnen Elektronikschrott pro Jahr</span>
|
||||
</li>
|
||||
<li className="flex items-start gap-2">
|
||||
<CheckCircle className="h-4 w-4 text-green-600 mt-0.5 flex-shrink-0" />
|
||||
<span>{Math.round(envSummary.reuseRate * 100)}% unserer Geräte werden wiederverwendet statt recycelt</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div className="bg-white p-6 rounded-lg">
|
||||
<h5 className="font-semibold mb-3">Vergleich mit Neugeräten</h5>
|
||||
<div className="space-y-3 text-sm">
|
||||
<div className="flex justify-between">
|
||||
<span>Herstellung eines neuen Laptops:</span>
|
||||
<span className="font-semibold">{envSummary.co2ProductionKg}kg CO₂</span>
|
||||
</div>
|
||||
<div className="flex justify-between">
|
||||
<span>Refurbishment eines Geräts:</span>
|
||||
<span className="font-semibold text-green-600">{envSummary.co2RefurbishmentKg}kg CO₂</span>
|
||||
</div>
|
||||
<div className="flex justify-between border-t pt-2">
|
||||
<span>CO₂-Einsparung pro Gerät:</span>
|
||||
<span className="font-semibold text-green-600">{envSummary.co2PerDevice}kg</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{activeTab === 'social' && (
|
||||
<div className="grid md:grid-cols-2 gap-6">
|
||||
<div>
|
||||
<h4 className="text-lg font-semibold mb-3">Soziale Wirkung im Detail</h4>
|
||||
<ul className="space-y-2 text-sm">
|
||||
<li className="flex items-start gap-2">
|
||||
<CheckCircle className="h-4 w-4 text-blue-600 mt-0.5 flex-shrink-0" />
|
||||
<span>~{Math.round(socialSummary.internshipSuccessRate * 100)}% unserer Praktikant:innen finden IT-Jobs oder Weiterbildung</span>
|
||||
</li>
|
||||
<li className="flex items-start gap-2">
|
||||
<CheckCircle className="h-4 w-4 text-blue-600 mt-0.5 flex-shrink-0" />
|
||||
<span>~{socialSummary.careerReentries} berufliche Wiedereinstiege pro Jahr durch unser Programm</span>
|
||||
</li>
|
||||
<li className="flex items-start gap-2">
|
||||
<CheckCircle className="h-4 w-4 text-blue-600 mt-0.5 flex-shrink-0" />
|
||||
<span>{getDefaultValue('people_helped_total')} Menschen in nachhaltiger IT begleitet seit 2003</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div className="bg-white p-6 rounded-lg">
|
||||
<h5 className="font-semibold mb-3">Erfolgsgeschichten</h5>
|
||||
<div className="space-y-3 text-sm">
|
||||
<p>"Dank RevampIT habe ich nach 3 Jahren Arbeitslosigkeit wieder Fuss gefasst in der IT-Branche."</p>
|
||||
<p className="text-gray-500">- Sarah M., ehemalige Praktikantin</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{activeTab === 'economic' && (
|
||||
<div className="grid md:grid-cols-2 gap-6">
|
||||
<div>
|
||||
<h4 className="text-lg font-semibold mb-3">Wirtschaftliche Wirkung</h4>
|
||||
<ul className="space-y-2 text-sm">
|
||||
<li className="flex items-start gap-2">
|
||||
<CheckCircle className="h-4 w-4 text-purple-600 mt-0.5 flex-shrink-0" />
|
||||
<span>Kunden sparen durchschnittlich CHF {getDefaultNumeric('customer_savings_chf')} pro repariertem Gerät</span>
|
||||
</li>
|
||||
<li className="flex items-start gap-2">
|
||||
<CheckCircle className="h-4 w-4 text-purple-600 mt-0.5 flex-shrink-0" />
|
||||
<span>KMU profitieren von günstigen Open Source-Lösungen</span>
|
||||
</li>
|
||||
<li className="flex items-start gap-2">
|
||||
<CheckCircle className="h-4 w-4 text-purple-600 mt-0.5 flex-shrink-0" />
|
||||
<span>{getDefaultValue('team_size_community')} sinnvolle Arbeitsplätze in der Schweiz</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div className="bg-white p-6 rounded-lg">
|
||||
<h5 className="font-semibold mb-3">Wirtschaftlicher Impact</h5>
|
||||
<div className="space-y-3 text-sm">
|
||||
<div className="flex justify-between">
|
||||
<span>Durchschnittliche Reparaturkosten:</span>
|
||||
<span className="font-semibold">CHF {getDefaultNumeric('avg_repair_cost_chf')}</span>
|
||||
</div>
|
||||
<div className="flex justify-between">
|
||||
<span>Neugerät-Preis (vergleichbar):</span>
|
||||
<span className="font-semibold">CHF {getDefaultNumeric('new_device_comparison_chf')}</span>
|
||||
</div>
|
||||
<div className="flex justify-between border-t pt-2">
|
||||
<span>Einsparung pro Kunde:</span>
|
||||
<span className="font-semibold text-green-600">CHF {getDefaultNumeric('customer_savings_chf')}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</SimpleTabs>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Donation Methods */}
|
||||
<section className="py-16 bg-gray-50">
|
||||
<div className="max-w-7xl mx-auto px-4">
|
||||
<div className="text-center mb-12">
|
||||
<h2 className="text-3xl font-bold mb-4">Wie Sie uns unterstützen können</h2>
|
||||
<p className="text-lg text-gray-600 max-w-3xl mx-auto">
|
||||
Jede Unterstützung zählt und trägt direkt zu unserer Mission bei. Wählen Sie die für Sie passende Art der Unterstützung.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="grid md:grid-cols-2 gap-6 mb-8">
|
||||
{donationMethods.map((method) => (
|
||||
<Card
|
||||
key={method.id}
|
||||
className={`cursor-pointer transition-all hover:shadow-lg ${
|
||||
method.popular ? 'ring-2 ring-green-500 bg-green-50' : ''
|
||||
}`}
|
||||
onClick={() => setSelectedDonationMethod(method.id)}
|
||||
>
|
||||
<CardHeader>
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-3">
|
||||
{method.icon}
|
||||
<CardTitle className="text-xl">{method.name}</CardTitle>
|
||||
</div>
|
||||
{method.popular && (
|
||||
<Badge className="bg-green-600 text-white">Beliebt</Badge>
|
||||
)}
|
||||
</div>
|
||||
<CardDescription className="text-base">{method.description}</CardDescription>
|
||||
{method.amount && (
|
||||
<p className="text-sm font-medium text-green-600">{method.amount}</p>
|
||||
)}
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<ul className="space-y-2 mb-4">
|
||||
{method.benefits.map((benefit, index) => (
|
||||
<li key={index} className="flex items-start gap-2 text-sm">
|
||||
<CheckCircle className="h-4 w-4 text-green-600 mt-0.5 flex-shrink-0" />
|
||||
<span>{benefit}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
<Button className="w-full" variant={method.popular ? "default" : "outline"}>
|
||||
{method.ctaText}
|
||||
<ArrowRight className="h-4 w-4 ml-2" />
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Donation Impact Calculator */}
|
||||
<Card className="bg-white">
|
||||
<CardHeader>
|
||||
<CardTitle className="text-center">Ihre Spenden-Wirkung berechnen</CardTitle>
|
||||
<CardDescription className="text-center">
|
||||
Sehen Sie sofort, welche Wirkung Ihre Spende haben kann
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="grid md:grid-cols-3 gap-6 text-center">
|
||||
<div className="space-y-2">
|
||||
<p className="text-2xl font-bold text-green-600">CHF {getDefaultNumeric('donation_impact_laptop_chf')}</p>
|
||||
<p className="text-sm text-gray-600">Reparatur eines Laptops für eine Familie</p>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<p className="text-2xl font-bold text-green-600">CHF {getDefaultNumeric('donation_impact_internship_chf')}</p>
|
||||
<p className="text-sm text-gray-600">Ein Monat Praktikumsstelle für Wiedereinsteiger:in</p>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<p className="text-2xl font-bold text-green-600">CHF {getDefaultNumeric('donation_impact_data_recovery_chf')}</p>
|
||||
<p className="text-sm text-gray-600">Vollständige Datenrettung für KMU-Kunde</p>
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Transparency & Reports */}
|
||||
<section className="py-16 px-4 max-w-7xl mx-auto">
|
||||
<div className="text-center mb-12">
|
||||
<h2 className="text-3xl font-bold mb-4">Transparenz & Berichterstattung</h2>
|
||||
<p className="text-lg text-gray-600 max-w-3xl mx-auto">
|
||||
Wir berichten regelmässig über unsere Aktivitäten und Wirkung. Alle Dokumente sind öffentlich zugänglich.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="grid md:grid-cols-3 gap-6">
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle className="flex items-center gap-2">
|
||||
<Download className="h-5 w-5" />
|
||||
Jahresbericht 2023
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p className="text-sm text-gray-600 mb-4">
|
||||
Vollständiger Tätigkeitsbericht mit allen Kennzahlen und Aktivitäten des Jahres 2023.
|
||||
</p>
|
||||
<Button variant="outline" className="w-full">
|
||||
PDF herunterladen
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle className="flex items-center gap-2">
|
||||
<Calendar className="h-5 w-5" />
|
||||
Wirkungsbericht
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p className="text-sm text-gray-600 mb-4">
|
||||
Detaillierte Analyse unserer sozialen und ökologischen Wirkung mit Methodik-Erläuterungen.
|
||||
</p>
|
||||
<Button variant="outline" className="w-full">
|
||||
Bericht ansehen
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle className="flex items-center gap-2">
|
||||
<MapPin className="h-5 w-5" />
|
||||
Transparenz-Register
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p className="text-sm text-gray-600 mb-4">
|
||||
Öffentliches Register aller Spenden und wie diese verwendet wurden.
|
||||
</p>
|
||||
<Button variant="outline" className="w-full">
|
||||
Register öffnen
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Call to Action */}
|
||||
<section className="py-16 bg-green-600 text-white">
|
||||
<div className="max-w-4xl mx-auto text-center px-4">
|
||||
<h2 className="text-3xl font-bold mb-6">Gemeinsam mehr erreichen</h2>
|
||||
<p className="text-xl mb-8">
|
||||
Ihre Unterstützung macht den Unterschied. Jeder Beitrag, ob gross oder klein, hilft uns dabei,
|
||||
die Schweizer IT-Landschaft nachhaltiger zu gestalten und Menschen neue Chancen zu geben.
|
||||
</p>
|
||||
<div className="flex flex-col sm:flex-row gap-4 justify-center">
|
||||
<Button size="lg" className="bg-white text-green-600 hover:bg-gray-100">
|
||||
Jetzt spenden
|
||||
<Heart className="h-5 w-5 ml-2" />
|
||||
</Button>
|
||||
<Button size="lg" variant="outline-light">
|
||||
Kontakt aufnehmen
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
+11
-21
@@ -9,9 +9,6 @@ import { redirect } from 'next/navigation'
|
||||
import { auth } from '@/auth'
|
||||
import { getAccessibleSections, isSuperAdmin, type AdminSection } from '@/lib/permissions'
|
||||
import { AdminLayoutClient } from './AdminLayoutClient'
|
||||
import AppShell from '@/components/layout/AppShell'
|
||||
import { NextIntlClientProvider } from 'next-intl'
|
||||
import { getMessages, getLocale } from 'next-intl/server'
|
||||
|
||||
export default async function AdminLayout({
|
||||
children,
|
||||
@@ -43,24 +40,17 @@ export default async function AdminLayout({
|
||||
redirect('/?error=no_admin_access')
|
||||
}
|
||||
|
||||
const messages = await getMessages()
|
||||
const locale = await getLocale()
|
||||
|
||||
return (
|
||||
<NextIntlClientProvider messages={messages} locale={locale}>
|
||||
<AppShell>
|
||||
<AdminLayoutClient
|
||||
user={{
|
||||
name: session.user.name ?? null,
|
||||
email: session.user.email,
|
||||
isStaff: session.user.isStaff,
|
||||
staffPermissions: session.user.staffPermissions,
|
||||
}}
|
||||
accessibleSections={accessibleSections}
|
||||
>
|
||||
{children}
|
||||
</AdminLayoutClient>
|
||||
</AppShell>
|
||||
</NextIntlClientProvider>
|
||||
<AdminLayoutClient
|
||||
user={{
|
||||
name: session.user.name ?? null,
|
||||
email: session.user.email,
|
||||
isStaff: session.user.isStaff,
|
||||
staffPermissions: session.user.staffPermissions,
|
||||
}}
|
||||
accessibleSections={accessibleSections}
|
||||
>
|
||||
{children}
|
||||
</AdminLayoutClient>
|
||||
)
|
||||
}
|
||||
+147
-12
@@ -10,16 +10,19 @@ import { auth } from '@/auth'
|
||||
import { redirect } from 'next/navigation'
|
||||
import { query } from '@/lib/auth/db'
|
||||
import { TABLE_NAMES } from '@/config/database'
|
||||
import { REPAIRER_PROFILE_TIER } from '@/config/repairer-status'
|
||||
import { CATEGORY_LABELS } from '@/config/service-categories'
|
||||
import { formatPriceCents } from '@/config/marketplace'
|
||||
import {
|
||||
Plus,
|
||||
Wrench,
|
||||
Users,
|
||||
Edit,
|
||||
Eye,
|
||||
CheckCircle,
|
||||
Star,
|
||||
Calendar,
|
||||
} from 'lucide-react'
|
||||
import AdminPageWrapper from '@/components/admin/AdminPageWrapper'
|
||||
import { ServiceListClient } from './ServiceListClient'
|
||||
import Heading from '@/components/admin/AdminHeading'
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: 'Dienstleistungen verwalten | RevampIT Admin',
|
||||
@@ -79,7 +82,7 @@ async function getServiceStats(): Promise<ServiceStats> {
|
||||
|
||||
try {
|
||||
const techResult = await query<{ count: string }>(
|
||||
`SELECT COUNT(*) as count FROM ${TABLE_NAMES.IT_HILFE_TECHNICIAN_PROFILES} WHERE is_active = true AND profile_tier = '${REPAIRER_PROFILE_TIER.COMMUNITY}'`
|
||||
`SELECT COUNT(*) as count FROM ${TABLE_NAMES.IT_HILFE_TECHNICIAN_PROFILES} WHERE is_active = true`
|
||||
)
|
||||
totalTechnicians = parseInt(techResult.rows[0]?.count || '0')
|
||||
} catch {
|
||||
@@ -107,6 +110,16 @@ async function getServices(): Promise<ServiceType[]> {
|
||||
}
|
||||
}
|
||||
|
||||
const formatPrice = formatPriceCents
|
||||
|
||||
function formatDuration(minutes: number | null): string {
|
||||
if (minutes === null) return '-'
|
||||
if (minutes < 60) return `${minutes} Min.`
|
||||
const hours = Math.floor(minutes / 60)
|
||||
const mins = minutes % 60
|
||||
if (mins === 0) return `${hours} Std.`
|
||||
return `${hours} Std. ${mins} Min.`
|
||||
}
|
||||
|
||||
export default async function AdminServicesPage() {
|
||||
const session = await auth()
|
||||
@@ -123,7 +136,7 @@ export default async function AdminServicesPage() {
|
||||
return (
|
||||
<AdminPageWrapper
|
||||
title="Dienstleistungen verwalten"
|
||||
description="Erstelle und verwalte die Service-Angebote"
|
||||
description="Erstellen und verwalten Sie Ihre Service-Angebote"
|
||||
icon={Wrench}
|
||||
iconColor="green"
|
||||
actions={
|
||||
@@ -179,23 +192,145 @@ export default async function AdminServicesPage() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Services Table with Search/Filters */}
|
||||
<ServiceListClient services={services} />
|
||||
{/* Services Table */}
|
||||
<div className="bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-100 dark:border-gray-700 overflow-hidden">
|
||||
{services.length > 0 ? (
|
||||
<div className="overflow-x-auto">
|
||||
<table className="w-full">
|
||||
<thead className="bg-gray-50 dark:bg-gray-700">
|
||||
<tr>
|
||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">
|
||||
Dienstleistung
|
||||
</th>
|
||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">
|
||||
Kategorie
|
||||
</th>
|
||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">
|
||||
Preis
|
||||
</th>
|
||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">
|
||||
Flags
|
||||
</th>
|
||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">
|
||||
Aktionen
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700">
|
||||
{services.map((service) => (
|
||||
<tr key={service.id} className="hover:bg-gray-50 dark:hover:bg-gray-700">
|
||||
<td className="px-6 py-4">
|
||||
<div>
|
||||
<div className="text-sm font-medium text-gray-900 dark:text-white">
|
||||
{service.name}
|
||||
</div>
|
||||
<div className="text-xs text-gray-500 dark:text-gray-400 font-mono">
|
||||
/{service.slug}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-6 py-4 whitespace-nowrap">
|
||||
<span className="text-sm text-gray-700 dark:text-gray-300">
|
||||
{service.category ? CATEGORY_LABELS[service.category as keyof typeof CATEGORY_LABELS] || service.category : '-'}
|
||||
</span>
|
||||
</td>
|
||||
<td className="px-6 py-4 whitespace-nowrap">
|
||||
<div className="text-sm font-medium text-gray-900 dark:text-white">
|
||||
{formatPrice(service.price_cents)}
|
||||
</div>
|
||||
<div className="text-xs text-gray-500 dark:text-gray-400">
|
||||
{formatDuration(service.duration_minutes)}
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-6 py-4 whitespace-nowrap">
|
||||
<div className="flex items-center gap-1.5">
|
||||
<span className={`inline-flex px-2 py-0.5 text-xs font-semibold rounded-full ${
|
||||
service.is_active
|
||||
? 'bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300'
|
||||
: 'bg-gray-100 text-gray-800 dark:bg-gray-900/30 dark:text-gray-300'
|
||||
}`}>
|
||||
{service.is_active ? 'Aktiv' : 'Inaktiv'}
|
||||
</span>
|
||||
{service.is_featured && (
|
||||
<span className="inline-flex items-center gap-0.5 px-2 py-0.5 text-xs font-semibold rounded-full bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300">
|
||||
<Star className="w-3 h-3" />
|
||||
</span>
|
||||
)}
|
||||
{service.is_bookable && (
|
||||
<span className="inline-flex items-center gap-0.5 px-2 py-0.5 text-xs font-semibold rounded-full bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300">
|
||||
<Calendar className="w-3 h-3" />
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-6 py-4 whitespace-nowrap text-sm font-medium">
|
||||
<div className="flex items-center gap-2">
|
||||
{service.is_featured && (
|
||||
<Link
|
||||
href={`/services/${service.slug}`}
|
||||
target="_blank"
|
||||
className="p-2.5 text-blue-600 hover:text-blue-900 dark:text-blue-400 dark:hover:text-blue-300 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded"
|
||||
title="Auf Website ansehen"
|
||||
>
|
||||
<Eye className="w-4 h-4" />
|
||||
</Link>
|
||||
)}
|
||||
<Link
|
||||
href={`/admin/services/${service.id}/edit`}
|
||||
className="p-2.5 text-green-600 hover:text-green-900 dark:text-green-400 dark:hover:text-green-300 hover:bg-green-50 dark:hover:bg-green-900/20 rounded"
|
||||
title="Bearbeiten"
|
||||
>
|
||||
<Edit className="w-4 h-4" />
|
||||
</Link>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
) : (
|
||||
<div className="text-center py-12">
|
||||
<Wrench className="w-12 h-12 text-gray-400 mx-auto mb-4" />
|
||||
<h3 className="text-lg font-medium text-gray-900 dark:text-white mb-2">
|
||||
Noch keine Dienstleistungen
|
||||
</h3>
|
||||
<p className="text-gray-600 dark:text-gray-400 mb-6">
|
||||
Erstellen Sie Ihre erste Dienstleistung, um Service-Termine anzubieten.
|
||||
</p>
|
||||
<Link
|
||||
href="/admin/services/new"
|
||||
className="inline-flex items-center gap-2 bg-green-600 hover:bg-green-700 text-white font-semibold px-6 py-3 rounded-lg transition-colors"
|
||||
>
|
||||
<Plus className="w-5 h-5" />
|
||||
Erste Dienstleistung erstellen
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Info Box */}
|
||||
{/* Quick Actions */}
|
||||
<div className="bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-xl p-6">
|
||||
<div className="flex items-start gap-4">
|
||||
<div className="w-10 h-10 bg-blue-100 dark:bg-blue-900/30 rounded-lg flex items-center justify-center flex-shrink-0">
|
||||
<Wrench className="w-5 h-5 text-blue-600" />
|
||||
</div>
|
||||
<div>
|
||||
<Heading level={3} className="font-medium text-blue-900 dark:text-blue-200">
|
||||
<h3 className="font-medium text-blue-900 dark:text-blue-200">
|
||||
Dienstleistungs-Verwaltung
|
||||
</Heading>
|
||||
<p className="text-sm text-blue-700 dark:text-blue-300 mt-1">
|
||||
Dienstleistungen sind die Kernkompetenz von RevampIT. Biete Reparaturen, Installationen,
|
||||
</h3>
|
||||
<p className="text-sm text-blue-700 dark:text-blue-300 mt-1 mb-3">
|
||||
Dienstleistungen sind die Kernkompetenz von RevampIT. Bieten Sie Reparaturen, Installationen,
|
||||
Beratungen und andere technische Services an. Kunden können online Termine buchen.
|
||||
</p>
|
||||
<div className="flex gap-3">
|
||||
<Link
|
||||
href="/admin/services/new"
|
||||
className="text-sm bg-blue-600 text-white px-3 py-1.5 rounded hover:bg-blue-700 transition-colors"
|
||||
>
|
||||
Dienstleistung erstellen
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import { Metadata } from 'next'
|
||||
import { HeroSection } from './sections/HeroSection'
|
||||
import { ProblemSection } from './sections/ProblemSection'
|
||||
import { WorkflowSection } from './sections/WorkflowSection'
|
||||
import { AccessControlSection } from './sections/AccessControlSection'
|
||||
import { FeaturesSection } from './sections/FeaturesSection'
|
||||
import { SuggestionTypesSection } from './sections/SuggestionTypesSection'
|
||||
import { ComparisonSection } from './sections/ComparisonSection'
|
||||
import { StatusSection } from './sections/StatusSection'
|
||||
import { CTASection } from './sections/CTASection'
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: 'Kontextuelle Website-Verbesserungen | RevampIT',
|
||||
description: 'Unser Verbesserungssystem ermöglicht es Nutzern, direkt auf jeder Seite Feedback zu geben. Eine moderne Alternative zu herkömmlichen Content-Management-Systemen.',
|
||||
keywords: ['Website Feedback', 'Content Management', 'User Feedback', 'Website Verbesserung', 'Community-driven Development'],
|
||||
}
|
||||
|
||||
export default function AICMSPage() {
|
||||
return (
|
||||
<div className="bg-white">
|
||||
<HeroSection />
|
||||
<ProblemSection />
|
||||
<WorkflowSection />
|
||||
<AccessControlSection />
|
||||
<FeaturesSection />
|
||||
<SuggestionTypesSection />
|
||||
<ComparisonSection />
|
||||
<StatusSection />
|
||||
<CTASection />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
export function AccessControlSection() {
|
||||
const roles = [
|
||||
{ role: 'Alle Nutzer', can: ['Vorschläge einreichen', 'Eigene Vorschläge verfolgen'], color: 'blue' },
|
||||
{ role: 'Registrierte Mitglieder', can: ['Vorschläge bewerten', 'Kommentare hinzufügen'], color: 'green' },
|
||||
{ role: 'Redaktion / Staff', can: ['Alle Vorschläge verwalten', 'Status setzen', 'Änderungen umsetzen'], color: 'purple' },
|
||||
]
|
||||
|
||||
const colorMap: Record<string, string> = {
|
||||
blue: 'bg-blue-50 border-blue-100 text-blue-900',
|
||||
green: 'bg-green-50 border-green-100 text-green-900',
|
||||
purple: 'bg-purple-50 border-purple-100 text-purple-900',
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="py-16 px-4 bg-white">
|
||||
<div className="max-w-4xl mx-auto">
|
||||
<h2 className="text-3xl font-bold text-neutral-900 text-center mb-4">
|
||||
Zugangskontrolle
|
||||
</h2>
|
||||
<p className="text-neutral-600 text-center mb-12">
|
||||
Das System funktioniert für alle — anonym oder eingeloggt. Mehr Rechte erhalten Mitglieder und Staff.
|
||||
</p>
|
||||
<div className="grid md:grid-cols-3 gap-6">
|
||||
{roles.map((r) => (
|
||||
<div key={r.role} className={`border rounded-lg p-6 ${colorMap[r.color]}`}>
|
||||
<h3 className="font-semibold mb-3">{r.role}</h3>
|
||||
<ul className="space-y-1">
|
||||
{r.can.map((item) => (
|
||||
<li key={item} className="text-sm flex items-start gap-2">
|
||||
<span className="mt-0.5">✓</span>
|
||||
{item}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import Link from 'next/link'
|
||||
|
||||
export function CTASection() {
|
||||
return (
|
||||
<section className="py-20 px-4 bg-green-600">
|
||||
<div className="max-w-2xl mx-auto text-center">
|
||||
<h2 className="text-3xl font-bold text-white mb-4">
|
||||
Machen Sie Ihre Website besser — gemeinsam
|
||||
</h2>
|
||||
<p className="text-green-100 mb-8">
|
||||
Registrieren Sie sich kostenlos und helfen Sie mit, revamp-it.ch kontinuierlich zu verbessern.
|
||||
</p>
|
||||
<div className="flex flex-col sm:flex-row gap-4 justify-center">
|
||||
<Link
|
||||
href="/auth/register"
|
||||
className="inline-flex items-center justify-center px-8 py-3 bg-white text-green-700 font-semibold rounded-lg hover:bg-green-50 transition-colors"
|
||||
>
|
||||
Kostenlos registrieren
|
||||
</Link>
|
||||
<Link
|
||||
href="/contact"
|
||||
className="inline-flex items-center justify-center px-8 py-3 border border-green-400 text-white font-semibold rounded-lg hover:bg-green-700 transition-colors"
|
||||
>
|
||||
Kontakt aufnehmen
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
export function ComparisonSection() {
|
||||
const rows = [
|
||||
{ feature: 'Kontext beim Feedback', classic: '❌ Manuell', new: '✅ Automatisch (URL, Screenshot)' },
|
||||
{ feature: 'Einreichung für Nutzer', classic: '❌ E-Mail / Formular', new: '✅ Direkt auf der Seite' },
|
||||
{ feature: 'Redaktioneller Aufwand', classic: '❌ Hoch', new: '✅ Niedrig (KI-Gruppierung)' },
|
||||
{ feature: 'Anonyme Einreichungen', classic: '✅ Möglich', new: '✅ Möglich' },
|
||||
{ feature: 'Benachrichtigungen', classic: '❌ Manuell', new: '✅ Automatisch' },
|
||||
{ feature: 'Datenschutz', classic: '✅ DSGVO-konform', new: '✅ DSGVO-konform' },
|
||||
]
|
||||
|
||||
return (
|
||||
<section className="py-16 px-4 bg-neutral-50">
|
||||
<div className="max-w-3xl mx-auto">
|
||||
<h2 className="text-3xl font-bold text-neutral-900 text-center mb-12">
|
||||
Klassisches CMS vs. Kontextuelles System
|
||||
</h2>
|
||||
<div className="overflow-x-auto">
|
||||
<table className="w-full text-sm">
|
||||
<thead>
|
||||
<tr className="border-b border-neutral-200">
|
||||
<th className="text-left py-3 pr-4 font-semibold text-neutral-700">Funktion</th>
|
||||
<th className="text-left py-3 px-4 font-semibold text-neutral-500">Klassisch</th>
|
||||
<th className="text-left py-3 pl-4 font-semibold text-green-700">Unser System</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{rows.map((r, i) => (
|
||||
<tr key={r.feature} className={i % 2 === 0 ? 'bg-white' : ''}>
|
||||
<td className="py-3 pr-4 text-neutral-700 font-medium">{r.feature}</td>
|
||||
<td className="py-3 px-4 text-neutral-500">{r.classic}</td>
|
||||
<td className="py-3 pl-4 text-neutral-800">{r.new}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
export function FeaturesSection() {
|
||||
const features = [
|
||||
{ icon: '🗺️', title: 'Seitenkontext automatisch', description: 'URL, Screenshot und Seitentitel werden beim Einreichen automatisch erfasst.' },
|
||||
{ icon: '🏷️', title: 'Kategorisierung', description: 'Vorschläge nach Typ: Fehler, Inhalt, Idee, Rechtschreibung, Barrierefreiheit.' },
|
||||
{ icon: '🔔', title: 'Benachrichtigungen', description: 'Nutzer werden informiert, wenn ihr Vorschlag umgesetzt oder kommentiert wird.' },
|
||||
{ icon: '🤖', title: 'KI-Zusammenfassung', description: 'Ähnliche Vorschläge werden automatisch gruppiert, um Duplikate zu reduzieren.' },
|
||||
{ icon: '📊', title: 'Auswertung', description: 'Das Staff-Dashboard zeigt Trends und häufig gemeldete Bereiche.' },
|
||||
{ icon: '🔒', title: 'Datenschutzkonform', description: 'Anonyme Einreichungen möglich — keine Pflichtangaben.' },
|
||||
]
|
||||
|
||||
return (
|
||||
<section className="py-16 px-4 bg-neutral-50">
|
||||
<div className="max-w-4xl mx-auto">
|
||||
<h2 className="text-3xl font-bold text-neutral-900 text-center mb-12">
|
||||
Funktionen
|
||||
</h2>
|
||||
<div className="grid sm:grid-cols-2 md:grid-cols-3 gap-6">
|
||||
{features.map((f) => (
|
||||
<div key={f.title} className="bg-white rounded-lg border border-neutral-200 p-6">
|
||||
<div className="text-3xl mb-3">{f.icon}</div>
|
||||
<h3 className="font-semibold text-neutral-900 mb-2">{f.title}</h3>
|
||||
<p className="text-neutral-600 text-sm">{f.description}</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import Link from 'next/link'
|
||||
|
||||
export function HeroSection() {
|
||||
return (
|
||||
<section className="bg-gradient-to-b from-green-50 to-white py-20 px-4">
|
||||
<div className="max-w-4xl mx-auto text-center">
|
||||
<span className="inline-block bg-green-100 text-green-800 text-sm font-medium px-3 py-1 rounded-full mb-6">
|
||||
Kontextuelles Feedback-System
|
||||
</span>
|
||||
<h1 className="text-4xl sm:text-5xl font-bold text-neutral-900 mb-6">
|
||||
Website-Verbesserungen direkt auf der Seite
|
||||
</h1>
|
||||
<p className="text-xl text-neutral-600 mb-8 max-w-2xl mx-auto">
|
||||
Unser Verbesserungssystem ermöglicht es Nutzern, Feedback direkt auf jeder Seite zu geben —
|
||||
ohne E-Mail, ohne Ticket, ohne Umwege. Eine moderne Alternative zu herkömmlichen CMS-Workflows.
|
||||
</p>
|
||||
<div className="flex flex-col sm:flex-row gap-4 justify-center">
|
||||
<Link
|
||||
href="/auth/register"
|
||||
className="inline-flex items-center justify-center px-6 py-3 bg-green-600 text-white font-semibold rounded-lg hover:bg-green-700 transition-colors"
|
||||
>
|
||||
Jetzt mitmachen
|
||||
</Link>
|
||||
<Link
|
||||
href="#workflow"
|
||||
className="inline-flex items-center justify-center px-6 py-3 border border-neutral-300 text-neutral-700 font-semibold rounded-lg hover:bg-neutral-50 transition-colors"
|
||||
>
|
||||
So funktioniert es
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
export function ProblemSection() {
|
||||
const problems = [
|
||||
{
|
||||
title: 'Feedback geht verloren',
|
||||
description: 'Nutzer finden einen Fehler, öffnen aber keine E-Mail. Der Fehler bleibt unbemerkt.',
|
||||
},
|
||||
{
|
||||
title: 'Fehlender Kontext',
|
||||
description: 'Bug-Reports ohne Screenshot oder URL sind kaum verwertbar.',
|
||||
},
|
||||
{
|
||||
title: 'Langsame Redaktionszyklen',
|
||||
description: 'Inhaltliche Änderungen brauchen Wochen, bis sie jemand einpflegt.',
|
||||
},
|
||||
]
|
||||
|
||||
return (
|
||||
<section className="py-16 px-4 bg-white">
|
||||
<div className="max-w-4xl mx-auto">
|
||||
<h2 className="text-3xl font-bold text-neutral-900 text-center mb-4">
|
||||
Das Problem mit klassischem Feedback
|
||||
</h2>
|
||||
<p className="text-neutral-600 text-center mb-12 max-w-2xl mx-auto">
|
||||
Traditionelle Rückmeldewege — E-Mail, Kontaktformular, Ticket-System — haben alle denselben
|
||||
Nachteil: sie trennen Kontext vom Problem.
|
||||
</p>
|
||||
<div className="grid md:grid-cols-3 gap-6">
|
||||
{problems.map((p) => (
|
||||
<div key={p.title} className="bg-red-50 border border-red-100 rounded-lg p-6">
|
||||
<h3 className="font-semibold text-red-900 mb-2">{p.title}</h3>
|
||||
<p className="text-red-700 text-sm">{p.description}</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
export function StatusSection() {
|
||||
return (
|
||||
<section className="py-16 px-4 bg-white">
|
||||
<div className="max-w-3xl mx-auto text-center">
|
||||
<h2 className="text-3xl font-bold text-neutral-900 mb-6">
|
||||
Aktueller Status
|
||||
</h2>
|
||||
<div className="inline-flex items-center gap-2 bg-yellow-50 border border-yellow-200 text-yellow-800 px-4 py-2 rounded-full text-sm font-medium mb-8">
|
||||
<span className="w-2 h-2 bg-yellow-500 rounded-full" />
|
||||
In Entwicklung — Beta
|
||||
</div>
|
||||
<p className="text-neutral-600 mb-8">
|
||||
Das Verbesserungssystem wird schrittweise auf revamp-it.ch eingeführt. Zuerst auf ausgewählten
|
||||
Seiten, dann auf der gesamten Plattform.
|
||||
</p>
|
||||
<div className="grid sm:grid-cols-3 gap-4 text-left">
|
||||
{[
|
||||
{ phase: 'Phase 1', label: 'Abgeschlossen', detail: 'Backend, Datenbank, Admin-Verwaltung', done: true },
|
||||
{ phase: 'Phase 2', label: 'Aktiv', detail: 'Frontend-Widget auf ausgewählten Seiten', done: false },
|
||||
{ phase: 'Phase 3', label: 'Geplant', detail: 'KI-Gruppierung, öffentliche Übersicht', done: false },
|
||||
].map((p) => (
|
||||
<div key={p.phase} className={`rounded-lg border p-4 ${p.done ? 'bg-green-50 border-green-200' : 'bg-neutral-50 border-neutral-200'}`}>
|
||||
<div className="text-xs font-medium text-neutral-500 uppercase tracking-wide mb-1">{p.phase}</div>
|
||||
<div className={`font-semibold mb-1 ${p.done ? 'text-green-800' : 'text-neutral-700'}`}>{p.label}</div>
|
||||
<div className="text-xs text-neutral-600">{p.detail}</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
export function SuggestionTypesSection() {
|
||||
const types = [
|
||||
{ label: 'Fehler', emoji: '🐛', description: 'Etwas funktioniert nicht oder zeigt falsche Informationen an.' },
|
||||
{ label: 'Inhalt', emoji: '✏️', description: 'Text ist veraltet, unvollständig oder missverständlich.' },
|
||||
{ label: 'Idee', emoji: '💡', description: 'Neue Funktion oder Verbesserungsvorschlag.' },
|
||||
{ label: 'Rechtschreibung', emoji: '🔤', description: 'Schreibfehler, Grammatik oder Formatierungsprobleme.' },
|
||||
{ label: 'Barrierefreiheit', emoji: '♿', description: 'Problem mit Screenreader, Kontrast oder Tastaturnavigation.' },
|
||||
{ label: 'Sonstiges', emoji: '📌', description: 'Allgemeines Feedback, das in keine Kategorie passt.' },
|
||||
]
|
||||
|
||||
return (
|
||||
<section className="py-16 px-4 bg-white">
|
||||
<div className="max-w-4xl mx-auto">
|
||||
<h2 className="text-3xl font-bold text-neutral-900 text-center mb-4">
|
||||
Arten von Vorschlägen
|
||||
</h2>
|
||||
<p className="text-neutral-600 text-center mb-10">
|
||||
Jede Einreichung wird einem Typ zugeordnet, damit das Team Prioritäten setzen kann.
|
||||
</p>
|
||||
<div className="grid sm:grid-cols-2 md:grid-cols-3 gap-4">
|
||||
{types.map((t) => (
|
||||
<div key={t.label} className="flex items-start gap-3 p-4 bg-neutral-50 rounded-lg border border-neutral-200">
|
||||
<span className="text-2xl flex-shrink-0">{t.emoji}</span>
|
||||
<div>
|
||||
<div className="font-semibold text-neutral-900 text-sm">{t.label}</div>
|
||||
<div className="text-neutral-600 text-xs mt-1">{t.description}</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
export function WorkflowSection() {
|
||||
const steps = [
|
||||
{ step: '1', title: 'Verbesserung entdecken', description: 'Nutzer klickt auf das Feedback-Symbol auf einer beliebigen Seite.' },
|
||||
{ step: '2', title: 'Vorschlag einreichen', description: 'Kurze Beschreibung, Typ (Fehler, Inhalt, Idee) und Screenshot werden automatisch erfasst.' },
|
||||
{ step: '3', title: 'Prüfung durch Redaktion', description: 'Das Team bewertet Vorschläge im Admin-Bereich und entscheidet über Umsetzung.' },
|
||||
{ step: '4', title: 'Umsetzung & Bestätigung', description: 'Umgesetzte Vorschläge werden als erledigt markiert — der Einreichende erhält eine Benachrichtigung.' },
|
||||
]
|
||||
|
||||
return (
|
||||
<section id="workflow" className="py-16 px-4 bg-neutral-50">
|
||||
<div className="max-w-4xl mx-auto">
|
||||
<h2 className="text-3xl font-bold text-neutral-900 text-center mb-12">
|
||||
So funktioniert das System
|
||||
</h2>
|
||||
<div className="relative">
|
||||
<div className="hidden md:block absolute left-8 top-8 bottom-8 w-px bg-green-200" />
|
||||
<div className="space-y-8">
|
||||
{steps.map((s) => (
|
||||
<div key={s.step} className="flex gap-6">
|
||||
<div className="flex-shrink-0 w-16 h-16 bg-green-600 text-white rounded-full flex items-center justify-center text-xl font-bold z-10">
|
||||
{s.step}
|
||||
</div>
|
||||
<div className="pt-3">
|
||||
<h3 className="font-semibold text-neutral-900 mb-1">{s.title}</h3>
|
||||
<p className="text-neutral-600 text-sm">{s.description}</p>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
+234
-178
@@ -2,209 +2,265 @@ import { Metadata } from 'next'
|
||||
import { auth } from '@/auth'
|
||||
import { redirect } from 'next/navigation'
|
||||
import Link from 'next/link'
|
||||
import { AlertCircle } from 'lucide-react'
|
||||
import { EmailVerificationBanner } from '@/components/dashboard/EmailVerificationBanner'
|
||||
import { DashboardCard } from '@/components/dashboard/DashboardCard'
|
||||
import {
|
||||
getAllDashboardCards,
|
||||
groupCardsByCategory,
|
||||
DASHBOARD_CATEGORIES,
|
||||
} from '@/config/dashboard'
|
||||
import Heading from '@/components/ui/Heading'
|
||||
import { query } from '@/lib/auth/db'
|
||||
import { TABLE_NAMES } from '@/config/database'
|
||||
import { BOOKING_STATUS } from '@/config/booking-status'
|
||||
import { formatDate } from '@/lib/date-formats'
|
||||
import { logger } from '@/lib/logger'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { ROLES } from '@/lib/constants'
|
||||
import { getCurrentUserRole } from '@/middleware/admin'
|
||||
import { getTextColor } from '@/lib/design-system'
|
||||
import { getTranslations, getLocale } from 'next-intl/server'
|
||||
import { ORG } from '@/config/org'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { EmailVerificationBanner } from '@/components/dashboard/EmailVerificationBanner'
|
||||
import { OnboardingChecklist } from '@/components/dashboard/OnboardingChecklist'
|
||||
import { isStaffEmail } from '@/lib/permissions'
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const locale = await getLocale()
|
||||
const t = await getTranslations({ locale, namespace: 'dashboard.meta' })
|
||||
return {
|
||||
title: `${t('dashboardTitle')} | ${ORG.name}`,
|
||||
description: t('dashboardDesc'),
|
||||
}
|
||||
}
|
||||
|
||||
interface MemberStatus {
|
||||
isMember: boolean
|
||||
memberSince: string | null
|
||||
memberType: string | null
|
||||
}
|
||||
|
||||
interface ActivityCounts {
|
||||
activeAppointments: number
|
||||
pendingQuotes: number
|
||||
}
|
||||
|
||||
|
||||
async function getMemberStatus(userId: string): Promise<MemberStatus> {
|
||||
try {
|
||||
const result = await query<{
|
||||
is_member: boolean
|
||||
member_since: string | null
|
||||
member_type: string | null
|
||||
}>(
|
||||
`SELECT is_member, member_since, member_type
|
||||
FROM ${TABLE_NAMES.USERS}
|
||||
WHERE id = $1`,
|
||||
[userId]
|
||||
)
|
||||
const row = result.rows[0]
|
||||
return {
|
||||
isMember: row?.is_member ?? false,
|
||||
memberSince: row?.member_since ?? null,
|
||||
memberType: row?.member_type ?? null,
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error('Failed to fetch member status', { userId, error })
|
||||
return { isMember: false, memberSince: null, memberType: null }
|
||||
}
|
||||
}
|
||||
|
||||
async function getActivityCounts(userId: string): Promise<ActivityCounts> {
|
||||
try {
|
||||
const result = await query<{
|
||||
active_appointments: string
|
||||
pending_quotes: string
|
||||
}>(
|
||||
`SELECT
|
||||
COUNT(CASE WHEN status NOT IN ('${BOOKING_STATUS.COMPLETED}', '${BOOKING_STATUS.CANCELLED}', '${BOOKING_STATUS.REJECTED}') THEN 1 END) AS active_appointments,
|
||||
COUNT(CASE WHEN status = '${BOOKING_STATUS.QUOTED}' THEN 1 END) AS pending_quotes
|
||||
FROM ${TABLE_NAMES.SERVICE_APPOINTMENTS}
|
||||
WHERE user_id = $1`,
|
||||
[userId]
|
||||
)
|
||||
return {
|
||||
activeAppointments: parseInt(result.rows[0]?.active_appointments ?? '0', 10),
|
||||
pendingQuotes: parseInt(result.rows[0]?.pending_quotes ?? '0', 10),
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error('Failed to fetch activity counts', { userId, error })
|
||||
return { activeAppointments: 0, pendingQuotes: 0 }
|
||||
}
|
||||
export const metadata: Metadata = {
|
||||
title: 'Dashboard | RevampIT',
|
||||
description: 'Verwalten Sie Ihr RevampIT-Konto, Workshops, Bestellungen und mehr.',
|
||||
}
|
||||
|
||||
export default async function DashboardPage() {
|
||||
const t = await getTranslations('dashboard.home')
|
||||
const session = await auth()
|
||||
|
||||
if (!session?.user) {
|
||||
redirect('/auth/login?callbackUrl=/dashboard')
|
||||
}
|
||||
|
||||
const [memberStatus, counts] = await Promise.all([
|
||||
getMemberStatus(session.user.id!),
|
||||
getActivityCounts(session.user.id!),
|
||||
])
|
||||
|
||||
const allCards = getAllDashboardCards({
|
||||
role: session.user.role ?? null,
|
||||
isStaff: session.user.isStaff,
|
||||
isSuperAdmin: false,
|
||||
})
|
||||
|
||||
// Inject live count badges on relevant cards
|
||||
const cardsWithBadges = allCards.map(card => {
|
||||
if (card.id === 'appointments' && counts.activeAppointments > 0)
|
||||
return { ...card, badge: t('activeBadge', { count: counts.activeAppointments }) }
|
||||
if (card.id === 'bookings' && counts.activeAppointments > 0)
|
||||
return { ...card, badge: t('activeBadge', { count: counts.activeAppointments }) }
|
||||
return card
|
||||
})
|
||||
|
||||
const grouped = groupCardsByCategory(cardsWithBadges)
|
||||
|
||||
const userName = session.user.name || session.user.email || t('unknownUser')
|
||||
const userRole = await getCurrentUserRole()
|
||||
|
||||
return (
|
||||
<main className="min-h-screen bg-neutral-50 dark:bg-neutral-900">
|
||||
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
|
||||
|
||||
{/* Email Verification Banner */}
|
||||
{!session.user.emailVerified && session.user.email && (
|
||||
<EmailVerificationBanner email={session.user.email} className="mb-6" />
|
||||
)}
|
||||
|
||||
{/* Header */}
|
||||
<div className="flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3 mb-6">
|
||||
<div>
|
||||
<Heading
|
||||
level={1}
|
||||
className={cn('text-2xl sm:text-3xl font-bold', getTextColor('neutral', 'primary'), 'dark:text-white')}
|
||||
>
|
||||
{t('welcomeBack', { name: userName })}
|
||||
</Heading>
|
||||
<p className={cn('mt-1 text-sm sm:text-base', getTextColor('neutral', 'muted'), 'dark:text-neutral-400')}>
|
||||
{t('subtitle')}
|
||||
</p>
|
||||
</div>
|
||||
{/* Onboarding Checklist */}
|
||||
<OnboardingChecklist
|
||||
role={userRole || ROLES.CUSTOMER}
|
||||
emailVerified={session.user.emailVerified ?? false}
|
||||
className="mb-6"
|
||||
/>
|
||||
|
||||
{/* Member status — inline badge, not full banner */}
|
||||
{memberStatus.isMember ? (
|
||||
<div className="inline-flex items-center gap-2 px-3 py-1.5 bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-300 rounded-full text-sm font-medium shrink-0">
|
||||
<span>🏅</span>
|
||||
<span>
|
||||
{memberStatus.memberType === 'regular' ? t('memberTypeRegular')
|
||||
: memberStatus.memberType === 'reduced' ? t('memberTypeReduced')
|
||||
: memberStatus.memberType === 'honorary' ? t('memberTypeHonorary')
|
||||
: t('memberFallback')}
|
||||
{memberStatus.memberSince && (
|
||||
<span className="font-normal opacity-75"> · {t('memberSince', { date: formatDate(memberStatus.memberSince) })}</span>
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
) : (
|
||||
<Link
|
||||
href="/mitglied-werden"
|
||||
className="shrink-0 text-sm text-blue-600 dark:text-blue-400 hover:underline font-medium"
|
||||
>
|
||||
{t('becomeMember')}
|
||||
</Link>
|
||||
)}
|
||||
<div className="mb-8">
|
||||
<h1 className={cn('text-3xl font-bold', getTextColor('neutral', 'primary'), 'dark:text-white')}>
|
||||
Willkommen zurück, {session.user.name || session.user.email}!
|
||||
</h1>
|
||||
<p className={cn('mt-2 text-sm sm:text-base', getTextColor('neutral', 'muted'), 'dark:text-neutral-400')}>
|
||||
Verwalten Sie Ihr Konto und entdecken Sie alle verfügbaren Funktionen.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Pending quotes alert */}
|
||||
{counts.pendingQuotes > 0 && (
|
||||
<div className="mb-6 p-4 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-700 rounded-lg flex items-center gap-3 text-amber-800 dark:text-amber-300">
|
||||
<AlertCircle className="h-5 w-5 shrink-0" />
|
||||
<span>{t('pendingQuotes', { count: counts.pendingQuotes })}</span>
|
||||
<Link
|
||||
href="/dashboard/bookings"
|
||||
className="ml-auto text-sm font-medium text-amber-900 dark:text-amber-200 hover:underline shrink-0"
|
||||
>
|
||||
{t('viewAlerts')}
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Grouped card sections */}
|
||||
{Array.from(grouped.entries()).map(([category, cards]) => {
|
||||
if (cards.length === 0) return null
|
||||
const categoryConfig = DASHBOARD_CATEGORIES[category]
|
||||
return (
|
||||
<section key={category} className="mb-8">
|
||||
<h2 className={cn(
|
||||
'text-xs font-semibold uppercase tracking-wider mb-3',
|
||||
getTextColor('neutral', 'muted'),
|
||||
'dark:text-neutral-500'
|
||||
)}>
|
||||
{categoryConfig.title}
|
||||
</h2>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
{cards.map(card => (
|
||||
<DashboardCard key={card.id} card={card} />
|
||||
))}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 sm:gap-6">
|
||||
{/* Profile Card */}
|
||||
<Link
|
||||
href="/dashboard/profile"
|
||||
className="bg-white dark:bg-neutral-800 rounded-lg shadow-sm border-2 border-neutral-200 dark:border-neutral-700 p-4 sm:p-6 hover:shadow-md transition-shadow"
|
||||
>
|
||||
<div className="flex items-center">
|
||||
<div className="w-12 h-12 bg-info-100 dark:bg-info-900 rounded-lg flex items-center justify-center">
|
||||
<span className="text-info-600 dark:text-info-400 font-semibold text-lg">
|
||||
{session.user.name?.charAt(0) || session.user.email?.charAt(0) || 'U'}
|
||||
</span>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
})}
|
||||
<div className="ml-4">
|
||||
<h3 className={cn('text-lg font-semibold', getTextColor('white', 'primary'), 'dark:text-white')}>
|
||||
Mein Profil
|
||||
</h3>
|
||||
<p className={cn('text-sm', getTextColor('white', 'muted'), 'dark:text-neutral-400')}>
|
||||
Persönliche Daten verwalten
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
|
||||
{/* Workshops Card */}
|
||||
<Link
|
||||
href="/dashboard/workshops"
|
||||
className="bg-white dark:bg-neutral-800 rounded-lg shadow-sm border-2 border-neutral-200 dark:border-neutral-700 p-4 sm:p-6 hover:shadow-md transition-shadow"
|
||||
>
|
||||
<div className="flex items-center">
|
||||
<div className="w-12 h-12 bg-green-100 dark:bg-green-900 rounded-lg flex items-center justify-center">
|
||||
<span className="text-green-600 dark:text-green-400 text-xl">🎓</span>
|
||||
</div>
|
||||
<div className="ml-4">
|
||||
<h3 className={cn('text-lg font-semibold', getTextColor('white', 'primary'), 'dark:text-white')}>
|
||||
Meine Workshops
|
||||
</h3>
|
||||
<p className={cn('text-sm', getTextColor('white', 'muted'), 'dark:text-neutral-400')}>
|
||||
Angemeldete Kurse verwalten
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
|
||||
{/* Appointments Card */}
|
||||
<Link
|
||||
href="/dashboard/appointments"
|
||||
className="bg-white dark:bg-neutral-800 rounded-lg shadow-sm border-2 border-neutral-200 dark:border-neutral-700 p-4 sm:p-6 hover:shadow-md transition-shadow"
|
||||
>
|
||||
<div className="flex items-center">
|
||||
<div className="w-12 h-12 bg-orange-100 dark:bg-orange-900 rounded-lg flex items-center justify-center">
|
||||
<span className="text-orange-600 dark:text-orange-400 text-xl">📅</span>
|
||||
</div>
|
||||
<div className="ml-4">
|
||||
<h3 className={cn('text-lg font-semibold', getTextColor('white', 'primary'), 'dark:text-white')}>
|
||||
Termine
|
||||
</h3>
|
||||
<p className={cn('text-sm', getTextColor('white', 'muted'), 'dark:text-neutral-400')}>
|
||||
Service-Termin buchen
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
|
||||
{/* Role-specific cards */}
|
||||
{userRole === ROLES.SELLER && (
|
||||
<Link
|
||||
href="/dashboard/seller"
|
||||
className="bg-white dark:bg-neutral-800 rounded-lg shadow-sm border-2 border-neutral-200 dark:border-neutral-700 p-4 sm:p-6 hover:shadow-md transition-shadow"
|
||||
>
|
||||
<div className="flex items-center">
|
||||
<div className="w-12 h-12 bg-secondary-100 dark:bg-secondary-900 rounded-lg flex items-center justify-center">
|
||||
<span className="text-secondary-600 dark:text-secondary-400 text-xl">🏪</span>
|
||||
</div>
|
||||
<div className="ml-4">
|
||||
<h3 className={cn('text-lg font-semibold', getTextColor('white', 'primary'), 'dark:text-white')}>
|
||||
Seller Dashboard
|
||||
</h3>
|
||||
<p className={cn('text-sm', getTextColor('white', 'muted'), 'dark:text-neutral-400')}>
|
||||
Produkte und Verkäufe
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
)}
|
||||
|
||||
{userRole === ROLES.REPAIRER && (
|
||||
<Link
|
||||
href="/dashboard/repairer"
|
||||
className="bg-white dark:bg-neutral-800 rounded-lg shadow-sm border-2 border-neutral-200 dark:border-neutral-700 p-4 sm:p-6 hover:shadow-md transition-shadow"
|
||||
>
|
||||
<div className="flex items-center">
|
||||
<div className="w-12 h-12 bg-warning-100 dark:bg-warning-900 rounded-lg flex items-center justify-center">
|
||||
<span className="text-warning-600 dark:text-warning-400 text-xl">🔧</span>
|
||||
</div>
|
||||
<div className="ml-4">
|
||||
<h3 className={cn('text-lg font-semibold', getTextColor('white', 'primary'), 'dark:text-white')}>
|
||||
Repairer Dashboard
|
||||
</h3>
|
||||
<p className={cn('text-sm', getTextColor('white', 'muted'), 'dark:text-neutral-400')}>
|
||||
Reparaturen verwalten
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
)}
|
||||
|
||||
{/* Upsell cards for capabilities (visible if user doesn't have role yet) */}
|
||||
{userRole !== ROLES.SELLER && (
|
||||
<Link
|
||||
href="/dashboard/seller"
|
||||
className="bg-white dark:bg-neutral-800 rounded-lg shadow-sm border-2 border-neutral-200 dark:border-neutral-700 p-4 sm:p-6 hover:shadow-md transition-shadow"
|
||||
>
|
||||
<div className="flex items-center">
|
||||
<div className="w-12 h-12 bg-secondary-100 dark:bg-secondary-900 rounded-lg flex items-center justify-center">
|
||||
<span className="text-secondary-600 dark:text-secondary-400 text-xl">🏪</span>
|
||||
</div>
|
||||
<div className="ml-4">
|
||||
<h3 className={cn('text-lg font-semibold', getTextColor('white', 'primary'), 'dark:text-white')}>
|
||||
Auf Revamp‑IT verkaufen
|
||||
</h3>
|
||||
<p className={cn('text-sm', getTextColor('white', 'muted'), 'dark:text-neutral-400')}>
|
||||
Eigene Produkte anbieten – Versand direkt an Käufer
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
)}
|
||||
|
||||
{userRole !== ROLES.REPAIRER && (
|
||||
<Link
|
||||
href="/dashboard/repairer"
|
||||
className="bg-white dark:bg-neutral-800 rounded-lg shadow-sm border-2 border-neutral-200 dark:border-neutral-700 p-4 sm:p-6 hover:shadow-md transition-shadow"
|
||||
>
|
||||
<div className="flex items-center">
|
||||
<div className="w-12 h-12 bg-warning-100 dark:bg-warning-900 rounded-lg flex items-center justify-center">
|
||||
<span className="text-warning-600 dark:text-warning-400 text-xl">🔧</span>
|
||||
</div>
|
||||
<div className="ml-4">
|
||||
<h3 className={cn('text-lg font-semibold', getTextColor('white', 'primary'), 'dark:text-white')}>
|
||||
Reparaturen anbieten
|
||||
</h3>
|
||||
<p className={cn('text-sm', getTextColor('white', 'muted'), 'dark:text-neutral-400')}>
|
||||
Dienstleistungen publizieren und Anfragen erhalten
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
)}
|
||||
|
||||
{/* Show admin card for staff users */}
|
||||
{(session.user.isStaff || isStaffEmail(session.user.email || '')) && (
|
||||
<Link
|
||||
href="/admin"
|
||||
className="bg-white dark:bg-neutral-800 rounded-lg shadow-sm border-2 border-neutral-200 dark:border-neutral-700 p-4 sm:p-6 hover:shadow-md transition-shadow"
|
||||
>
|
||||
<div className="flex items-center">
|
||||
<div className="w-12 h-12 bg-error-100 dark:bg-error-900 rounded-lg flex items-center justify-center">
|
||||
<span className="text-error-600 dark:text-error-400 text-xl">⚙️</span>
|
||||
</div>
|
||||
<div className="ml-4">
|
||||
<h3 className={cn('text-lg font-semibold', getTextColor('white', 'primary'), 'dark:text-white')}>
|
||||
Admin-Bereich
|
||||
</h3>
|
||||
<p className={cn('text-sm', getTextColor('white', 'muted'), 'dark:text-neutral-400')}>
|
||||
System verwalten
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
)}
|
||||
|
||||
{/* Workshop Proposal Card */}
|
||||
<Link
|
||||
href="/workshops/propose"
|
||||
className="bg-white dark:bg-neutral-800 rounded-lg shadow-sm border-2 border-neutral-200 dark:border-neutral-700 p-4 sm:p-6 hover:shadow-md transition-shadow"
|
||||
>
|
||||
<div className="flex items-center">
|
||||
<div className="w-12 h-12 bg-purple-100 dark:bg-purple-900 rounded-lg flex items-center justify-center">
|
||||
<span className="text-purple-600 dark:text-purple-400 text-xl">🎓</span>
|
||||
</div>
|
||||
<div className="ml-4">
|
||||
<h3 className={cn('text-lg font-semibold', getTextColor('white', 'primary'), 'dark:text-white')}>
|
||||
Workshop vorschlagen
|
||||
</h3>
|
||||
<p className={cn('text-sm', getTextColor('white', 'muted'), 'dark:text-neutral-400')}>
|
||||
Eigene Workshops anbieten
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
|
||||
|
||||
{/* Blog Submit Card */}
|
||||
<Link
|
||||
href="/blog/submit"
|
||||
className="bg-white dark:bg-neutral-800 rounded-lg shadow-sm border-2 border-neutral-200 dark:border-neutral-700 p-4 sm:p-6 hover:shadow-md transition-shadow"
|
||||
>
|
||||
<div className="flex items-center">
|
||||
<div className="w-12 h-12 bg-info-100 dark:bg-info-900 rounded-lg flex items-center justify-center">
|
||||
<span className="text-info-600 dark:text-info-400 text-xl">✍️</span>
|
||||
</div>
|
||||
<div className="ml-4">
|
||||
<h3 className={cn('text-lg font-semibold', getTextColor('white', 'primary'), 'dark:text-white')}>
|
||||
Beitrag verfassen
|
||||
</h3>
|
||||
<p className={cn('text-sm', getTextColor('white', 'muted'), 'dark:text-neutral-400')}>
|
||||
Idee teilen oder Tutorial schreiben
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
'use client'
|
||||
|
||||
import { useState, useEffect, useCallback } from 'react'
|
||||
import { useState, useEffect } from 'react'
|
||||
import { useSession } from 'next-auth/react'
|
||||
import { useRouter } from 'next/navigation'
|
||||
import { apiFetch } from '@/lib/api/client'
|
||||
import Link from 'next/link'
|
||||
import {
|
||||
Package,
|
||||
@@ -19,9 +18,6 @@ import {
|
||||
RefreshCw
|
||||
} from 'lucide-react'
|
||||
import { ListingImage } from '@/components/marketplace/ListingImage'
|
||||
import { useTranslations } from 'next-intl'
|
||||
import Heading from '@/components/ui/Heading'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { ROLES } from '@/lib/constants'
|
||||
import { LISTING_STATUS_CONFIG } from '@/config/marketplace'
|
||||
import type { ListingStatus } from '@/config/marketplace'
|
||||
@@ -55,7 +51,6 @@ interface DashboardData {
|
||||
}
|
||||
|
||||
export default function SellerDashboard() {
|
||||
const t = useTranslations('dashboard.seller')
|
||||
const { data: session, status } = useSession()
|
||||
const router = useRouter()
|
||||
const [data, setData] = useState<DashboardData | null>(null)
|
||||
@@ -67,23 +62,6 @@ export default function SellerDashboard() {
|
||||
document.title = 'Seller Dashboard | RevampIT'
|
||||
}, [])
|
||||
|
||||
const fetchDashboardData = useCallback(async () => {
|
||||
setIsLoading(true)
|
||||
setError(null)
|
||||
try {
|
||||
const result = await apiFetch<DashboardData>('/api/seller/dashboard')
|
||||
if (result.success && result.data) {
|
||||
setData(result.data)
|
||||
} else {
|
||||
throw new Error(result.error || t('loadErrorGeneric'))
|
||||
}
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : t('unexpectedError'))
|
||||
} finally {
|
||||
setIsLoading(false)
|
||||
}
|
||||
}, [t])
|
||||
|
||||
useEffect(() => {
|
||||
if (status === 'loading') return
|
||||
|
||||
@@ -106,33 +84,53 @@ export default function SellerDashboard() {
|
||||
}
|
||||
|
||||
fetchDashboardData()
|
||||
}, [session, status, router, fetchDashboardData])
|
||||
}, [session, status, router])
|
||||
|
||||
const fetchDashboardData = async () => {
|
||||
setIsLoading(true)
|
||||
setError(null)
|
||||
|
||||
try {
|
||||
const response = await fetch('/api/seller/dashboard')
|
||||
const result = await response.json()
|
||||
|
||||
if (result.success && result.data) {
|
||||
setData(result.data)
|
||||
} else {
|
||||
throw new Error(result.error || 'Fehler beim Laden des Dashboards')
|
||||
}
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Ein unerwarteter Fehler ist aufgetreten')
|
||||
} finally {
|
||||
setIsLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
const quickActions = [
|
||||
{
|
||||
title: t('quickNewProduct'),
|
||||
description: t('quickNewProductDesc'),
|
||||
title: 'Neues Produkt',
|
||||
description: 'Produkt zum Marketplace hinzufügen',
|
||||
href: '/marketplace/sell',
|
||||
icon: Plus,
|
||||
color: 'bg-green-500',
|
||||
},
|
||||
{
|
||||
title: t('quickMyProducts'),
|
||||
description: t('quickMyProductsDesc'),
|
||||
title: 'Meine Produkte',
|
||||
description: 'Alle Ihre Produkte verwalten',
|
||||
href: '/dashboard/listings',
|
||||
icon: Package,
|
||||
color: 'bg-blue-500',
|
||||
},
|
||||
{
|
||||
title: t('quickSales'),
|
||||
description: t('quickSalesDesc'),
|
||||
title: 'Verkäufe',
|
||||
description: 'Bestellungen und Verkäufe anzeigen',
|
||||
href: '/dashboard/orders',
|
||||
icon: TrendingUp,
|
||||
color: 'bg-purple-500',
|
||||
},
|
||||
{
|
||||
title: t('quickMarketplace'),
|
||||
description: t('quickMarketplaceDesc'),
|
||||
title: 'Marketplace',
|
||||
description: 'Marketplace ansehen',
|
||||
href: '/marketplace',
|
||||
icon: BarChart3,
|
||||
color: 'bg-orange-500',
|
||||
@@ -149,7 +147,7 @@ export default function SellerDashboard() {
|
||||
return (
|
||||
<div className="flex items-center justify-center min-h-[400px]">
|
||||
<Loader2 className="w-8 h-8 text-green-600 animate-spin" />
|
||||
<span className="ml-3 text-gray-600 dark:text-gray-400">{t('loading')}</span>
|
||||
<span className="ml-3 text-gray-600 dark:text-gray-400">Dashboard wird geladen...</span>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -158,14 +156,17 @@ export default function SellerDashboard() {
|
||||
return (
|
||||
<div className="bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-xl p-6 text-center">
|
||||
<AlertCircle className="w-12 h-12 text-red-500 mx-auto mb-4" />
|
||||
<Heading level={3} className="text-lg font-semibold text-red-800 dark:text-red-200 mb-2">
|
||||
{t('loadErrorTitle')}
|
||||
</Heading>
|
||||
<h3 className="text-lg font-semibold text-red-800 dark:text-red-200 mb-2">
|
||||
Fehler beim Laden
|
||||
</h3>
|
||||
<p className="text-red-600 dark:text-red-300 mb-4">{error}</p>
|
||||
<Button onClick={fetchDashboardData} variant="destructive" className="gap-2">
|
||||
<button
|
||||
onClick={fetchDashboardData}
|
||||
className="inline-flex items-center gap-2 bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded-lg"
|
||||
>
|
||||
<RefreshCw className="w-4 h-4" />
|
||||
{t('retry')}
|
||||
</Button>
|
||||
Erneut versuchen
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -188,17 +189,17 @@ export default function SellerDashboard() {
|
||||
<div className="bg-gradient-to-r from-green-600 to-green-700 rounded-xl p-6 text-white">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<Heading level={1} className="text-2xl font-bold mb-2">
|
||||
<h1 className="text-2xl font-bold mb-2">
|
||||
Seller Dashboard
|
||||
</Heading>
|
||||
</h1>
|
||||
<p className="text-green-100">
|
||||
{t('pageSubtitle')}
|
||||
Verwalten Sie Ihre Produkte im RevampIT Marketplace und verfolgen Sie Ihre Verkäufe.
|
||||
</p>
|
||||
</div>
|
||||
<button
|
||||
onClick={fetchDashboardData}
|
||||
className="p-2 rounded-lg bg-white/10 hover:bg-white/20 transition-colors"
|
||||
title={t('refresh')}
|
||||
title="Aktualisieren"
|
||||
>
|
||||
<RefreshCw className="w-5 h-5" />
|
||||
</button>
|
||||
@@ -210,9 +211,9 @@ export default function SellerDashboard() {
|
||||
<div className="bg-white dark:bg-gray-800 rounded-xl p-6 shadow-sm border border-gray-100 dark:border-gray-700">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<p className="text-sm font-medium text-gray-600 dark:text-gray-400">{t('statsProducts')}</p>
|
||||
<p className="text-sm font-medium text-gray-600 dark:text-gray-400">Meine Produkte</p>
|
||||
<p className="text-3xl font-bold text-gray-900 dark:text-white">{stats.totalProducts}</p>
|
||||
<p className="text-sm text-green-600">{t('statsActive', { count: stats.activeProducts })}</p>
|
||||
<p className="text-sm text-green-600">{stats.activeProducts} aktiv</p>
|
||||
</div>
|
||||
<Package className="w-8 h-8 text-blue-600" />
|
||||
</div>
|
||||
@@ -221,13 +222,13 @@ export default function SellerDashboard() {
|
||||
<div className="bg-white dark:bg-gray-800 rounded-xl p-6 shadow-sm border border-gray-100 dark:border-gray-700">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<p className="text-sm font-medium text-gray-600 dark:text-gray-400">{t('statsRevenue')}</p>
|
||||
<p className="text-sm font-medium text-gray-600 dark:text-gray-400">Umsatz</p>
|
||||
<p className="text-3xl font-bold text-gray-900 dark:text-white">
|
||||
CHF {stats.totalRevenue.toLocaleString('de-CH')}
|
||||
</p>
|
||||
<p className="text-sm text-green-600 flex items-center gap-1">
|
||||
<TrendingUp className="w-4 h-4" />
|
||||
{t('statsTotalRevenue')}
|
||||
Gesamtumsatz
|
||||
</p>
|
||||
</div>
|
||||
<DollarSign className="w-8 h-8 text-green-600" />
|
||||
@@ -237,9 +238,9 @@ export default function SellerDashboard() {
|
||||
<div className="bg-white dark:bg-gray-800 rounded-xl p-6 shadow-sm border border-gray-100 dark:border-gray-700">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<p className="text-sm font-medium text-gray-600 dark:text-gray-400">{t('statsViews')}</p>
|
||||
<p className="text-sm font-medium text-gray-600 dark:text-gray-400">Produkt-Aufrufe</p>
|
||||
<p className="text-3xl font-bold text-gray-900 dark:text-white">{stats.totalViews.toLocaleString()}</p>
|
||||
<p className="text-sm text-blue-600">{t('statsFavorites', { count: stats.totalFavorites })}</p>
|
||||
<p className="text-sm text-blue-600">{stats.totalFavorites} Favoriten</p>
|
||||
</div>
|
||||
<Eye className="w-8 h-8 text-blue-600" />
|
||||
</div>
|
||||
@@ -248,9 +249,9 @@ export default function SellerDashboard() {
|
||||
<div className="bg-white dark:bg-gray-800 rounded-xl p-6 shadow-sm border border-gray-100 dark:border-gray-700">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<p className="text-sm font-medium text-gray-600 dark:text-gray-400">{t('statsOrders')}</p>
|
||||
<p className="text-sm font-medium text-gray-600 dark:text-gray-400">Bestellungen</p>
|
||||
<p className="text-3xl font-bold text-gray-900 dark:text-white">{stats.totalOrders}</p>
|
||||
<p className="text-sm text-purple-600">{t('statsPending', { count: stats.pendingOrders })}</p>
|
||||
<p className="text-sm text-purple-600">ausstehend: {stats.pendingOrders}</p>
|
||||
</div>
|
||||
<Users className="w-8 h-8 text-purple-600" />
|
||||
</div>
|
||||
@@ -261,11 +262,11 @@ export default function SellerDashboard() {
|
||||
{/* Recent Products */}
|
||||
<div className="bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-100 dark:border-gray-700">
|
||||
<div className="p-6 border-b border-gray-100 dark:border-gray-700">
|
||||
<Heading level={2} className="text-lg font-semibold text-gray-900 dark:text-white">
|
||||
{t('recentTitle')}
|
||||
</Heading>
|
||||
<h2 className="text-lg font-semibold text-gray-900 dark:text-white">
|
||||
Meine Produkte
|
||||
</h2>
|
||||
<p className="text-sm text-gray-600 dark:text-gray-400 mt-1">
|
||||
{t('recentSubtitle')}
|
||||
Übersicht Ihrer Produkte
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -274,14 +275,14 @@ export default function SellerDashboard() {
|
||||
<div className="text-center py-8">
|
||||
<Package className="w-12 h-12 text-gray-400 mx-auto mb-3" />
|
||||
<p className="text-gray-600 dark:text-gray-400 mb-4">
|
||||
{t('noProducts')}
|
||||
Sie haben noch keine Produkte erstellt.
|
||||
</p>
|
||||
<Link
|
||||
href="/marketplace/sell"
|
||||
className="inline-flex items-center gap-2 bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg"
|
||||
>
|
||||
<Plus className="w-4 h-4" />
|
||||
{t('createFirst')}
|
||||
Erstes Produkt erstellen
|
||||
</Link>
|
||||
</div>
|
||||
) : (
|
||||
@@ -294,11 +295,11 @@ export default function SellerDashboard() {
|
||||
<ListingImage src={product.image} alt={product.title} fallbackIconSize="w-5 h-5" />
|
||||
</div>
|
||||
<div className="flex-1 min-w-0">
|
||||
<Heading level={3} className="font-medium text-gray-900 dark:text-white truncate">
|
||||
<h3 className="font-medium text-gray-900 dark:text-white truncate">
|
||||
{product.title}
|
||||
</Heading>
|
||||
</h3>
|
||||
<p className="text-sm text-gray-500 dark:text-gray-400">
|
||||
CHF {product.price} • {t('viewCount', { count: product.viewsCount })}
|
||||
CHF {product.price} • {product.viewsCount} Aufrufe
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
@@ -318,7 +319,7 @@ export default function SellerDashboard() {
|
||||
href="/dashboard/listings"
|
||||
className="text-sm text-green-600 hover:text-green-700 dark:text-green-400 font-medium flex items-center gap-1"
|
||||
>
|
||||
{t('manageAll')}
|
||||
Alle Produkte verwalten
|
||||
<ArrowRight className="w-4 h-4" />
|
||||
</Link>
|
||||
</div>
|
||||
@@ -329,11 +330,11 @@ export default function SellerDashboard() {
|
||||
{/* Quick Actions */}
|
||||
<div className="bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-100 dark:border-gray-700">
|
||||
<div className="p-6 border-b border-gray-100 dark:border-gray-700">
|
||||
<Heading level={2} className="text-lg font-semibold text-gray-900 dark:text-white">
|
||||
{t('quickActionsTitle')}
|
||||
</Heading>
|
||||
<h2 className="text-lg font-semibold text-gray-900 dark:text-white">
|
||||
Schnellzugriff
|
||||
</h2>
|
||||
<p className="text-sm text-gray-600 dark:text-gray-400 mt-1">
|
||||
{t('quickActionsSubtitle')}
|
||||
Häufig verwendete Seller-Funktionen
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -349,9 +350,9 @@ export default function SellerDashboard() {
|
||||
<div className={`w-8 h-8 ${action.color} rounded-lg flex items-center justify-center`}>
|
||||
<action.icon className="w-4 h-4 text-white" />
|
||||
</div>
|
||||
<Heading level={3} className="font-medium text-gray-900 dark:text-white group-hover:text-green-600 transition-colors">
|
||||
<h3 className="font-medium text-gray-900 dark:text-white group-hover:text-green-600 transition-colors">
|
||||
{action.title}
|
||||
</Heading>
|
||||
</h3>
|
||||
</div>
|
||||
<p className="text-sm text-gray-600 dark:text-gray-400">
|
||||
{action.description}
|
||||
@@ -370,24 +371,26 @@ export default function SellerDashboard() {
|
||||
<Package className="w-5 h-5 text-blue-600" />
|
||||
</div>
|
||||
<div>
|
||||
<Heading level={3} className="font-medium text-blue-900 dark:text-blue-200">
|
||||
{t('infoTitle')}
|
||||
</Heading>
|
||||
<h3 className="font-medium text-blue-900 dark:text-blue-200">
|
||||
RevampIT Marketplace
|
||||
</h3>
|
||||
<p className="text-sm text-blue-700 dark:text-blue-300 mt-1">
|
||||
{t('infoDesc')}
|
||||
Als Seller können Sie Ihre eigenen refurbished Produkte im RevampIT Marketplace verkaufen.
|
||||
Ihre Produkte erscheinen neben den offiziellen RevampIT Produkten und helfen dabei,
|
||||
die Kreislaufwirtschaft zu fördern.
|
||||
</p>
|
||||
<div className="mt-3 flex gap-3">
|
||||
<Link
|
||||
href="/marketplace"
|
||||
className="text-sm bg-blue-600 text-white px-3 py-1.5 rounded hover:bg-blue-700 transition-colors"
|
||||
>
|
||||
{t('viewMarketplace')}
|
||||
Marketplace ansehen
|
||||
</Link>
|
||||
<Link
|
||||
href="/marketplace/sell"
|
||||
className="text-sm bg-green-600 text-white px-3 py-1.5 rounded hover:bg-green-700 transition-colors"
|
||||
>
|
||||
{t('addProduct')}
|
||||
Produkt hinzufügen
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,18 +2,12 @@
|
||||
|
||||
import { useSession } from 'next-auth/react'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useRouter, useSearchParams } from 'next/navigation'
|
||||
import { apiFetch } from '@/lib/api/client'
|
||||
import { Calendar, Clock, MapPin, Users, CheckCircle, XCircle, AlertCircle, ArrowLeft, LogIn } from 'lucide-react'
|
||||
import { EmptyState } from '@/components/ui/EmptyState'
|
||||
import { Calendar, Clock, MapPin, Users, CheckCircle, XCircle, AlertCircle, ArrowLeft } from 'lucide-react'
|
||||
import { WORKSHOP_REGISTRATION_STATUS } from '@/config/workshop-registration-status'
|
||||
import Link from 'next/link'
|
||||
import { getTextColor, getStatusColors } from '@/lib/design-system'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { formatDate } from '@/lib/date-formats'
|
||||
import { Modal } from '@/components/ui/Modal'
|
||||
import Heading from '@/components/ui/Heading'
|
||||
|
||||
interface WorkshopRegistration {
|
||||
id: string
|
||||
@@ -32,54 +26,35 @@ interface WorkshopRegistration {
|
||||
}
|
||||
|
||||
export default function WorkshopsDashboard() {
|
||||
const tDates = useTranslations('dashboard.dates')
|
||||
const t = useTranslations('dashboard.workshops')
|
||||
const { data: session, status } = useSession()
|
||||
const router = useRouter()
|
||||
const searchParams = useSearchParams()
|
||||
const [registrations, setRegistrations] = useState<WorkshopRegistration[]>([])
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [error, setError] = useState<string>('')
|
||||
const [paymentSuccess, setPaymentSuccess] = useState(
|
||||
() => searchParams.get('payment') === 'success'
|
||||
)
|
||||
const [editingId, setEditingId] = useState<string | null>(null)
|
||||
const [editRating, setEditRating] = useState<number>(5)
|
||||
const [editFeedback, setEditFeedback] = useState<string>('')
|
||||
const [saving, setSaving] = useState(false)
|
||||
|
||||
// Strip the ?payment=success param from the URL after we've captured it into state
|
||||
useEffect(() => {
|
||||
if (searchParams.get('payment') === 'success') {
|
||||
router.replace('/dashboard/workshops')
|
||||
if (session?.user) {
|
||||
fetchRegistrations()
|
||||
}
|
||||
}, [searchParams, router])
|
||||
|
||||
useEffect(() => {
|
||||
if (!session?.user) return
|
||||
let cancelled = false
|
||||
async function load() {
|
||||
const result = await apiFetch<{ registrations: WorkshopRegistration[] }>('/api/user/workshop-registrations')
|
||||
if (cancelled) return
|
||||
if (result.success && result.data) {
|
||||
setRegistrations(result.data.registrations || [])
|
||||
} else {
|
||||
setError(result.error || t('loadError'))
|
||||
}
|
||||
setLoading(false)
|
||||
}
|
||||
load()
|
||||
return () => { cancelled = true }
|
||||
}, [session, t])
|
||||
}, [session])
|
||||
|
||||
const fetchRegistrations = async () => {
|
||||
const result = await apiFetch<{ registrations: WorkshopRegistration[] }>('/api/user/workshop-registrations')
|
||||
if (result.success && result.data) {
|
||||
setRegistrations(result.data.registrations || [])
|
||||
} else {
|
||||
setError(result.error || t('loadError'))
|
||||
try {
|
||||
const response = await fetch('/api/user/workshop-registrations')
|
||||
if (response.ok) {
|
||||
const data = await response.json()
|
||||
setRegistrations(data.data?.registrations || [])
|
||||
} else {
|
||||
setError('Fehler beim Laden der Workshop-Anmeldungen')
|
||||
}
|
||||
} catch (error) {
|
||||
setError('Netzwerkfehler beim Laden der Daten')
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
const openEdit = (reg: WorkshopRegistration) => {
|
||||
@@ -91,17 +66,23 @@ export default function WorkshopsDashboard() {
|
||||
const saveEdit = async () => {
|
||||
if (!editingId) return
|
||||
setSaving(true)
|
||||
const result = await apiFetch<void>(`/api/workshops/registrations/${editingId}`, {
|
||||
method: 'PATCH',
|
||||
body: { rating: editRating, feedback: editFeedback }
|
||||
})
|
||||
if (result.success) {
|
||||
setEditingId(null)
|
||||
fetchRegistrations()
|
||||
} else {
|
||||
setError(result.error || t('saveFailed'))
|
||||
try {
|
||||
const resp = await fetch(`/api/workshops/registrations/${editingId}`, {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ rating: editRating, feedback: editFeedback })
|
||||
})
|
||||
if (resp.ok) {
|
||||
setEditingId(null)
|
||||
fetchRegistrations()
|
||||
} else {
|
||||
alert('Speichern fehlgeschlagen')
|
||||
}
|
||||
} catch {
|
||||
alert('Netzwerkfehler beim Speichern')
|
||||
} finally {
|
||||
setSaving(false)
|
||||
}
|
||||
setSaving(false)
|
||||
}
|
||||
|
||||
const getStatusIcon = (status: string) => {
|
||||
@@ -120,11 +101,11 @@ export default function WorkshopsDashboard() {
|
||||
const getStatusText = (status: string) => {
|
||||
switch (status) {
|
||||
case WORKSHOP_REGISTRATION_STATUS.CONFIRMED:
|
||||
return t('statusConfirmed')
|
||||
return 'Bestätigt'
|
||||
case WORKSHOP_REGISTRATION_STATUS.PENDING:
|
||||
return t('statusPending')
|
||||
return 'Ausstehend'
|
||||
case WORKSHOP_REGISTRATION_STATUS.CANCELLED:
|
||||
return t('statusCancelled')
|
||||
return 'Storniert'
|
||||
default:
|
||||
return status
|
||||
}
|
||||
@@ -154,19 +135,18 @@ export default function WorkshopsDashboard() {
|
||||
return (
|
||||
<div className="min-h-screen bg-neutral-50 py-8">
|
||||
<div className="max-w-4xl mx-auto px-4">
|
||||
<EmptyState
|
||||
icon={LogIn}
|
||||
title={t('loginRequired')}
|
||||
description={t('loginDesc')}
|
||||
action={
|
||||
<Link
|
||||
href="/auth/login"
|
||||
className="inline-block bg-green-600 text-white px-6 py-3 rounded-lg hover:bg-green-700 transition-colors font-medium"
|
||||
>
|
||||
{t('login')}
|
||||
</Link>
|
||||
}
|
||||
/>
|
||||
<div className="bg-white rounded-xl shadow-lg p-8 text-center border-2 border-neutral-200">
|
||||
<h1 className={cn('text-2xl font-bold mb-4', getTextColor('white', 'primary'))}>Anmeldung erforderlich</h1>
|
||||
<p className={cn('mb-6', getTextColor('white', 'muted'))}>
|
||||
Bitte melden Sie sich an, um Ihre Workshop-Anmeldungen zu sehen.
|
||||
</p>
|
||||
<Link
|
||||
href="/auth/login"
|
||||
className="inline-block bg-primary-600 text-white px-6 py-3 rounded-lg hover:bg-primary-700 transition-colors min-h-[touch] touch-target"
|
||||
>
|
||||
Anmelden
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
@@ -182,31 +162,14 @@ export default function WorkshopsDashboard() {
|
||||
className={cn('inline-flex items-center mb-4', getTextColor('neutral', 'muted'), 'hover:text-primary-600')}
|
||||
>
|
||||
<ArrowLeft className="w-4 h-4 mr-2" />
|
||||
{t('backToDashboard')}
|
||||
Zurück zum Dashboard
|
||||
</Link>
|
||||
<Heading level={1} className={cn('text-3xl font-bold mb-2', getTextColor('neutral', 'primary'))}>{t('pageTitle')}</Heading>
|
||||
<h1 className={cn('text-3xl font-bold mb-2', getTextColor('neutral', 'primary'))}>Meine Workshops</h1>
|
||||
<p className={cn('text-sm sm:text-base', getTextColor('neutral', 'muted'))}>
|
||||
{t('pageSubtitle')}
|
||||
Übersicht Ihrer Workshop-Anmeldungen und Teilnahmen
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Payment success banner (shown after Payrexx redirect) */}
|
||||
{paymentSuccess && (
|
||||
<div className="bg-emerald-50 border border-emerald-200 rounded-lg p-4 mb-6 flex items-center justify-between gap-3">
|
||||
<div className="flex items-center gap-3">
|
||||
<CheckCircle className="w-5 h-5 text-emerald-600 flex-shrink-0" />
|
||||
<p className="text-emerald-800 font-medium">{t('paymentSuccess')}</p>
|
||||
</div>
|
||||
<button
|
||||
onClick={() => setPaymentSuccess(false)}
|
||||
className="text-emerald-600 hover:text-emerald-800 text-lg leading-none"
|
||||
aria-label="Schliessen"
|
||||
>
|
||||
×
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Error Message */}
|
||||
{error && (
|
||||
<div className={cn('rounded-lg p-4 mb-6 border-2', getStatusColors('error').bg, getStatusColors('error').border)}>
|
||||
@@ -221,9 +184,9 @@ export default function WorkshopsDashboard() {
|
||||
<div key={registration.id} className="bg-white rounded-xl shadow-lg p-4 sm:p-6 border-2 border-neutral-200">
|
||||
<div className="flex items-start justify-between mb-4">
|
||||
<div className="flex-1">
|
||||
<Heading level={3} className={cn('text-xl font-semibold mb-2', getTextColor('white', 'primary'))}>
|
||||
<h3 className={cn('text-xl font-semibold mb-2', getTextColor('white', 'primary'))}>
|
||||
{registration.workshop_title}
|
||||
</Heading>
|
||||
</h3>
|
||||
<div className={cn('flex items-center gap-4 text-sm mb-3', getTextColor('white', 'muted'))}>
|
||||
<div className="flex items-center">
|
||||
{getStatusIcon(registration.status)}
|
||||
@@ -231,7 +194,7 @@ export default function WorkshopsDashboard() {
|
||||
</div>
|
||||
<div className="flex items-center">
|
||||
<Calendar className="w-4 h-4 mr-1" />
|
||||
<span>{tDates('registeredOn', { date: formatDate(registration.created_at) })}</span>
|
||||
<span>Angemeldet am {formatDate(registration.created_at)}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -242,10 +205,10 @@ export default function WorkshopsDashboard() {
|
||||
<div className="bg-green-50 border border-green-200 rounded-lg p-4">
|
||||
<div className="flex items-center text-green-800">
|
||||
<CheckCircle className="w-5 h-5 mr-2" />
|
||||
<span className="font-medium">{t('confirmedTitle')}</span>
|
||||
<span className="font-medium">Ihre Anmeldung wurde bestätigt!</span>
|
||||
</div>
|
||||
<p className="text-green-700 text-sm mt-1">
|
||||
{t('confirmedDesc')}
|
||||
Sie erhalten in Kürze weitere Informationen zu Datum und Ort.
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
@@ -254,10 +217,10 @@ export default function WorkshopsDashboard() {
|
||||
<div className="bg-yellow-50 border border-yellow-200 rounded-lg p-4">
|
||||
<div className="flex items-center text-yellow-800">
|
||||
<AlertCircle className="w-5 h-5 mr-2" />
|
||||
<span className="font-medium">{t('pendingTitle')}</span>
|
||||
<span className="font-medium">Anmeldung ausstehend</span>
|
||||
</div>
|
||||
<p className="text-yellow-700 text-sm mt-1">
|
||||
{t('pendingDesc')}
|
||||
Ihre Anmeldung wird von unserem Team geprüft. Sie erhalten eine Bestätigung per E-Mail.
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
@@ -266,11 +229,11 @@ export default function WorkshopsDashboard() {
|
||||
<div className="bg-red-50 border border-red-200 rounded-lg p-4">
|
||||
<div className="flex items-center text-red-800">
|
||||
<XCircle className="w-5 h-5 mr-2" />
|
||||
<span className="font-medium">{t('cancelledTitle')}</span>
|
||||
<span className="font-medium">Anmeldung storniert</span>
|
||||
</div>
|
||||
{registration.cancelled_at && (
|
||||
<p className="text-red-700 text-sm mt-1">
|
||||
{t('cancelledOn', { date: formatDate(registration.cancelled_at) })}
|
||||
Storniert am {formatDate(registration.cancelled_at)}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
@@ -281,26 +244,31 @@ export default function WorkshopsDashboard() {
|
||||
<div className="mt-4 flex gap-3">
|
||||
<button
|
||||
onClick={async () => {
|
||||
if (!confirm(t('confirmCancel'))) return
|
||||
const result = await apiFetch<void>(`/api/workshops/registrations/${registration.id}`, {
|
||||
method: 'PATCH',
|
||||
body: { action: 'cancel' }
|
||||
})
|
||||
if (result.success) {
|
||||
fetchRegistrations()
|
||||
} else {
|
||||
setError(result.error || t('cancelFailed'))
|
||||
if (!confirm('Möchten Sie diese Anmeldung wirklich stornieren?')) return
|
||||
try {
|
||||
const resp = await fetch(`/api/workshops/registrations/${registration.id}`, {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ action: 'cancel' })
|
||||
})
|
||||
if (resp.ok) {
|
||||
fetchRegistrations()
|
||||
} else {
|
||||
alert('Stornierung fehlgeschlagen')
|
||||
}
|
||||
} catch {
|
||||
alert('Netzwerkfehler bei der Stornierung')
|
||||
}
|
||||
}}
|
||||
className="px-4 py-2 rounded-lg border border-gray-300 text-gray-700 hover:bg-gray-50"
|
||||
>
|
||||
{t('cancelButton')}
|
||||
Anmeldung stornieren
|
||||
</button>
|
||||
<button
|
||||
onClick={() => openEdit(registration)}
|
||||
className="px-4 py-2 rounded-lg border border-indigo-300 text-indigo-700 hover:bg-indigo-50"
|
||||
>
|
||||
{registration.feedback || registration.rating ? t('feedbackEdit') : t('feedbackAdd')}
|
||||
{registration.feedback || registration.rating ? 'Feedback bearbeiten' : 'Feedback hinzufügen'}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
@@ -308,58 +276,75 @@ export default function WorkshopsDashboard() {
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<EmptyState
|
||||
icon={Calendar}
|
||||
iconBg="bg-green-50 dark:bg-green-900/20"
|
||||
iconColor="text-green-600 dark:text-green-400"
|
||||
title={t('emptyTitle')}
|
||||
description={t('emptyDesc')}
|
||||
action={
|
||||
<Link
|
||||
href="/workshops"
|
||||
className="inline-block bg-green-600 text-white px-6 py-3 rounded-lg hover:bg-green-700 transition-colors font-medium"
|
||||
>
|
||||
{t('discoverWorkshops')}
|
||||
</Link>
|
||||
}
|
||||
/>
|
||||
<div className="bg-white rounded-xl shadow-lg p-8 text-center">
|
||||
<Calendar className="w-16 h-16 text-gray-300 mx-auto mb-4" />
|
||||
<h3 className="text-xl font-semibold text-gray-900 mb-2">
|
||||
Noch keine Workshop-Anmeldungen
|
||||
</h3>
|
||||
<p className="text-gray-600 mb-6">
|
||||
Sie haben sich noch für keine Workshops angemeldet.
|
||||
</p>
|
||||
<Link
|
||||
href="/workshops"
|
||||
className="inline-block bg-green-600 text-white px-6 py-3 rounded-lg hover:bg-green-700 transition-colors"
|
||||
>
|
||||
Workshops entdecken
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<Modal isOpen={!!editingId} onClose={() => setEditingId(null)} title={t('modalTitle')}>
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">{t('ratingLabel')}</label>
|
||||
<input
|
||||
type="number"
|
||||
min={1}
|
||||
max={5}
|
||||
value={editRating}
|
||||
onChange={(e) => setEditRating(Math.max(1, Math.min(5, Number(e.target.value))))}
|
||||
className="w-24 px-3 py-2 border border-gray-300 rounded-lg"
|
||||
/>
|
||||
<Modal open={!!editingId} onClose={() => setEditingId(null)}>
|
||||
<div className="p-6">
|
||||
<h3 className="text-lg font-semibold text-gray-900 mb-4">Feedback bearbeiten</h3>
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">Bewertung (1-5)</label>
|
||||
<input
|
||||
type="number"
|
||||
min={1}
|
||||
max={5}
|
||||
value={editRating}
|
||||
onChange={(e) => setEditRating(Math.max(1, Math.min(5, Number(e.target.value))))}
|
||||
className="w-24 px-3 py-2 border border-gray-300 rounded-lg"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">Feedback</label>
|
||||
<textarea
|
||||
value={editFeedback}
|
||||
onChange={(e) => setEditFeedback(e.target.value)}
|
||||
rows={4}
|
||||
className="w-full px-3 py-2 border border-gray-300 rounded-lg"
|
||||
placeholder="Wie war Ihre Erfahrung?"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">{t('feedbackLabel')}</label>
|
||||
<textarea
|
||||
value={editFeedback}
|
||||
onChange={(e) => setEditFeedback(e.target.value)}
|
||||
rows={4}
|
||||
className="w-full px-3 py-2 border border-gray-300 rounded-lg"
|
||||
placeholder={t('feedbackPlaceholder')}
|
||||
/>
|
||||
<div className="mt-6 flex justify-end gap-3">
|
||||
<button onClick={() => setEditingId(null)} className="px-4 py-2 rounded-lg border border-gray-300">Abbrechen</button>
|
||||
<button onClick={saveEdit} disabled={saving} className="px-4 py-2 rounded-lg bg-indigo-600 text-white disabled:opacity-50">
|
||||
{saving ? 'Speichern…' : 'Speichern'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-6 flex justify-end gap-3">
|
||||
<button onClick={() => setEditingId(null)} className="px-4 py-2 rounded-lg border border-gray-300">{t('cancel')}</button>
|
||||
<button onClick={saveEdit} disabled={saving} className="px-4 py-2 rounded-lg bg-indigo-600 text-white disabled:opacity-50">
|
||||
{saving ? t('saving') : t('save')}
|
||||
</button>
|
||||
</div>
|
||||
</Modal>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
// Simple modal
|
||||
function Modal({ open, onClose, children }: { open: boolean, onClose: () => void, children: React.ReactNode }) {
|
||||
if (!open) return null
|
||||
return (
|
||||
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4" onClick={onClose}>
|
||||
<div className="bg-white rounded-xl shadow-xl w-full max-w-lg" onClick={(e) => e.stopPropagation()}>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+17
-24
@@ -1,39 +1,32 @@
|
||||
import type { Viewport } from "next";
|
||||
import { Inter } from 'next/font/google'
|
||||
import { getLocale } from 'next-intl/server'
|
||||
import type { Metadata } from "next";
|
||||
import { Providers } from "@/components/providers/providers";
|
||||
import ConditionalMainLayout from "@/components/layout/ConditionalMainLayout";
|
||||
import { CSRF_SCRIPT } from "@/lib/auth/csrf";
|
||||
import "./globals.css";
|
||||
|
||||
const inter = Inter({
|
||||
subsets: ['latin', 'latin-ext'],
|
||||
display: 'swap',
|
||||
variable: '--font-inter',
|
||||
})
|
||||
// Use system fonts to avoid build-time network fetches
|
||||
const interClassName = "";
|
||||
|
||||
export const viewport: Viewport = {
|
||||
width: 'device-width',
|
||||
initialScale: 1,
|
||||
maximumScale: 5,
|
||||
export const metadata: Metadata = {
|
||||
title: "RevampIT",
|
||||
description: "RevampIT - Nachhaltige Technologielösungen durch Aufarbeitung und Recycling. Helfen Sie mit, Elektroschrott zu reduzieren und Technologie für alle zugänglich zu machen.",
|
||||
keywords: ["Elektroschrott", "Recycling", "Aufarbeitung", "nachhaltige Technologie", "Workshops", "Freiwilligenarbeit"],
|
||||
};
|
||||
|
||||
export default async function RootLayout({
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
const locale = await getLocale()
|
||||
|
||||
return (
|
||||
<html lang={locale} suppressHydrationWarning>
|
||||
<body className={`${inter.className} antialiased`}>
|
||||
<a
|
||||
href="#main"
|
||||
className="sr-only focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-[9999] focus:px-4 focus:py-2 focus:bg-green-600 focus:text-white focus:rounded-md focus:shadow-lg focus:outline-none"
|
||||
>
|
||||
Zum Inhalt springen
|
||||
</a>
|
||||
<html lang="de" suppressHydrationWarning>
|
||||
<body className={`${interClassName} fix-text-rendering`}>
|
||||
<script dangerouslySetInnerHTML={{ __html: CSRF_SCRIPT }} />
|
||||
{children}
|
||||
<Providers>
|
||||
<ConditionalMainLayout>
|
||||
{children}
|
||||
</ConditionalMainLayout>
|
||||
</Providers>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
import { Metadata } from 'next'
|
||||
import { notFound } from 'next/navigation'
|
||||
import ServiceHero from '@/components/services/ServiceHero'
|
||||
import ServiceFeatures from '@/components/services/ServiceFeatures'
|
||||
import ServicePricing from '@/components/services/ServicePricing'
|
||||
import ServiceProcessSection from '@/components/services/ServiceProcess'
|
||||
import ServiceCTA from '@/components/services/ServiceCTA'
|
||||
import { getService, getAllServiceSlugs } from '@/lib/services'
|
||||
import { Clock } from 'lucide-react'
|
||||
|
||||
/**
|
||||
* Generate static paths for all featured services
|
||||
*/
|
||||
export async function generateStaticParams() {
|
||||
const slugs = await getAllServiceSlugs()
|
||||
return slugs.map((slug) => ({ service: slug }))
|
||||
}
|
||||
|
||||
export async function generateMetadata({ params }: { params: Promise<{ service: string }> }): Promise<Metadata> {
|
||||
const { service: slug } = await params
|
||||
const service = await getService(slug)
|
||||
|
||||
if (!service) {
|
||||
return {
|
||||
title: 'Service Not Found | RevampIT',
|
||||
description: 'The requested service could not be found.',
|
||||
}
|
||||
}
|
||||
|
||||
// Special SEO metadata for data recovery
|
||||
if (slug === 'data-recovery-transfer') {
|
||||
return {
|
||||
title: 'Data Recovery & Transfer Services Zurich | RevampIT',
|
||||
description: 'Professional data recovery and transfer services in Zurich. Recover data from old computers, transfer files between devices, access legacy media (floppy disks, ZIP drives, MO drives). Base fee CHF 30.',
|
||||
keywords: [
|
||||
'data recovery zurich',
|
||||
'data transfer service',
|
||||
'floppy disk data recovery',
|
||||
'ZIP drive data recovery',
|
||||
'legacy data recovery',
|
||||
'old computer data recovery',
|
||||
'data migration service',
|
||||
'file transfer service',
|
||||
'MO drive data recovery',
|
||||
'SCSI IDE data recovery'
|
||||
],
|
||||
openGraph: {
|
||||
title: 'Data Recovery & Transfer Services Zurich | RevampIT',
|
||||
description: 'Professional data recovery and transfer services in Zurich. Recover data from old computers, transfer files between devices, access legacy media.',
|
||||
type: 'website',
|
||||
url: 'https://revampit.org/services/data-recovery-transfer',
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
title: `${service.name} | RevampIT`,
|
||||
description: service.description,
|
||||
openGraph: {
|
||||
title: `${service.name} | RevampIT`,
|
||||
description: service.description,
|
||||
type: 'website',
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export default async function ServicePage({ params }: { params: Promise<{ service: string }> }) {
|
||||
const { service: slug } = await params
|
||||
const service = await getService(slug)
|
||||
|
||||
if (!service) {
|
||||
notFound()
|
||||
}
|
||||
|
||||
const isComingSoon = !service.isActive
|
||||
|
||||
return (
|
||||
<>
|
||||
{slug === 'data-recovery-transfer' && (
|
||||
<script
|
||||
type="application/ld+json"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: JSON.stringify({
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'Service',
|
||||
'name': 'Data Recovery & Transfer Services',
|
||||
'description': 'Professional data recovery and transfer services for all types of storage media.',
|
||||
'provider': {
|
||||
'@type': 'Organization',
|
||||
'name': 'RevampIT',
|
||||
'url': 'https://revampit.org',
|
||||
'logo': 'https://revampit.org/logo.png',
|
||||
'address': {
|
||||
'@type': 'PostalAddress',
|
||||
'addressLocality': 'Zurich',
|
||||
'addressRegion': 'ZH',
|
||||
'addressCountry': 'CH'
|
||||
}
|
||||
},
|
||||
'serviceType': [
|
||||
'Data Recovery',
|
||||
'Data Transfer',
|
||||
'Legacy Media Access',
|
||||
'File Migration'
|
||||
],
|
||||
'areaServed': {
|
||||
'@type': 'City',
|
||||
'name': 'Zurich'
|
||||
},
|
||||
'hasOfferCatalog': {
|
||||
'@type': 'OfferCatalog',
|
||||
'name': 'Data Recovery Services',
|
||||
'itemListElement': [
|
||||
{
|
||||
'@type': 'Offer',
|
||||
'itemOffered': {
|
||||
'@type': 'Service',
|
||||
'name': 'Data Recovery Base Service',
|
||||
'description': 'Base data recovery service with assessment'
|
||||
},
|
||||
'price': '30',
|
||||
'priceCurrency': 'CHF'
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<main>
|
||||
{/* Coming Soon Banner */}
|
||||
{isComingSoon && (
|
||||
<div className="bg-yellow-100 border-b border-yellow-200">
|
||||
<div className="container mx-auto px-4 py-3">
|
||||
<div className="flex items-center justify-center">
|
||||
<Clock className="w-5 h-5 text-yellow-600 mr-2" />
|
||||
<span className="text-yellow-800 font-semibold">Dieser Service kommt bald. Kontaktieren Sie uns, um Ihr Interesse zu bekunden und benachrichtigt zu werden, wenn er verfügbar ist.</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Hero Section */}
|
||||
<ServiceHero hero={service.hero} />
|
||||
|
||||
{/* Features Section */}
|
||||
<ServiceFeatures features={service.features} />
|
||||
|
||||
{/* Pricing Section */}
|
||||
<ServicePricing pricing={service.pricing} />
|
||||
|
||||
{/* Process Section */}
|
||||
{service.process && <ServiceProcessSection process={service.process} />}
|
||||
|
||||
{/* CTA Section */}
|
||||
<ServiceCTA
|
||||
serviceTitle={service.name}
|
||||
serviceSlug={service.isBookable ? slug : undefined}
|
||||
pricing={service.pricing.base}
|
||||
/>
|
||||
</main>
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* BenefitsSection Component
|
||||
*
|
||||
* Reusable section for displaying benefits
|
||||
*
|
||||
* Created: 2025-12-17
|
||||
* Last Modified: 2025-12-17
|
||||
* Last Modified Summary: Created reusable benefits section component
|
||||
*/
|
||||
|
||||
import { Benefit } from '../data'
|
||||
import { getTextColor } from '@/lib/design-system'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
interface BenefitsSectionProps {
|
||||
benefits: Benefit[]
|
||||
}
|
||||
|
||||
export function BenefitsSection({ benefits }: BenefitsSectionProps) {
|
||||
return (
|
||||
<section className="py-12 sm:py-16 md:py-20 bg-white">
|
||||
<div className="container mx-auto px-4 sm:px-6">
|
||||
<div className="max-w-3xl mx-auto text-center mb-12 sm:mb-16">
|
||||
<h2 className={cn('text-3xl font-bold mb-6', getTextColor('white', 'primary'))}>
|
||||
Warum Open Source wählen?
|
||||
</h2>
|
||||
<p className={cn('text-lg', getTextColor('white', 'muted'))}>
|
||||
Open-Source-Software bietet einen überlegenen Wert, Sicherheit und Flexibilität im Vergleich zu proprietären Alternativen.
|
||||
</p>
|
||||
</div>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 sm:gap-8">
|
||||
{benefits.map((benefit, index) => {
|
||||
const Icon = benefit.icon
|
||||
return (
|
||||
<div key={index} className="bg-success-50 rounded-xl p-6 sm:p-8 border-2 border-success-200">
|
||||
<div className="flex items-center mb-4">
|
||||
<Icon className="w-6 h-6 text-success-600 mr-3" />
|
||||
<h3 className={cn('text-xl font-semibold', getTextColor('success', 'primary'))}>
|
||||
{benefit.title}
|
||||
</h3>
|
||||
</div>
|
||||
<p className={cn('text-sm sm:text-base', getTextColor('success', 'muted'))}>
|
||||
{benefit.description}
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* CTASection Component
|
||||
*
|
||||
* Reusable CTA section for open-source solutions page
|
||||
*
|
||||
* Created: 2025-12-17
|
||||
* Last Modified: 2025-12-17
|
||||
* Last Modified Summary: Created reusable CTA section component
|
||||
*/
|
||||
|
||||
import Link from 'next/link'
|
||||
import { getTextColor, getButtonVariant } from '@/lib/design-system'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
export function CTASection() {
|
||||
return (
|
||||
<section className="py-16 sm:py-20 bg-gradient-to-r from-primary-700 to-primary-800 text-white">
|
||||
<div className="container mx-auto px-4 sm:px-6 text-center">
|
||||
<h2 className="text-3xl sm:text-4xl font-bold mb-6">Bereit für Open Source?</h2>
|
||||
<p className="text-lg sm:text-xl mb-8 max-w-2xl mx-auto text-white/90">
|
||||
Schliessen Sie sich Tausenden von Einzelpersonen und Unternehmen an, die erfolgreich auf Open-Source-Lösungen umgestiegen sind.
|
||||
Unser Expertenteam ist bereit, Ihnen beim Wechsel zu helfen.
|
||||
</p>
|
||||
<div className="flex flex-col sm:flex-row gap-4 justify-center">
|
||||
<Link
|
||||
href="/contact"
|
||||
className={cn(
|
||||
'inline-block px-6 sm:px-8 py-3 sm:py-4 rounded-lg font-semibold transition-colors duration-300 text-base sm:text-lg min-h-[touch] touch-target',
|
||||
'bg-white text-primary-800 hover:bg-primary-50'
|
||||
)}
|
||||
>
|
||||
Starten Sie noch heute
|
||||
</Link>
|
||||
<Link
|
||||
href="/services"
|
||||
className={cn(
|
||||
'inline-block border-2 border-white px-6 sm:px-8 py-3 sm:py-4 rounded-lg font-semibold transition-colors duration-300 text-base sm:text-lg min-h-[touch] touch-target',
|
||||
'text-white hover:bg-white/10'
|
||||
)}
|
||||
>
|
||||
Alle Dienstleistungen entdecken
|
||||
</Link>
|
||||
</div>
|
||||
<div className="mt-12">
|
||||
<h3 className="text-2xl font-bold mb-6 sm:mb-8">Warum RevampIT wählen?</h3>
|
||||
<div className="grid grid-cols-1 md:grid-cols-3 gap-6 sm:gap-8 max-w-4xl mx-auto">
|
||||
<div className="bg-white/10 rounded-lg p-4 sm:p-6 border-2 border-white/20">
|
||||
<h4 className={cn('text-lg sm:text-xl font-semibold mb-2', 'text-white')}>Expertenberatung</h4>
|
||||
<p className="text-white/90 text-sm sm:text-base">Professionelle Unterstützung für Ihre Open-Source-Reise</p>
|
||||
</div>
|
||||
<div className="bg-white/10 rounded-lg p-4 sm:p-6 border-2 border-white/20">
|
||||
<h4 className={cn('text-lg sm:text-xl font-semibold mb-2', 'text-white')}>Massgeschneiderte Lösungen</h4>
|
||||
<p className="text-white/90 text-sm sm:text-base">Zugeschnitten auf Ihre spezifischen Bedürfnisse und Anforderungen</p>
|
||||
</div>
|
||||
<div className="bg-white/10 rounded-lg p-4 sm:p-6 border-2 border-white/20">
|
||||
<h4 className={cn('text-lg sm:text-xl font-semibold mb-2', 'text-white')}>Laufender Support</h4>
|
||||
<p className="text-white/90 text-sm sm:text-base">Kontinuierliche Unterstützung und Wartung</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
/**
|
||||
* ComparisonCard Component
|
||||
*
|
||||
* Reusable component for displaying open-source vs proprietary comparisons
|
||||
*
|
||||
* Created: 2025-12-17
|
||||
* Last Modified: 2025-12-17
|
||||
* Last Modified Summary: Created reusable comparison card component
|
||||
*/
|
||||
|
||||
import React from 'react'
|
||||
import { FileCheck, FileX, LucideIcon } from 'lucide-react'
|
||||
import { getTextColor } from '@/lib/design-system'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
interface ComparisonItem {
|
||||
name: string
|
||||
icon: LucideIcon
|
||||
cost: string
|
||||
comparisons: string[]
|
||||
examples?: string[]
|
||||
}
|
||||
|
||||
interface ComparisonCardProps {
|
||||
item: ComparisonItem
|
||||
variant: 'openSource' | 'proprietary'
|
||||
}
|
||||
|
||||
const ComparisonCardComponent: React.FC<ComparisonCardProps> = ({ item, variant }) => {
|
||||
const isOpenSource = variant === 'openSource'
|
||||
const Icon = item.icon
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
'rounded-lg p-4 sm:p-6 border-2',
|
||||
isOpenSource
|
||||
? 'bg-success-50 border-success-200'
|
||||
: 'bg-neutral-50 border-neutral-200'
|
||||
)}
|
||||
>
|
||||
<div className="flex items-center mb-4">
|
||||
<div
|
||||
className={cn(
|
||||
'p-3 rounded-lg mr-4',
|
||||
isOpenSource ? 'bg-success-100 text-success-600' : 'bg-neutral-100 text-neutral-600'
|
||||
)}
|
||||
>
|
||||
<Icon className="w-8 h-8" />
|
||||
</div>
|
||||
<div>
|
||||
<h5 className={cn('text-xl sm:text-2xl font-bold', getTextColor(isOpenSource ? 'success' : 'neutral', 'primary'))}>
|
||||
{item.name}
|
||||
</h5>
|
||||
<p
|
||||
className={cn(
|
||||
'font-medium text-sm sm:text-base',
|
||||
isOpenSource ? 'text-success-600' : getTextColor('neutral', 'muted')
|
||||
)}
|
||||
>
|
||||
{isOpenSource ? 'Open Source' : 'Proprietär'} • {item.cost}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{item.examples && item.examples.length > 0 && (
|
||||
<div className="mb-6">
|
||||
<h6 className={cn('text-base sm:text-lg font-semibold mb-3', getTextColor(isOpenSource ? 'success' : 'neutral', 'primary'))}>
|
||||
Beliebte Beispiele:
|
||||
</h6>
|
||||
<ul className="space-y-2">
|
||||
{item.examples.map((example, i) => (
|
||||
<li key={i} className="flex items-start">
|
||||
<div
|
||||
className={cn(
|
||||
'p-1 rounded-full mr-3 mt-0.5',
|
||||
isOpenSource ? 'bg-success-100' : 'bg-neutral-100'
|
||||
)}
|
||||
>
|
||||
{isOpenSource ? (
|
||||
<FileCheck className="w-4 h-4 text-success-600" />
|
||||
) : (
|
||||
<FileX className="w-4 h-4 text-neutral-500" />
|
||||
)}
|
||||
</div>
|
||||
<span className={cn('text-sm sm:text-base', getTextColor(isOpenSource ? 'success' : 'neutral', 'muted'))}>
|
||||
{example}
|
||||
</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="space-y-4">
|
||||
{item.examples && (
|
||||
<h6 className={cn('text-base sm:text-lg font-semibold mb-3', getTextColor(isOpenSource ? 'success' : 'neutral', 'primary'))}>
|
||||
{isOpenSource ? 'Wichtige Vorteile:' : 'Wichtige Merkmale:'}
|
||||
</h6>
|
||||
)}
|
||||
{item.comparisons.map((comparison, i) => (
|
||||
<div key={i} className="flex items-start">
|
||||
<div
|
||||
className={cn(
|
||||
'p-1 rounded-full mr-3 mt-0.5',
|
||||
isOpenSource ? 'bg-success-100' : 'bg-neutral-100'
|
||||
)}
|
||||
>
|
||||
{isOpenSource ? (
|
||||
<FileCheck className="w-4 h-4 text-success-600" />
|
||||
) : (
|
||||
<FileX className="w-4 h-4 text-neutral-500" />
|
||||
)}
|
||||
</div>
|
||||
<span className={cn('text-sm sm:text-base', getTextColor(isOpenSource ? 'success' : 'neutral', 'muted'))}>
|
||||
{comparison}
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
// Memoize to prevent unnecessary re-renders when parent updates
|
||||
export const ComparisonCard = React.memo(ComparisonCardComponent)
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* ComparisonSection Component
|
||||
*
|
||||
* Reusable section for displaying comparison groups
|
||||
*
|
||||
* Created: 2025-12-17
|
||||
* Last Modified: 2025-12-17
|
||||
* Last Modified Summary: Created reusable comparison section component
|
||||
*/
|
||||
|
||||
import { Comparison } from '../data'
|
||||
import { ComparisonCard } from './ComparisonCard'
|
||||
import { getTextColor } from '@/lib/design-system'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
interface ComparisonSectionProps {
|
||||
title: string
|
||||
comparisons: Comparison[]
|
||||
}
|
||||
|
||||
export function ComparisonSection({ title, comparisons }: ComparisonSectionProps) {
|
||||
return (
|
||||
<div className="mb-12 sm:mb-16">
|
||||
<h3 className={cn('text-2xl font-bold mb-6 sm:mb-8 text-center', getTextColor('white', 'primary'))}>
|
||||
{title}
|
||||
</h3>
|
||||
<div className="space-y-8 sm:space-y-12">
|
||||
{comparisons.map((comparison, index) => (
|
||||
<div key={index} className="bg-neutral-50 rounded-xl p-6 sm:p-8 shadow-lg border-2 border-neutral-200">
|
||||
<h4 className={cn('text-xl sm:text-2xl font-bold mb-6 sm:mb-8 text-center', getTextColor('neutral', 'primary'))}>
|
||||
{comparison.category}
|
||||
</h4>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-6 sm:gap-8">
|
||||
<ComparisonCard item={comparison.openSource} variant="openSource" />
|
||||
<ComparisonCard item={comparison.proprietary} variant="proprietary" />
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* ServicesSection Component
|
||||
*
|
||||
* Reusable section for displaying services/features
|
||||
*
|
||||
* Created: 2025-12-17
|
||||
* Last Modified: 2025-12-17
|
||||
* Last Modified Summary: Created reusable services section component
|
||||
*/
|
||||
|
||||
import { Feature } from '../data'
|
||||
import { getTextColor } from '@/lib/design-system'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
interface ServicesSectionProps {
|
||||
features: Feature[]
|
||||
}
|
||||
|
||||
export function ServicesSection({ features }: ServicesSectionProps) {
|
||||
return (
|
||||
<section className="py-12 sm:py-16 md:py-20 bg-neutral-50">
|
||||
<div className="container mx-auto px-4 sm:px-6">
|
||||
<h2 className={cn('text-3xl font-bold mb-8 sm:mb-12 text-center', getTextColor('neutral', 'primary'))}>
|
||||
Unsere Dienstleistungen
|
||||
</h2>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-6 sm:gap-8">
|
||||
{features.map((feature, index) => {
|
||||
const Icon = feature.icon
|
||||
return (
|
||||
<div key={index} className="bg-white rounded-xl p-6 sm:p-8 shadow-lg border-2 border-neutral-200">
|
||||
<div className="flex items-start mb-6">
|
||||
<div className="p-3 bg-success-100 rounded-lg text-success-600 mr-4">
|
||||
<Icon className="w-8 h-8" />
|
||||
</div>
|
||||
<div>
|
||||
<h3 className={cn('text-xl sm:text-2xl font-bold mb-3', getTextColor('white', 'primary'))}>
|
||||
{feature.title}
|
||||
</h3>
|
||||
<p className={cn('text-sm sm:text-base', getTextColor('white', 'muted'))}>
|
||||
{feature.description}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,613 @@
|
||||
/**
|
||||
* Open Source Solutions Page Data
|
||||
*
|
||||
* Centralized data for the open-source-solutions page
|
||||
*
|
||||
* Created: 2025-12-17
|
||||
* Last Modified: 2025-12-17
|
||||
* Last Modified Summary: Extracted data constants from page component
|
||||
*/
|
||||
|
||||
import {
|
||||
Code,
|
||||
Shield,
|
||||
Users,
|
||||
BookOpen,
|
||||
Database,
|
||||
Server,
|
||||
Terminal,
|
||||
Globe,
|
||||
DollarSign,
|
||||
FileSpreadsheet,
|
||||
FileImage,
|
||||
FileVideo,
|
||||
FileCode,
|
||||
FileCheck,
|
||||
FileX,
|
||||
FileText,
|
||||
Chrome,
|
||||
Image,
|
||||
Video,
|
||||
Cloud,
|
||||
Paintbrush,
|
||||
Film,
|
||||
Coins,
|
||||
Wallet,
|
||||
Banknote,
|
||||
Brain,
|
||||
Network,
|
||||
Monitor,
|
||||
Box,
|
||||
GitBranch,
|
||||
MessageSquare,
|
||||
Activity,
|
||||
Share2,
|
||||
LucideIcon
|
||||
} from 'lucide-react'
|
||||
|
||||
export interface Benefit {
|
||||
title: string
|
||||
description: string
|
||||
icon: LucideIcon
|
||||
}
|
||||
|
||||
export interface PopularApp {
|
||||
name: string
|
||||
description: string
|
||||
icon: LucideIcon
|
||||
comparison: string
|
||||
}
|
||||
|
||||
export interface Feature {
|
||||
title: string
|
||||
description: string
|
||||
icon: LucideIcon
|
||||
}
|
||||
|
||||
export interface ComparisonItem {
|
||||
name: string
|
||||
icon: LucideIcon
|
||||
cost: string
|
||||
comparisons: string[]
|
||||
examples?: string[]
|
||||
}
|
||||
|
||||
export interface Comparison {
|
||||
category: string
|
||||
openSource: ComparisonItem
|
||||
proprietary: ComparisonItem
|
||||
}
|
||||
|
||||
export const benefits: Benefit[] = [
|
||||
{
|
||||
title: 'Kosteneffektiv',
|
||||
description: 'Keine Lizenzgebühren und niedrigere Gesamtbetriebskosten im Vergleich zu proprietären Lösungen.',
|
||||
icon: DollarSign
|
||||
},
|
||||
{
|
||||
title: 'Erhöhte Sicherheit',
|
||||
description: 'Transparenter Code, der von jedermann überprüft werden kann, was zu einer schnelleren Erkennung und Behebung von Schwachstellen führt.',
|
||||
icon: Shield
|
||||
},
|
||||
{
|
||||
title: 'Freiheit & Flexibilität',
|
||||
description: 'Kein Anbieter-Lock-in. Sie besitzen Ihre Daten und können die Software an Ihre Bedürfnisse anpassen.',
|
||||
icon: Globe
|
||||
},
|
||||
{
|
||||
title: 'Community-Unterstützung',
|
||||
description: 'Zugang zu einer globalen Gemeinschaft von Entwicklern und Benutzern für Unterstützung und Innovation.',
|
||||
icon: Users
|
||||
}
|
||||
]
|
||||
|
||||
export const popularApps: PopularApp[] = [
|
||||
{
|
||||
name: 'LibreOffice',
|
||||
description: 'Professionelle Office-Suite, die mit Microsoft Office konkurriert, mit voller Kompatibilität und erweiterten Funktionen.',
|
||||
icon: BookOpen,
|
||||
comparison: 'Microsoft Office-Alternative'
|
||||
},
|
||||
{
|
||||
name: 'Nextcloud',
|
||||
description: 'Sichere Filesharing- und Kollaborationsplattform, die mit Dropbox und Google Drive konkurriert.',
|
||||
icon: Server,
|
||||
comparison: 'Dropbox/Google Drive-Alternative'
|
||||
},
|
||||
{
|
||||
name: 'GIMP',
|
||||
description: 'Professionelle Bildbearbeitungssoftware mit Funktionen, die Adobe Photoshop entsprechen.',
|
||||
icon: Code,
|
||||
comparison: 'Photoshop-Alternative'
|
||||
},
|
||||
{
|
||||
name: 'PostgreSQL',
|
||||
description: 'Datenbanksystem der Enterprise-Klasse, das in Leistung und Funktionen mit Oracle und SQL Server konkurriert.',
|
||||
icon: Database,
|
||||
comparison: 'Oracle/SQL Server-Alternative'
|
||||
}
|
||||
]
|
||||
|
||||
export const features: Feature[] = [
|
||||
{
|
||||
title: 'Open-Source-Beratung',
|
||||
description: 'Strategische Anleitung zur Auswahl und Implementierung von Open-Source-Software für Ihre spezifischen Bedürfnisse.',
|
||||
icon: Code
|
||||
},
|
||||
{
|
||||
title: 'Kundenspezifische Entwicklung',
|
||||
description: 'Massgeschneiderte Open-Source-Lösungen und -Anpassungen, um Ihre einzigartigen Anforderungen zu erfüllen.',
|
||||
icon: Terminal
|
||||
},
|
||||
{
|
||||
title: 'Community-Integration',
|
||||
description: 'Hilft Ihnen, ein aktiver Teil der Open-Source-Community zu werden und deren Vorteile zu nutzen.',
|
||||
icon: Users
|
||||
},
|
||||
{
|
||||
title: 'Sicherheit & Compliance',
|
||||
description: 'Stellen Sie sicher, dass Ihre Open-Source-Lösungen die Sicherheitsstandards und Compliance-Anforderungen erfüllen.',
|
||||
icon: Shield
|
||||
}
|
||||
]
|
||||
|
||||
export const consumerComparisons: Comparison[] = [
|
||||
{
|
||||
category: 'Office-Paket',
|
||||
openSource: {
|
||||
name: 'LibreOffice',
|
||||
icon: FileSpreadsheet,
|
||||
cost: 'Kostenlos, keine Abonnements',
|
||||
comparisons: [
|
||||
'Vollständiger Funktionsumfang, der Microsoft Office entspricht',
|
||||
'Export in jedes Dokumentenformat',
|
||||
'Keine erzwungenen Upgrades oder Telemetrie',
|
||||
'Community-gesteuerte Entwicklung',
|
||||
'Verfügbar in mehreren Sprachen',
|
||||
'Vollständige Kontrolle über Ihre Dokumente'
|
||||
]
|
||||
},
|
||||
proprietary: {
|
||||
name: 'Microsoft 365',
|
||||
icon: FileText,
|
||||
cost: 'Ab CHF 69/Jahr pro Benutzer',
|
||||
comparisons: [
|
||||
'Vollständiger Funktionsumfang mit Cloud-Integration',
|
||||
'Native Unterstützung des Microsoft-Formats',
|
||||
'Regelmässige Updates und neue Funktionen',
|
||||
'Unternehmensgesteuerte Entwicklung',
|
||||
'Verfügbar in mehreren Sprachen',
|
||||
'Abonnement für volle Funktionalität erforderlich'
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
category: 'Betriebssystem',
|
||||
openSource: {
|
||||
name: 'Linux',
|
||||
icon: Terminal,
|
||||
cost: 'Kostenlos, keine Lizenzen',
|
||||
comparisons: [
|
||||
'Vollständig anpassbar und überprüfbar',
|
||||
'Keine erzwungenen Updates oder Telemetrie',
|
||||
'Tausende von kostenlosen Anwendungen',
|
||||
'Community-gesteuerte Sicherheitsupdates',
|
||||
'Verfügbar in mehreren Distributionen',
|
||||
'Vollständige Kontrolle über Ihr System'
|
||||
]
|
||||
},
|
||||
proprietary: {
|
||||
name: 'Windows/macOS',
|
||||
icon: Monitor,
|
||||
cost: 'Lizenzgebühren und Abonnements',
|
||||
comparisons: [
|
||||
'Auf den meisten Geräten vorinstalliert',
|
||||
'Integrierte Telemetrie und Updates',
|
||||
'Offizielle App-Stores und Support',
|
||||
'Unternehmensgesteuerte Updates',
|
||||
'Begrenzte Anpassungsmöglichkeiten',
|
||||
'Regelmässige Lizenzerneuerungen erforderlich'
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
category: 'Datei-Synchronisierung & -Freigabe',
|
||||
openSource: {
|
||||
name: 'Nextcloud',
|
||||
icon: Cloud,
|
||||
cost: 'Kostenlos, selbst gehostet',
|
||||
comparisons: [
|
||||
'Vollständige Kontrolle über Ihre Daten',
|
||||
'Hunderte von integrierten Apps',
|
||||
'DSGVO- und datenschutzkonform',
|
||||
'Community-gesteuerte Entwicklung',
|
||||
'Verfügbar in mehreren Sprachen',
|
||||
'Keine Speicherbegrenzungen oder Gebühren'
|
||||
]
|
||||
},
|
||||
proprietary: {
|
||||
name: 'Dropbox/Google Drive',
|
||||
icon: Cloud,
|
||||
cost: 'Ab CHF 10/Monat',
|
||||
comparisons: [
|
||||
'Einfach zu bedienen und einzurichten',
|
||||
'Integriert mit anderen Diensten',
|
||||
'Automatische Synchronisierung und Sicherung',
|
||||
'Unternehmensgesteuerte Entwicklung',
|
||||
'Verfügbar in mehreren Sprachen',
|
||||
'Speicherbegrenzungen und Gebühren fallen an'
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
category: 'Webbrowser',
|
||||
openSource: {
|
||||
name: 'Firefox/Brave',
|
||||
icon: Globe,
|
||||
cost: 'Kostenlos',
|
||||
comparisons: [
|
||||
'Datenschutzorientiert ohne Tracking',
|
||||
'Funktioniert mit allen Webstandards',
|
||||
'Regelmässige Sicherheitsupdates',
|
||||
'Community-gesteuerte Entwicklung',
|
||||
'Verfügbar in mehreren Sprachen',
|
||||
'Keine Datenerfassung'
|
||||
]
|
||||
},
|
||||
proprietary: {
|
||||
name: 'Chrome/Edge',
|
||||
icon: Chrome,
|
||||
cost: 'Kostenlos mit Datenerfassung',
|
||||
comparisons: [
|
||||
'Umfangreiche Datenerfassung und Tracking',
|
||||
'Funktioniert mit allen Webstandards',
|
||||
'Regelmässige Sicherheitsupdates',
|
||||
'Unternehmensgesteuerte Entwicklung',
|
||||
'Verfügbar in mehreren Sprachen',
|
||||
'Datenerfassung erforderlich'
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
category: 'Grafikbearbeitung',
|
||||
openSource: {
|
||||
name: 'GIMP/Inkscape',
|
||||
icon: Paintbrush,
|
||||
cost: 'Kostenlos',
|
||||
comparisons: [
|
||||
'Professionelle Werkzeuge',
|
||||
'Funktioniert mit allen Bildformaten',
|
||||
'Regelmässige Sicherheitsupdates',
|
||||
'Community-gesteuerte Entwicklung',
|
||||
'Verfügbar in mehreren Sprachen',
|
||||
'Keine Wasserzeichen oder Einschränkungen'
|
||||
]
|
||||
},
|
||||
proprietary: {
|
||||
name: 'Adobe Photoshop/Illustrator',
|
||||
icon: Image,
|
||||
cost: 'CHF 24/Monat',
|
||||
comparisons: [
|
||||
'Branchenübliche Werkzeuge',
|
||||
'Funktioniert mit allen Bildformaten',
|
||||
'Regelmässige Sicherheitsupdates',
|
||||
'Unternehmensgesteuerte Entwicklung',
|
||||
'Verfügbar in mehreren Sprachen',
|
||||
'Abonnement erforderlich'
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
category: '3D & Video',
|
||||
openSource: {
|
||||
name: 'Blender',
|
||||
icon: Film,
|
||||
cost: 'Kostenlos',
|
||||
comparisons: [
|
||||
'3D/VFX/Animation in Studioqualität',
|
||||
'Riesiges Plugin-Ökosystem',
|
||||
'Regelmässige Sicherheitsupdates',
|
||||
'Community-gesteuerte Entwicklung',
|
||||
'Verfügbar in mehreren Sprachen',
|
||||
'Keine Wasserzeichen oder Einschränkungen'
|
||||
]
|
||||
},
|
||||
proprietary: {
|
||||
name: 'Autodesk Maya/3ds Max',
|
||||
icon: Video,
|
||||
cost: 'Komplexe Lizenzgebühren',
|
||||
comparisons: [
|
||||
'Branchenübliche Werkzeuge',
|
||||
'Funktioniert mit allen Formaten',
|
||||
'Regelmässige Sicherheitsupdates',
|
||||
'Unternehmensgesteuerte Entwicklung',
|
||||
'Verfügbar in mehreren Sprachen',
|
||||
'Lizenz und Support erforderlich'
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
category: 'Soziale Medien',
|
||||
openSource: {
|
||||
name: 'Mastodon/Pixelfed',
|
||||
icon: Users,
|
||||
cost: 'Kostenlos, selbst gehostet oder einem Server beitreten',
|
||||
comparisons: [
|
||||
'Dezentrales Netzwerk (Fediverse)',
|
||||
'Keine Algorithmus-Manipulation',
|
||||
'Keine Datenerfassung oder Werbung',
|
||||
'Community-gesteuerte Moderation',
|
||||
'Verfügbar in mehreren Sprachen',
|
||||
'Exportieren Sie Ihre Daten jederzeit'
|
||||
]
|
||||
},
|
||||
proprietary: {
|
||||
name: 'X/Instagram',
|
||||
icon: Share2,
|
||||
cost: 'Kostenlos mit Werbung und Datenerfassung',
|
||||
comparisons: [
|
||||
'Zentralisierte Plattformkontrolle',
|
||||
'Algorithmus-gesteuerter Inhalt',
|
||||
'Umfangreiche Datenerfassung',
|
||||
'Unternehmensmoderation',
|
||||
'Verfügbar in mehreren Sprachen',
|
||||
'Begrenzte Datenportabilität'
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
export const businessComparisons: Comparison[] = [
|
||||
{
|
||||
category: 'Datenbank',
|
||||
openSource: {
|
||||
name: 'PostgreSQL/MariaDB',
|
||||
icon: Database,
|
||||
cost: 'Kostenlos, keine Platzgebühren',
|
||||
comparisons: [
|
||||
'Leistung auf Unternehmensebene',
|
||||
'Unbegrenzte Erweiterungen und Plugins',
|
||||
'Starke ACID-Konformität',
|
||||
'Community-gesteuerte Sicherheit',
|
||||
'Verfügbar für alle Plattformen',
|
||||
'Vollständige Kontrolle über die Daten'
|
||||
]
|
||||
},
|
||||
proprietary: {
|
||||
name: 'Oracle DB',
|
||||
icon: Database,
|
||||
cost: 'Komplexe Lizenzgebühren',
|
||||
comparisons: [
|
||||
'Funktionen auf Unternehmensebene',
|
||||
'Offizieller Support und Schulungen',
|
||||
'Starke Sicherheitsfunktionen',
|
||||
'Unternehmensgesteuerte Updates',
|
||||
'Verfügbar für alle Plattformen',
|
||||
'Lizenz und Support erforderlich'
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
category: 'Virtualisierung',
|
||||
openSource: {
|
||||
name: 'KVM/QEMU',
|
||||
icon: Server,
|
||||
cost: 'Kostenlos, keine Lizenzen',
|
||||
comparisons: [
|
||||
'Vollständig offener Hypervisor',
|
||||
'Integriert sich in jede Toolchain',
|
||||
'Funktionen auf Unternehmensebene',
|
||||
'Community-gesteuerte Sicherheit',
|
||||
'Verfügbar für alle Plattformen',
|
||||
'Vollständige Kontrolle über VMs'
|
||||
]
|
||||
},
|
||||
proprietary: {
|
||||
name: 'VMware vSphere',
|
||||
icon: Server,
|
||||
cost: 'Lizenzen pro CPU/Sockel',
|
||||
comparisons: [
|
||||
'Funktionen auf Unternehmensebene',
|
||||
'Offizieller Support und Schulungen',
|
||||
'Starke Sicherheitsfunktionen',
|
||||
'Unternehmensgesteuerte Updates',
|
||||
'Verfügbar für alle Plattformen',
|
||||
'Lizenz und Support erforderlich'
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
category: 'Container-Plattform',
|
||||
openSource: {
|
||||
name: 'Kubernetes',
|
||||
icon: Box,
|
||||
cost: 'Kostenlos, kein Lock-in',
|
||||
comparisons: [
|
||||
'Überall lauffähig, kein Cloud-Lock',
|
||||
'Nach Bedarf forken und anpassen',
|
||||
'Funktionen auf Unternehmensebene',
|
||||
'Community-gesteuerte Sicherheit',
|
||||
'Verfügbar für alle Plattformen',
|
||||
'Vollständige Kontrolle über Container'
|
||||
]
|
||||
},
|
||||
proprietary: {
|
||||
name: 'AWS ECS/EKS',
|
||||
icon: Cloud,
|
||||
cost: 'Komplexes Preismodell',
|
||||
comparisons: [
|
||||
'Verwalteter Dienst mit Support',
|
||||
'Integriert in das AWS-Ökosystem',
|
||||
'Funktionen auf Unternehmensebene',
|
||||
'Unternehmensgesteuerte Updates',
|
||||
'Verfügbar auf der AWS-Plattform',
|
||||
'Potenzial für Anbieter-Lock-in'
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
category: 'CI/CD',
|
||||
openSource: {
|
||||
name: 'Jenkins/GitLab CI',
|
||||
icon: GitBranch,
|
||||
cost: 'Kostenlos, selbst gehostet',
|
||||
comparisons: [
|
||||
'Unendliche Plugins und Erweiterungen',
|
||||
'Selbst-Hosting oder Cloud-Bereitstellung',
|
||||
'Funktionen auf Unternehmensebene',
|
||||
'Community-gesteuerte Sicherheit',
|
||||
'Verfügbar für alle Plattformen',
|
||||
'Vollständige Kontrolle über die Pipeline'
|
||||
]
|
||||
},
|
||||
proprietary: {
|
||||
name: 'TeamCity/CircleCI',
|
||||
icon: GitBranch,
|
||||
cost: 'Gebühren pro Benutzer oder pro Build',
|
||||
comparisons: [
|
||||
'Verwalteter Dienst mit Support',
|
||||
'Integriert mit anderen Tools',
|
||||
'Funktionen auf Unternehmensebene',
|
||||
'Unternehmensgesteuerte Updates',
|
||||
'Verfügbar für alle Plattformen',
|
||||
'Nutzungsabhängige Preise'
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
category: 'Überwachung',
|
||||
openSource: {
|
||||
name: 'Prometheus + Grafana',
|
||||
icon: Activity,
|
||||
cost: 'Kostenlos, selbst gehostet',
|
||||
comparisons: [
|
||||
'Pull-Modell-Metrikerfassung',
|
||||
'Flexible Abfragesprache',
|
||||
'Umfangreiches Plugin-Ökosystem',
|
||||
'Community-gesteuerte Sicherheit',
|
||||
'Verfügbar für alle Plattformen',
|
||||
'Vollständige Kontrolle über die Überwachung'
|
||||
]
|
||||
},
|
||||
proprietary: {
|
||||
name: 'Datadog/New Relic',
|
||||
icon: Activity,
|
||||
cost: 'Gebühren pro Host/pro Metrik',
|
||||
comparisons: [
|
||||
'Verwalteter Dienst mit Support',
|
||||
'Integriert mit anderen Tools',
|
||||
'Funktionen auf Unternehmensebene',
|
||||
'Unternehmensgesteuerte Updates',
|
||||
'Verfügbar für alle Plattformen',
|
||||
'Nutzungsabhängige Preise'
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
category: 'Zusammenarbeit',
|
||||
openSource: {
|
||||
name: 'Mattermost/Rocket.Chat',
|
||||
icon: MessageSquare,
|
||||
cost: 'Kostenlos, selbst gehostet',
|
||||
comparisons: [
|
||||
'Selbst gehostete Slack-Alternative',
|
||||
'Keine Datenerfassung',
|
||||
'Daten jederzeit exportieren',
|
||||
'Community-gesteuerte Sicherheit',
|
||||
'Verfügbar für alle Plattformen',
|
||||
'Vollständige Kontrolle über die Daten'
|
||||
]
|
||||
},
|
||||
proprietary: {
|
||||
name: 'Slack/Teams',
|
||||
icon: MessageSquare,
|
||||
cost: 'Abonnement pro Benutzer',
|
||||
comparisons: [
|
||||
'Einfach zu bedienen und einzurichten',
|
||||
'Integriert mit anderen Diensten',
|
||||
'Funktionen auf Unternehmensebene',
|
||||
'Unternehmensgesteuerte Updates',
|
||||
'Verfügbar für alle Plattformen',
|
||||
'Es gelten Datenaufbewahrungsrichtlinien'
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
export const emergingTechComparisons: Comparison[] = [
|
||||
{
|
||||
category: 'Digitale Währung',
|
||||
openSource: {
|
||||
name: 'Bitcoin',
|
||||
icon: Coins,
|
||||
cost: 'Transparente Netzwerkgebühren',
|
||||
comparisons: [
|
||||
'Open-Source-Protokoll mit öffentlichem Prüfpfad',
|
||||
'Vorhersehbares Angebot mit 21 Millionen Obergrenze',
|
||||
'Selbstverwahrung: volle Kontrolle über die Gelder',
|
||||
'Globales Netzwerk mit 24/7-Verfügbarkeit',
|
||||
'Genehmigungsfreie Transaktionen',
|
||||
'Keine zentrale Behörde'
|
||||
]
|
||||
},
|
||||
proprietary: {
|
||||
name: 'Traditionelles Bankwesen',
|
||||
icon: Banknote,
|
||||
cost: 'Mehrere Gebühren und Entgelte',
|
||||
comparisons: [
|
||||
'Zentralisierte Kontrolle und Regulierung',
|
||||
'Unbegrenztes Angebot durch Zentralbanken',
|
||||
'Verwahrung: Banken kontrollieren die Gelder',
|
||||
'Begrenzt durch Banköffnungszeiten',
|
||||
'Genehmigungspflichtige Transaktionen',
|
||||
'Zentrale Behörde erforderlich'
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
category: 'Künstliche Intelligenz',
|
||||
openSource: {
|
||||
name: 'Open-Source-KI',
|
||||
icon: Brain,
|
||||
cost: 'Kostenlos nutzbar, Bezahlung für Rechenleistung',
|
||||
examples: [
|
||||
'LLaMA 2 (Meta) - Leistungsstarkes Sprachmodell',
|
||||
'Stable Diffusion - Bilderzeugung',
|
||||
'Whisper - Spracherkennung',
|
||||
'BERT - Verarbeitung natürlicher Sprache',
|
||||
'TensorFlow/PyTorch - ML-Frameworks'
|
||||
],
|
||||
comparisons: [
|
||||
'Vollständig überprüfbarer Code und Modelle',
|
||||
'Keine erzwungene Telemetrie oder Tracking',
|
||||
'Läuft auf jeder kompatiblen Hardware',
|
||||
'Community-gesteuerte Sicherheit',
|
||||
'Demokratisierte Entwicklung',
|
||||
'Vollständige Anpassung möglich'
|
||||
]
|
||||
},
|
||||
proprietary: {
|
||||
name: 'Proprietäre KI',
|
||||
icon: Network,
|
||||
cost: 'Pay-per-Use oder Abonnement',
|
||||
examples: [
|
||||
'ChatGPT (OpenAI)',
|
||||
'DALL-E (OpenAI)',
|
||||
'Claude (Anthropic)',
|
||||
'Midjourney',
|
||||
'Google Bard'
|
||||
],
|
||||
comparisons: [
|
||||
'Closed-Source mit Einschränkungen',
|
||||
'Integriertes Nutzungs-Tracking',
|
||||
'Nur Cloud-Bereitstellung',
|
||||
'Unternehmensgesteuerte Updates',
|
||||
'Roadmap eines einzelnen Unternehmens',
|
||||
'Begrenzte Anpassungsmöglichkeiten'
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
import { Metadata } from 'next'
|
||||
import { ResponsiveHero } from '@/components/layout/ResponsiveHero'
|
||||
import { BenefitsSection } from './components/BenefitsSection'
|
||||
import { ServicesSection } from './components/ServicesSection'
|
||||
import { ComparisonSection } from './components/ComparisonSection'
|
||||
import { CTASection } from './components/CTASection'
|
||||
import { getTextColor } from '@/lib/design-system'
|
||||
import { cn } from '@/lib/utils'
|
||||
import {
|
||||
benefits,
|
||||
popularApps,
|
||||
features,
|
||||
consumerComparisons,
|
||||
businessComparisons,
|
||||
emergingTechComparisons
|
||||
} from './data'
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: 'Open-Source-Lösungen | RevampIT',
|
||||
description: 'Professionelle Implementierung, Unterstützung und Schulung für Open-Source-Software für Unternehmen und Privatpersonen.',
|
||||
}
|
||||
|
||||
export default function OpenSourceSolutionsPage() {
|
||||
return (
|
||||
<main>
|
||||
{/* Hero Section */}
|
||||
<ResponsiveHero
|
||||
title="Open-Source-Lösungen"
|
||||
description="Professionelle Implementierung von Open-Source-Software, die proprietären Alternativen entspricht oder diese übertrifft."
|
||||
backgroundColor="green"
|
||||
/>
|
||||
|
||||
{/* Benefits Section */}
|
||||
<BenefitsSection benefits={benefits} />
|
||||
|
||||
{/* Services Section */}
|
||||
<ServicesSection features={features} />
|
||||
|
||||
{/* CTA Section */}
|
||||
<CTASection />
|
||||
|
||||
{/* Verification Note */}
|
||||
<div className="bg-neutral-50 py-6 sm:py-8">
|
||||
<div className="container mx-auto px-4 sm:px-6 text-center">
|
||||
<p className={cn('text-sm', getTextColor('neutral', 'muted'))}>
|
||||
Alle bereitgestellten Informationen sind zum {new Date().toLocaleDateString('de-CH', { year: 'numeric', month: 'long' })} korrekt.
|
||||
Wir aktualisieren unsere Inhalte regelmässig, um die neuesten Entwicklungen in der Open-Source-Software widerzuspiegeln.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Comparison Section */}
|
||||
<section className="py-12 sm:py-16 md:py-20 bg-white">
|
||||
<div className="container mx-auto px-4 sm:px-6">
|
||||
<div className="max-w-3xl mx-auto text-center mb-12 sm:mb-16">
|
||||
<h2 className={cn('text-3xl font-bold mb-6', getTextColor('white', 'primary'))}>
|
||||
Open-Source-Lösungen
|
||||
</h2>
|
||||
<p className={cn('text-lg', getTextColor('white', 'muted'))}>
|
||||
Entdecken Sie leistungsstarke Open-Source-Alternativen zu teurer proprietärer Software.
|
||||
Alle diese Lösungen sind kostenlos, werden regelmässig aktualisiert und von der Community vorangetrieben.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Consumer Solutions */}
|
||||
<ComparisonSection title="Lösungen für Verbraucher" comparisons={consumerComparisons} />
|
||||
|
||||
{/* Business Solutions */}
|
||||
<ComparisonSection title="Lösungen für Unternehmen" comparisons={businessComparisons} />
|
||||
|
||||
{/* Emerging Technologies */}
|
||||
<ComparisonSection title="Aufstrebende Technologien" comparisons={emergingTechComparisons} />
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
import React from 'react'
|
||||
import { Loader2, AlertTriangle } from 'lucide-react'
|
||||
import Heading from '@/components/admin/AdminHeading'
|
||||
import {
|
||||
ProductTabSwitcher,
|
||||
ProductStatsCards,
|
||||
@@ -45,11 +44,11 @@ export default function ProductManagement() {
|
||||
<div className="bg-white rounded-xl shadow-sm border border-gray-200 p-8">
|
||||
<div className="text-center">
|
||||
<AlertTriangle className="w-12 h-12 text-red-500 mx-auto mb-4" />
|
||||
<Heading level={3} className="text-lg font-medium text-gray-900 mb-2">
|
||||
<h3 className="text-lg font-medium text-gray-900 mb-2">
|
||||
Fehler beim Laden der Produkte
|
||||
</Heading>
|
||||
</h3>
|
||||
<p className="text-gray-600 mb-4">
|
||||
{actions.error.message || 'Bitte versuche es später erneut.'}
|
||||
{actions.error.message || 'Bitte versuchen Sie es später erneut.'}
|
||||
</p>
|
||||
<button
|
||||
onClick={() => actions.refetch()}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
'use client'
|
||||
|
||||
import { cn } from '@/lib/utils'
|
||||
import { UserRole, ROLES } from '@/lib/constants'
|
||||
import { CheckCircle, Circle } from 'lucide-react'
|
||||
|
||||
interface Step {
|
||||
label: string
|
||||
done: boolean
|
||||
href?: string
|
||||
}
|
||||
|
||||
interface OnboardingChecklistProps {
|
||||
role: UserRole
|
||||
emailVerified: boolean
|
||||
className?: string
|
||||
}
|
||||
|
||||
export function OnboardingChecklist({ role, emailVerified, className }: OnboardingChecklistProps) {
|
||||
const steps: Step[] = [
|
||||
{ label: 'E-Mail-Adresse bestätigen', done: emailVerified, href: '/dashboard/profile' },
|
||||
{ label: 'Profil vervollständigen', done: false, href: '/dashboard/profile' },
|
||||
]
|
||||
|
||||
if (role === ROLES.SELLER) {
|
||||
steps.push({ label: 'Seller-Profil eingerichtet', done: true })
|
||||
steps.push({ label: 'Erstes Produkt inserieren', done: false, href: '/dashboard/seller' })
|
||||
} else if (role === ROLES.REPAIRER) {
|
||||
steps.push({ label: 'Techniker-Profil eingerichtet', done: true })
|
||||
steps.push({ label: 'Erste Dienstleistung publizieren', done: false, href: '/dashboard/repairer' })
|
||||
}
|
||||
|
||||
const allDone = steps.every((s) => s.done)
|
||||
if (allDone) return null
|
||||
|
||||
const remaining = steps.filter((s) => !s.done).length
|
||||
|
||||
return (
|
||||
<div className={cn('bg-white dark:bg-neutral-800 rounded-lg border border-neutral-200 dark:border-neutral-700 p-4', className)}>
|
||||
<div className="flex items-center justify-between mb-3">
|
||||
<h2 className="text-sm font-semibold text-neutral-700 dark:text-neutral-300">
|
||||
Erste Schritte
|
||||
</h2>
|
||||
<span className="text-xs text-neutral-500 dark:text-neutral-400">
|
||||
{steps.length - remaining}/{steps.length} erledigt
|
||||
</span>
|
||||
</div>
|
||||
<ul className="space-y-2">
|
||||
{steps.map((step) => (
|
||||
<li key={step.label} className="flex items-center gap-2 text-sm">
|
||||
{step.done ? (
|
||||
<CheckCircle className="w-4 h-4 text-green-500 flex-shrink-0" />
|
||||
) : (
|
||||
<Circle className="w-4 h-4 text-neutral-300 dark:text-neutral-600 flex-shrink-0" />
|
||||
)}
|
||||
{step.href && !step.done ? (
|
||||
<a href={step.href} className="text-neutral-600 dark:text-neutral-400 hover:text-green-600 dark:hover:text-green-400 hover:underline">
|
||||
{step.label}
|
||||
</a>
|
||||
) : (
|
||||
<span className={step.done ? 'text-neutral-400 dark:text-neutral-500 line-through' : 'text-neutral-600 dark:text-neutral-400'}>
|
||||
{step.label}
|
||||
</span>
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -15,7 +15,7 @@ export default function MainLayout({ children }: MainLayoutProps) {
|
||||
<div className="min-h-screen bg-gradient-to-b from-white to-gray-50">
|
||||
<Header />
|
||||
|
||||
<main id="main" className="pt-20">
|
||||
<main className="pt-20">
|
||||
{children}
|
||||
</main>
|
||||
|
||||
|
||||
@@ -13,8 +13,7 @@ import { ReactNode } from 'react'
|
||||
import { responsiveSpacing, responsiveTypography, responsiveButtons } from '@/lib/responsive'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { getTextColor, getBackgroundColor, getButtonVariant } from '@/lib/design-system'
|
||||
import { Link } from '@/i18n/navigation'
|
||||
import Heading from '@/components/ui/Heading'
|
||||
import Link from 'next/link'
|
||||
|
||||
export interface ResponsiveHeroProps {
|
||||
title: string
|
||||
@@ -105,15 +104,15 @@ export function ResponsiveHero({
|
||||
|
||||
<div className={cn('container mx-auto relative', responsiveSpacing.container)}>
|
||||
<div className="max-w-3xl">
|
||||
<Heading level={1} className={cn(responsiveTypography.hero, 'font-bold mb-4 sm:mb-6 leading-tight')}>
|
||||
<h1 className={cn(responsiveTypography.hero, 'font-bold mb-4 sm:mb-6 leading-tight')}>
|
||||
{title}
|
||||
</Heading>
|
||||
</h1>
|
||||
|
||||
{subtitle && (
|
||||
<Heading level={2} className={cn(
|
||||
<h2 className={cn(
|
||||
responsiveTypography.subsection,
|
||||
'font-semibold mb-4 sm:mb-6 md:mb-8',
|
||||
backgroundColor === 'white'
|
||||
backgroundColor === 'white'
|
||||
? getTextColor('white', 'secondary')
|
||||
: backgroundColor === 'green'
|
||||
? 'text-primary-100'
|
||||
@@ -122,7 +121,7 @@ export function ResponsiveHero({
|
||||
: 'text-neutral-200'
|
||||
)}>
|
||||
{subtitle}
|
||||
</Heading>
|
||||
</h2>
|
||||
)}
|
||||
|
||||
{description && (
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* Product Listing Constants
|
||||
*
|
||||
* Constants for product listing form.
|
||||
* Conditions derived from SSOT: @/config/erfassung/conditions
|
||||
* Categories derived from SSOT: @/config/erfassung/categories
|
||||
*/
|
||||
|
||||
import { ZUSTAND_OPTIONS } from '@/config/erfassung/conditions'
|
||||
import { KATEGORIEN } from '@/config/erfassung/categories'
|
||||
import type { ProductCondition, ProductCategory } from './types'
|
||||
|
||||
/**
|
||||
* Product categories for marketplace listings.
|
||||
* Derived from KATEGORIEN SSOT (main categories only).
|
||||
*/
|
||||
export const PRODUCT_CATEGORIES: ProductCategory[] = KATEGORIEN.map(k => ({
|
||||
value: k.label,
|
||||
label: k.label,
|
||||
}))
|
||||
|
||||
/**
|
||||
* Conditions available for seller product listings.
|
||||
* Subset of ZUSTAND_OPTIONS — excludes 'poor' and 'defect' (not suitable for sale).
|
||||
*/
|
||||
const SELLER_CONDITION_VALUES = ['new', 'like_new', 'good', 'fair'] as const
|
||||
|
||||
export const PRODUCT_CONDITIONS: ProductCondition[] = SELLER_CONDITION_VALUES.map(value => {
|
||||
const condition = ZUSTAND_OPTIONS.find(c => c.value === value)!
|
||||
return {
|
||||
value: condition.value,
|
||||
label: condition.label,
|
||||
description: condition.description,
|
||||
}
|
||||
})
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
'use client'
|
||||
|
||||
import { useState, useCallback } from 'react'
|
||||
|
||||
interface SearchResult {
|
||||
id: string
|
||||
name: string
|
||||
brand: string
|
||||
category: string
|
||||
estimatedPrice: number
|
||||
confidence: number
|
||||
features: string[]
|
||||
condition: string
|
||||
}
|
||||
|
||||
interface UseAISearchReturn {
|
||||
searchQuery: string
|
||||
setSearchQuery: (query: string) => void
|
||||
isSearching: boolean
|
||||
searchResults: SearchResult[]
|
||||
search: () => Promise<void>
|
||||
clearResults: () => void
|
||||
}
|
||||
|
||||
export function useAISearch(): UseAISearchReturn {
|
||||
const [searchQuery, setSearchQuery] = useState('')
|
||||
const [isSearching, setIsSearching] = useState(false)
|
||||
const [searchResults, setSearchResults] = useState<SearchResult[]>([])
|
||||
|
||||
const search = useCallback(async () => {
|
||||
if (!searchQuery.trim()) return
|
||||
setIsSearching(true)
|
||||
try {
|
||||
const res = await fetch(`/api/ai/search-products?q=${encodeURIComponent(searchQuery)}`)
|
||||
if (res.ok) {
|
||||
const data = await res.json()
|
||||
setSearchResults(data.results ?? [])
|
||||
}
|
||||
} finally {
|
||||
setIsSearching(false)
|
||||
}
|
||||
}, [searchQuery])
|
||||
|
||||
const clearResults = useCallback(() => {
|
||||
setSearchResults([])
|
||||
setSearchQuery('')
|
||||
}, [])
|
||||
|
||||
return { searchQuery, setSearchQuery, isSearching, searchResults, search, clearResults }
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/**
|
||||
* useProductForm Hook
|
||||
*
|
||||
* Custom hook for product form state management
|
||||
*
|
||||
* Created: 2025-12-17
|
||||
* Last Modified: 2025-12-17
|
||||
* Last Modified Summary: Extracted form state management from ProductListingForm
|
||||
*/
|
||||
|
||||
import { useState } from 'react'
|
||||
import { ProductFormData, ProductListingErrors } from '../types'
|
||||
import { MARKETPLACE_LIMITS } from '@/config/marketplace'
|
||||
|
||||
function validateProductForm(formData: ProductFormData): ProductListingErrors {
|
||||
const errors: ProductListingErrors = {}
|
||||
if (!formData.title.trim()) errors.title = 'Titel ist erforderlich'
|
||||
if (!formData.description.trim()) errors.description = 'Beschreibung ist erforderlich'
|
||||
if (!formData.price.trim()) errors.price = 'Preis ist erforderlich'
|
||||
if (!formData.category) errors.category = 'Kategorie ist erforderlich'
|
||||
if (!formData.condition) errors.condition = 'Zustand ist erforderlich'
|
||||
if (!formData.location.trim()) errors.location = 'Standort ist erforderlich'
|
||||
return errors
|
||||
}
|
||||
|
||||
function isFormValid(errors: ProductListingErrors): boolean {
|
||||
return Object.keys(errors).length === 0
|
||||
}
|
||||
|
||||
const initialFormData: ProductFormData = {
|
||||
title: '',
|
||||
description: '',
|
||||
price: '',
|
||||
category: '',
|
||||
brand: '',
|
||||
condition: '',
|
||||
images: [],
|
||||
location: '',
|
||||
contactInfo: '',
|
||||
}
|
||||
|
||||
export function useProductForm() {
|
||||
const [formData, setFormData] = useState<ProductFormData>(initialFormData)
|
||||
const [errors, setErrors] = useState<ProductListingErrors>({})
|
||||
|
||||
const updateField = (field: keyof ProductFormData, value: string | File[]) => {
|
||||
setFormData(prev => ({ ...prev, [field]: value }))
|
||||
// Clear error for this field when user starts typing
|
||||
if (errors[field as keyof ProductListingErrors]) {
|
||||
setErrors(prev => {
|
||||
const newErrors = { ...prev }
|
||||
delete newErrors[field as keyof ProductListingErrors]
|
||||
return newErrors
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const addImages = (files: File[]) => {
|
||||
if (formData.images.length + files.length > MARKETPLACE_LIMITS.MAX_IMAGES) {
|
||||
throw new Error(`Maximal ${MARKETPLACE_LIMITS.MAX_IMAGES} Bilder erlaubt`)
|
||||
}
|
||||
setFormData(prev => ({
|
||||
...prev,
|
||||
images: [...prev.images, ...files]
|
||||
}))
|
||||
}
|
||||
|
||||
const removeImage = (index: number) => {
|
||||
setFormData(prev => ({
|
||||
...prev,
|
||||
images: prev.images.filter((_, i) => i !== index)
|
||||
}))
|
||||
}
|
||||
|
||||
const validate = (): boolean => {
|
||||
const validationErrors = validateProductForm(formData)
|
||||
setErrors(validationErrors)
|
||||
return isFormValid(validationErrors)
|
||||
}
|
||||
|
||||
const reset = () => {
|
||||
setFormData(initialFormData)
|
||||
setErrors({})
|
||||
}
|
||||
|
||||
return {
|
||||
formData,
|
||||
errors,
|
||||
updateField,
|
||||
addImages,
|
||||
removeImage,
|
||||
validate,
|
||||
reset,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Marketplace Components Index
|
||||
*
|
||||
* Central export point for marketplace components
|
||||
*
|
||||
* Created: 2025-12-17
|
||||
* Last Modified: 2025-12-17
|
||||
* Last Modified Summary: Created index file for marketplace components
|
||||
*/
|
||||
|
||||
// Form sections
|
||||
export { BasicInfoSection } from './sections/BasicInfoSection'
|
||||
export { ConditionSection } from './sections/ConditionSection'
|
||||
export { ImageUploadSection } from './sections/ImageUploadSection'
|
||||
export { ContactInfoSection } from './sections/ContactInfoSection'
|
||||
|
||||
// Modals
|
||||
export { AISearchModal } from './modals/AISearchModal'
|
||||
// Hooks
|
||||
export { useProductForm } from './hooks/useProductForm'
|
||||
export { useAISearch } from './hooks/useAISearch'
|
||||
|
||||
// Types
|
||||
export type { ProductFormData, ProductCondition, ProductCategory, ProductListingErrors } from './types'
|
||||
|
||||
// Constants
|
||||
export { PRODUCT_CATEGORIES, PRODUCT_CONDITIONS } from './constants'
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,274 @@
|
||||
/**
|
||||
* AISearchModal Component
|
||||
*
|
||||
* Modal for AI-powered product search
|
||||
*
|
||||
* Created: 2025-12-17
|
||||
* Last Modified: 2025-12-17
|
||||
* Last Modified Summary: Extracted from ProductListingForm
|
||||
*/
|
||||
|
||||
'use client'
|
||||
|
||||
import { motion, AnimatePresence } from 'framer-motion'
|
||||
import { Search, Package, CheckCircle, Loader2, X } from 'lucide-react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { getTextColor, getStatusColors } from '@/lib/design-system'
|
||||
|
||||
interface SearchResult {
|
||||
id: string
|
||||
name: string
|
||||
brand: string
|
||||
category: string
|
||||
estimatedPrice: number
|
||||
confidence: number
|
||||
features: string[]
|
||||
condition: string
|
||||
}
|
||||
|
||||
interface AISearchModalProps {
|
||||
isOpen: boolean
|
||||
onClose: () => void
|
||||
searchQuery: string
|
||||
onSearchQueryChange: (query: string) => void
|
||||
onSearch: () => void
|
||||
isSearching: boolean
|
||||
searchResults: SearchResult[]
|
||||
onSelectResult: (result: SearchResult) => void
|
||||
}
|
||||
|
||||
export function AISearchModal({
|
||||
isOpen,
|
||||
onClose,
|
||||
searchQuery,
|
||||
onSearchQueryChange,
|
||||
onSearch,
|
||||
isSearching,
|
||||
searchResults,
|
||||
onSelectResult,
|
||||
}: AISearchModalProps) {
|
||||
const searchExamples = [
|
||||
'iPhone 13 Pro Max',
|
||||
'MacBook Air M1',
|
||||
'Dell Latitude E7470',
|
||||
'Samsung Galaxy S21',
|
||||
'Artikel-Nr. 12345'
|
||||
]
|
||||
|
||||
return (
|
||||
<AnimatePresence>
|
||||
{isOpen && (
|
||||
<motion.div
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
exit={{ opacity: 0 }}
|
||||
className="fixed inset-0 bg-neutral-900/75 backdrop-blur-sm flex items-center justify-center z-50 p-4"
|
||||
onClick={onClose}
|
||||
>
|
||||
<motion.div
|
||||
initial={{ scale: 0.9, opacity: 0 }}
|
||||
animate={{ scale: 1, opacity: 1 }}
|
||||
exit={{ scale: 0.9, opacity: 0 }}
|
||||
className="bg-white rounded-xl shadow-2xl max-w-2xl w-full max-h-[80vh] overflow-hidden"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
{/* Header */}
|
||||
<div className="p-6 border-b border-neutral-200">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="w-10 h-10 bg-info-100 rounded-lg flex items-center justify-center">
|
||||
<Search className="w-5 h-5 text-info-600" />
|
||||
</div>
|
||||
<div>
|
||||
<h2 className={cn('text-xl font-semibold', getTextColor('white', 'primary'))}>
|
||||
AI Schnellsuche
|
||||
</h2>
|
||||
<p className={cn('text-sm', getTextColor('white', 'muted'))}>
|
||||
Geben Sie einen Produktnamen oder Artikelnummer ein
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
onClick={onClose}
|
||||
className="text-neutral-400 hover:text-neutral-600 transition-colors min-h-[touch] touch-target p-2"
|
||||
aria-label="Schliessen"
|
||||
>
|
||||
<X className="w-6 h-6" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Content */}
|
||||
<div className="p-6 overflow-y-auto max-h-[calc(80vh-120px)]">
|
||||
{/* Search Input */}
|
||||
<div className="mb-6">
|
||||
<div className="flex gap-3">
|
||||
<div className="flex-1 relative">
|
||||
<Search className="w-5 h-5 text-neutral-400 absolute left-3 top-1/2 transform -translate-y-1/2" />
|
||||
<input
|
||||
type="text"
|
||||
value={searchQuery}
|
||||
onChange={(e) => onSearchQueryChange(e.target.value)}
|
||||
onKeyPress={(e) => e.key === 'Enter' && onSearch()}
|
||||
placeholder="z.B. iPhone 13 Pro Max, Dell XPS 13, Artikel-Nr. 12345..."
|
||||
className="w-full pl-10 pr-4 py-3 border-2 border-neutral-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-info-500 focus:border-info-500 text-base"
|
||||
/>
|
||||
</div>
|
||||
<button
|
||||
onClick={onSearch}
|
||||
disabled={!searchQuery.trim() || isSearching}
|
||||
className="px-6 py-3 bg-info-600 text-white rounded-lg hover:bg-info-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors flex items-center gap-2 min-h-[touch] touch-target"
|
||||
>
|
||||
{isSearching ? (
|
||||
<Loader2 className="w-4 h-4 animate-spin" />
|
||||
) : (
|
||||
<Search className="w-4 h-4" />
|
||||
)}
|
||||
Suchen
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Search Examples */}
|
||||
<div className="mt-4 p-4 bg-info-50 rounded-lg border border-info-200">
|
||||
<p className={cn('text-sm font-medium mb-2', getStatusColors('info').text)}>
|
||||
Beispiele:
|
||||
</p>
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{searchExamples.map((example) => (
|
||||
<button
|
||||
key={example}
|
||||
onClick={() => onSearchQueryChange(example)}
|
||||
className="px-3 py-1 bg-info-100 text-info-700 rounded-full text-xs hover:bg-info-200 transition-colors min-h-[touch] touch-target"
|
||||
>
|
||||
{example}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Search Results */}
|
||||
{searchResults.length > 0 && (
|
||||
<div className="space-y-4">
|
||||
<h3 className={cn('text-lg font-medium', getTextColor('white', 'primary'))}>
|
||||
{searchResults.length} Produkt{searchResults.length !== 1 ? 'e' : ''} gefunden
|
||||
</h3>
|
||||
|
||||
<div className="space-y-3 max-h-96 overflow-y-auto">
|
||||
{searchResults.map((result) => {
|
||||
const confidenceColors =
|
||||
result.confidence > 0.8 ? getStatusColors('success') :
|
||||
result.confidence > 0.6 ? getStatusColors('warning') :
|
||||
getStatusColors('error')
|
||||
|
||||
return (
|
||||
<div
|
||||
key={result.id}
|
||||
onClick={() => onSelectResult(result)}
|
||||
className="p-4 border-2 border-neutral-200 rounded-lg hover:border-info-300 hover:bg-info-50 cursor-pointer transition-colors"
|
||||
>
|
||||
<div className="flex items-start gap-4">
|
||||
<div className="w-12 h-12 bg-info-100 rounded-lg flex items-center justify-center flex-shrink-0">
|
||||
<Package className="w-6 h-6 text-info-600" />
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<div className="flex items-center gap-2 mb-1">
|
||||
<h4 className={cn('font-medium', getTextColor('white', 'primary'))}>
|
||||
{result.name}
|
||||
</h4>
|
||||
<span className={cn(
|
||||
"px-2 py-1 text-xs rounded-full",
|
||||
confidenceColors.bg,
|
||||
confidenceColors.text
|
||||
)}>
|
||||
{Math.round(result.confidence * 100)}% Übereinstimmung
|
||||
</span>
|
||||
</div>
|
||||
<p className={cn('text-sm mb-2', getTextColor('white', 'muted'))}>
|
||||
{result.brand} • {result.category} • CHF {result.estimatedPrice}
|
||||
</p>
|
||||
<div className="flex flex-wrap gap-1">
|
||||
{result.features.slice(0, 3).map((feature, index) => (
|
||||
<span key={index} className="text-xs bg-neutral-100 text-neutral-700 px-2 py-1 rounded">
|
||||
{feature}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<CheckCircle className="w-5 h-5 text-info-600 opacity-0 group-hover:opacity-100 transition-opacity" />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
|
||||
{/* Actions */}
|
||||
<div className="flex gap-3 pt-4 border-t border-neutral-200">
|
||||
<button
|
||||
onClick={() => {
|
||||
onSearchQueryChange('')
|
||||
// Clear results handled by parent
|
||||
}}
|
||||
className="flex-1 px-4 py-2 border-2 border-neutral-300 text-neutral-700 rounded-lg hover:bg-neutral-50 transition-colors min-h-[touch] touch-target"
|
||||
>
|
||||
Neue Suche
|
||||
</button>
|
||||
<button
|
||||
onClick={onClose}
|
||||
className="px-4 py-2 text-neutral-600 hover:text-neutral-800 transition-colors min-h-[touch] touch-target"
|
||||
>
|
||||
Manueller Eintrag
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Loading State */}
|
||||
{isSearching && (
|
||||
<div className="text-center py-12">
|
||||
<Loader2 className="w-8 h-8 text-info-600 animate-spin mx-auto mb-4" />
|
||||
<h3 className={cn('text-lg font-medium mb-2', getTextColor('white', 'primary'))}>
|
||||
Produkt wird gesucht...
|
||||
</h3>
|
||||
<p className={cn('text-sm', getTextColor('white', 'muted'))}>
|
||||
Durchsuche Produktdatenbank nach passenden Artikeln
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* No Results State */}
|
||||
{!isSearching && searchResults.length === 0 && searchQuery && (
|
||||
<div className="text-center py-12">
|
||||
<Search className="w-12 h-12 text-neutral-400 mx-auto mb-4" />
|
||||
<h3 className={cn('text-lg font-medium mb-2', getTextColor('white', 'primary'))}>
|
||||
Keine Produkte gefunden
|
||||
</h3>
|
||||
<p className={cn('text-sm mb-4', getTextColor('white', 'muted'))}>
|
||||
Für "{searchQuery}" wurden keine passenden Produkte gefunden.
|
||||
</p>
|
||||
<div className="flex gap-3 justify-center">
|
||||
<button
|
||||
onClick={() => onSearchQueryChange('')}
|
||||
className="px-4 py-2 bg-info-600 text-white rounded-lg hover:bg-info-700 transition-colors min-h-[touch] touch-target"
|
||||
>
|
||||
Neue Suche
|
||||
</button>
|
||||
<button
|
||||
onClick={onClose}
|
||||
className="px-4 py-2 border-2 border-neutral-300 text-neutral-700 rounded-lg hover:bg-neutral-50 transition-colors min-h-[touch] touch-target"
|
||||
>
|
||||
Manueller Eintrag
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</motion.div>
|
||||
</motion.div>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
/**
|
||||
* BasicInfoSection Component
|
||||
*
|
||||
* Form section for basic product information
|
||||
*
|
||||
* Created: 2025-12-17
|
||||
* Last Modified: 2025-12-17
|
||||
* Last Modified Summary: Extracted from ProductListingForm
|
||||
*/
|
||||
|
||||
import { DollarSign } from 'lucide-react'
|
||||
import { ProductFormData, ProductListingErrors } from '../types'
|
||||
import { PRODUCT_CATEGORIES } from '../constants'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { getTextColor } from '@/lib/design-system'
|
||||
|
||||
interface BasicInfoSectionProps {
|
||||
formData: ProductFormData
|
||||
errors: ProductListingErrors
|
||||
onFieldChange: (field: keyof ProductFormData, value: string) => void
|
||||
}
|
||||
|
||||
export function BasicInfoSection({ formData, errors, onFieldChange }: BasicInfoSectionProps) {
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<h3 className={cn('text-lg font-medium', getTextColor('white', 'primary'))}>
|
||||
Grundinformationen
|
||||
</h3>
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<div>
|
||||
<label className={cn('block text-sm font-medium mb-2', getTextColor('white', 'secondary'))}>
|
||||
Produkt-Titel *
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
value={formData.title}
|
||||
onChange={(e) => onFieldChange('title', e.target.value)}
|
||||
aria-required="true"
|
||||
aria-invalid={!!errors.title}
|
||||
aria-describedby={errors.title ? 'title-error' : undefined}
|
||||
className={cn(
|
||||
"w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500",
|
||||
errors.title ? "border-error-300" : "border-neutral-300"
|
||||
)}
|
||||
placeholder="z.B. Dell Latitude E7470 Laptop"
|
||||
/>
|
||||
{errors.title && (
|
||||
<p id="title-error" className="text-error-600 text-sm mt-1">{errors.title}</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className={cn('block text-sm font-medium mb-2', getTextColor('white', 'secondary'))}>
|
||||
Preis (CHF) *
|
||||
</label>
|
||||
<div className="relative">
|
||||
<DollarSign className="w-5 h-5 text-neutral-400 absolute left-3 top-1/2 transform -translate-y-1/2" />
|
||||
<input
|
||||
type="number"
|
||||
step="0.01"
|
||||
min="0"
|
||||
value={formData.price}
|
||||
onChange={(e) => onFieldChange('price', e.target.value)}
|
||||
aria-required="true"
|
||||
aria-invalid={!!errors.price}
|
||||
aria-describedby={errors.price ? 'price-error' : undefined}
|
||||
className={cn(
|
||||
"w-full pl-10 pr-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500",
|
||||
errors.price ? "border-error-300" : "border-neutral-300"
|
||||
)}
|
||||
placeholder="599.00"
|
||||
/>
|
||||
</div>
|
||||
{errors.price && (
|
||||
<p id="price-error" className="text-error-600 text-sm mt-1">{errors.price}</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className={cn('block text-sm font-medium mb-2', getTextColor('white', 'secondary'))}>
|
||||
Beschreibung *
|
||||
</label>
|
||||
<textarea
|
||||
value={formData.description}
|
||||
onChange={(e) => onFieldChange('description', e.target.value)}
|
||||
rows={4}
|
||||
aria-required="true"
|
||||
aria-invalid={!!errors.description}
|
||||
aria-describedby={errors.description ? 'description-error' : undefined}
|
||||
className={cn(
|
||||
"w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500",
|
||||
errors.description ? "border-error-300" : "border-neutral-300"
|
||||
)}
|
||||
placeholder="Beschreiben Sie den Zustand, Ausstattung, eventuelle Mängel und alle wichtigen Details..."
|
||||
/>
|
||||
{errors.description && (
|
||||
<p id="description-error" className="text-error-600 text-sm mt-1">{errors.description}</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-3 gap-6">
|
||||
<div>
|
||||
<label className={cn('block text-sm font-medium mb-2', getTextColor('white', 'secondary'))}>
|
||||
Kategorie *
|
||||
</label>
|
||||
<select
|
||||
value={formData.category}
|
||||
onChange={(e) => onFieldChange('category', e.target.value)}
|
||||
aria-required="true"
|
||||
aria-invalid={!!errors.category}
|
||||
aria-describedby={errors.category ? 'category-error' : undefined}
|
||||
className={cn(
|
||||
"w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500",
|
||||
errors.category ? "border-error-300" : "border-neutral-300"
|
||||
)}
|
||||
>
|
||||
<option value="">Kategorie wählen</option>
|
||||
{PRODUCT_CATEGORIES.map(category => (
|
||||
<option key={category.value} value={category.value}>{category.label}</option>
|
||||
))}
|
||||
</select>
|
||||
{errors.category && (
|
||||
<p id="category-error" className="text-error-600 text-sm mt-1">{errors.category}</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className={cn('block text-sm font-medium mb-2', getTextColor('white', 'secondary'))}>
|
||||
Marke
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
value={formData.brand}
|
||||
onChange={(e) => onFieldChange('brand', e.target.value)}
|
||||
className="w-full px-3 py-2 border border-neutral-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500"
|
||||
placeholder="z.B. Dell, Apple, Lenovo"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className={cn('block text-sm font-medium mb-2', getTextColor('white', 'secondary'))}>
|
||||
Standort *
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
value={formData.location}
|
||||
onChange={(e) => onFieldChange('location', e.target.value)}
|
||||
aria-required="true"
|
||||
aria-invalid={!!errors.location}
|
||||
aria-describedby={errors.location ? 'location-error' : undefined}
|
||||
className={cn(
|
||||
"w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500",
|
||||
errors.location ? "border-error-300" : "border-neutral-300"
|
||||
)}
|
||||
placeholder="z.B. Zürich, Bern, Basel"
|
||||
/>
|
||||
{errors.location && (
|
||||
<p id="location-error" className="text-error-600 text-sm mt-1">{errors.location}</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
* ConditionSection Component
|
||||
*
|
||||
* Form section for product condition selection
|
||||
*
|
||||
* Created: 2025-12-17
|
||||
* Last Modified: 2025-12-17
|
||||
* Last Modified Summary: Extracted from ProductListingForm
|
||||
*/
|
||||
|
||||
import { CheckCircle } from 'lucide-react'
|
||||
import { ProductFormData, ProductListingErrors } from '../types'
|
||||
import { PRODUCT_CONDITIONS } from '../constants'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { getTextColor, getStatusColors } from '@/lib/design-system'
|
||||
|
||||
interface ConditionSectionProps {
|
||||
formData: ProductFormData
|
||||
errors: ProductListingErrors
|
||||
onConditionChange: (value: string) => void
|
||||
}
|
||||
|
||||
export function ConditionSection({ formData, errors, onConditionChange }: ConditionSectionProps) {
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<h3 className={cn('text-lg font-medium', getTextColor('white', 'primary'))}>
|
||||
Zustand *
|
||||
</h3>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
{PRODUCT_CONDITIONS.map((condition) => {
|
||||
const isSelected = formData.condition === condition.value
|
||||
const selectedColors = getStatusColors('info')
|
||||
|
||||
return (
|
||||
<label
|
||||
key={condition.value}
|
||||
className={cn(
|
||||
"relative flex items-start p-4 border-2 rounded-lg cursor-pointer transition-colors min-h-[touch] touch-target",
|
||||
isSelected
|
||||
? `${selectedColors.border} ${selectedColors.bg}`
|
||||
: "border-neutral-200 hover:border-neutral-300"
|
||||
)}
|
||||
>
|
||||
<input
|
||||
type="radio"
|
||||
name="condition"
|
||||
value={condition.value}
|
||||
checked={isSelected}
|
||||
onChange={(e) => onConditionChange(e.target.value)}
|
||||
className="sr-only"
|
||||
/>
|
||||
<div className="flex-1">
|
||||
<div className={cn('font-medium', getTextColor('white', 'primary'))}>
|
||||
{condition.label}
|
||||
</div>
|
||||
<div className={cn('text-sm', getTextColor('white', 'muted'))}>
|
||||
{condition.description}
|
||||
</div>
|
||||
</div>
|
||||
{isSelected && (
|
||||
<CheckCircle className={cn('w-5 h-5 flex-shrink-0', selectedColors.icon)} />
|
||||
)}
|
||||
</label>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
{errors.condition && (
|
||||
<p className="text-error-600 text-sm">{errors.condition}</p>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* ContactInfoSection Component
|
||||
*
|
||||
* Form section for contact information
|
||||
*
|
||||
* Created: 2025-12-17
|
||||
* Last Modified: 2025-12-17
|
||||
* Last Modified Summary: Extracted from ProductListingForm
|
||||
*/
|
||||
|
||||
import { ProductFormData } from '../types'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { getTextColor } from '@/lib/design-system'
|
||||
|
||||
interface ContactInfoSectionProps {
|
||||
contactInfo: string
|
||||
onContactInfoChange: (value: string) => void
|
||||
}
|
||||
|
||||
export function ContactInfoSection({ contactInfo, onContactInfoChange }: ContactInfoSectionProps) {
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<h3 className={cn('text-lg font-medium', getTextColor('white', 'primary'))}>
|
||||
Kontaktinformationen
|
||||
</h3>
|
||||
<div>
|
||||
<label className={cn('block text-sm font-medium mb-2', getTextColor('white', 'secondary'))}>
|
||||
Zusätzliche Kontaktinformationen (optional)
|
||||
</label>
|
||||
<textarea
|
||||
value={contactInfo}
|
||||
onChange={(e) => onContactInfoChange(e.target.value)}
|
||||
rows={3}
|
||||
className="w-full px-3 py-2 border-2 border-neutral-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500 text-base"
|
||||
placeholder="z.B. Telefonnummer, bevorzugte Kontaktzeiten, Versandmöglichkeiten..."
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
/**
|
||||
* ImageUploadSection Component
|
||||
*
|
||||
* Form section for product image upload and management
|
||||
*
|
||||
* Created: 2025-12-17
|
||||
* Last Modified: 2025-12-17
|
||||
* Last Modified Summary: Extracted from ProductListingForm
|
||||
*/
|
||||
|
||||
import { Image as ImageIcon, X } from 'lucide-react'
|
||||
import { MARKETPLACE_LIMITS } from '@/config/marketplace'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { getTextColor } from '@/lib/design-system'
|
||||
|
||||
interface ImageUploadSectionProps {
|
||||
images: File[]
|
||||
onImageUpload: (e: React.ChangeEvent<HTMLInputElement>) => void
|
||||
onImageRemove: (index: number) => void
|
||||
}
|
||||
|
||||
export function ImageUploadSection({ images, onImageUpload, onImageRemove }: ImageUploadSectionProps) {
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<h3 className={cn('text-lg font-medium', getTextColor('white', 'primary'))}>
|
||||
Produkt-Bilder
|
||||
</h3>
|
||||
<p className={cn('text-sm', getTextColor('white', 'muted'))}>
|
||||
Fügen Sie bis zu {MARKETPLACE_LIMITS.MAX_IMAGES} klare Bilder Ihres Produkts hinzu
|
||||
</p>
|
||||
|
||||
<div className="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-4">
|
||||
{/* Existing images */}
|
||||
{images.map((image, index) => (
|
||||
<div key={index} className="relative group">
|
||||
<img
|
||||
src={URL.createObjectURL(image)}
|
||||
alt={`Bild ${index + 1}`}
|
||||
className="w-full h-24 object-cover rounded-lg border-2 border-neutral-200"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => onImageRemove(index)}
|
||||
className="absolute -top-2 -right-2 w-6 h-6 bg-error-500 text-white rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity min-h-[touch] touch-target"
|
||||
aria-label="Bild entfernen"
|
||||
>
|
||||
<X className="w-3 h-3" />
|
||||
</button>
|
||||
</div>
|
||||
))}
|
||||
|
||||
{/* Upload button */}
|
||||
{images.length < MARKETPLACE_LIMITS.MAX_IMAGES && (
|
||||
<div className="border-2 border-dashed border-neutral-300 rounded-lg p-4 flex flex-col items-center justify-center hover:border-neutral-400 transition-colors cursor-pointer">
|
||||
<ImageIcon className="w-8 h-8 text-neutral-400 mb-2" />
|
||||
<label className="cursor-pointer">
|
||||
<span className={cn('text-sm', getTextColor('white', 'muted'))}>
|
||||
Bild hinzufügen
|
||||
</span>
|
||||
<input
|
||||
type="file"
|
||||
accept="image/*"
|
||||
multiple
|
||||
onChange={onImageUpload}
|
||||
className="hidden"
|
||||
aria-label="Bild hochladen"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{images.length >= MARKETPLACE_LIMITS.MAX_IMAGES && (
|
||||
<p className={cn('text-sm', getTextColor('white', 'muted'))}>
|
||||
Maximum {MARKETPLACE_LIMITS.MAX_IMAGES} Bilder erreicht
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* Product Listing Types
|
||||
*
|
||||
* Type definitions for product listing form
|
||||
*
|
||||
* Created: 2025-12-17
|
||||
* Last Modified: 2025-12-17
|
||||
* Last Modified Summary: Extracted types from ProductListingForm
|
||||
*/
|
||||
|
||||
export interface ProductFormData {
|
||||
title: string
|
||||
description: string
|
||||
price: string
|
||||
category: string
|
||||
brand: string
|
||||
condition: string
|
||||
images: File[]
|
||||
location: string
|
||||
contactInfo: string
|
||||
}
|
||||
|
||||
export interface ProductCondition {
|
||||
value: string
|
||||
label: string
|
||||
description: string
|
||||
}
|
||||
|
||||
export interface ProductCategory {
|
||||
value: string
|
||||
label: string
|
||||
}
|
||||
|
||||
export interface ProductListingErrors {
|
||||
title?: string
|
||||
description?: string
|
||||
price?: string
|
||||
category?: string
|
||||
condition?: string
|
||||
location?: string
|
||||
}
|
||||
|
||||
export interface ListedProduct {
|
||||
id: string
|
||||
title: string
|
||||
price: string
|
||||
brand?: string
|
||||
condition?: string
|
||||
images?: string[]
|
||||
createdAt: string
|
||||
views?: number
|
||||
}
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
*/
|
||||
|
||||
import { Button } from '@/components/ui/button'
|
||||
import Heading from '@/components/ui/Heading'
|
||||
import { Link } from '@/i18n/navigation'
|
||||
import Link from 'next/link'
|
||||
import { ProjectCard } from './types'
|
||||
import { getTextColor, getBackgroundColor, getButtonVariant } from '@/lib/design-system'
|
||||
import { cn } from '@/lib/utils'
|
||||
@@ -42,9 +41,9 @@ export function ProjectCallToAction({
|
||||
<section className={`py-20 ${bgClass}`}>
|
||||
<div className="container mx-auto px-4">
|
||||
<div className="max-w-4xl mx-auto text-center">
|
||||
<Heading level={2} className={`text-4xl font-bold mb-8 ${textColorClass}`}>
|
||||
<h2 className={`text-4xl font-bold mb-8 ${textColorClass}`}>
|
||||
{title}
|
||||
</Heading>
|
||||
</h2>
|
||||
{subtitle && (
|
||||
<p className={`text-xl mb-12 ${textSecondaryClass}`}>
|
||||
{subtitle}
|
||||
@@ -59,9 +58,9 @@ export function ProjectCallToAction({
|
||||
backgroundColor === 'gray' ? 'bg-white' : 'bg-white/10'
|
||||
}`}
|
||||
>
|
||||
<Heading level={3} className={`text-xl font-semibold mb-4 ${textColorClass}`}>
|
||||
<h3 className={`text-xl font-semibold mb-4 ${textColorClass}`}>
|
||||
{action.title}
|
||||
</Heading>
|
||||
</h3>
|
||||
<p className={`mb-4 flex-grow ${textSecondaryClass}`}>
|
||||
{action.description}
|
||||
</p>
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
*/
|
||||
|
||||
import { ProjectHero as ProjectHeroType } from './types'
|
||||
import Heading from '@/components/ui/Heading'
|
||||
import { Link } from '@/i18n/navigation'
|
||||
import Link from 'next/link'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { getTextColor, getButtonVariant } from '@/lib/design-system'
|
||||
|
||||
@@ -35,7 +34,7 @@ export function ProjectHero({ hero }: ProjectHeroProps) {
|
||||
<div className="absolute inset-0 bg-gradient-to-r from-black/50 to-transparent"></div>
|
||||
<div className="container mx-auto px-4 relative">
|
||||
<div className="max-w-3xl">
|
||||
<Heading level={1} className="text-5xl md:text-6xl font-bold mb-6 leading-tight">{title}</Heading>
|
||||
<h1 className="text-5xl md:text-6xl font-bold mb-6 leading-tight">{title}</h1>
|
||||
<p className={cn('text-xl mb-8', getTextColor('primary', 'secondary'))}>
|
||||
{description}
|
||||
</p>
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
|
||||
import Heading from '@/components/ui/Heading'
|
||||
import { ProjectSection as ProjectSectionType } from './types'
|
||||
import { CheckCircle } from 'lucide-react'
|
||||
import { getTextColor, getBackgroundColor } from '@/lib/design-system'
|
||||
@@ -39,9 +38,9 @@ export function ProjectSection({ section }: ProjectSectionProps) {
|
||||
{(section.title || section.description) && (
|
||||
<div className="text-center mb-12">
|
||||
{section.title && (
|
||||
<Heading level={2} className={`text-4xl font-bold mb-4 ${textColorClass}`}>
|
||||
<h2 className={`text-4xl font-bold mb-4 ${textColorClass}`}>
|
||||
{section.title}
|
||||
</Heading>
|
||||
</h2>
|
||||
)}
|
||||
{section.description && (
|
||||
<p className={`text-xl max-w-3xl mx-auto ${textSecondaryClass}`}>
|
||||
@@ -76,16 +75,17 @@ export function ProjectSection({ section }: ProjectSectionProps) {
|
||||
</div>
|
||||
) : typeof card.icon === 'function' ? (
|
||||
<div className={`w-8 h-8 ${card.iconColor || 'text-blue-600'} mr-3`}>
|
||||
{(() => { const Icon = card.icon as React.ComponentType<{ className?: string }>; return <Icon className="w-8 h-8" /> })()}
|
||||
{/* @ts-ignore - Component type handling */}
|
||||
<card.icon className="w-8 h-8" />
|
||||
</div>
|
||||
) : (
|
||||
<div className={`w-8 h-8 ${card.iconColor || 'text-blue-600'} mr-3`}>
|
||||
{card.icon}
|
||||
</div>
|
||||
)}
|
||||
<Heading level={3} className={`text-2xl font-semibold ${textColorClass}`}>
|
||||
<h3 className={`text-2xl font-semibold ${textColorClass}`}>
|
||||
{card.title}
|
||||
</Heading>
|
||||
</h3>
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
@@ -4,12 +4,7 @@ import { useState } from 'react'
|
||||
import { useSession } from 'next-auth/react'
|
||||
import { useRouter } from 'next/navigation'
|
||||
import { Calendar, Clock, AlertCircle, CheckCircle, Loader2, Wrench } from 'lucide-react'
|
||||
import { Link } from '@/i18n/navigation'
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { apiFetch } from '@/lib/api/client'
|
||||
import { Modal } from '@/components/ui/Modal'
|
||||
import Heading from '@/components/ui/Heading'
|
||||
import { URGENCY } from '@/config/it-hilfe'
|
||||
import Link from 'next/link'
|
||||
|
||||
interface AppointmentBookingFormProps {
|
||||
serviceSlug: string
|
||||
@@ -18,13 +13,12 @@ interface AppointmentBookingFormProps {
|
||||
}
|
||||
|
||||
export default function AppointmentBookingForm({ serviceSlug, serviceTitle, pricing }: AppointmentBookingFormProps) {
|
||||
const t = useTranslations('services.appointment')
|
||||
const { data: session } = useSession()
|
||||
const router = useRouter()
|
||||
const [isOpen, setIsOpen] = useState(false)
|
||||
const [formData, setFormData] = useState<{ description: string; urgency: string; preferredDate: string; preferredTime: string }>({
|
||||
const [formData, setFormData] = useState({
|
||||
description: '',
|
||||
urgency: URGENCY.NORMAL,
|
||||
urgency: 'normal' as 'normal' | 'high' | 'urgent',
|
||||
preferredDate: '',
|
||||
preferredTime: ''
|
||||
})
|
||||
@@ -45,27 +39,32 @@ export default function AppointmentBookingForm({ serviceSlug, serviceTitle, pric
|
||||
setSubmitResult(null)
|
||||
|
||||
try {
|
||||
const { data: result, error: apiError } = await apiFetch<{ message?: string }>('/api/appointments', {
|
||||
const response = await fetch('/api/appointments', {
|
||||
method: 'POST',
|
||||
body: {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
serviceSlug,
|
||||
description: formData.description,
|
||||
urgency: formData.urgency,
|
||||
preferredDate: formData.preferredDate && formData.preferredTime
|
||||
? `${formData.preferredDate}T${formData.preferredTime}`
|
||||
: null
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
if (!apiError) {
|
||||
const result = await response.json()
|
||||
|
||||
if (result.success) {
|
||||
setSubmitResult({
|
||||
success: true,
|
||||
message: result?.message || t('successFallback')
|
||||
message: result.message || 'Termin erfolgreich gebucht!'
|
||||
})
|
||||
// Reset form
|
||||
setFormData({
|
||||
description: '',
|
||||
urgency: URGENCY.NORMAL,
|
||||
urgency: 'normal',
|
||||
preferredDate: '',
|
||||
preferredTime: ''
|
||||
})
|
||||
@@ -79,13 +78,13 @@ export default function AppointmentBookingForm({ serviceSlug, serviceTitle, pric
|
||||
} else {
|
||||
setSubmitResult({
|
||||
success: false,
|
||||
message: apiError,
|
||||
message: result.error || 'Fehler beim Buchen des Termins'
|
||||
})
|
||||
}
|
||||
} catch (error) {
|
||||
setSubmitResult({
|
||||
success: false,
|
||||
message: t('networkError')
|
||||
message: 'Netzwerkfehler. Bitte versuchen Sie es erneut.'
|
||||
})
|
||||
} finally {
|
||||
setIsSubmitting(false)
|
||||
@@ -99,18 +98,33 @@ export default function AppointmentBookingForm({ serviceSlug, serviceTitle, pric
|
||||
className="inline-block bg-primary-600 text-white px-4 sm:px-6 md:px-8 py-3 sm:py-4 rounded-lg font-semibold hover:bg-primary-700 transition-colors duration-300 text-base sm:text-lg mr-4 min-h-[touch] touch-target"
|
||||
>
|
||||
<Calendar className="w-5 h-5 inline mr-2" />
|
||||
{t('bookButton')}
|
||||
Termin buchen
|
||||
</button>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<Modal isOpen={isOpen} onClose={() => setIsOpen(false)} title={t('modalTitle', { serviceTitle })}>
|
||||
<div className="fixed inset-0 bg-neutral-900/60 backdrop-blur-sm z-50 flex items-center justify-center p-4">
|
||||
<div className="bg-white rounded-xl shadow-2xl w-full max-w-lg max-h-[90vh] overflow-y-auto">
|
||||
<div className="p-4 sm:p-6">
|
||||
<div className="flex items-center justify-between mb-4 sm:mb-6">
|
||||
<h3 className="text-lg sm:text-xl font-bold text-neutral-900">
|
||||
Termin für {serviceTitle} buchen
|
||||
</h3>
|
||||
<button
|
||||
onClick={() => setIsOpen(false)}
|
||||
className="text-neutral-500 hover:text-neutral-700 min-w-[touch] min-h-[touch] touch-target p-2 -mr-2"
|
||||
aria-label="Schliessen"
|
||||
>
|
||||
✕
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{pricing && (
|
||||
<div className="bg-info-50 border border-info-200 rounded-lg p-3 sm:p-4 mb-4 sm:mb-6">
|
||||
<div className="flex items-center text-info-800">
|
||||
<Wrench className="w-5 h-5 mr-2 flex-shrink-0" />
|
||||
<span className="font-medium text-sm sm:text-base">{t('priceInfo', { pricing })}</span>
|
||||
<span className="font-medium text-sm sm:text-base">Preis: {pricing}</span>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
@@ -135,24 +149,24 @@ export default function AppointmentBookingForm({ serviceSlug, serviceTitle, pric
|
||||
{!session?.user ? (
|
||||
<div className="text-center py-6 sm:py-8">
|
||||
<AlertCircle className="w-12 h-12 sm:w-16 sm:h-16 text-warning-500 mx-auto mb-4" />
|
||||
<Heading level={4} className="text-base sm:text-lg font-semibold text-neutral-900 mb-2">
|
||||
{t('loginRequired')}
|
||||
</Heading>
|
||||
<h4 className="text-base sm:text-lg font-semibold text-neutral-900 mb-2">
|
||||
Anmeldung erforderlich
|
||||
</h4>
|
||||
<p className="text-neutral-600 mb-6 text-sm sm:text-base">
|
||||
{t('loginDescription')}
|
||||
Bitte melden Sie sich an, um einen Termin zu buchen.
|
||||
</p>
|
||||
<div className="flex flex-col sm:flex-row gap-3 justify-center">
|
||||
<Link
|
||||
href="/auth/login"
|
||||
className="bg-primary-600 text-white px-6 py-3 rounded-lg hover:bg-primary-700 transition-colors min-h-[touch] touch-target text-center font-medium"
|
||||
>
|
||||
{t('loginSignIn')}
|
||||
Anmelden
|
||||
</Link>
|
||||
<Link
|
||||
href="/auth/register"
|
||||
className="border-2 border-neutral-300 text-neutral-700 px-6 py-3 rounded-lg hover:bg-neutral-50 transition-colors min-h-[touch] touch-target text-center font-medium"
|
||||
>
|
||||
{t('loginRegister')}
|
||||
Registrieren
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
@@ -160,14 +174,14 @@ export default function AppointmentBookingForm({ serviceSlug, serviceTitle, pric
|
||||
<form onSubmit={handleSubmit} className="space-y-4 sm:space-y-6">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-neutral-700 mb-2">
|
||||
{t('problemLabel')}
|
||||
Problembeschreibung *
|
||||
</label>
|
||||
<textarea
|
||||
value={formData.description}
|
||||
onChange={(e) => setFormData(prev => ({ ...prev, description: e.target.value }))}
|
||||
rows={4}
|
||||
className="w-full px-3 py-2.5 border-2 border-neutral-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-primary-500 text-base"
|
||||
placeholder={t('problemPlaceholder')}
|
||||
placeholder="Beschreiben Sie Ihr Problem oder Ihren Bedarf so genau wie möglich..."
|
||||
required
|
||||
aria-required="true"
|
||||
aria-invalid={!!(submitResult && !submitResult.success)}
|
||||
@@ -177,23 +191,23 @@ export default function AppointmentBookingForm({ serviceSlug, serviceTitle, pric
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-neutral-700 mb-2">
|
||||
{t('urgencyLabel')}
|
||||
Dringlichkeit
|
||||
</label>
|
||||
<select
|
||||
value={formData.urgency}
|
||||
onChange={(e) => setFormData(prev => ({ ...prev, urgency: e.target.value }))}
|
||||
onChange={(e) => setFormData(prev => ({ ...prev, urgency: e.target.value as 'normal' | 'high' | 'urgent' }))}
|
||||
className="w-full px-3 py-2.5 border-2 border-neutral-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-primary-500 text-base min-h-[touch] touch-target"
|
||||
>
|
||||
<option value={URGENCY.NORMAL}>{t('urgencyNormal')}</option>
|
||||
<option value={URGENCY.HIGH}>{t('urgencyHigh')}</option>
|
||||
<option value={URGENCY.URGENT}>{t('urgencyUrgent')}</option>
|
||||
<option value="normal">Normal - Innerhalb 1-2 Wochen</option>
|
||||
<option value="high">Hoch - Innerhalb weniger Tage</option>
|
||||
<option value="urgent">Dringend - So schnell wie möglich</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-neutral-700 mb-2">
|
||||
{t('preferredDateLabel')}
|
||||
Bevorzugtes Datum
|
||||
</label>
|
||||
<input
|
||||
type="date"
|
||||
@@ -205,7 +219,7 @@ export default function AppointmentBookingForm({ serviceSlug, serviceTitle, pric
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-neutral-700 mb-2">
|
||||
{t('preferredTimeLabel')}
|
||||
Bevorzugte Zeit
|
||||
</label>
|
||||
<input
|
||||
type="time"
|
||||
@@ -220,11 +234,11 @@ export default function AppointmentBookingForm({ serviceSlug, serviceTitle, pric
|
||||
<div className="flex items-start">
|
||||
<Clock className="w-5 h-5 text-neutral-500 mt-0.5 mr-3 flex-shrink-0" />
|
||||
<div className="text-sm text-neutral-700">
|
||||
<p className="font-medium mb-1">{t('nextStepsTitle')}</p>
|
||||
<p className="font-medium mb-1">Was passiert als nächstes?</p>
|
||||
<ul className="space-y-1 list-disc list-inside">
|
||||
<li>{t('nextStep1')}</li>
|
||||
<li>{t('nextStep2')}</li>
|
||||
<li>{t('nextStep3')}</li>
|
||||
<li>Ihre Anfrage wird von unserem Team geprüft</li>
|
||||
<li>Sie erhalten eine Terminbestätigung per E-Mail</li>
|
||||
<li>Bei Fragen kontaktieren wir Sie für weitere Details</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -236,7 +250,7 @@ export default function AppointmentBookingForm({ serviceSlug, serviceTitle, pric
|
||||
onClick={() => setIsOpen(false)}
|
||||
className="flex-1 px-4 py-3 border-2 border-neutral-300 text-neutral-700 rounded-lg hover:bg-neutral-50 transition-colors min-h-[touch] touch-target font-medium"
|
||||
>
|
||||
{t('cancelButton')}
|
||||
Abbrechen
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
@@ -246,19 +260,21 @@ export default function AppointmentBookingForm({ serviceSlug, serviceTitle, pric
|
||||
{isSubmitting ? (
|
||||
<>
|
||||
<Loader2 className="w-4 h-4 mr-2 animate-spin" />
|
||||
{t('submittingButton')}
|
||||
Wird gebucht...
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Calendar className="w-4 h-4 mr-2" />
|
||||
{t('submitButton')}
|
||||
Termin buchen
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
)}
|
||||
</Modal>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -5,12 +5,8 @@
|
||||
* Maintains consistent branding and CTAs.
|
||||
*/
|
||||
|
||||
'use client'
|
||||
|
||||
import { Link } from '@/i18n/navigation'
|
||||
import { useTranslations } from 'next-intl'
|
||||
import Link from 'next/link'
|
||||
import AppointmentBookingForm from './AppointmentBookingForm'
|
||||
import Heading from '@/components/ui/Heading'
|
||||
|
||||
interface ServiceCTAProps {
|
||||
serviceTitle: string
|
||||
@@ -19,13 +15,12 @@ interface ServiceCTAProps {
|
||||
}
|
||||
|
||||
export default function ServiceCTA({ serviceTitle, serviceSlug, pricing }: ServiceCTAProps) {
|
||||
const t = useTranslations('components.serviceCta')
|
||||
return (
|
||||
<section className="py-12 sm:py-16 md:py-20 bg-gradient-to-r from-primary-700 to-primary-800 text-white">
|
||||
<div className="container mx-auto px-4 sm:px-6 text-center">
|
||||
<Heading level={2} className="text-2xl sm:text-3xl md:text-4xl font-bold mb-4 sm:mb-6">{t('heading')}</Heading>
|
||||
<h2 className="text-2xl sm:text-3xl md:text-4xl font-bold mb-4 sm:mb-6">Bereit loszulegen?</h2>
|
||||
<p className="text-base sm:text-lg md:text-xl mb-6 sm:mb-8 max-w-2xl mx-auto text-primary-100">
|
||||
{t('desc', { serviceTitle })}
|
||||
Buchen Sie jetzt Ihren Termin für unsere {serviceTitle} Dienstleistungen.
|
||||
</p>
|
||||
<div className="flex flex-col sm:flex-row gap-3 sm:gap-4 justify-center items-center">
|
||||
{serviceSlug && (
|
||||
@@ -39,16 +34,17 @@ export default function ServiceCTA({ serviceTitle, serviceSlug, pricing }: Servi
|
||||
href="/contact"
|
||||
className="inline-block bg-white text-primary-800 px-4 sm:px-6 md:px-8 py-3 sm:py-4 rounded-lg font-semibold hover:bg-primary-50 transition-colors duration-300 text-base sm:text-lg min-h-[44px] touch-target"
|
||||
>
|
||||
{t('contact')}
|
||||
Kontakt
|
||||
</Link>
|
||||
<Link
|
||||
href="/services"
|
||||
className="inline-block border-2 border-white text-white px-4 sm:px-6 md:px-8 py-3 sm:py-4 rounded-lg font-semibold hover:bg-white/20 transition-colors duration-300 text-base sm:text-lg min-h-[44px] touch-target"
|
||||
>
|
||||
{t('backToServices')}
|
||||
Zurück zu Services
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
import type { ServiceFeature } from '@/lib/services'
|
||||
import { getTextColor } from '@/lib/design-system'
|
||||
import { cn } from '@/lib/utils'
|
||||
import Heading from '@/components/ui/Heading'
|
||||
|
||||
interface ServiceFeaturesProps {
|
||||
features: ServiceFeature[]
|
||||
@@ -26,7 +25,7 @@ export default function ServiceFeatures({ features }: ServiceFeaturesProps) {
|
||||
<feature.icon className="w-6 h-6 sm:w-8 sm:h-8" />
|
||||
</div>
|
||||
<div className="flex-1 min-w-0">
|
||||
<Heading level={3} className={cn('text-xl sm:text-2xl font-bold mb-2 sm:mb-3', getTextColor('white', 'primary'))}>{feature.title}</Heading>
|
||||
<h3 className={cn('text-xl sm:text-2xl font-bold mb-2 sm:mb-3', getTextColor('white', 'primary'))}>{feature.title}</h3>
|
||||
<p className={cn('text-sm sm:text-base', getTextColor('white', 'muted'))}>{feature.description}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -9,21 +9,17 @@ import { CheckCircle2 } from 'lucide-react'
|
||||
import type { ServicePricing } from '@/lib/services'
|
||||
import { getTextColor } from '@/lib/design-system'
|
||||
import { cn } from '@/lib/utils'
|
||||
import Heading from '@/components/ui/Heading'
|
||||
import { getTranslations } from 'next-intl/server'
|
||||
|
||||
interface ServicePricingProps {
|
||||
pricing: ServicePricing
|
||||
}
|
||||
|
||||
export default async function ServicePricingSection({ pricing }: ServicePricingProps) {
|
||||
const t = await getTranslations('services')
|
||||
|
||||
export default function ServicePricingSection({ pricing }: ServicePricingProps) {
|
||||
return (
|
||||
<section className="py-12 sm:py-16 md:py-20">
|
||||
<div className="container mx-auto px-4 sm:px-6">
|
||||
<div className="max-w-2xl mx-auto bg-white rounded-xl p-6 sm:p-8 shadow-lg border-2 border-neutral-200">
|
||||
<Heading level={2} className={cn('text-2xl sm:text-3xl font-bold mb-6 sm:mb-8 text-center', getTextColor('white', 'primary'))}>{t('pricingTitle')}</Heading>
|
||||
<h2 className={cn('text-2xl sm:text-3xl font-bold mb-6 sm:mb-8 text-center', getTextColor('white', 'primary'))}>Preise</h2>
|
||||
<div className="text-center mb-6 sm:mb-8">
|
||||
<p className="text-xl sm:text-2xl font-bold text-primary-600">{pricing.base}</p>
|
||||
</div>
|
||||
@@ -38,7 +34,7 @@ export default async function ServicePricingSection({ pricing }: ServicePricingP
|
||||
|
||||
{pricing.mediaPrices && pricing.mediaPrices.length > 0 && (
|
||||
<div className="mt-6 sm:mt-8 pt-6 sm:pt-8 border-t-2 border-neutral-200">
|
||||
<Heading level={3} className={cn('text-lg sm:text-xl font-bold mb-3 sm:mb-4 text-center', getTextColor('white', 'primary'))}>{t('mediaCostsTitle')}</Heading>
|
||||
<h3 className={cn('text-lg sm:text-xl font-bold mb-3 sm:mb-4 text-center', getTextColor('white', 'primary'))}>Medienkosten</h3>
|
||||
<div className="space-y-2 sm:space-y-3">
|
||||
{pricing.mediaPrices.map((price, index) => (
|
||||
<div key={index} className="flex items-start">
|
||||
|
||||
@@ -8,27 +8,23 @@
|
||||
import type { ServiceProcess } from '@/lib/services'
|
||||
import { getTextColor } from '@/lib/design-system'
|
||||
import { cn } from '@/lib/utils'
|
||||
import Heading from '@/components/ui/Heading'
|
||||
import { getTranslations } from 'next-intl/server'
|
||||
|
||||
interface ServiceProcessProps {
|
||||
process: ServiceProcess[]
|
||||
}
|
||||
|
||||
export default async function ServiceProcessSection({ process }: ServiceProcessProps) {
|
||||
const t = await getTranslations('services')
|
||||
|
||||
export default function ServiceProcessSection({ process }: ServiceProcessProps) {
|
||||
return (
|
||||
<section className="py-12 sm:py-16 md:py-20 bg-neutral-50">
|
||||
<div className="container mx-auto px-4 sm:px-6">
|
||||
<Heading level={2} className={cn('text-2xl sm:text-3xl font-bold mb-8 sm:mb-12 text-center', getTextColor('neutral', 'primary'))}>{t('processTitle')}</Heading>
|
||||
<h2 className={cn('text-2xl sm:text-3xl font-bold mb-8 sm:mb-12 text-center', getTextColor('neutral', 'primary'))}>Unser Prozess</h2>
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6 sm:gap-8">
|
||||
{process.map((step, index) => (
|
||||
<div key={index} className="text-center">
|
||||
<div className="w-12 h-12 sm:w-16 sm:h-16 bg-primary-600 text-white rounded-full flex items-center justify-center text-lg sm:text-xl font-bold mx-auto mb-3 sm:mb-4">
|
||||
{step.step}
|
||||
</div>
|
||||
<Heading level={3} className={cn('text-lg sm:text-xl font-bold mb-2 sm:mb-3', getTextColor('neutral', 'primary'))}>{step.title}</Heading>
|
||||
<h3 className={cn('text-lg sm:text-xl font-bold mb-2 sm:mb-3', getTextColor('neutral', 'primary'))}>{step.title}</h3>
|
||||
<p className={cn('text-sm sm:text-base', getTextColor('neutral', 'muted'))}>{step.description}</p>
|
||||
</div>
|
||||
))}
|
||||
|
||||
+19
-4
@@ -22,15 +22,30 @@
|
||||
* @see @/lib/permissions.ts
|
||||
*/
|
||||
export const ROLES = {
|
||||
// Staff role — used in auth fallback. Migrate to is_staff + staff_permissions.
|
||||
// Organization Roles - DEPRECATED: Use is_staff + staff_permissions instead
|
||||
REVAMPIT_SUPER_ADMIN: 'revampit_super_admin',
|
||||
REVAMPIT_ADMIN: 'revampit_admin',
|
||||
REVAMPIT_EDITOR: 'revampit_editor',
|
||||
REVAMPIT_SUPPORT: 'revampit_support',
|
||||
|
||||
// Community Roles — actively used for seller/repairer profiles
|
||||
// Business Partner Roles - DEPRECATED
|
||||
PARTNER_ADMIN: 'partner_admin',
|
||||
PARTNER_STAFF: 'partner_staff',
|
||||
|
||||
// Hirn Dashboard Roles - DEPRECATED: Use staff_permissions instead
|
||||
HIRN_ADMIN: 'hirn_admin',
|
||||
HIRN_USER: 'hirn_user',
|
||||
|
||||
// Community Roles - STILL ACTIVE: Used for seller/repairer profiles
|
||||
MODERATOR: 'moderator',
|
||||
SELLER: 'seller',
|
||||
REPAIRER: 'repairer',
|
||||
TECHNICAL_EXPERT: 'technical_expert',
|
||||
|
||||
// Default role for regular users
|
||||
CUSTOMER: 'customer',
|
||||
// Customer Roles - DEPRECATED: Regular users don't need roles
|
||||
PREMIUM_CUSTOMER: 'premium_customer',
|
||||
VERIFIED_CUSTOMER: 'verified_customer',
|
||||
CUSTOMER: 'customer'
|
||||
} as const
|
||||
|
||||
export type UserRole = typeof ROLES[keyof typeof ROLES]
|
||||
|
||||
Reference in new issue
Block a user