Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 8 additions & 51 deletions src/context/TutorialContext.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,6 @@ import { api } from '../api/client'
import { getIconComponent as getIconComponentFromMap } from '../utils/iconMap'
const TutorialContext = createContext(null)

const FALLBACK_TUTORIALS = Object.freeze([
{
id: 'linux-shell-grundlagen',
title: 'Linux Shell Grundlagen',
description: 'Starte mit den wichtigsten Terminalbefehlen, Navigationskonzepten und grundlegenden Workflows.',
icon: 'Terminal',
color: 'from-primary-500 to-accent-cyan',
topics: ['Shell', 'Bash', 'Navigation'],
target: { type: 'route', value: '/grundlagen' },
buttonLabel: 'Zum Grundlagenkurs',
},
{
id: 'linux-dateiverwaltung',
title: 'Dateiverwaltung & Berechtigungen',
description: 'Verstehe Dateisysteme, Berechtigungen und sichere Arbeitsweisen für den Linux-Alltag.',
icon: 'FolderTree',
color: 'from-accent-emerald to-accent-cyan',
topics: ['Dateisystem', 'Rechte', 'Sicherheit'],
target: { type: 'route', value: '/grundlagen' },
buttonLabel: 'Mehr über Rechte lernen',
},
{
id: 'linux-netzwerkpraxis',
title: 'Netzwerk & Praxis',
description: 'Lerne die wichtigsten Netzwerk-Tools kennen und übe praxisnahe Szenarien mit SSH & Co.',
icon: 'Network',
color: 'from-accent-violet to-primary-600',
topics: ['Netzwerk', 'SSH', 'Praxis'],
target: { type: 'route', value: '/grundlagen' },
buttonLabel: 'Praxisbeispiele ansehen',
},
])

const cloneFallbackTutorials = () =>
FALLBACK_TUTORIALS.map((tutorial) => ({
...tutorial,
topics: Array.isArray(tutorial.topics) ? [...tutorial.topics] : [],
}))
export const TutorialProvider = ({ children }) => {
const [tutorials, setTutorials] = useState([])
const [loading, setLoading] = useState(true)
Expand All @@ -55,13 +17,12 @@ export const TutorialProvider = ({ children }) => {
const data = await api.getTutorials({ signal })
if (!signal?.aborted) {
const list = Array.isArray(data) ? data : []
if (list.length > 0) {
setTutorials(list)
setError(null)
} else {
setTutorials(cloneFallbackTutorials())
setError(null)
}
const normalized = list.map((tutorial) => ({
...tutorial,
topics: Array.isArray(tutorial.topics) ? [...tutorial.topics] : [],
}))
setTutorials(normalized)
setError(null)
}
} catch (err) {
if (signal?.aborted) {
Expand Down Expand Up @@ -100,12 +61,8 @@ export const TutorialProvider = ({ children }) => {
}
console.error('Failed to load tutorials:', err)
if (!signal?.aborted) {
const fallbackError = new Error(
'Standard-Linux-Tutorials werden angezeigt, da die echten Inhalte aktuell nicht geladen werden konnten.'
)
fallbackError.code = 'fallback'
setTutorials(cloneFallbackTutorials())
setError(fallbackError)
setTutorials([])
setError(err)
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/pages/AdminDashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ const AdminDashboard = () => {
}, [showForm])
return (
<div className="min-h-screen bg-gray-50 dark:bg-slate-950 text-gray-900 dark:text-slate-100">
{}
{}
<header className="bg-white/90 dark:bg-slate-900/80 shadow-md backdrop-blur">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4">
Expand Down Expand Up @@ -136,7 +135,6 @@ const AdminDashboard = () => {
</div>
</div>
</header>
{}
<main className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
{}
{}
Expand Down
Loading