Skip to content

Commit

Permalink
Merge branch 'development' of https://github.com/madfish-solutions/te…
Browse files Browse the repository at this point in the history
…mplewallet-extension into TW-1101-e-hide-ad-banner-on-click-x-button
  • Loading branch information
keshan3262 committed Jan 9, 2024
2 parents bade3f1 + df8e7ca commit 64c69eb
Show file tree
Hide file tree
Showing 23 changed files with 121 additions and 79 deletions.
11 changes: 8 additions & 3 deletions public/_locales/de/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"message": "Kryptowährungs-Wallet für Tezos-Blockchain als Web-Erweiterung für Ihren Browser."
},
"createAccount": {
"message": "Konto erstellen oder wiederherstellen"
"message": "Konto erstellen"
},
"importAccount": {
"message": "Konto importieren"
Expand Down Expand Up @@ -1455,8 +1455,13 @@
"searchAssets": {
"message": "Vermögenswerte suchen..."
},
"searchByName": {
"message": "Nach Name suchen..."
"searchAccount": {
"message": "Suchen$hotkey$",
"placeholders": {
"hotkey": {
"content": "$1"
}
}
},
"deployNew": {
"message": "Neu bereitstellen"
Expand Down
11 changes: 8 additions & 3 deletions public/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"message": "🔐💰Cryptocurrency wallet for Tezos blockchain as Web Extension for your Browser."
},
"createAccount": {
"message": "Create or Restore account"
"message": "Create account"
},
"importAccount": {
"message": "Import account"
Expand Down Expand Up @@ -1744,8 +1744,13 @@
"searchAssets": {
"message": "Search assets..."
},
"searchByName": {
"message": "Search by name..."
"searchAccount": {
"message": "Search$hotkey$",
"placeholders": {
"hotkey": {
"content": "$1"
}
}
},
"deployNew": {
"message": "Deploy new"
Expand Down
2 changes: 1 addition & 1 deletion public/_locales/en_GB/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"message": "🔐💰Cryptocurrency wallet for Tezos blockchain as Web Extension for your Browser."
},
"createAccount": {
"message": "Create or Restore account"
"message": "Create account"
},
"totalEquityValue": {
"message": "Total Equity Value"
Expand Down
2 changes: 1 addition & 1 deletion public/_locales/fr/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"message": "Importer un compte"
},
"createAccount": {
"message": "Créer ou restaurer un compte"
"message": "Créer un compte"
},
"faucetFileTitle": {
"message": "Fichier Faucet"
Expand Down
2 changes: 1 addition & 1 deletion public/_locales/ja/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"message": "アカウントをインポート"
},
"createAccount": {
"message": "アカウントを作成または復元する"
"message": "アカウントを作成"
},
"faucetFileTitle": {
"message": "フォーセットファイル"
Expand Down
2 changes: 1 addition & 1 deletion public/_locales/ko/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"message": "계정 불러오기"
},
"createAccount": {
"message": "계정 생성 또는 복원"
"message": "계정 만들기"
},
"faucetFileTitle": {
"message": "수도꼭지 파일"
Expand Down
11 changes: 8 additions & 3 deletions public/_locales/pt/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"message": "Carteira de criptomoedas para blocos em cadeia Tezos como extensão da Web para o seu Browser."
},
"createAccount": {
"message": "Criar ou restaurar conta"
"message": "Criar conta"
},
"importAccount": {
"message": "Importar conta"
Expand Down Expand Up @@ -1455,8 +1455,13 @@
"searchAssets": {
"message": "Procurar ativos..."
},
"searchByName": {
"message": "Procurar por nome..."
"searchAccount": {
"message": "Procurar$hotkey$",
"placeholders": {
"hotkey": {
"content": "$1"
}
}
},
"deployNew": {
"message": "Implantar novo"
Expand Down
11 changes: 8 additions & 3 deletions public/_locales/tr/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"message": "Tarayıcınızda Web Uzantısı olarak Tezos blokzinciri için kripto para cüzdanı."
},
"createAccount": {
"message": "Hesap Oluştur veya Geri Yükle"
"message": "Bir hesap oluşturun"
},
"importAccount": {
"message": "Hesabı içe aktar"
Expand Down Expand Up @@ -1455,8 +1455,13 @@
"searchAssets": {
"message": "Varlıkları ara..."
},
"searchByName": {
"message": "Ada göre ara..."
"searchAccount": {
"message": "Aramak$hotkey$",
"placeholders": {
"hotkey": {
"content": "$1"
}
}
},
"deployNew": {
"message": "Yeni dağıt"
Expand Down
2 changes: 1 addition & 1 deletion public/_locales/uk/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"message": "🔐💰Криптовалютний гаманець для блокчейну Тезос як Розширення для твого браузеру"
},
"createAccount": {
"message": "Створити або відновити аккаунт"
"message": "Створити аккаунт"
},
"importAccount": {
"message": "Імпортувати аккаунт"
Expand Down
2 changes: 1 addition & 1 deletion public/_locales/zh_CN/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"message": "导入账户"
},
"createAccount": {
"message": "创建或恢复帐户"
"message": "创建一个帐户"
},
"faucetFileTitle": {
"message": "Faucet文件"
Expand Down
2 changes: 1 addition & 1 deletion public/_locales/zh_TW/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"message": "匯入帳戶"
},
"createAccount": {
"message": "創建或恢復帳戶"
"message": "建立一個帳戶"
},
"faucetFileTitle": {
"message": "水龍頭檔案"
Expand Down
4 changes: 2 additions & 2 deletions src/app/atoms/AccountTypeBadge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ const AccountTypeBadge = memo<AccountTypeBadgeProps>(({ account, darkTheme = fal
return title ? (
<span
className={clsx(
'rounded border border-opacity-25 px-1 py-px ml-2 leading-tight text-opacity-50',
darkTheme ? 'border-white text-white' : 'border-black text-black'
'rounded border px-1 py-px ml-2 leading-none text-xxxxs font-medium',
darkTheme ? 'border-gray-500 text-gray-500' : 'border-black text-black'
)}
style={{ fontSize: '0.6rem' }}
>
Expand Down
4 changes: 3 additions & 1 deletion src/app/atoms/CleanButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ import useTippy from 'lib/ui/useTippy';

type CleanButtonProps = HTMLAttributes<HTMLButtonElement> & {
bottomOffset?: string;
iconClassName?: string;
iconStyle?: React.CSSProperties;
};

const CleanButton: FC<CleanButtonProps> = ({
bottomOffset = '0.4rem',
className,
iconClassName,
style = {},
iconStyle = {},
...rest
Expand Down Expand Up @@ -48,7 +50,7 @@ const CleanButton: FC<CleanButtonProps> = ({
tabIndex={-1}
{...rest}
>
<CloseIcon className="w-auto h-4 stroke-current" style={iconStyle} />
<CloseIcon className={classNames('w-auto h-4 stroke-current', iconClassName)} style={iconStyle} />
</button>
);
};
Expand Down
5 changes: 5 additions & 0 deletions src/app/icons/sad-search.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const AccountItem: React.FC<AccountItemProps> = ({ account, selected, gas
'text-white text-shadow-black overflow-hidden',
'transition ease-in-out duration-200',
selected && 'shadow',
selected ? 'bg-gray-700 bg-opacity-40' : 'hover:bg-white hover:bg-opacity-5',
selected ? 'bg-gray-700 bg-opacity-40' : 'hover:bg-gray-700 hover:bg-opacity-20',
!selected && 'opacity-65 hover:opacity-100'
),
[selected]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ export const ActionButton: React.FC<ActionButtonProps> = ({ Icon, linkTo, onClic
className: classNames(
'block w-full flex items-center px-2 whitespace-nowrap overflow-hidden',
'rounded text-white text-shadow-black text-sm',
'hover:bg-white hover:bg-opacity-10',
'hover:bg-gray-700 hover:bg-opacity-30',
'transition ease-in-out duration-200'
),
style: {
paddingTop: '0.375rem',
paddingBottom: '0.375rem'
paddingTop: '0.5rem',
paddingBottom: '0.5rem'
},
onClick,
children: (
<>
<div className="flex items-center w-8">
<Icon className="w-auto h-6 stroke-current" />
<div className="flex items-center w-6">
<Icon className="w-auto h-4 stroke-current" />
</div>

<T id={i18nKey} />
Expand Down
75 changes: 36 additions & 39 deletions src/app/layouts/PageLayout/Header/AccountDropdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,22 @@ import { ReactComponent as DownloadIcon } from 'app/icons/download.svg';
import { ReactComponent as LinkIcon } from 'app/icons/link.svg';
import { ReactComponent as LockIcon } from 'app/icons/lock.svg';
import { ReactComponent as MaximiseIcon } from 'app/icons/maximise.svg';
import { ReactComponent as SadSearchIcon } from 'app/icons/sad-search.svg';
import { ReactComponent as SettingsIcon } from 'app/icons/settings.svg';
import SearchField from 'app/templates/SearchField';
import { T, t } from 'lib/i18n';
import { useAccount, useRelevantAccounts, useSetAccountPkh, useTempleClient, useGasToken } from 'lib/temple/front';
import { PopperRenderProps } from 'lib/ui/Popper';
import { searchAndFilterItems } from 'lib/utils/search-items';
import { HistoryAction, navigate } from 'lib/woozie';

import { AccountItem } from './AccountItem';
import { ActionButtonProps, ActionButton } from './ActionButton';
import { AccountDropdownSelectors } from './selectors';

const isMacOS = /Mac OS/.test(navigator.userAgent);
const searchHotkey = ` (${isMacOS ? '⌘' : 'Ctrl + '}K)`;

type AccountDropdownProps = PopperRenderProps;

interface TDropdownAction extends ActionButtonProps {
Expand All @@ -39,16 +44,15 @@ const AccountDropdown: FC<AccountDropdownProps> = ({ opened, setOpened }) => {
const [searchValue, setSearchValue] = useState('');
const [attractSelectedAccount, setAttractSelectedAccount] = useState(true);

const isShowSearch = useMemo(() => allAccounts.length > 5, [allAccounts.length]);

const filteredAccounts = useMemo(() => {
if (searchValue.length === 0) {
return allAccounts;
} else {
const lowerCaseSearchValue = searchValue.toLowerCase();

return allAccounts.filter(currentAccount => currentAccount.name.toLowerCase().includes(lowerCaseSearchValue));
}

return searchAndFilterItems(allAccounts, searchValue.toLowerCase(), [
{ name: 'name', weight: 0.5 },
{ name: 'publicKeyHash', weight: 0.5 }
]);
}, [searchValue, allAccounts]);

const closeDropdown = useCallback(() => {
Expand Down Expand Up @@ -136,7 +140,7 @@ const AccountDropdown: FC<AccountDropdownProps> = ({ opened, setOpened }) => {

useEffect(() => {
if (searchValue) setAttractSelectedAccount(false);
else if (opened === false) setAttractSelectedAccount(true);
else if (!opened) setAttractSelectedAccount(true);
}, [opened, searchValue]);

return (
Expand All @@ -158,11 +162,11 @@ const AccountDropdown: FC<AccountDropdownProps> = ({ opened, setOpened }) => {

<Button
className={classNames(
'px-2 py-1',
'px-2 py-0.5',
'rounded-md',
'border border-gray-700',
'border border-gray-200',
'flex items-center',
'text-white text-shadow-black',
'text-gray-200',
'text-sm',
'transition duration-300 ease-in-out',
'opacity-20',
Expand All @@ -177,39 +181,32 @@ const AccountDropdown: FC<AccountDropdownProps> = ({ opened, setOpened }) => {
</div>

<div className="my-2">
{isShowSearch && (
<SearchField
value={searchValue}
className={classNames(
'py-2 pl-8 pr-4',
'bg-transparent',
'border border-white border-opacity-10',
'focus:outline-none',
'transition ease-in-out duration-200',
'rounded-md rounded-b-none',
'text-white text-sm leading-tight'
)}
placeholder={t('searchByName')}
searchIconClassName="h-5 w-auto"
searchIconWrapperClassName="px-2 text-white opacity-75"
cleanButtonStyle={{ backgroundColor: 'transparent' }}
cleanButtonIconStyle={{ stroke: 'white' }}
onValueChange={setSearchValue}
/>
)}

<div
<SearchField
value={searchValue}
className={classNames(
'overflow-y-auto rounded border border-gray-700 shadow-inner',
isShowSearch && 'border-t-0 rounded-t-none'
'py-2 pl-8 pr-8',
'bg-transparent',
'border border-gray-200 border-opacity-20',
'focus:outline-none',
'transition ease-in-out duration-200',
'rounded-md rounded-b-none',
'text-gray-500 placeholder-gray-600 text-sm leading-tight'
)}
style={{ maxHeight: isShowSearch ? '12rem' : '14.25rem' }}
>
placeholder={t('searchAccount', [searchHotkey])}
searchIconClassName="h-5 w-auto text-gray-600 stroke-current"
searchIconWrapperClassName="px-2"
cleanButtonClassName="border-gray-600"
cleanButtonIconClassName="text-gray-600 stroke-current"
cleanButtonStyle={{ backgroundColor: 'transparent' }}
onValueChange={setSearchValue}
/>

<div className="overflow-y-auto rounded border border-gray-200 border-opacity-20 shadow-inner border-t-0 rounded-t-none h-48">
<div className="flex flex-col">
{filteredAccounts.length === 0 ? (
<p className="text-center text-white text-sm p-10">
<T id="noResults" />
</p>
<div className="h-48 flex justify-center items-center">
<SadSearchIcon />
</div>
) : (
filteredAccounts.map(acc => (
<AccountItem
Expand Down
6 changes: 1 addition & 5 deletions src/app/pages/CreateAccount/CreateAccount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,7 @@ const CreateAccount: FC = () => {
testID={CreateAccountSelectors.accountNameInputField}
/>

<FormSubmitButton
className="capitalize"
loading={submitting}
testID={CreateAccountSelectors.createOrRestoreButton}
>
<FormSubmitButton loading={submitting} testID={CreateAccountSelectors.createOrRestoreButton}>
<T id="createAccount" />
</FormSubmitButton>
</form>
Expand Down
1 change: 1 addition & 0 deletions src/app/templates/DAppsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ const DAppsList = () => {
searchIconClassName="h-4 w-auto"
searchIconWrapperClassName="px-2 text-gray-700"
value={searchString}
isCleanButtonVisible={Boolean(searchString)}
onValueChange={setSearchString}
/>
<div className={classNames(popup ? 'mb-4' : 'mb-6', 'w-full flex justify-between')}>
Expand Down
Loading

0 comments on commit 64c69eb

Please sign in to comment.