add ref link error, add refill button, update referral invites table
This commit is contained in:
@@ -1,9 +1,31 @@
|
||||
'use client'
|
||||
|
||||
import { referralRefill } from '@/app/actions/referralsActions';
|
||||
import { toast } from 'sonner';
|
||||
|
||||
export default function SecurePayments() {
|
||||
|
||||
return (
|
||||
<div className="secure-payments-wrapper">
|
||||
<h3>
|
||||
🔒 Безопасные платежи
|
||||
</h3>
|
||||
<div>
|
||||
<button
|
||||
className='btn btn-primary'
|
||||
onClick={async () => {
|
||||
const response = await referralRefill();
|
||||
console.log(response);
|
||||
if (response?.account === 'refill') {
|
||||
toast.success('refill');
|
||||
} else {
|
||||
toast.error(`error refill: ${response?.error?.message_desc}`);
|
||||
}
|
||||
}}
|
||||
>
|
||||
referralRefill
|
||||
</button>
|
||||
</div>
|
||||
<div className="secure-payments-grid">
|
||||
<div className="secure-payments-card">
|
||||
<div className="secure-payments-card-header">
|
||||
|
||||
@@ -11,24 +11,23 @@ import {
|
||||
SortingState,
|
||||
ColumnFiltersState,
|
||||
} from '@tanstack/react-table';
|
||||
import { IconEye, IconDoubleArrowRight, IconArrowRight, IconDoubleArrowLeft, IconArrowLeft, IconArrowUp, IconArrowDown, IconFilter, IconFileDownload, IconShieldExclamation } from '@/app/ui/icons/icons';
|
||||
import { IconDoubleArrowRight, IconArrowRight, IconDoubleArrowLeft, IconArrowLeft, IconArrowUp, IconArrowDown, IconFilter } from '@/app/ui/icons/icons';
|
||||
import { useTranslations, useLocale } from 'next-intl';
|
||||
import DropDownList from '@/app/components/DropDownList';
|
||||
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import { toast } from 'sonner';
|
||||
import { pluralize } from '@/app/lib/pluralize';
|
||||
import { fetchReferralInvitees } from '@/app/actions/referralsActions';
|
||||
|
||||
type InviteesType = {
|
||||
status?: string;
|
||||
email?: string;
|
||||
registrationData: number;
|
||||
registrationData: string;
|
||||
};
|
||||
|
||||
type InviteType = {
|
||||
active?: string;
|
||||
email?: string;
|
||||
regDate: number;
|
||||
regDate: string;
|
||||
};
|
||||
|
||||
export default function InvitationsTable() {
|
||||
@@ -45,28 +44,14 @@ export default function InvitationsTable() {
|
||||
|
||||
select: (data: InviteType[]): InviteesType[] => {
|
||||
if (!data) return [
|
||||
{
|
||||
status: 'string1',
|
||||
email: 'string1',
|
||||
registrationData: 1
|
||||
},
|
||||
{
|
||||
status: 'string2',
|
||||
email: 'string2',
|
||||
registrationData: 2
|
||||
},
|
||||
{
|
||||
status: 'string3',
|
||||
email: 'string3',
|
||||
registrationData: 3
|
||||
}
|
||||
];
|
||||
|
||||
return data.map((item: InviteType) => {
|
||||
console.log(item);
|
||||
return {
|
||||
status: item.active,
|
||||
email: item.email,
|
||||
registrationData: item.regDate
|
||||
status: item?.active ? 'active' : 'not-active',
|
||||
email: item?.email,
|
||||
registrationData: item?.regDate
|
||||
};
|
||||
});
|
||||
},
|
||||
@@ -191,7 +176,7 @@ export default function InvitationsTable() {
|
||||
cell: ({ row }) => {
|
||||
return (
|
||||
<div className="text-center table-item">
|
||||
{row.original.registrationData}
|
||||
{row.original.registrationData?.split('T')[0]}
|
||||
</div>
|
||||
)
|
||||
},
|
||||
@@ -214,7 +199,7 @@ export default function InvitationsTable() {
|
||||
}
|
||||
|
||||
// Фильтр по дате
|
||||
if (dateFilter !== 'all') {
|
||||
/* if (dateFilter !== 'all') {
|
||||
const now = Date.now();
|
||||
const oneDay = 24 * 60 * 60 * 1000;
|
||||
const sevenDays = 7 * oneDay;
|
||||
@@ -256,7 +241,7 @@ export default function InvitationsTable() {
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
} */
|
||||
|
||||
return result;
|
||||
}, [referralInvitees, statusFilter, dateFilter]);
|
||||
|
||||
Reference in New Issue
Block a user