-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4383913
commit 29cf178
Showing
14 changed files
with
441 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import type { ProfileView } from "@atproto/api/dist/client/types/app/bsky/actor/defs"; | ||
import Modal from "~lib/components/Modal"; | ||
import UserCardWithoutActionButton from "~lib/components/UserCardWithoutActionButton"; | ||
|
||
interface ReSearchModalProps { | ||
open: boolean; | ||
onClose: () => void; | ||
reSearchResults: { | ||
sourceDid: string; | ||
users: ProfileView[]; | ||
}; | ||
handleClickReSearchResult: ({ | ||
sourceDid, | ||
user, | ||
}: { | ||
sourceDid: string; | ||
user: ProfileView; | ||
}) => void; | ||
} | ||
|
||
const ReSearchModal: React.FC<ReSearchModalProps> = ({ | ||
open, | ||
onClose, | ||
reSearchResults, | ||
handleClickReSearchResult, | ||
}) => { | ||
return ( | ||
<Modal open={open} width={600} onClose={onClose}> | ||
<h2 className="text-lg font-bold text-center py-2">Search Results</h2> | ||
{reSearchResults.users.length === 0 && ( | ||
<div className="text-center flex justify-center items-center flex-col gap-4 mt-5"> | ||
<span className="loading loading-spinner loading-lg" /> | ||
<div className="text-center flex justify-center items-center text-sm"> | ||
Loading... | ||
</div> | ||
</div> | ||
)} | ||
{reSearchResults.users.length > 0 && ( | ||
<div className="divide-y divide-gray-500"> | ||
{reSearchResults.users.map((user) => ( | ||
<UserCardWithoutActionButton | ||
key={user.handle} | ||
onClick={() => | ||
handleClickReSearchResult({ | ||
sourceDid: reSearchResults.sourceDid, | ||
user, | ||
}) | ||
} | ||
user={{ | ||
avatar: user.avatar, | ||
handle: user.handle, | ||
displayName: user.displayName, | ||
description: user.description, | ||
}} | ||
/> | ||
))} | ||
</div> | ||
)} | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default ReSearchModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from "react"; | ||
|
||
type ActionButtonProps = { | ||
loading: boolean; | ||
actionBtnLabelAndClass: { label: string; class: string }; | ||
handleActionButtonClick: () => void; | ||
setIsBtnHovered: (value: boolean) => void; | ||
setIsJustClicked: (value: boolean) => void; | ||
}; | ||
|
||
export const ActionButton = ({ | ||
loading, | ||
actionBtnLabelAndClass, | ||
handleActionButtonClick, | ||
setIsBtnHovered, | ||
setIsJustClicked, | ||
}: ActionButtonProps) => ( | ||
<button | ||
type="button" | ||
className={`btn btn-sm rounded-3xl ${ | ||
loading ? "" : actionBtnLabelAndClass.class | ||
}`} | ||
onClick={handleActionButtonClick} | ||
onMouseEnter={() => setIsBtnHovered(true)} | ||
onMouseLeave={() => { | ||
setIsBtnHovered(false); | ||
setIsJustClicked(false); | ||
}} | ||
disabled={loading} | ||
> | ||
{loading ? "Processing..." : actionBtnLabelAndClass.label} | ||
</button> | ||
); | ||
|
||
export default ActionButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.