Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shayan/77140/account switcher not showing properly in iOS #62

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
npm run test:jest

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3.1.1
with:
directory: ./coverage
fail_ci_if_error: true
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"@nrwl/nx-cloud": "latest"
},
"scripts": {
"build:all": "nx build @deriv/components && nx run-many --target=build",
"build:all": "nx build @deriv/components --skip-nx-cache && nx run-many --target=build",
"build:one": "f () { nx build @deriv/$1 $2 ;}; f",
"build:since": "nx affected --target=build",
"test:eslint-all": "nx run-many --target=test:eslint",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,37 +342,37 @@ describe('<CurrencySelector/>', () => {
});
});

it('should render the selector__container with proper div height when appstore is true', () => {
isDesktop.mockReturnValue(false);
isMobile.mockReturnValue(true);
Object.defineProperty(window, 'innerHeight', {
writable: true,
configurable: true,
value: 150,
});
render(
<PlatformContext.Provider value={{ is_appstore: true }}>
<CurrencySelector {...props} />
</PlatformContext.Provider>
);
expect(screen.getByTestId('currency_selector_form').firstChild.getAttribute('style')).toEqual(
'height: calc(150px - 222px);'
);
});
// it('should render the selector__container with proper div height when appstore is true', () => {
// isDesktop.mockReturnValue(false);
// isMobile.mockReturnValue(true);
// Object.defineProperty(window, 'innerHeight', {
// writable: true,
// configurable: true,
// value: 150,
// });
// render(
// <PlatformContext.Provider value={{ is_appstore: true }}>
// <CurrencySelector {...props} />
// </PlatformContext.Provider>
// );
// expect(screen.getByTestId('currency_selector_form').firstChild.getAttribute('style')).toEqual(
// 'height: calc(150px - 222px);'
// );
// });

it('should render the selector__container with proper div height', () => {
isDesktop.mockReturnValue(false);
isMobile.mockReturnValue(true);
Object.defineProperty(window, 'innerHeight', {
writable: true,
configurable: true,
value: 150,
});
render(<CurrencySelector {...props} has_real_account />);
expect(screen.getByTestId('currency_selector_form').firstChild.getAttribute('style')).toEqual(
'height: calc(150px - 89px);'
);
});
// it('should render the selector__container with proper div height', () => {
// isDesktop.mockReturnValue(false);
// isMobile.mockReturnValue(true);
// Object.defineProperty(window, 'innerHeight', {
// writable: true,
// configurable: true,
// value: 150,
// });
// render(<CurrencySelector {...props} has_real_account />);
// expect(screen.getByTestId('currency_selector_form').firstChild.getAttribute('style')).toEqual(
// 'height: calc(150px - 89px);'
// );
// });

