From e00a8bfae3cca092db064956477d8b246191f4b9 Mon Sep 17 00:00:00 2001 From: tjtanjin Date: Fri, 4 Oct 2024 00:54:40 +0800 Subject: [PATCH] refactor: Rename hooks for consistency --- .../Buttons/FileAttachmentButton/FileAttachmentButton.tsx | 2 +- src/components/ChatBotBody/ToastPrompt/ToastPrompt.tsx | 2 +- src/components/ChatBotContainer.tsx | 4 ++-- .../{useBotEffectInternal.tsx => useBotEffectsInternal.tsx} | 2 +- .../internal/{useButtonInternal.ts => useButtonsInternal.ts} | 0 src/hooks/internal/useSubmitInputInternal.ts | 2 +- .../internal/{useToastInternal.tsx => useToastsInternal.tsx} | 0 src/hooks/{useToast.ts => useToasts.ts} | 2 +- src/index.tsx | 2 +- 9 files changed, 8 insertions(+), 8 deletions(-) rename src/hooks/internal/{useBotEffectInternal.tsx => useBotEffectsInternal.tsx} (99%) rename src/hooks/internal/{useButtonInternal.ts => useButtonsInternal.ts} (100%) rename src/hooks/internal/{useToastInternal.tsx => useToastsInternal.tsx} (100%) rename src/hooks/{useToast.ts => useToasts.ts} (79%) diff --git a/src/components/Buttons/FileAttachmentButton/FileAttachmentButton.tsx b/src/components/Buttons/FileAttachmentButton/FileAttachmentButton.tsx index 92094761..11b41442 100644 --- a/src/components/Buttons/FileAttachmentButton/FileAttachmentButton.tsx +++ b/src/components/Buttons/FileAttachmentButton/FileAttachmentButton.tsx @@ -2,7 +2,7 @@ import { ChangeEvent } from "react"; import MediaDisplay from "../../ChatBotBody/MediaDisplay/MediaDisplay"; import { getMediaFileDetails } from "../../../utils/mediaFileParser"; -import { useToastInternal } from "../../../hooks/internal/useToastInternal"; +import { useToastInternal } from "../../../hooks/internal/useToastsInternal"; import { useChatWindowInternal } from "../../../hooks/internal/useChatWindowInternal"; import { useSubmitInputInternal } from "../../../hooks/internal/useSubmitInputInternal"; import { useMessagesInternal } from "../../../hooks/internal/useMessagesInternal"; diff --git a/src/components/ChatBotBody/ToastPrompt/ToastPrompt.tsx b/src/components/ChatBotBody/ToastPrompt/ToastPrompt.tsx index 9a491810..c8ca5dd2 100644 --- a/src/components/ChatBotBody/ToastPrompt/ToastPrompt.tsx +++ b/src/components/ChatBotBody/ToastPrompt/ToastPrompt.tsx @@ -1,6 +1,6 @@ import { useEffect, useState, MouseEvent } from "react"; -import { useToastInternal } from "../../../hooks/internal/useToastInternal"; +import { useToastInternal } from "../../../hooks/internal/useToastsInternal"; import { useSettingsContext } from "../../../context/SettingsContext"; import { useStylesContext } from "../../../context/StylesContext"; diff --git a/src/components/ChatBotContainer.tsx b/src/components/ChatBotContainer.tsx index c52d0fb7..b193172b 100644 --- a/src/components/ChatBotContainer.tsx +++ b/src/components/ChatBotContainer.tsx @@ -6,9 +6,9 @@ import ChatBotInput from "./ChatBotInput/ChatBotInput"; import ChatBotFooter from "./ChatBotFooter/ChatBotFooter"; import ChatBotButton from "./ChatBotButton/ChatBotButton"; import ChatBotTooltip from "./ChatBotTooltip/ChatBotTooltip"; -import { useButtonInternal } from "../hooks/internal/useButtonInternal"; +import { useButtonInternal } from "../hooks/internal/useButtonsInternal"; import { useChatWindowInternal } from "../hooks/internal/useChatWindowInternal"; -import { useBotEffectInternal } from "../hooks/internal/useBotEffectInternal"; +import { useBotEffectInternal } from "../hooks/internal/useBotEffectsInternal"; import { useIsDesktopInternal } from "../hooks/internal/useIsDesktopInternal"; import { useBotRefsContext } from "../context/BotRefsContext"; import { useBotStatesContext } from "../context/BotStatesContext"; diff --git a/src/hooks/internal/useBotEffectInternal.tsx b/src/hooks/internal/useBotEffectsInternal.tsx similarity index 99% rename from src/hooks/internal/useBotEffectInternal.tsx rename to src/hooks/internal/useBotEffectsInternal.tsx index 9b343531..f6229e29 100644 --- a/src/hooks/internal/useBotEffectInternal.tsx +++ b/src/hooks/internal/useBotEffectsInternal.tsx @@ -13,7 +13,7 @@ import { useChatHistoryInternal } from "./useChatHistoryInternal"; import { usePathsInternal } from "./usePathsInternal"; import { useTextAreaInternal } from "./useTextAreaInternal"; import { useMessagesInternal } from "./useMessagesInternal"; -import { useToastInternal } from "./useToastInternal"; +import { useToastInternal } from "./useToastsInternal"; import { useVoiceInternal } from "./useVoiceInternal"; import { useSettingsContext } from "../../context/SettingsContext"; import { useBotStatesContext } from "../../context/BotStatesContext"; diff --git a/src/hooks/internal/useButtonInternal.ts b/src/hooks/internal/useButtonsInternal.ts similarity index 100% rename from src/hooks/internal/useButtonInternal.ts rename to src/hooks/internal/useButtonsInternal.ts diff --git a/src/hooks/internal/useSubmitInputInternal.ts b/src/hooks/internal/useSubmitInputInternal.ts index 084309f2..ae0bb618 100644 --- a/src/hooks/internal/useSubmitInputInternal.ts +++ b/src/hooks/internal/useSubmitInputInternal.ts @@ -8,7 +8,7 @@ import { useRcbEventInternal } from "./useRcbEventInternal"; import { useVoiceInternal } from "./useVoiceInternal"; import { useTextAreaInternal } from "./useTextAreaInternal"; import { useChatWindowInternal } from "./useChatWindowInternal"; -import { useToastInternal } from "./useToastInternal"; +import { useToastInternal } from "./useToastsInternal"; import { useBotStatesContext } from "../../context/BotStatesContext"; import { useBotRefsContext } from "../../context/BotRefsContext"; import { useSettingsContext } from "../../context/SettingsContext"; diff --git a/src/hooks/internal/useToastInternal.tsx b/src/hooks/internal/useToastsInternal.tsx similarity index 100% rename from src/hooks/internal/useToastInternal.tsx rename to src/hooks/internal/useToastsInternal.tsx diff --git a/src/hooks/useToast.ts b/src/hooks/useToasts.ts similarity index 79% rename from src/hooks/useToast.ts rename to src/hooks/useToasts.ts index d5240fd6..d4a4048b 100644 --- a/src/hooks/useToast.ts +++ b/src/hooks/useToasts.ts @@ -1,4 +1,4 @@ -import { useToastInternal } from "./internal/useToastInternal"; +import { useToastInternal } from "./internal/useToastsInternal"; /** * External custom hook for managing toasts. diff --git a/src/index.tsx b/src/index.tsx index ad28ad04..066010a1 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -43,7 +43,7 @@ import { usePaths } from "./hooks/usePaths"; import { useSettings } from "./hooks/useSettings"; import { useStyles } from "./hooks/useStyles"; import { useTextArea } from "./hooks/useTextArea"; -import { useToast } from "./hooks/useToast"; +import { useToast } from "./hooks/useToasts"; import { useVoice } from "./hooks/useVoice"; import { useChatHistory } from "./hooks/useChatHistory";