even more sonarqube fixes

This commit is contained in:
Sascha 2025-10-30 17:26:30 +01:00
parent acbdb1ea3c
commit c83b6e07cf
6 changed files with 32 additions and 32 deletions

View File

@ -20,14 +20,14 @@ function AppRouter() {
useEffect(() => { useEffect(() => {
// Apply theme to document and save preference // Apply theme to document and save preference
document.documentElement.setAttribute('data-theme', theme); document.documentElement.dataset.theme = theme;
localStorage.setItem('theme', theme); localStorage.setItem('theme', theme);
}, [theme]); }, [theme]);
useEffect(() => { useEffect(() => {
// Handle hash-based navigation for sections // Handle hash-based navigation for sections
const handleHashChange = () => { const handleHashChange = () => {
const hash = window.location.hash.substring(1); const hash = globalThis.location.hash.substring(1);
if (hash) { if (hash) {
setTimeout(() => { setTimeout(() => {
const element = document.getElementById(hash); const element = document.getElementById(hash);
@ -42,10 +42,10 @@ function AppRouter() {
handleHashChange(); handleHashChange();
// Listen for hash changes // Listen for hash changes
window.addEventListener('hashchange', handleHashChange); globalThis.addEventListener('hashchange', handleHashChange);
return () => { return () => {
window.removeEventListener('hashchange', handleHashChange); globalThis.removeEventListener('hashchange', handleHashChange);
}; };
}, []); }, []);

View File

@ -1,10 +1,10 @@
import React from 'react'; import React from 'react';
import { getTexts } from '../config/texts'; import { getTexts } from '../config/texts';
type Props = { type Props = Readonly<{
theme: 'light' | 'dark'; theme: 'light' | 'dark';
setTheme: React.Dispatch<React.SetStateAction<'light' | 'dark'>>; setTheme: React.Dispatch<React.SetStateAction<'light' | 'dark'>>;
}; }>;
export default function ThemeToggle({ export default function ThemeToggle({
theme, theme,

View File

@ -1,9 +1,9 @@
import { useEffect, useRef } from 'react'; import { useEffect, useRef } from 'react';
type Props = { type Props = {
menuItems: string[]; readonly menuItems: string[];
isOpen: boolean; readonly isOpen: boolean;
onItemClick: (section: string) => void; readonly onItemClick: (section: string) => void;
}; };
export default function MobileMenu({ menuItems, isOpen, onItemClick }: Props) { export default function MobileMenu({ menuItems, isOpen, onItemClick }: Props) {

View File

@ -16,7 +16,7 @@ export default function ImprintPage() {
return () => { return () => {
const existingMeta = document.querySelector('meta[name="robots"]'); const existingMeta = document.querySelector('meta[name="robots"]');
if (existingMeta) { if (existingMeta) {
document.head.removeChild(existingMeta); existingMeta.remove();
} }
}; };
}, []); }, []);
@ -63,8 +63,8 @@ export default function ImprintPage() {
<div className="imprint-page__subsection"> <div className="imprint-page__subsection">
<h3 className="imprint-page__subsection-title">{texts.contentLiabilityTitle}</h3> <h3 className="imprint-page__subsection-title">{texts.contentLiabilityTitle}</h3>
{texts.contentLiabilityText.map((text, index) => ( {texts.contentLiabilityText.map((text) => (
<p key={index} className="imprint-page__text"> <p key={text.substring(0, 50)} className="imprint-page__text">
{text} {text}
</p> </p>
))} ))}
@ -72,8 +72,8 @@ export default function ImprintPage() {
<div className="imprint-page__subsection"> <div className="imprint-page__subsection">
<h3 className="imprint-page__subsection-title">{texts.copyrightTitle}</h3> <h3 className="imprint-page__subsection-title">{texts.copyrightTitle}</h3>
{texts.copyrightText.map((text, index) => ( {texts.copyrightText.map((text) => (
<p key={index} className="imprint-page__text"> <p key={text.substring(0, 50)} className="imprint-page__text">
{text} {text}
</p> </p>
))} ))}
@ -101,8 +101,8 @@ export default function ImprintPage() {
<h3 className="imprint-page__privacy-subtitle">{texts.detailedPrivacyPolicy.responsibleTitle}</h3> <h3 className="imprint-page__privacy-subtitle">{texts.detailedPrivacyPolicy.responsibleTitle}</h3>
<p className="imprint-page__privacy-text">{texts.detailedPrivacyPolicy.responsibleText}</p> <p className="imprint-page__privacy-text">{texts.detailedPrivacyPolicy.responsibleText}</p>
<div className="imprint-page__contact-info"> <div className="imprint-page__contact-info">
{texts.detailedPrivacyPolicy.responsibleContact.split('\n').map((line, index) => ( {texts.detailedPrivacyPolicy.responsibleContact.split('\n').map((line) => (
<p key={index} className="imprint-page__contact-line">{line}</p> <p key={line.trim() || 'empty-line'} className="imprint-page__contact-line">{line}</p>
))} ))}
</div> </div>
</div> </div>
@ -118,8 +118,8 @@ export default function ImprintPage() {
<h3 className="imprint-page__privacy-subtitle">{texts.detailedPrivacyPolicy.rightsTitle}</h3> <h3 className="imprint-page__privacy-subtitle">{texts.detailedPrivacyPolicy.rightsTitle}</h3>
<p className="imprint-page__privacy-text">{texts.detailedPrivacyPolicy.rightsIntro}</p> <p className="imprint-page__privacy-text">{texts.detailedPrivacyPolicy.rightsIntro}</p>
<ul className="imprint-page__rights-list"> <ul className="imprint-page__rights-list">
{texts.detailedPrivacyPolicy.rights.map((right, index) => ( {texts.detailedPrivacyPolicy.rights.map((right) => (
<li key={index} className="imprint-page__rights-item"> <li key={right.title} className="imprint-page__rights-item">
<strong>{right.title}:</strong> {right.text} <strong>{right.title}:</strong> {right.text}
</li> </li>
))} ))}
@ -139,8 +139,8 @@ export default function ImprintPage() {
<h3 className="imprint-page__privacy-subtitle">{texts.detailedPrivacyPolicy.dataDeletionTitle}</h3> <h3 className="imprint-page__privacy-subtitle">{texts.detailedPrivacyPolicy.dataDeletionTitle}</h3>
<p className="imprint-page__privacy-text">{texts.detailedPrivacyPolicy.dataDeletionIntro}</p> <p className="imprint-page__privacy-text">{texts.detailedPrivacyPolicy.dataDeletionIntro}</p>
<ul className="imprint-page__deletion-list"> <ul className="imprint-page__deletion-list">
{texts.detailedPrivacyPolicy.dataDeletionReasons.map((reason, index) => ( {texts.detailedPrivacyPolicy.dataDeletionReasons.map((reason) => (
<li key={index} className="imprint-page__deletion-item">{reason}</li> <li key={reason.substring(0, 50)} className="imprint-page__deletion-item">{reason}</li>
))} ))}
</ul> </ul>
<p className="imprint-page__privacy-text">{texts.detailedPrivacyPolicy.retentionText}</p> <p className="imprint-page__privacy-text">{texts.detailedPrivacyPolicy.retentionText}</p>
@ -153,8 +153,8 @@ export default function ImprintPage() {
{texts.detailedPrivacyPolicy.webhostingText} {texts.detailedPrivacyPolicy.webhostingText}
</p> </p>
<ul className="imprint-page__webhosting-list"> <ul className="imprint-page__webhosting-list">
{texts.detailedPrivacyPolicy.webhostingDataTypes.map((dataType, index) => ( {texts.detailedPrivacyPolicy.webhostingDataTypes.map((dataType) => (
<li key={index} className="imprint-page__webhosting-item">{dataType}</li> <li key={dataType} className="imprint-page__webhosting-item">{dataType}</li>
))} ))}
</ul> </ul>
<p className="imprint-page__privacy-text">{texts.detailedPrivacyPolicy.webhostingPurpose}</p> <p className="imprint-page__privacy-text">{texts.detailedPrivacyPolicy.webhostingPurpose}</p>
@ -164,8 +164,8 @@ export default function ImprintPage() {
<strong>{texts.detailedPrivacyPolicy.webhostingDataCategories.affectedData}</strong> <strong>{texts.detailedPrivacyPolicy.webhostingDataCategories.affectedData}</strong>
</p> </p>
<ul className="imprint-page__category-list"> <ul className="imprint-page__category-list">
{texts.detailedPrivacyPolicy.webhostingDataCategories.affectedDataList.map((item, index) => ( {texts.detailedPrivacyPolicy.webhostingDataCategories.affectedDataList.map((item) => (
<li key={index}>{item}</li> <li key={item}>{item}</li>
))} ))}
</ul> </ul>
<p><strong>{texts.detailedPrivacyPolicy.webhostingDataCategories.affectedPersons}</strong></p> <p><strong>{texts.detailedPrivacyPolicy.webhostingDataCategories.affectedPersons}</strong></p>
@ -199,8 +199,8 @@ export default function ImprintPage() {
<div className="imprint-page__data-categories"> <div className="imprint-page__data-categories">
<p className="imprint-page__category-title"><strong>Betroffene Daten:</strong></p> <p className="imprint-page__category-title"><strong>Betroffene Daten:</strong></p>
<ul className="imprint-page__category-list"> <ul className="imprint-page__category-list">
{texts.detailedPrivacyPolicy.contactDataCategories.affectedData.map((item, index) => ( {texts.detailedPrivacyPolicy.contactDataCategories.affectedData.map((item) => (
<li key={index}>{item}</li> <li key={item}>{item}</li>
))} ))}
</ul> </ul>
<p><strong>Betroffene Personen: </strong>{texts.detailedPrivacyPolicy.contactDataCategories.affectedPersons}</p> <p><strong>Betroffene Personen: </strong>{texts.detailedPrivacyPolicy.contactDataCategories.affectedPersons}</p>

View File

@ -15,7 +15,7 @@ export default function PrivacyPolicy() {
return () => { return () => {
const existingMeta = document.querySelector('meta[name="robots"]'); const existingMeta = document.querySelector('meta[name="robots"]');
if (existingMeta) { if (existingMeta) {
document.head.removeChild(existingMeta); existingMeta.remove();
} }
}; };
}, []); }, []);
@ -28,8 +28,8 @@ export default function PrivacyPolicy() {
<h2>{texts.dataCollectionTitle}</h2> <h2>{texts.dataCollectionTitle}</h2>
<p>{texts.dataCollectionText}</p> <p>{texts.dataCollectionText}</p>
<ul> <ul>
{texts.dataCollectionList.map((item, index) => ( {texts.dataCollectionList.map((item) => (
<li key={index}>{item}</li> <li key={item}>{item}</li>
))} ))}
</ul> </ul>
@ -45,8 +45,8 @@ export default function PrivacyPolicy() {
<h2>{texts.rightsTitle}</h2> <h2>{texts.rightsTitle}</h2>
<p>{texts.rightsText}</p> <p>{texts.rightsText}</p>
<ul> <ul>
{texts.rightsList.map((right, index) => ( {texts.rightsList.map((right) => (
<li key={index}>{right}</li> <li key={right}>{right}</li>
))} ))}
</ul> </ul>

View File

@ -16,7 +16,7 @@ export function scrollToSection(
navigate(`/#${sectionId}`); navigate(`/#${sectionId}`);
} else { } else {
// Fallback: direct navigation without router // Fallback: direct navigation without router
window.location.href = `/#${sectionId}`; globalThis.location.href = `/#${sectionId}`;
} }
} }