forked from element-hq/element-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: adds linkify matrix replacement with slight mods * feat: adds fetching the bot accounts from the backend * feat: atoms for verified bots * fix(wallet): updates link storage to correct orders * refactor(dm): extracts openDmForUser * chore: removes community bot atom * chore: removes last wallet bot usage * chore: removes trailing comma
- Loading branch information
1 parent
069e3c8
commit fc6280a
Showing
9 changed files
with
386 additions
and
46 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
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
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 |
---|---|---|
@@ -1,19 +1,33 @@ | ||
import { useMemo } from "react"; | ||
import { useAtom } from "jotai"; | ||
|
||
import { verifiedBotsAtom } from "../atoms"; | ||
import { botAccountsAtom, getBotAccountData } from "../atoms"; | ||
|
||
/** | ||
* Custom hook to check if a bot is verified. | ||
* @param botId - The ID of the bot to check. | ||
* @returns A boolean indicating whether the bot is verified or not. | ||
*/ | ||
export function useVerifiedBot(botId?: string): boolean { | ||
const [verifiedBots] = useAtom(verifiedBotsAtom); | ||
const [botAccounts] = useAtom(botAccountsAtom); | ||
|
||
const isVerifiedBot: boolean = useMemo(() => { | ||
return !!(botId && !!verifiedBots[botId]); | ||
}, [botId, verifiedBots]); | ||
return useMemo(() => { | ||
return !!( | ||
botId && | ||
(botId === botAccounts?.communityBot || | ||
botId === botAccounts?.superheroBot || | ||
botId === botAccounts?.blockchainBot) | ||
); | ||
}, [botId, botAccounts]); | ||
} | ||
|
||
export function isVerifiedBot(botId?: string): boolean { | ||
const botAccounts = getBotAccountData(); | ||
|
||
return isVerifiedBot; | ||
return !!( | ||
botId && | ||
(botId === botAccounts?.communityBot || | ||
botId === botAccounts?.superheroBot || | ||
botId === botAccounts?.blockchainBot) | ||
); | ||
} |
Oops, something went wrong.