-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: granular utxo protection feature
- Loading branch information
1 parent
0ddf20e
commit fbb2fed
Showing
22 changed files
with
488 additions
and
143 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { useCallback, useState } from 'react'; | ||
|
||
interface HoverBind { | ||
onMouseEnter(event: React.MouseEvent<HTMLElement, MouseEvent>): void; | ||
onMouseLeave(event: React.MouseEvent<HTMLElement, MouseEvent>): void; | ||
} | ||
|
||
export function useHoverWithChildren(): [boolean, HoverBind] { | ||
const [isHovered, setIsHovered] = useState(false); | ||
|
||
const handleMouseEnter = useCallback(() => { | ||
setIsHovered(true); | ||
}, []); | ||
|
||
const handleMouseLeave = useCallback((event: React.MouseEvent<HTMLElement, MouseEvent>) => { | ||
const relatedTarget = event.relatedTarget as HTMLElement; | ||
|
||
// If the related target is a child of the current element, don't trigger mouseleave | ||
if (event.currentTarget.contains(relatedTarget)) { | ||
return; | ||
} | ||
|
||
setIsHovered(false); | ||
}, []); | ||
|
||
const bind: HoverBind = { | ||
onMouseEnter: handleMouseEnter, | ||
onMouseLeave: handleMouseLeave, | ||
}; | ||
|
||
return [isHovered, bind]; | ||
} |
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
23 changes: 23 additions & 0 deletions
23
src/app/features/collectibles/components/bitcoin/high-sat-value-utxo.tsx
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,23 @@ | ||
import { Box, Circle } from 'leather-styles/jsx'; | ||
|
||
import type { Inscription } from '@leather.io/models'; | ||
|
||
import { BasicTooltip } from '@app/ui/components/tooltip/basic-tooltip'; | ||
|
||
const featureBuilt = false; | ||
|
||
interface HighSatValueUtxoProps { | ||
inscription: Inscription; | ||
} | ||
|
||
export function HighSatValueUtxoWarning({ inscription }: HighSatValueUtxoProps) { | ||
if (Number(inscription.value) < 5_000) return null; | ||
if (!featureBuilt) return null; | ||
return ( | ||
<Box position="absolute" top="space.01" right="space.01"> | ||
<BasicTooltip label="This inscription has loads of BTC on it, remove protections? Click"> | ||
<Circle bg="red" size="sm" /> | ||
</BasicTooltip> | ||
</Box> | ||
); | ||
} |
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.