From c79e1bde3bc23c6e46d9595a37757803bb77001b Mon Sep 17 00:00:00 2001 From: serhat Date: Wed, 17 Apr 2024 15:08:39 +0300 Subject: [PATCH 1/3] wip --- web-app/src/app/[id]/page.tsx | 5 -- web-app/src/components/ai/no-indexes.tsx | 2 +- .../src/components/base/SearchInput/index.tsx | 14 +++- .../IndexConversationContext.tsx | 2 +- .../TabContainer/IndexItemsTab.tsx | 2 +- .../SettingsTab/SettingsModal.tsx | 5 +- .../SettingsTab/WaitingForTransaction.tsx | 5 +- .../index-details/IndexItemList/index.tsx | 16 +++-- .../site/indexes/AskIndexes/index.tsx | 3 +- .../components/site/input/LinkInput/index.tsx | 2 +- .../modal/Common/ConfirmTransaction/index.tsx | 66 ++++++++++--------- 11 files changed, 64 insertions(+), 58 deletions(-) diff --git a/web-app/src/app/[id]/page.tsx b/web-app/src/app/[id]/page.tsx index 86b71409..39eaea1d 100644 --- a/web-app/src/app/[id]/page.tsx +++ b/web-app/src/app/[id]/page.tsx @@ -8,17 +8,12 @@ import UserConversationSection from "components/sections/UserConversation"; import { useRouteParams } from "hooks/useRouteParams"; import { useEffect } from "react"; import "../../styles/main.scss"; -import { useRouter } from "next/navigation"; const Discovery = () => { const { discoveryType, indexes } = useApp(); const { id } = useRouteParams(); - const router = useRouter(); useEffect(() => { - console.log("discoveryType in page.tsx:", discoveryType, id); - console.log("indexes in page.tsx:", indexes); - // if (typeof window !== "undefined") { // window.ethereum.on("message", (message: any) => { // console.log("eth: ", message); diff --git a/web-app/src/components/ai/no-indexes.tsx b/web-app/src/components/ai/no-indexes.tsx index 353a9e01..6ff6724b 100644 --- a/web-app/src/components/ai/no-indexes.tsx +++ b/web-app/src/components/ai/no-indexes.tsx @@ -14,7 +14,7 @@ export default function NoIndexesChat({ isSelfDid }: { isSelfDid?: boolean }) { textAlign: "center", flexDirection: "column", alignItems: "center", - padding: "4rem 0", + padding: "8rem 0 0 0", }} > } + addOnBefore={ + + + + } addOnAfter={ loading ? ( diff --git a/web-app/src/components/sections/IndexConversation/IndexConversationContext.tsx b/web-app/src/components/sections/IndexConversation/IndexConversationContext.tsx index 75d3def1..ad441ec9 100644 --- a/web-app/src/components/sections/IndexConversation/IndexConversationContext.tsx +++ b/web-app/src/components/sections/IndexConversation/IndexConversationContext.tsx @@ -98,7 +98,7 @@ export const IndexConversationProvider = ({ children }: { children: any }) => { const fetchInitial = useCallback(async () => { await fetchIndex(); fetchIndexItems(true); - }, [viewedIndex, fetchIndex, fetchIndexItems]); + }, [fetchIndex, fetchIndexItems]); useEffect(() => { fetchInitial(); diff --git a/web-app/src/components/sections/IndexConversation/TabContainer/IndexItemsTab.tsx b/web-app/src/components/sections/IndexConversation/TabContainer/IndexItemsTab.tsx index d3642ee3..1aa24976 100644 --- a/web-app/src/components/sections/IndexConversation/TabContainer/IndexItemsTab.tsx +++ b/web-app/src/components/sections/IndexConversation/TabContainer/IndexItemsTab.tsx @@ -189,7 +189,7 @@ export default function IndexItemsTabSection() { search={search} hasMore={!!itemsState.cursor} removeItem={handleRemove} - // loadMore={fetchIndexItems} + // loadMore={() => fetchIndexItems(false)} loadMore={() => {}} /> diff --git a/web-app/src/components/sections/IndexConversation/TabContainer/SettingsTab/SettingsModal.tsx b/web-app/src/components/sections/IndexConversation/TabContainer/SettingsTab/SettingsModal.tsx index 80338512..6b3aa94b 100644 --- a/web-app/src/components/sections/IndexConversation/TabContainer/SettingsTab/SettingsModal.tsx +++ b/web-app/src/components/sections/IndexConversation/TabContainer/SettingsTab/SettingsModal.tsx @@ -36,10 +36,7 @@ const SettingsModal: FC = ({ header = (

Waiting for transaction

-

- Please wait while the transaction is being processed. This may take a - few minutes. -

+

Please wait while the transaction is being processed.

); } else if (step === "done") { diff --git a/web-app/src/components/sections/IndexConversation/TabContainer/SettingsTab/WaitingForTransaction.tsx b/web-app/src/components/sections/IndexConversation/TabContainer/SettingsTab/WaitingForTransaction.tsx index 5af4336c..2fcdd869 100644 --- a/web-app/src/components/sections/IndexConversation/TabContainer/SettingsTab/WaitingForTransaction.tsx +++ b/web-app/src/components/sections/IndexConversation/TabContainer/SettingsTab/WaitingForTransaction.tsx @@ -1,4 +1,3 @@ -import Button from "@/components/base/Button"; import { FC } from "react"; interface WaitingForTransactionProps { @@ -41,7 +40,7 @@ const WaitingForTransaction: FC = ({ -
= ({ > Loading -
+ */} ); diff --git a/web-app/src/components/site/index-details/IndexItemList/index.tsx b/web-app/src/components/site/index-details/IndexItemList/index.tsx index b362676c..a9e0eeae 100644 --- a/web-app/src/components/site/index-details/IndexItemList/index.tsx +++ b/web-app/src/components/site/index-details/IndexItemList/index.tsx @@ -1,10 +1,12 @@ -import React from "react"; import List from "components/base/List"; +import React from "react"; import InfiniteScroll from "react-infinite-scroller"; -import { IndexItem } from "types/entity"; import { useRole } from "hooks/useRole"; -import LinkItem from "../LinkItem"; +import { IndexItem } from "types/entity"; +// import InfiniteScroll from "react-infinite-scroll-component"; + import NoLinks from "../../indexes/NoLinks"; +import LinkItem from "../LinkItem"; export interface IndexItemListProps { search: string; @@ -16,7 +18,7 @@ export interface IndexItemListProps { const MemoLinkItem = React.memo(LinkItem); -const IndexItemList: React.VFC = ({ +const IndexItemList: React.FC = ({ search, items, hasMore, @@ -24,7 +26,6 @@ const IndexItemList: React.VFC = ({ removeItem, }) => { const { isOwner } = useRole(); - return ( <> {items.length === 0 ? ( @@ -36,13 +37,16 @@ const IndexItemList: React.VFC = ({ hasMore={hasMore} loadMore={loadMore} marginHeight={50} + // loader={
} > ( removeItem(item)} - search={!!search} item={item} /> + search={!!search} + item={item} + /> )} divided data={items} diff --git a/web-app/src/components/site/indexes/AskIndexes/index.tsx b/web-app/src/components/site/indexes/AskIndexes/index.tsx index 58f5cd71..a5715b4e 100644 --- a/web-app/src/components/site/indexes/AskIndexes/index.tsx +++ b/web-app/src/components/site/indexes/AskIndexes/index.tsx @@ -163,7 +163,7 @@ const AskIndexes: FC = ({ chatID, did, indexIds }) => { useEffect(() => { scrollToBottom(); - }, [messages, isLoading]); + }, [messages, isLoading, scrollToBottom]); if (leftSectionIndexes.length === 0) { return ; @@ -192,6 +192,7 @@ const AskIndexes: FC = ({ chatID, did, indexIds }) => { height: "100%", justifyContent: "stretch", width: "100%", + flexDirection: "column", }} > {messages.length ? ( diff --git a/web-app/src/components/site/input/LinkInput/index.tsx b/web-app/src/components/site/input/LinkInput/index.tsx index 008890f6..cdb28cf0 100644 --- a/web-app/src/components/site/input/LinkInput/index.tsx +++ b/web-app/src/components/site/input/LinkInput/index.tsx @@ -61,7 +61,7 @@ const LinkInput: React.FC = ({ className={cc(["link-input__input", `link-input-${size}`])} disabled={disabled} addOnBefore={ - + } addOnAfter={ loading ? ( diff --git a/web-app/src/components/site/modal/Common/ConfirmTransaction/index.tsx b/web-app/src/components/site/modal/Common/ConfirmTransaction/index.tsx index 5c54e217..4a5570c8 100644 --- a/web-app/src/components/site/modal/Common/ConfirmTransaction/index.tsx +++ b/web-app/src/components/site/modal/Common/ConfirmTransaction/index.tsx @@ -1,8 +1,5 @@ -import React from "react"; import Text from "components/base/Text"; -import Col from "components/layout/base/Grid/Col"; import Modal from "components/base/Modal"; -import Button from "components/base/Button"; import Row from "components/layout/base/Grid/Row"; import Header from "components/base/Header"; import Flex from "components/layout/base/Grid/Flex"; @@ -19,7 +16,12 @@ const ConfirmTransaction = ({ handleCancel, ...modalProps }: any) => { body={ <> - +