fixing linting and tests errors
This commit is contained in:
@@ -18,7 +18,7 @@ afterAll(() => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
nodemailermock.mock.reset();
|
nodemailermock.mock.reset();
|
||||||
process.env.MY_EMAIL = 'test@dki.one';
|
process.env.MY_EMAIL = 'test@dk0.dev';
|
||||||
process.env.MY_PASSWORD = 'test-password';
|
process.env.MY_PASSWORD = 'test-password';
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ describe('POST /api/email', () => {
|
|||||||
|
|
||||||
const sentEmails = nodemailermock.mock.getSentMail();
|
const sentEmails = nodemailermock.mock.getSentMail();
|
||||||
expect(sentEmails.length).toBe(1);
|
expect(sentEmails.length).toBe(1);
|
||||||
expect(sentEmails[0].to).toBe('contact@dki.one');
|
expect(sentEmails[0].to).toBe('contact@dk0.dev');
|
||||||
expect(sentEmails[0].text).toContain('Hello! This is a test message.');
|
expect(sentEmails[0].text).toContain('Hello! This is a test message.');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ import '@testing-library/jest-dom';
|
|||||||
describe('Header', () => {
|
describe('Header', () => {
|
||||||
it('renders the header', () => {
|
it('renders the header', () => {
|
||||||
render(<Header />);
|
render(<Header />);
|
||||||
expect(screen.getByText('DK')).toBeInTheDocument();
|
expect(screen.getByText('dk')).toBeInTheDocument();
|
||||||
|
expect(screen.getByText('0')).toBeInTheDocument();
|
||||||
|
|
||||||
const aboutButtons = screen.getAllByText('About');
|
const aboutButtons = screen.getAllByText('About');
|
||||||
expect(aboutButtons.length).toBeGreaterThan(0);
|
expect(aboutButtons.length).toBeGreaterThan(0);
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ export const EmailResponder: React.FC<EmailResponderProps> = ({
|
|||||||
setToastType('error');
|
setToastType('error');
|
||||||
setShowToast(true);
|
setShowToast(true);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch {
|
||||||
setToastMessage('❌ Fehler beim Senden der E-Mail');
|
setToastMessage('❌ Fehler beim Senden der E-Mail');
|
||||||
setToastType('error');
|
setToastType('error');
|
||||||
setShowToast(true);
|
setShowToast(true);
|
||||||
@@ -144,7 +144,7 @@ export const EmailResponder: React.FC<EmailResponderProps> = ({
|
|||||||
? 'border-blue-500 bg-blue-50 shadow-lg scale-105'
|
? 'border-blue-500 bg-blue-50 shadow-lg scale-105'
|
||||||
: 'border-gray-200 hover:border-gray-300 hover:shadow-md'
|
: 'border-gray-200 hover:border-gray-300 hover:shadow-md'
|
||||||
}`}
|
}`}
|
||||||
onClick={() => setSelectedTemplate(key as any)}
|
onClick={() => setSelectedTemplate(key as keyof typeof templates)}
|
||||||
>
|
>
|
||||||
<div className={`bg-gradient-to-r ${template.color} text-white p-4 rounded-t-xl`}>
|
<div className={`bg-gradient-to-r ${template.color} text-white p-4 rounded-t-xl`}>
|
||||||
<div className="text-center">
|
<div className="text-center">
|
||||||
|
|||||||
@@ -4,13 +4,9 @@ import React, { useState, useEffect } from 'react';
|
|||||||
import { motion, AnimatePresence } from 'framer-motion';
|
import { motion, AnimatePresence } from 'framer-motion';
|
||||||
import {
|
import {
|
||||||
Mail,
|
Mail,
|
||||||
Users,
|
|
||||||
BarChart3,
|
BarChart3,
|
||||||
Database,
|
|
||||||
Zap,
|
Zap,
|
||||||
Globe,
|
Globe,
|
||||||
Shield,
|
|
||||||
Bell,
|
|
||||||
Settings,
|
Settings,
|
||||||
FileText,
|
FileText,
|
||||||
TrendingUp,
|
TrendingUp,
|
||||||
@@ -18,23 +14,9 @@ import {
|
|||||||
Plus,
|
Plus,
|
||||||
Edit,
|
Edit,
|
||||||
Trash2,
|
Trash2,
|
||||||
Eye,
|
Eye
|
||||||
Save,
|
|
||||||
Upload,
|
|
||||||
Bold,
|
|
||||||
Italic,
|
|
||||||
List,
|
|
||||||
Link as LinkIcon,
|
|
||||||
Image as ImageIcon,
|
|
||||||
Code,
|
|
||||||
Quote,
|
|
||||||
ChevronDown,
|
|
||||||
ChevronRight,
|
|
||||||
Palette,
|
|
||||||
Smile
|
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import ReactMarkdown from 'react-markdown';
|
|
||||||
import { EmailManager } from './EmailManager';
|
import { EmailManager } from './EmailManager';
|
||||||
import { AnalyticsDashboard } from './AnalyticsDashboard';
|
import { AnalyticsDashboard } from './AnalyticsDashboard';
|
||||||
import ImportExport from './ImportExport';
|
import ImportExport from './ImportExport';
|
||||||
@@ -81,43 +63,7 @@ interface Project {
|
|||||||
const ModernAdminDashboard: React.FC = () => {
|
const ModernAdminDashboard: React.FC = () => {
|
||||||
const [activeTab, setActiveTab] = useState<'overview' | 'projects' | 'emails' | 'analytics' | 'settings'>('overview');
|
const [activeTab, setActiveTab] = useState<'overview' | 'projects' | 'emails' | 'analytics' | 'settings'>('overview');
|
||||||
const [projects, setProjects] = useState<Project[]>([]);
|
const [projects, setProjects] = useState<Project[]>([]);
|
||||||
const [selectedProject, setSelectedProject] = useState<Project | null>(null);
|
|
||||||
const [isLoading, setIsLoading] = useState(true);
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
const [showProjectEditor, setShowProjectEditor] = useState(false);
|
|
||||||
const [isPreview, setIsPreview] = useState(false);
|
|
||||||
const [markdownContent, setMarkdownContent] = useState('');
|
|
||||||
const [formData, setFormData] = useState({
|
|
||||||
title: '',
|
|
||||||
description: '',
|
|
||||||
content: '',
|
|
||||||
tags: '',
|
|
||||||
category: '',
|
|
||||||
featured: false,
|
|
||||||
github: '',
|
|
||||||
live: '',
|
|
||||||
published: true,
|
|
||||||
imageUrl: '',
|
|
||||||
difficulty: 'Intermediate' as 'Beginner' | 'Intermediate' | 'Advanced' | 'Expert',
|
|
||||||
timeToComplete: '',
|
|
||||||
technologies: '',
|
|
||||||
challenges: '',
|
|
||||||
lessonsLearned: '',
|
|
||||||
futureImprovements: '',
|
|
||||||
demoVideo: '',
|
|
||||||
screenshots: '',
|
|
||||||
colorScheme: 'Dark',
|
|
||||||
accessibility: true,
|
|
||||||
performance: {
|
|
||||||
lighthouse: 90,
|
|
||||||
bundleSize: '50KB',
|
|
||||||
loadTime: '1.5s'
|
|
||||||
},
|
|
||||||
analytics: {
|
|
||||||
views: 0,
|
|
||||||
likes: 0,
|
|
||||||
shares: 0
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Mock stats for overview
|
// Mock stats for overview
|
||||||
const stats = {
|
const stats = {
|
||||||
@@ -175,14 +121,6 @@ const ModernAdminDashboard: React.FC = () => {
|
|||||||
setShowProjectEditor(true);
|
setShowProjectEditor(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSave = async () => {
|
|
||||||
// Save logic here
|
|
||||||
console.log('Saving project...');
|
|
||||||
await loadProjects();
|
|
||||||
setShowProjectEditor(false);
|
|
||||||
setSelectedProject(null);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleDelete = async (projectId: number) => {
|
const handleDelete = async (projectId: number) => {
|
||||||
if (confirm('Are you sure you want to delete this project?')) {
|
if (confirm('Are you sure you want to delete this project?')) {
|
||||||
try {
|
try {
|
||||||
@@ -240,12 +178,6 @@ const ModernAdminDashboard: React.FC = () => {
|
|||||||
{ id: 'settings', label: 'Settings', icon: Settings, color: 'gray' }
|
{ id: 'settings', label: 'Settings', icon: Settings, color: 'gray' }
|
||||||
];
|
];
|
||||||
|
|
||||||
const categories = [
|
|
||||||
"Web Development", "Full-Stack", "Web Application", "Mobile App",
|
|
||||||
"Desktop App", "API Development", "Database Design", "DevOps",
|
|
||||||
"UI/UX Design", "Game Development", "Machine Learning", "Data Science",
|
|
||||||
"Blockchain", "IoT", "Cybersecurity"
|
|
||||||
];
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen bg-gradient-to-br from-slate-900 via-purple-900 to-slate-900">
|
<div className="min-h-screen bg-gradient-to-br from-slate-900 via-purple-900 to-slate-900">
|
||||||
@@ -290,7 +222,7 @@ const ModernAdminDashboard: React.FC = () => {
|
|||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
key={tab.id}
|
key={tab.id}
|
||||||
onClick={() => setActiveTab(tab.id as any)}
|
onClick={() => setActiveTab(tab.id as 'overview' | 'projects' | 'emails' | 'analytics' | 'settings')}
|
||||||
className={`w-full flex items-center space-x-3 px-4 py-3 rounded-xl transition-all duration-200 ${
|
className={`w-full flex items-center space-x-3 px-4 py-3 rounded-xl transition-all duration-200 ${
|
||||||
activeTab === tab.id
|
activeTab === tab.id
|
||||||
? `bg-${tab.color}-500/20 text-${tab.color}-400 border border-${tab.color}-500/30`
|
? `bg-${tab.color}-500/20 text-${tab.color}-400 border border-${tab.color}-500/30`
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||||
const { spawn, exec } = require('child_process');
|
const { spawn, exec } = require('child_process');
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
const isWindows = process.platform === 'win32';
|
const isWindows = process.platform === 'win32';
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||||
const { spawn } = require('child_process');
|
const { spawn } = require('child_process');
|
||||||
const isWindows = process.platform === 'win32';
|
const isWindows = process.platform === 'win32';
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||||
const { exec } = require('child_process');
|
const { exec } = require('child_process');
|
||||||
const path = require('path');
|
|
||||||
|
|
||||||
console.log('🗄️ Setting up database...');
|
console.log('🗄️ Setting up database...');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user