fix(ci): the file error helper no longer shadows the modal's own errorText

The new switch over the file errors took the name of the component's local errorText, so the local constant was read before its declaration (TS2448, the import tests and an unused-var warning). It is fileErrorText now.
This commit is contained in:
Maurice
2026-11-29 18:39:54 +01:00
parent b1c7bd0a33
commit ab7468f028
@@ -36,7 +36,7 @@ interface ImportCollectionModalProps {
}
/** The words for each way a file can fail; a switch, so a new way does not build without its words. */
function errorText(error: CollectionFileError, t: TranslationFn, count: number): string {
function fileErrorText(error: CollectionFileError, t: TranslationFn, count: number): string {
switch (error) {
case 'too-large':
return t('collections.file.errorTooLarge')
@@ -278,7 +278,7 @@ export default function ImportCollectionModal({
const errorText = error === 'failed'
? (failedMessage ?? t('common.error'))
: error ? errorText(error, t, MAX_COLLECTION_FILE_PLACES) : null
: error ? fileErrorText(error, t, MAX_COLLECTION_FILE_PLACES) : null
// A GPX of nothing but a track would make an empty list, which is never what was meant.
const nothingToImport = (!!leftovers || !!map) && !!file && (map ? picked.size === 0 : file.places.length === 0)