From 1357a18b65f6c6d9eb5df45fb9c48645413f97e4 Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 22 Feb 2025 16:49:50 +0100 Subject: [PATCH 1/4] Don't crash when text field is not set (#147) --- src/Components/Profile/Subcomponents/ProfileTextView.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Components/Profile/Subcomponents/ProfileTextView.tsx b/src/Components/Profile/Subcomponents/ProfileTextView.tsx index 9fc35bbb..f2f1d283 100644 --- a/src/Components/Profile/Subcomponents/ProfileTextView.tsx +++ b/src/Components/Profile/Subcomponents/ProfileTextView.tsx @@ -17,9 +17,7 @@ export const ProfileTextView = ({ }) => { const text = get(item, dataField) - if (typeof text !== 'string') { - throw new Error('ProfileTextView: text is not a string') - } + const parsedText = typeof text !== 'string' ? '' : text return (
@@ -27,7 +25,7 @@ export const ProfileTextView = ({

{heading}

)}
- +
) From 63e864ff81b6268e5a75b34b6cbd5f25c3d7580f Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 22 Feb 2025 16:54:34 +0100 Subject: [PATCH 2/4] fix delayed build (#150) We noticed that the build was outdated and lagged behind 1 build. Reason for this is rollup and its second config. Solved by https://github.com/rollup/rollup/issues/1666#issuecomment-1163091988 This could cause problems when types change --- rollup.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/rollup.config.js b/rollup.config.js index 0370b6cc..a4a08289 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -87,5 +87,6 @@ export default [ }), ], external: [/\.css$/], //, /\.d\.ts$/ + watch: false, }, ] From 12fd624780ef2b34dad9a777505405ca98590169 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 22 Feb 2025 17:09:38 +0100 Subject: [PATCH 3/4] refactor(source): define more types (#149) * define more types * lint fixes * update snapshot and reduce coverage * revert role change, since it incompatible with directus --- src/Components/AppShell/Content.tsx | 3 +- src/Components/AppShell/ContextWrapper.tsx | 4 +-- src/Components/Gaming/hooks/useQuests.tsx | 10 ++++-- src/Components/Input/SelectBox.tsx | 8 ++--- src/Components/Input/TextAreaInput.tsx | 20 +++++------ src/Components/Input/TextInput.tsx | 21 ++++++------ .../__snapshots__/TextInput.spec.tsx.snap | 6 ++-- src/Components/Map/hooks/useDebounce.tsx | 3 +- src/Components/Map/hooks/useLayers.tsx | 5 ++- src/Components/Map/hooks/usePermissions.tsx | 34 +++++++++++-------- vite.config.ts | 4 +-- 11 files changed, 58 insertions(+), 60 deletions(-) diff --git a/src/Components/AppShell/Content.tsx b/src/Components/AppShell/Content.tsx index 42dfbf5f..9adaf028 100644 --- a/src/Components/AppShell/Content.tsx +++ b/src/Components/AppShell/Content.tsx @@ -1,5 +1,4 @@ -/* eslint-disable @typescript-eslint/consistent-type-definitions */ -type ContentProps = { +interface ContentProps { children?: React.ReactNode } diff --git a/src/Components/AppShell/ContextWrapper.tsx b/src/Components/AppShell/ContextWrapper.tsx index cde23c2d..ece603ad 100644 --- a/src/Components/AppShell/ContextWrapper.tsx +++ b/src/Components/AppShell/ContextWrapper.tsx @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unsafe-return */ import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { useContext, createContext } from 'react' import { BrowserRouter as Router, useLocation } from 'react-router-dom' @@ -19,8 +18,7 @@ import { AppStateProvider } from './hooks/useAppState' // Helper context to determine if the ContextWrapper is already present. const ContextCheckContext = createContext(false) -// eslint-disable-next-line react/prop-types -export const ContextWrapper = ({ children }) => { +export const ContextWrapper = ({ children }: { children: React.ReactNode }) => { const isWrapped = useContext(ContextCheckContext) // Check if we are already inside a Router diff --git a/src/Components/Gaming/hooks/useQuests.tsx b/src/Components/Gaming/hooks/useQuests.tsx index 336d7a8f..1b3cc1d4 100644 --- a/src/Components/Gaming/hooks/useQuests.tsx +++ b/src/Components/Gaming/hooks/useQuests.tsx @@ -1,4 +1,3 @@ -/* eslint-disable react/prop-types */ /* eslint-disable @typescript-eslint/no-empty-function */ import { useCallback, useState, createContext, useContext } from 'react' @@ -22,10 +21,15 @@ function useQuestsManager(initialOpen: boolean): { return { open, setQuestsOpen } } -export const QuestsProvider: React.FunctionComponent<{ +interface QuestProviderProps { initialOpen: boolean children?: React.ReactNode -}> = ({ initialOpen, children }) => ( +} + +export const QuestsProvider: React.FunctionComponent = ({ + initialOpen, + children, +}: QuestProviderProps) => ( {children} ) diff --git a/src/Components/Input/SelectBox.tsx b/src/Components/Input/SelectBox.tsx index c4d4282e..f91ed194 100644 --- a/src/Components/Input/SelectBox.tsx +++ b/src/Components/Input/SelectBox.tsx @@ -1,9 +1,7 @@ -/* eslint-disable @typescript-eslint/consistent-type-definitions */ -/* eslint-disable @typescript-eslint/restrict-template-expressions */ import InformationCircleIcon from '@heroicons/react/24/outline/InformationCircleIcon' import { useState } from 'react' -type SelectBoxProps = { +interface SelectBoxProps { labelTitle?: string labelStyle?: string type?: string @@ -40,9 +38,9 @@ export function SelectBox(props: SelectBoxProps) { } return ( -
+
{labelTitle ? ( -