From c882a9c0f852b974b4fb7ef53b99520c62053458 Mon Sep 17 00:00:00 2001 From: Pete Edwards Date: Mon, 5 Aug 2024 10:24:04 +0100 Subject: [PATCH] Fix more typescript errors --- api/files.ts | 1 + app/(tabs)/home/[fileName].tsx | 1 + app/(tabs)/home/download.tsx | 1 + app/(tabs)/home/index.tsx | 1 + app/(tabs)/profile.tsx | 6 ++++-- components/files/BottomModal.tsx | 1 + components/files/FileList.tsx | 1 + utils/fileUtils.ts | 1 + 8 files changed, 11 insertions(+), 2 deletions(-) diff --git a/api/files.ts b/api/files.ts index 84f065b..2edea56 100644 --- a/api/files.ts +++ b/api/files.ts @@ -19,6 +19,7 @@ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // import mime from "mime"; +import type { WalletFile } from "@/types/WalletFile"; import { makeApiRequest } from "./apiRequest"; interface FileObject { diff --git a/app/(tabs)/home/[fileName].tsx b/app/(tabs)/home/[fileName].tsx index f83a840..2e19717 100644 --- a/app/(tabs)/home/[fileName].tsx +++ b/app/(tabs)/home/[fileName].tsx @@ -31,6 +31,7 @@ import { FontAwesome6 } from "@expo/vector-icons"; import { Colors } from "@/constants/Colors"; import VcCard from "@/components/files/VcCard"; import BottomModal from "@/components/files/BottomModal"; +import type { WalletFile } from "@/types/WalletFile"; interface FileDetailProps { file: WalletFile; diff --git a/app/(tabs)/home/download.tsx b/app/(tabs)/home/download.tsx index 5c3ab91..35035a2 100644 --- a/app/(tabs)/home/download.tsx +++ b/app/(tabs)/home/download.tsx @@ -28,6 +28,7 @@ import { postFile } from "@/api/files"; import { FontAwesome6 } from "@expo/vector-icons"; import IconResourceName from "@/components/common/IconResourceName"; import { RDF_CONTENT_TYPE } from "@/utils/constants"; +import type { WalletFile } from "@/types/WalletFile"; interface FileDetailProps { file: WalletFile; diff --git a/app/(tabs)/home/index.tsx b/app/(tabs)/home/index.tsx index e8d5d1c..ceca0e2 100644 --- a/app/(tabs)/home/index.tsx +++ b/app/(tabs)/home/index.tsx @@ -28,6 +28,7 @@ import { fetchFiles } from "@/api/files"; import FileList from "@/components/files/FileList"; import useRefreshOnFocus from "@/hooks/useRefreshOnFocus"; import { Colors } from "@/constants/Colors"; +import type { WalletFile } from "@/types/WalletFile"; const HomeScreen = () => { const { data, isLoading, isFetching, refetch } = useQuery({ diff --git a/app/(tabs)/profile.tsx b/app/(tabs)/profile.tsx index 9baf8c1..19ca4fe 100644 --- a/app/(tabs)/profile.tsx +++ b/app/(tabs)/profile.tsx @@ -88,11 +88,13 @@ export default function Profile() { borderRadius={50} /> ) : ( - + )} - {name || webId ? formatResourceName(webId, false, webId) : null} + {name || webId + ? formatResourceName(name || webId || "", false, webId) + : null} {webId} diff --git a/components/files/BottomModal.tsx b/components/files/BottomModal.tsx index eccb2de..48616cb 100644 --- a/components/files/BottomModal.tsx +++ b/components/files/BottomModal.tsx @@ -30,6 +30,7 @@ import * as FileSystem from "expo-file-system"; import QRCode from "react-native-qrcode-svg"; import { formatResourceName } from "@/utils/fileUtils"; import type { UserInfo } from "@/constants/user"; +import type { WalletFile } from "@/types/WalletFile"; import { ThemedText } from "../ThemedText"; import ConfirmModal from "../common/ConfirmModal"; diff --git a/components/files/FileList.tsx b/components/files/FileList.tsx index fc87d9d..7e565e4 100644 --- a/components/files/FileList.tsx +++ b/components/files/FileList.tsx @@ -33,6 +33,7 @@ import { faEllipsis } from "@fortawesome/free-solid-svg-icons/faEllipsis"; import { useRouter } from "expo-router"; import { useIsMutating } from "@tanstack/react-query"; import Loading from "@/components/LoadingButton"; +import type { WalletFile } from "@/types/WalletFile"; import BottomModal from "./BottomModal"; import { ThemedText } from "../ThemedText"; diff --git a/utils/fileUtils.ts b/utils/fileUtils.ts index 0b0ab6b..f3ce1c6 100644 --- a/utils/fileUtils.ts +++ b/utils/fileUtils.ts @@ -23,6 +23,7 @@ import { faImage } from "@fortawesome/free-solid-svg-icons/faImage"; import { faIdCard } from "@fortawesome/free-solid-svg-icons/faIdCard"; import { faWallet } from "@fortawesome/free-solid-svg-icons/faWallet"; import { AccessRequestMode } from "@/types/enums"; +import type { WalletFile } from "@/types/WalletFile"; function capitalize(word: string): string { return word.charAt(0).toUpperCase() + word.slice(1);