-
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: add option to hide balance, closes #5096
- Loading branch information
1 parent
36a84dc
commit d2599ab
Showing
34 changed files
with
328 additions
and
43 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
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,38 @@ | ||
import React from 'react'; | ||
|
||
import { type HTMLStyledProps, styled } from 'leather-styles/jsx'; | ||
|
||
import { BasicTooltip } from '@app/ui/components/tooltip/basic-tooltip'; | ||
|
||
interface PrivateTextLayoutProps extends HTMLStyledProps<'span'> { | ||
children: React.ReactNode; | ||
isPrivate?: boolean; | ||
onShowValue?(): void; | ||
} | ||
|
||
export function PrivateTextLayout({ | ||
isPrivate, | ||
onShowValue, | ||
children, | ||
style = {}, | ||
...rest | ||
}: PrivateTextLayoutProps) { | ||
const canShowValue = isPrivate && onShowValue; | ||
|
||
return ( | ||
<BasicTooltip label="Show value" disabled={!canShowValue} asChild> | ||
<styled.span | ||
{...rest} | ||
onClick={canShowValue ? onShowValue : undefined} | ||
cursor={canShowValue ? 'pointer' : undefined} | ||
style={{ | ||
...style, | ||
fontFamily: isPrivate ? 'Fira Code, Consolata, monospace' : style?.fontFamily, | ||
letterSpacing: isPrivate ? '0.05em' : style?.letterSpacing, | ||
}} | ||
> | ||
{isPrivate ? '***' : children} | ||
</styled.span> | ||
</BasicTooltip> | ||
); | ||
} |
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,25 @@ | ||
import { type HTMLStyledProps } from 'leather-styles/jsx'; | ||
|
||
import { PrivateTextLayout } from '@app/components/privacy/private-text.layout'; | ||
import { useTogglePrivateMode } from '@app/store/settings/settings.actions'; | ||
import { useIsPrivateMode } from '@app/store/settings/settings.selectors'; | ||
|
||
interface PrivateTextProps extends HTMLStyledProps<'span'> { | ||
children: React.ReactNode; | ||
canClickToShow?: boolean; | ||
} | ||
|
||
export function PrivateText({ children, canClickToShow, ...rest }: PrivateTextProps) { | ||
const isPrivateMode = useIsPrivateMode(); | ||
const togglePrivateMode = useTogglePrivateMode(); | ||
|
||
return ( | ||
<PrivateTextLayout | ||
{...rest} | ||
isPrivate={isPrivateMode} | ||
onShowValue={canClickToShow ? togglePrivateMode : undefined} | ||
> | ||
{children} | ||
</PrivateTextLayout> | ||
); | ||
} |
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.