From c83b6e07cf3d912e99bf18eff9a7e6681a556e8d Mon Sep 17 00:00:00 2001 From: Sascha Date: Thu, 30 Oct 2025 17:26:30 +0100 Subject: [PATCH] even more sonarqube fixes --- src/app/AppRouter.tsx | 8 +++---- src/components/ThemeToggle.tsx | 4 ++-- src/components/layout/MobileMenu.tsx | 6 ++--- src/pages/ImprintPage.tsx | 34 ++++++++++++++-------------- src/pages/PrivacyPolicy.tsx | 10 ++++---- src/utils/scrollUtils.ts | 2 +- 6 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/app/AppRouter.tsx b/src/app/AppRouter.tsx index 8532425..712135d 100644 --- a/src/app/AppRouter.tsx +++ b/src/app/AppRouter.tsx @@ -20,14 +20,14 @@ function AppRouter() { useEffect(() => { // Apply theme to document and save preference - document.documentElement.setAttribute('data-theme', theme); + document.documentElement.dataset.theme = theme; localStorage.setItem('theme', theme); }, [theme]); useEffect(() => { // Handle hash-based navigation for sections const handleHashChange = () => { - const hash = window.location.hash.substring(1); + const hash = globalThis.location.hash.substring(1); if (hash) { setTimeout(() => { const element = document.getElementById(hash); @@ -42,10 +42,10 @@ function AppRouter() { handleHashChange(); // Listen for hash changes - window.addEventListener('hashchange', handleHashChange); + globalThis.addEventListener('hashchange', handleHashChange); return () => { - window.removeEventListener('hashchange', handleHashChange); + globalThis.removeEventListener('hashchange', handleHashChange); }; }, []); diff --git a/src/components/ThemeToggle.tsx b/src/components/ThemeToggle.tsx index fd48ede..70d698d 100644 --- a/src/components/ThemeToggle.tsx +++ b/src/components/ThemeToggle.tsx @@ -1,10 +1,10 @@ import React from 'react'; import { getTexts } from '../config/texts'; -type Props = { +type Props = Readonly<{ theme: 'light' | 'dark'; setTheme: React.Dispatch>; -}; +}>; export default function ThemeToggle({ theme, diff --git a/src/components/layout/MobileMenu.tsx b/src/components/layout/MobileMenu.tsx index addcf49..e1f798c 100644 --- a/src/components/layout/MobileMenu.tsx +++ b/src/components/layout/MobileMenu.tsx @@ -1,9 +1,9 @@ import { useEffect, useRef } from 'react'; type Props = { - menuItems: string[]; - isOpen: boolean; - onItemClick: (section: string) => void; + readonly menuItems: string[]; + readonly isOpen: boolean; + readonly onItemClick: (section: string) => void; }; export default function MobileMenu({ menuItems, isOpen, onItemClick }: Props) { diff --git a/src/pages/ImprintPage.tsx b/src/pages/ImprintPage.tsx index f8adc79..cf21317 100644 --- a/src/pages/ImprintPage.tsx +++ b/src/pages/ImprintPage.tsx @@ -16,7 +16,7 @@ export default function ImprintPage() { return () => { const existingMeta = document.querySelector('meta[name="robots"]'); if (existingMeta) { - document.head.removeChild(existingMeta); + existingMeta.remove(); } }; }, []); @@ -63,8 +63,8 @@ export default function ImprintPage() {

{texts.contentLiabilityTitle}

- {texts.contentLiabilityText.map((text, index) => ( -

+ {texts.contentLiabilityText.map((text) => ( +

{text}

))} @@ -72,8 +72,8 @@ export default function ImprintPage() {

{texts.copyrightTitle}

- {texts.copyrightText.map((text, index) => ( -

+ {texts.copyrightText.map((text) => ( +

{text}

))} @@ -101,8 +101,8 @@ export default function ImprintPage() {

{texts.detailedPrivacyPolicy.responsibleTitle}

{texts.detailedPrivacyPolicy.responsibleText}

- {texts.detailedPrivacyPolicy.responsibleContact.split('\n').map((line, index) => ( -

{line}

+ {texts.detailedPrivacyPolicy.responsibleContact.split('\n').map((line) => ( +

{line}

))}
@@ -118,8 +118,8 @@ export default function ImprintPage() {

{texts.detailedPrivacyPolicy.rightsTitle}

{texts.detailedPrivacyPolicy.rightsIntro}

    - {texts.detailedPrivacyPolicy.rights.map((right, index) => ( -
  • + {texts.detailedPrivacyPolicy.rights.map((right) => ( +
  • {right.title}: {right.text}
  • ))} @@ -139,8 +139,8 @@ export default function ImprintPage() {

    {texts.detailedPrivacyPolicy.dataDeletionTitle}

    {texts.detailedPrivacyPolicy.dataDeletionIntro}

      - {texts.detailedPrivacyPolicy.dataDeletionReasons.map((reason, index) => ( -
    • {reason}
    • + {texts.detailedPrivacyPolicy.dataDeletionReasons.map((reason) => ( +
    • {reason}
    • ))}

    {texts.detailedPrivacyPolicy.retentionText}

    @@ -153,8 +153,8 @@ export default function ImprintPage() { {texts.detailedPrivacyPolicy.webhostingText}

      - {texts.detailedPrivacyPolicy.webhostingDataTypes.map((dataType, index) => ( -
    • {dataType}
    • + {texts.detailedPrivacyPolicy.webhostingDataTypes.map((dataType) => ( +
    • {dataType}
    • ))}

    {texts.detailedPrivacyPolicy.webhostingPurpose}

    @@ -164,8 +164,8 @@ export default function ImprintPage() { {texts.detailedPrivacyPolicy.webhostingDataCategories.affectedData}

      - {texts.detailedPrivacyPolicy.webhostingDataCategories.affectedDataList.map((item, index) => ( -
    • {item}
    • + {texts.detailedPrivacyPolicy.webhostingDataCategories.affectedDataList.map((item) => ( +
    • {item}
    • ))}

    {texts.detailedPrivacyPolicy.webhostingDataCategories.affectedPersons}

    @@ -199,8 +199,8 @@ export default function ImprintPage() {

    Betroffene Daten:

      - {texts.detailedPrivacyPolicy.contactDataCategories.affectedData.map((item, index) => ( -
    • {item}
    • + {texts.detailedPrivacyPolicy.contactDataCategories.affectedData.map((item) => ( +
    • {item}
    • ))}

    Betroffene Personen: {texts.detailedPrivacyPolicy.contactDataCategories.affectedPersons}

    diff --git a/src/pages/PrivacyPolicy.tsx b/src/pages/PrivacyPolicy.tsx index 41d714f..3c6e6fc 100644 --- a/src/pages/PrivacyPolicy.tsx +++ b/src/pages/PrivacyPolicy.tsx @@ -15,7 +15,7 @@ export default function PrivacyPolicy() { return () => { const existingMeta = document.querySelector('meta[name="robots"]'); if (existingMeta) { - document.head.removeChild(existingMeta); + existingMeta.remove(); } }; }, []); @@ -28,8 +28,8 @@ export default function PrivacyPolicy() {

    {texts.dataCollectionTitle}

    {texts.dataCollectionText}

      - {texts.dataCollectionList.map((item, index) => ( -
    • {item}
    • + {texts.dataCollectionList.map((item) => ( +
    • {item}
    • ))}
    @@ -45,8 +45,8 @@ export default function PrivacyPolicy() {

    {texts.rightsTitle}

    {texts.rightsText}

      - {texts.rightsList.map((right, index) => ( -
    • {right}
    • + {texts.rightsList.map((right) => ( +
    • {right}
    • ))}
    diff --git a/src/utils/scrollUtils.ts b/src/utils/scrollUtils.ts index d2873b8..dd8b26c 100644 --- a/src/utils/scrollUtils.ts +++ b/src/utils/scrollUtils.ts @@ -16,7 +16,7 @@ export function scrollToSection( navigate(`/#${sectionId}`); } else { // Fallback: direct navigation without router - window.location.href = `/#${sectionId}`; + globalThis.location.href = `/#${sectionId}`; } }