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

Nada/feat: implementation of copy ads #102

Merged
merged 13 commits into from
Jun 10, 2024
183 changes: 182 additions & 1 deletion src/__mocks__/mock-data.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TAdvertType, TType01 } from 'types';
import { TAdvertType, TPaymentFieldType, TType01, TWalletType } from 'types';

export const mockAdvertValues = {
account_currency: 'USD',
Expand Down Expand Up @@ -93,3 +93,184 @@ export const mockAdvertValues = {
type: 'sell' as 'buy' | 'sell',
visibility_status: ['advertiser_temp_ban'] as TAdvertType['visibility_status'],
};

export const mockAdvertiserPaymentMethods = [
{
display_name: 'Other',
fields: {
account: {
display_name: 'Account ID / phone number / email',
required: 0,
type: 'text' as TPaymentFieldType,
value: 'adfg',
},
instructions: {
display_name: 'Instructions',
required: 0,
type: 'memo' as TPaymentFieldType,
value: 'rtbnrt',
},
name: {
display_name: 'Payment method name',
required: 1,
type: 'text' as TPaymentFieldType,
value: 'wrtnwrtn',
},
},
id: '89',
is_enabled: 1 as TType01,
method: 'other',
type: 'other' as TWalletType,
used_by_adverts: ['194'],
used_by_orders: null,
},
];

export const mockCountryList = {
af: {
country_name: 'Afghanistan',
cross_border_ads_enabled: 1,
fixed_rate_adverts: 'enabled',
float_rate_adverts: 'disabled',
float_rate_offset_limit: 10,
local_currency: 'AFN',
payment_methods: {
alipay: {
display_name: 'Alipay',
fields: {
account: {
display_name: 'Alipay ID',
required: 1,
type: 'text',
},
instructions: {
display_name: 'Instructions',
required: 0,
type: 'memo',
},
},
type: 'ewallet',
},
},
},
};

export const mockPaymentMethods = [
{
display_name: 'Bank Transfer',
fields: {
account: {
display_name: 'Account Number',
required: 1,
type: 'text',
value: 'Account Number',
},
bank_name: { display_name: 'Bank Transfer', required: 1, type: 'text', value: 'Bank Name' },
},
id: 'test1',
is_enabled: 0,
method: '',
type: 'bank',
used_by_adverts: null,
used_by_orders: null,
},
{
display_name: 'Ali pay',
fields: {
account: {
display_name: 'Account Number',
required: 1,
type: 'text',
value: 'Account Number',
},
bank_name: { display_name: 'Ali pay', required: 1, type: 'text', value: 'Bank Name' },
},
id: 'test2',
is_enabled: 0,
method: '',
type: 'wallet',
used_by_adverts: null,
used_by_orders: null,
},
{
display_name: 'Skrill',
fields: {
account: {
display_name: 'Account Number',
required: 1,
type: 'text',
value: 'Account Number',
},
bank_name: { display_name: 'Skrill', required: 1, type: 'text', value: 'Bank Name' },
},
id: 'test3',
is_enabled: 0,
method: '',
type: 'wallet',
used_by_adverts: null,
used_by_orders: null,
},
];

export const mockAdvertiserAdvertValues = {
account_currency: 'USD',
active_orders: 0,
advertiser_details: {
completed_orders_count: 0,
has_not_been_recommended: false,
id: '34',
is_blocked: false,
is_favourite: false,
is_online: true,
is_recommended: false,
last_online_time: 1688480346,
name: 'client CR90000212',
rating_average: null,
rating_count: 0,
recommended_average: null,
recommended_count: null,
total_completion_rate: null,
},
amount: 22,
amount_display: '22.00',
block_trade: false,
contact_info: '',
counterparty_type: 'sell' as const,
country: 'id',
created_time: new Date(1688460999),
currentRateType: 'fixed' as const,
days_until_archive: 1,
description: '',
effective_rate: 22,
effective_rate_display: '22.00',
eligible_countries: ['ID'],
id: '138',
is_active: true,
is_floating: false,
is_visible: true,
local_currency: 'IDR',
max_order_amount: 22,
max_order_amount_display: '22.00',
max_order_amount_limit: 22,
max_order_amount_limit_display: '22.00',
min_completion_rate: 22,
min_join_days: 4,
min_order_amount: 22,
min_order_amount_display: '22.00',
min_order_amount_limit: 22,
min_order_amount_limit_display: '22.00',
min_rating: 4,
order_expiry_period: 900,
payment_info: '',
payment_method: null,
payment_method_names: ['Bank Transfer'],
price: 22,
price_display: '22.00',
rate: 22,
rate_display: '22.00',
rate_type: 'fixed' as const,
remaining_amount: 22,
remaining_amount_display: '22.00',
type: 'buy' as const,
visibility_status: [],
};
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Localize } from '@deriv-com/translations';
import { Button, useDevice } from '@deriv-com/ui';

type TBuySellFormFooterProps = {
Expand All @@ -17,7 +18,7 @@ const BuySellFormFooter = ({ isDisabled, onClickCancel, onSubmit }: TBuySellForm
textSize={isMobile ? 'md' : 'sm'}
variant='outlined'
>
Cancel
<Localize i18n_default_text='Cancel' />
</Button>
<Button
disabled={isDisabled}
Expand All @@ -26,7 +27,7 @@ const BuySellFormFooter = ({ isDisabled, onClickCancel, onSubmit }: TBuySellForm
textSize={isMobile ? 'md' : 'sm'}
type='submit'
>
Confirm
<Localize i18n_default_text='Confirm' />
</Button>
</div>
);
Expand Down
25 changes: 25 additions & 0 deletions src/components/CopyAdForm/CopyAdForm.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.copy-ad-form {
margin: 0 2.4rem;

@include mobile {
margin: 0 1.6rem;
}

&__full-page-modal {
position: absolute;
top: -6rem;
z-index: 2;
height: calc(100vh - 12rem);

& .mobile-wrapper__body {
margin-top: 1.6rem;
overflow: auto;
}

& .mobile-wrapper__footer {
display: flex;
gap: 0.8rem;
justify-content: flex-end;
}
}
}
Loading
Loading