-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: add translation to account icons tooltips
- Loading branch information
Showing
7 changed files
with
127 additions
and
85 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
28 changes: 28 additions & 0 deletions
28
packages/extension-polkagate/src/hooks/useHasIdentityTooltipText.ts
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,28 @@ | ||
// Copyright 2019-2024 @polkadot/extension-polkagate authors & contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { useMemo } from 'react'; | ||
|
||
import { useChain, useTranslation } from '.'; | ||
|
||
export default function useHasIdentityTooltipText (address: string | undefined, hasID: boolean | undefined): string { | ||
const { t } = useTranslation(); | ||
|
||
const chain = useChain(address); | ||
const anyChinModeText = t('Account is in Any Chain mode'); | ||
|
||
return useMemo(() => { | ||
if (!chain) { | ||
return anyChinModeText; | ||
} | ||
|
||
switch (hasID) { | ||
case true: | ||
return t('Has identity'); | ||
case false: | ||
return t('No identity'); | ||
default: | ||
return t('Checking'); | ||
} | ||
}, [anyChinModeText, chain, hasID, t]); | ||
} |
28 changes: 28 additions & 0 deletions
28
packages/extension-polkagate/src/hooks/useHasProxyTooltipText.ts
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,28 @@ | ||
// Copyright 2019-2024 @polkadot/extension-polkagate authors & contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { useMemo } from 'react'; | ||
|
||
import { useChain, useTranslation } from '.'; | ||
|
||
export default function useHasProxyTooltipText (address: string | undefined, hasProxy: boolean | undefined): string { | ||
const { t } = useTranslation(); | ||
|
||
const chain = useChain(address); | ||
const anyChinModeText = t('Account is in Any Chain mode'); | ||
|
||
return useMemo(() => { | ||
if (!chain) { | ||
return anyChinModeText; | ||
} | ||
|
||
switch (hasProxy) { | ||
case true: | ||
return t('Has proxy'); | ||
case false: | ||
return t('No proxy'); | ||
default: | ||
return t('Checking'); | ||
} | ||
}, [anyChinModeText, chain, hasProxy, t]); | ||
} |
28 changes: 28 additions & 0 deletions
28
packages/extension-polkagate/src/hooks/useIsRecoverableTooltipText.ts
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,28 @@ | ||
// Copyright 2019-2024 @polkadot/extension-polkagate authors & contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { useMemo } from 'react'; | ||
|
||
import { useChain, useTranslation } from '.'; | ||
|
||
export default function useIsRecoverableTooltipText (address: string | undefined, isRecoverable: boolean | undefined): string { | ||
const { t } = useTranslation(); | ||
|
||
const chain = useChain(address); | ||
const anyChinModeText = t('Account is in Any Chain mode'); | ||
|
||
return useMemo(() => { | ||
if (!chain) { | ||
return anyChinModeText; | ||
} | ||
|
||
switch (isRecoverable) { | ||
case true: | ||
return t('Recoverable'); | ||
case false: | ||
return t('Not recoverable'); | ||
default: | ||
return t('Checking'); | ||
} | ||
}, [anyChinModeText, chain, isRecoverable, t]); | ||
} |
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