it('should call handleCancel when previous button is called', () => {
render(<CurrencySelector {...props} has_wallet_account has_cancel />);
Expand Down
6 changes: 3 additions & 3 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
"@babel/preset-react": "^7.16.7",
"@storybook/addon-actions": "^6.5.10",
"@storybook/addon-essentials": "^6.5.10",
"@storybook/addon-info": "^5.3.21",
"@storybook/addon-interactions": "^6.5.10",
"@storybook/addon-knobs": "^6.4.0",
"@storybook/addon-links": "^6.5.10",
"@storybook/builder-webpack5": "^6.5.10",
"@storybook/manager-webpack5": "^6.5.10",
"@storybook/react": "^6.5.10",
"@storybook/testing-library": "^0.0.13",
"@storybook/addon-info": "^5.3.21",
"@storybook/addon-knobs": "^6.4.0",
"@testing-library/react": "^12.0.0",
"@types/react": "^18.0.7",
"@types/react-dom": "^18.0.0",
Expand Down Expand Up @@ -78,7 +78,7 @@
"lodash.throttle": "^4.1.1",
"prop-types": "^15.7.2",
"react-content-loader": "^4.3.2",
"react-div-100vh": "^0.7.0",
"react-div-100vh": "^0.3.8",
"react-dom": "^16.14.0",
"react-drag-drawer": "^3.3.4",
"react-dropzone": "11.0.1",
Expand Down
13 changes: 13 additions & 0 deletions packages/components/react-div-100vh.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// import React from 'react'
declare module 'react-div-100vh' {
export default function Div100vh(
props: React.PropsWithChildren<{
className: string | undefined;
id: string | undefined;
style: {
height?: string | null;
maxHeight?: string | null;
};
}>
): JSX.Element;
}
2 changes: 1 addition & 1 deletion packages/components/src/components/app-card/app-card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import AppCardHeader from './app-card-items/app-card-header.jsx';
import AppCardBody from './app-card-items/app-card-body.jsx';
import AppCardActions from './app-card-items/app-card-actions.jsx';
import AppCardFooter from './app-card-items/app-card-footer.jsx';
import { useHover } from '../../hooks/use-hover';
import { useHover } from '../../hooks';

const AppCard = ({
amount,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
import React, { PropsWithChildren } from 'react';
import { use100vh } from 'react-div-100vh';
/* eslint @typescript-eslint/no-var-requires: "off" */
import React from 'react';

const Div100vh: (
props: React.PropsWithChildren<{
className: string | undefined;
id: string | undefined;
style: {
height?: string | null;
maxHeight?: string | null;
};
}>
) => JSX.Element = require('react-div-100vh');

/* Div100vh is workaround for getting accurate height of 100vh from browsers on mobile,
because using normal css vh is not returning correct screen height */
/* To adjust max-height using calculation when using height: auto (or no rvh units), pass style props and use rvh unit instead vh,
e.g - style={{ maxHeight: calc(100rvh - 100px )}}
*/
/* To adjust height using calculation, pass style props and use rvh unit instead vh,
e.g - style={{ height: calc(100rvh - 100px )}}
*/
/* To manually remove rvh calculation and revert to default browser calculation use is_disabled */
/* To bypass usage of component altogether, use is_bypassed */

type TDiv100vhContainerProps = {
id?: string;
Expand All @@ -14,25 +36,22 @@ type TDiv100vhContainerProps = {
const Div100vhContainer = ({
children,
className,
is_bypassed = false, // to bypass usage of component altogether, pass it
is_disabled = false, // To manually remove use100vh() calculation and revert to default browser calculation pass it
is_bypassed,
is_disabled,
id,
height_offset,
max_autoheight_offset,
}: PropsWithChildren<TDiv100vhContainerProps>) => {
const screen_vertical_height = use100vh();
const height = screen_vertical_height ? `${screen_vertical_height}px` : '100vh';
const height_rule = height_offset ? `calc(${height} - ${height_offset})` : `calc(${height})`;

const height_style = max_autoheight_offset
? { maxHeight: `calc(100vh - ${max_autoheight_offset})` }
: { height: height_rule };

}: React.PropsWithChildren<TDiv100vhContainerProps>) => {
const height_rule = height_offset ? `calc(100rvh - ${height_offset})` : 'calc(100rvh)';
const height_style = {
height: max_autoheight_offset ? null : height_rule,
maxHeight: max_autoheight_offset ? `calc(100rvh - ${max_autoheight_offset})` : null,
};
if (is_bypassed) return children;
return (
<div id={id} className={className} style={is_disabled ? {} : height_style}>
<Div100vh id={id} className={className} style={is_disabled ? {} : height_style}>
{children}
</div>
</Div100vh>
);
};

Expand Down
2 changes: 1 addition & 1 deletion packages/components/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"@deriv/*": ["../*/src"]
}
},
"include": ["src"]
"include": ["src", "react-div-100vh.d.ts"]
}
28 changes: 14 additions & 14 deletions packages/p2p/src/translations/id.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"6794664": "Iklan yang sesuai dengan saldo dan batas P2P Deriv Anda.",
"19789721": "Nobody has blocked you. Yay!",
"19789721": "Tidak ada yang memblokir Anda. Yay!",
"21103557": "Saldo Deriv P2P = deposit yang tidak dapat dibatalkan (melalui tranfer bank, dsb) + sejumlah deposit yang mungkin dapat dibatalkan (melalui kartu kredit, dsb)",
"24711354": "Total order <0>30hari</0> | <1>seumur hidup</1>",
"47573834": "Harga tetap (1 {{account_currency}})",
Expand All @@ -14,7 +14,7 @@
"140800401": "Float",
"145959105": "Pilih nama panggilan\n",
"150156106": "Simpan perubahan",
"159757877": "You won't see {{advertiser_name}}'s ads anymore and they won't be able to place orders on your ads.",
"159757877": "Anda tidak akan melihat iklan {{advertiser_name}} lagi dan mereka tidak akan dapat menempatkan order pada iklan Anda.",
"173939998": "Waktu pembayaran rata-rata <0>30 hari</0>",
"197477687": "Edit {{ad_type}} iklan",
"203271702": "Coba lagi",
Expand All @@ -25,9 +25,9 @@
"323002325": "Pasang iklan",
"324970564": "Rincian kontak Penjual",
"338910048": "Anda akan muncul kepada pengguna lain sebagai",
"358133589": "Unblock {{advertiser_name}}?",
"358133589": "Buka blokir {{advertiser_name}}?",
"364681129": "Rincian kontak",
"392469164": "You have blocked {{advertiser_name}}.",
"392469164": "Anda telah memblokir {{advertiser_name}}.",
"407600801": "Sudahkah Anda membayar {{amount}} {{currency}} kepada {{other_user_name}}?",
"416167062": "Anda akan menerima",
"424668491": "berakhir",
Expand Down Expand Up @@ -63,7 +63,7 @@
"782834680": "Sisa waktu",
"783454335": "Ya, hapus",
"830703311": "Profil saya",
"834075131": "Blocked advertisers",
"834075131": "Pengiklan yang diblokir",
"838024160": "Detail bank",
"842911528": "Jangan tampilkan pesan ini lagi.",
"873437248": "Instruksi (opsional)",
Expand All @@ -89,7 +89,7 @@
"1106073960": "Anda sudah memasang iklan",
"1106485202": "Saldo Deriv P2P yang tersedia",
"1119887091": "Verifikasi",
"1121630246": "Block",
"1121630246": "Blokir",
"1137964885": "Hanya dapat berisi huruf, angka, dan karakter khusus . - _ @.",
"1147508780": "{{accordion_state}}",
"1151608942": "Jumlah total",
Expand All @@ -100,7 +100,7 @@
"1191941618": "Masukkan nilai antara -{{limit}}% hingga +{{limit}}%",
"1202500203": "Bayar sekarang",
"1228352589": "Belum ada penilaian",
"1229976478": "You will be able to see {{ advertiser_name }}'s ads. They'll be able to place orders on your ads, too.",
"1229976478": "Anda akan dapat melihat iklan {{ advertiser_name }}. Mereka juga akan dapat menempatkan order pada iklan Anda.",
"1236083813": "Rincian pembayaran Anda",
"1258285343": "Sesuatu telah terjadi",
"1265751551": "Saldo Deriv P2P",
Expand Down Expand Up @@ -167,7 +167,7 @@
"2039361923": "Anda membuat iklan untuk menjual...",
"2060873863": "Order {{order_id}} telah diproses",
"2063890788": "Dibatalkan",
"2086563542": "Exchange rate (Default)",
"2086563542": "Nilai tukar (Standar)",
"2091671594": "Status",
"2096014107": "Daftar",
"2121837513": "Minimum adalah {{value}} {{currency}}",
Expand Down Expand Up @@ -218,15 +218,15 @@
"-2015102262": "({{number_of_ratings}} penilaian)",
"-1412298133": "({{number_of_ratings}} penilaian)",
"-1070228546": "Terdaftar {{days_since_joined}} hari",
"-260332243": "{{user_blocked_count}} person has blocked you",
"-117094654": "{{user_blocked_count}} people have blocked you",
"-260332243": "{{user_blocked_count}} orang telah memblokir Anda",
"-117094654": "{{user_blocked_count}} orang telah memblokir Anda",
"-329713179": "Ok",
"-1689905285": "Unblock",
"-1689905285": "Buka blokir",
"-1837059346": "Beli / Jual",
"-494667560": "Order",
"-679691613": "Iklan saya",
"-1426771335": "You have no blocked advertisers",
"-1530773708": "Block {{advertiser_name}}?",
"-1426771335": "Anda tidak memiliki pengiklan yang diblokir",
"-1530773708": "Blokir {{advertiser_name}}?",
"-1148912768": "Jika harga pasar berubah dari harga yang ditampilkan di sini, maka kami tidak dapat memproses order.",
"-55126326": "Penjual",
"-835196958": "Terima pembayaran melalui",
Expand Down Expand Up @@ -292,7 +292,7 @@
"-1220275347": "Anda dapat memilih hingga 3 metode pembayaran untuk iklan ini.",
"-1889014820": "<0>Metode pembayaran Anda tidak tersedia?</0> <1>Tambah baru.</1>",
"-806152028": "Iklan Anda sedang berjalan",
"-1007339977": "There are no matching name.",
"-1007339977": "Tidak ada nama yang cocok.",
"-179005984": "Simpan",
"-2059312414": "Detail iklan",
"-1769584466": "Statistik",
Expand Down
28 changes: 14 additions & 14 deletions packages/p2p/src/translations/ru.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"6794664": "Объявления, которые соответствуют вашему балансу и лимитам Deriv P2P.",
"19789721": "Nobody has blocked you. Yay!",
"19789721": "Ура! Вас никто не заблокировал.",
"21103557": "Баланс Deriv P2P = депозиты, которые не могут быть отменены (банковские переводы и т.д.) + часть депозитов, которые могут быть отменены (платежи по кредитной карте и т.д.)",
"24711354": "Всего ордеров <0>30д</0> | <1>все время</1>",
"47573834": "Фиксированный курс (1 {{account_currency}})",
Expand All @@ -14,7 +14,7 @@
"140800401": "Курс",
"145959105": "Выберите псевдоним",
"150156106": "Сохранить изменения",
"159757877": "You won't see {{advertiser_name}}'s ads anymore and they won't be able to place orders on your ads.",
"159757877": "Вы больше не будете видеть объявления {{advertiser_name}}, и он не сможет размещать ордеры на ваши объявления.",
"173939998": "Средн. время оплаты за <0>30д</0>",
"197477687": "Изменить объявление – {{ad_type}}",
"203271702": "Попробуйте еще раз",
Expand All @@ -25,9 +25,9 @@
"323002325": "Разместить объявление",
"324970564": "Контактные данные продавца",
"338910048": "Вы будете отображаться другим пользователям как",
"358133589": "Unblock {{advertiser_name}}?",
"358133589": "Разблокировать {{advertiser_name}}?",
"364681129": "Контактные данные",
"392469164": "You have blocked {{advertiser_name}}.",
"392469164": "Вы заблокировали {{advertiser_name}}.",
"407600801": "Вы заплатили {{amount}} {{currency}} пользователю {{other_user_name}}?",
"416167062": "Вы получите",
"424668491": "время истекло",
Expand Down Expand Up @@ -63,7 +63,7 @@
"782834680": "Осталось времени",
"783454335": "Да, удалить",
"830703311": "Мой профайл",
"834075131": "Blocked advertisers",
"834075131": "Заблокированные адвертайзеры",
"838024160": "Банковские реквизиты",
"842911528": "Больше не показывать это сообщение.",
"873437248": "Инструкции (необязательно)",
Expand All @@ -89,7 +89,7 @@
"1106073960": "Вы создали объявление",
"1106485202": "Доступный баланс Deriv P2P",
"1119887091": "Подтверждение",
"1121630246": "Block",
"1121630246": "Заблокировать",
"1137964885": "Может содержать только буквы, цифры и символы .- _ @.",
"1147508780": "{{accordion_state}}",
"1151608942": "Общая сумма",
Expand All @@ -100,7 +100,7 @@
"1191941618": "Введите значение от -{{limit}}% до +{{limit}}%",
"1202500203": "Заплатить сейчас",
"1228352589": "Нет рейтинга",
"1229976478": "You will be able to see {{ advertiser_name }}'s ads. They'll be able to place orders on your ads, too.",
"1229976478": "Вы сможете увидеть объявления {{ advertiser_name }}. Он также сможет размещать ордеры на ваши объявления.",
"1236083813": "Ваши платежные реквизиты",
"1258285343": "Упс, что-то пошло не так",
"1265751551": "Баланс Deriv P2P",
Expand Down Expand Up @@ -167,7 +167,7 @@
"2039361923": "Вы создаете объявление о продаже...",
"2060873863": "Ваш ордер {{order_id}} завершен",
"2063890788": "Отменено",
"2086563542": "Exchange rate (Default)",
"2086563542": "Обменный курс (по умолчанию)",
"2091671594": "Статус",
"2096014107": "Применить",
"2121837513": "Минимум: {{value}} {{currency}}",
Expand Down Expand Up @@ -218,15 +218,15 @@
"-2015102262": "({{number_of_ratings}} оценка)",
"-1412298133": "({{number_of_ratings}} оценок)",
"-1070228546": "На платформе {{days_since_joined}}д",
"-260332243": "{{user_blocked_count}} person has blocked you",
"-117094654": "{{user_blocked_count}} people have blocked you",
"-260332243": "{{user_blocked_count}} человек заблокировали вас",
"-117094654": "{{user_blocked_count}} человек заблокировали вас",
"-329713179": "Ok",
"-1689905285": "Unblock",
"-1689905285": "Разблокировать",
"-1837059346": "Покупка/продажа",
"-494667560": "Ордеры",
"-679691613": "Мои объявления",
"-1426771335": "You have no blocked advertisers",
"-1530773708": "Block {{advertiser_name}}?",
"-1426771335": "У вас нет заблокированных адвертайзеров",
"-1530773708": "Блокировать {{advertiser_name}}?",
"-1148912768": "Если рыночный курс изменится по сравнению с указанным здесь, мы не сможем обработать ваш ордер.",
"-55126326": "Продавец",
"-835196958": "Получить платеж на",
Expand Down Expand Up @@ -292,7 +292,7 @@
"-1220275347": "Для этого объявления можно выбрать до 3 платежных методов.",
"-1889014820": "<0>Не нашли свой платежный метод?</0> <1>Добавьте новый.</1>",
"-806152028": "Ваши объявления запущены",
"-1007339977": "There are no matching name.",
"-1007339977": "Нет подходящего имени.",
"-179005984": "Сохранить",
"-2059312414": "Детали объявления",
"-1769584466": "Статистика",
Expand Down
Loading