함수 공용화
This commit is contained in:
@@ -3,7 +3,7 @@ import { AccountHolderAuthListProps } from '../../model/account-holder-auth/type
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useGroupDateOnStore, useGroupDateStore } from '@/shared/model/store';
|
import { useGroupDateOnStore, useGroupDateStore } from '@/shared/model/store';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { GetListHeight, IMAGE_ROOT, ListScrollOn } from '@/shared/constants/common';
|
import { GetListHeight, IMAGE_ROOT, ListScrollOn, setScrollAction } from '@/shared/constants/common';
|
||||||
|
|
||||||
export const AccountHolderAuthList = ({
|
export const AccountHolderAuthList = ({
|
||||||
additionalServiceCategory,
|
additionalServiceCategory,
|
||||||
@@ -69,62 +69,21 @@ export const AccountHolderAuthList = ({
|
|||||||
return rs;
|
return rs;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getMax = (data: Array<Record<string, any>>) => {
|
|
||||||
let maxItem = null;
|
|
||||||
if(data.length > 0){
|
|
||||||
let numberArr = data.map((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top;
|
|
||||||
});
|
|
||||||
let max = Math.max(...numberArr);
|
|
||||||
maxItem = data.filter((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top === max;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return maxItem? maxItem[0]: null;
|
|
||||||
};
|
|
||||||
|
|
||||||
const setScrollAction = (e: Event) => {
|
|
||||||
let dateHeader = document.querySelectorAll('.date-header');
|
|
||||||
let posData: Array<Record<string, any>> = [];
|
|
||||||
dateHeader.forEach((value, index) => {
|
|
||||||
let date: string = value.innerHTML;
|
|
||||||
let top: number = value.getBoundingClientRect().top;
|
|
||||||
if(top < 10){
|
|
||||||
posData.push({
|
|
||||||
date: date,
|
|
||||||
top: top
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
let maxItem = getMax(posData);
|
|
||||||
if(maxItem){
|
|
||||||
setGroupDateOn(true);
|
|
||||||
setGroupDate(maxItem.date);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
setGroupDateOn(false);
|
|
||||||
setGroupDate('');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
ListScrollOn(true);
|
ListScrollOn(true);
|
||||||
let heightList = GetListHeight();
|
let heightList = GetListHeight();
|
||||||
setListHeight(heightList.listHeight);
|
setListHeight(heightList.listHeight);
|
||||||
|
|
||||||
let tabContent = document.querySelector('.tab-content');
|
let tabContent = document.querySelector('.tab-content');
|
||||||
tabContent?.addEventListener('scroll', setScrollAction);
|
tabContent?.addEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
ListScrollOn(false);
|
ListScrollOn(false);
|
||||||
tabContent?.removeEventListener('scroll', setScrollAction);
|
tabContent?.removeEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { checkGrant } from '@/shared/lib/check-grant';
|
|||||||
import { showAlert } from '@/widgets/show-alert';
|
import { showAlert } from '@/widgets/show-alert';
|
||||||
import { useGroupDateOnStore, useGroupDateStore } from '@/shared/model/store';
|
import { useGroupDateOnStore, useGroupDateStore } from '@/shared/model/store';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { GetListHeight, IMAGE_ROOT, ListScrollOn } from '@/shared/constants/common';
|
import { GetListHeight, IMAGE_ROOT, ListScrollOn, setScrollAction } from '@/shared/constants/common';
|
||||||
|
|
||||||
export const AccountHolderSearchList = ({
|
export const AccountHolderSearchList = ({
|
||||||
listItems,
|
listItems,
|
||||||
@@ -82,62 +82,21 @@ export const AccountHolderSearchList = ({
|
|||||||
navigate(PATHS.additionalService.accountHolderSearch.request)
|
navigate(PATHS.additionalService.accountHolderSearch.request)
|
||||||
};
|
};
|
||||||
|
|
||||||
const getMax = (data: Array<Record<string, any>>) => {
|
|
||||||
let maxItem = null;
|
|
||||||
if(data.length > 0){
|
|
||||||
let numberArr = data.map((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top;
|
|
||||||
});
|
|
||||||
let max = Math.max(...numberArr);
|
|
||||||
maxItem = data.filter((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top === max;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return maxItem? maxItem[0]: null;
|
|
||||||
};
|
|
||||||
|
|
||||||
const setScrollAction = (e: Event) => {
|
|
||||||
let dateHeader = document.querySelectorAll('.date-header');
|
|
||||||
let posData: Array<Record<string, any>> = [];
|
|
||||||
dateHeader.forEach((value, index) => {
|
|
||||||
let date: string = value.innerHTML;
|
|
||||||
let top: number = value.getBoundingClientRect().top;
|
|
||||||
if(top < 10){
|
|
||||||
posData.push({
|
|
||||||
date: date,
|
|
||||||
top: top
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
let maxItem = getMax(posData);
|
|
||||||
if(maxItem){
|
|
||||||
setGroupDateOn(true);
|
|
||||||
setGroupDate(maxItem.date);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
setGroupDateOn(false);
|
|
||||||
setGroupDate('');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
ListScrollOn(true);
|
ListScrollOn(true);
|
||||||
let heightList = GetListHeight();
|
let heightList = GetListHeight();
|
||||||
setListHeight(heightList.listHeight);
|
setListHeight(heightList.listHeight);
|
||||||
|
|
||||||
let tabContent = document.querySelector('.tab-content');
|
let tabContent = document.querySelector('.tab-content');
|
||||||
tabContent?.addEventListener('scroll', setScrollAction);
|
tabContent?.addEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
ListScrollOn(false);
|
ListScrollOn(false);
|
||||||
tabContent?.removeEventListener('scroll', setScrollAction);
|
tabContent?.removeEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { useEffect, useState } from "react";
|
|||||||
import { ArsListProps } from "../../model/ars/types";
|
import { ArsListProps } from "../../model/ars/types";
|
||||||
import { AdditionalServiceCategory, ListItemProps } from "../../model/types";
|
import { AdditionalServiceCategory, ListItemProps } from "../../model/types";
|
||||||
import { ListDateGroup } from "../list-date-group";
|
import { ListDateGroup } from "../list-date-group";
|
||||||
import { GetListHeight, IMAGE_ROOT, ListScrollOn } from "@/shared/constants/common";
|
import { GetListHeight, IMAGE_ROOT, ListScrollOn, setScrollAction } from "@/shared/constants/common";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useGroupDateOnStore, useGroupDateStore } from "@/shared/model/store";
|
import { useGroupDateOnStore, useGroupDateStore } from "@/shared/model/store";
|
||||||
|
|
||||||
@@ -69,62 +69,21 @@ export const ArsList = ({
|
|||||||
return rs;
|
return rs;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getMax = (data: Array<Record<string, any>>) => {
|
|
||||||
let maxItem = null;
|
|
||||||
if(data.length > 0){
|
|
||||||
let numberArr = data.map((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top;
|
|
||||||
});
|
|
||||||
let max = Math.max(...numberArr);
|
|
||||||
maxItem = data.filter((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top === max;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return maxItem? maxItem[0]: null;
|
|
||||||
};
|
|
||||||
|
|
||||||
const setScrollAction = (e: Event) => {
|
|
||||||
let dateHeader = document.querySelectorAll('.date-header');
|
|
||||||
let posData: Array<Record<string, any>> = [];
|
|
||||||
dateHeader.forEach((value, index) => {
|
|
||||||
let date: string = value.innerHTML;
|
|
||||||
let top: number = value.getBoundingClientRect().top;
|
|
||||||
if(top < 10){
|
|
||||||
posData.push({
|
|
||||||
date: date,
|
|
||||||
top: top
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
let maxItem = getMax(posData);
|
|
||||||
if(maxItem){
|
|
||||||
setGroupDateOn(true);
|
|
||||||
setGroupDate(maxItem.date);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
setGroupDateOn(false);
|
|
||||||
setGroupDate('');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
ListScrollOn(true);
|
ListScrollOn(true);
|
||||||
let heightList = GetListHeight();
|
let heightList = GetListHeight();
|
||||||
setListHeight(heightList.listHeight);
|
setListHeight(heightList.listHeight);
|
||||||
|
|
||||||
let tabContent = document.querySelector('.tab-content');
|
let tabContent = document.querySelector('.tab-content');
|
||||||
tabContent?.addEventListener('scroll', setScrollAction);
|
tabContent?.addEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
ListScrollOn(false);
|
ListScrollOn(false);
|
||||||
tabContent?.removeEventListener('scroll', setScrollAction);
|
tabContent?.removeEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { DefaultRequestPagination, SortTypeKeys } from '@/entities/common/model/types';
|
import { DefaultRequestPagination, SortTypeKeys } from '@/entities/common/model/types';
|
||||||
import { GetListHeight, IMAGE_ROOT, ListScrollOn } from '@/shared/constants/common';
|
import { GetListHeight, IMAGE_ROOT, ListScrollOn, setScrollAction } from '@/shared/constants/common';
|
||||||
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
|
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
|
||||||
import { JSX, useEffect, useState } from 'react';
|
import { JSX, useEffect, useState } from 'react';
|
||||||
import { DEFAULT_PAGE_PARAM } from '@/entities/common/model/constant';
|
import { DEFAULT_PAGE_PARAM } from '@/entities/common/model/constant';
|
||||||
@@ -264,51 +264,6 @@ export const FundAccountResultListWrap = () => {
|
|||||||
return rs;
|
return rs;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getMax = (data: Array<Record<string, any>>) => {
|
|
||||||
let maxItem = null;
|
|
||||||
if(data.length > 0){
|
|
||||||
let numberArr = data.map((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top;
|
|
||||||
});
|
|
||||||
let max = Math.max(...numberArr);
|
|
||||||
maxItem = data.filter((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top === max;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return maxItem? maxItem[0]: null;
|
|
||||||
};
|
|
||||||
|
|
||||||
const setScrollAction = (e: Event) => {
|
|
||||||
let dateHeader = document.querySelectorAll('.date-header');
|
|
||||||
let posData: Array<Record<string, any>> = [];
|
|
||||||
dateHeader.forEach((value, index) => {
|
|
||||||
let date: string = value.innerHTML;
|
|
||||||
let top: number = value.getBoundingClientRect().top;
|
|
||||||
if(top < 10){
|
|
||||||
posData.push({
|
|
||||||
date: date,
|
|
||||||
top: top
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
let maxItem = getMax(posData);
|
|
||||||
if(maxItem){
|
|
||||||
setGroupDateOn(true);
|
|
||||||
setGroupDate(maxItem.date);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
setGroupDateOn(false);
|
|
||||||
setGroupDate('');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
callSummary();
|
callSummary();
|
||||||
ListScrollOn(true);
|
ListScrollOn(true);
|
||||||
@@ -316,10 +271,15 @@ export const FundAccountResultListWrap = () => {
|
|||||||
setListHeight(heightList.listHeight);
|
setListHeight(heightList.listHeight);
|
||||||
|
|
||||||
let tabContent = document.querySelector('.tab-content');
|
let tabContent = document.querySelector('.tab-content');
|
||||||
tabContent?.addEventListener('scroll', setScrollAction);
|
tabContent?.addEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
ListScrollOn(false);
|
ListScrollOn(false);
|
||||||
tabContent?.removeEventListener('scroll', setScrollAction);
|
tabContent?.removeEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { DefaultRequestPagination, SortTypeKeys } from '@/entities/common/model/types';
|
import { DefaultRequestPagination, SortTypeKeys } from '@/entities/common/model/types';
|
||||||
import { GetListHeight, IMAGE_ROOT, ListScrollOn } from '@/shared/constants/common';
|
import { GetListHeight, IMAGE_ROOT, ListScrollOn, setScrollAction } from '@/shared/constants/common';
|
||||||
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
|
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
|
||||||
import { JSX, useEffect, useState } from 'react';
|
import { JSX, useEffect, useState } from 'react';
|
||||||
import {
|
import {
|
||||||
@@ -260,51 +260,6 @@ export const FundAccountTransferListWrap = () => {
|
|||||||
navigate(PATHS.additionalService.fundAccount.transferRequest);
|
navigate(PATHS.additionalService.fundAccount.transferRequest);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getMax = (data: Array<Record<string, any>>) => {
|
|
||||||
let maxItem = null;
|
|
||||||
if(data.length > 0){
|
|
||||||
let numberArr = data.map((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top;
|
|
||||||
});
|
|
||||||
let max = Math.max(...numberArr);
|
|
||||||
maxItem = data.filter((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top === max;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return maxItem? maxItem[0]: null;
|
|
||||||
};
|
|
||||||
|
|
||||||
const setScrollAction = (e: Event) => {
|
|
||||||
let dateHeader = document.querySelectorAll('.date-header');
|
|
||||||
let posData: Array<Record<string, any>> = [];
|
|
||||||
dateHeader.forEach((value, index) => {
|
|
||||||
let date: string = value.innerHTML;
|
|
||||||
let top: number = value.getBoundingClientRect().top;
|
|
||||||
if(top < 10){
|
|
||||||
posData.push({
|
|
||||||
date: date,
|
|
||||||
top: top
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
let maxItem = getMax(posData);
|
|
||||||
if(maxItem){
|
|
||||||
setGroupDateOn(true);
|
|
||||||
setGroupDate(maxItem.date);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
setGroupDateOn(false);
|
|
||||||
setGroupDate('');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
callList();
|
callList();
|
||||||
}, [
|
}, [
|
||||||
@@ -324,11 +279,15 @@ export const FundAccountTransferListWrap = () => {
|
|||||||
setListHeight(heightList.listHeight);
|
setListHeight(heightList.listHeight);
|
||||||
|
|
||||||
let tabContent = document.querySelector('.tab-content');
|
let tabContent = document.querySelector('.tab-content');
|
||||||
tabContent?.addEventListener('scroll', setScrollAction);
|
tabContent?.addEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
ListScrollOn(false);
|
ListScrollOn(false);
|
||||||
tabContent?.removeEventListener('scroll', setScrollAction);
|
tabContent?.removeEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { useEffect, useState } from 'react';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { checkGrant } from '@/shared/lib/check-grant';
|
import { checkGrant } from '@/shared/lib/check-grant';
|
||||||
import { showAlert } from '@/widgets/show-alert';
|
import { showAlert } from '@/widgets/show-alert';
|
||||||
import { GetListHeight, IMAGE_ROOT, ListScrollOn } from '@/shared/constants/common';
|
import { GetListHeight, IMAGE_ROOT, ListScrollOn, setScrollAction } from '@/shared/constants/common';
|
||||||
import { useGroupDateOnStore, useGroupDateStore } from '@/shared/model/store';
|
import { useGroupDateOnStore, useGroupDateStore } from '@/shared/model/store';
|
||||||
|
|
||||||
export const KeyInPaymentList = ({
|
export const KeyInPaymentList = ({
|
||||||
@@ -77,62 +77,21 @@ export const KeyInPaymentList = ({
|
|||||||
navigate(PATHS.additionalService.keyInPayment.request);
|
navigate(PATHS.additionalService.keyInPayment.request);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getMax = (data: Array<Record<string, any>>) => {
|
|
||||||
let maxItem = null;
|
|
||||||
if(data.length > 0){
|
|
||||||
let numberArr = data.map((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top;
|
|
||||||
});
|
|
||||||
let max = Math.max(...numberArr);
|
|
||||||
maxItem = data.filter((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top === max;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return maxItem? maxItem[0]: null;
|
|
||||||
};
|
|
||||||
|
|
||||||
const setScrollAction = (e: Event) => {
|
|
||||||
let dateHeader = document.querySelectorAll('.date-header');
|
|
||||||
let posData: Array<Record<string, any>> = [];
|
|
||||||
dateHeader.forEach((value, index) => {
|
|
||||||
let date: string = value.innerHTML;
|
|
||||||
let top: number = value.getBoundingClientRect().top;
|
|
||||||
if(top < 10){
|
|
||||||
posData.push({
|
|
||||||
date: date,
|
|
||||||
top: top
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
let maxItem = getMax(posData);
|
|
||||||
if(maxItem){
|
|
||||||
setGroupDateOn(true);
|
|
||||||
setGroupDate(maxItem.date);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
setGroupDateOn(false);
|
|
||||||
setGroupDate('');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
ListScrollOn(true);
|
ListScrollOn(true);
|
||||||
let heightList = GetListHeight();
|
let heightList = GetListHeight();
|
||||||
setListHeight(heightList.listHeight);
|
setListHeight(heightList.listHeight);
|
||||||
|
|
||||||
let tabContent = document.querySelector('.tab-content');
|
let tabContent = document.querySelector('.tab-content');
|
||||||
tabContent?.addEventListener('scroll', setScrollAction);
|
tabContent?.addEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
ListScrollOn(false);
|
ListScrollOn(false);
|
||||||
tabContent?.removeEventListener('scroll', setScrollAction);
|
tabContent?.removeEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { GetListHeight, IMAGE_ROOT, ListScrollOn } from '@/shared/constants/common';
|
import { GetListHeight, IMAGE_ROOT, ListScrollOn, setScrollAction } from '@/shared/constants/common';
|
||||||
import { LinkPaymentHistoryListProps } from '../../model/link-pay/types';
|
import { LinkPaymentHistoryListProps } from '../../model/link-pay/types';
|
||||||
import { ListDateGroup } from '../list-date-group';
|
import { ListDateGroup } from '../list-date-group';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
@@ -68,62 +68,21 @@ export const LinkPaymentHistoryList = ({
|
|||||||
return rs;
|
return rs;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getMax = (data: Array<Record<string, any>>) => {
|
|
||||||
let maxItem = null;
|
|
||||||
if(data.length > 0){
|
|
||||||
let numberArr = data.map((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top;
|
|
||||||
});
|
|
||||||
let max = Math.max(...numberArr);
|
|
||||||
maxItem = data.filter((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top === max;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return maxItem? maxItem[0]: null;
|
|
||||||
};
|
|
||||||
|
|
||||||
const setScrollAction = (e: Event) => {
|
|
||||||
let dateHeader = document.querySelectorAll('.date-header');
|
|
||||||
let posData: Array<Record<string, any>> = [];
|
|
||||||
dateHeader.forEach((value, index) => {
|
|
||||||
let date: string = value.innerHTML;
|
|
||||||
let top: number = value.getBoundingClientRect().top;
|
|
||||||
if(top < 10){
|
|
||||||
posData.push({
|
|
||||||
date: date,
|
|
||||||
top: top
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
let maxItem = getMax(posData);
|
|
||||||
if(maxItem){
|
|
||||||
setGroupDateOn(true);
|
|
||||||
setGroupDate(maxItem.date);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
setGroupDateOn(false);
|
|
||||||
setGroupDate('');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
ListScrollOn(true);
|
ListScrollOn(true);
|
||||||
let heightList = GetListHeight();
|
let heightList = GetListHeight();
|
||||||
setListHeight(heightList.listHeight);
|
setListHeight(heightList.listHeight);
|
||||||
|
|
||||||
let tabContent = document.querySelector('.tab-content');
|
let tabContent = document.querySelector('.tab-content');
|
||||||
tabContent?.addEventListener('scroll', setScrollAction);
|
tabContent?.addEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
ListScrollOn(false);
|
ListScrollOn(false);
|
||||||
tabContent?.removeEventListener('scroll', setScrollAction);
|
tabContent?.removeEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { LinkPaymentWaitListProps } from '../../model/link-pay/types';
|
|||||||
import { ListDateGroup } from '../list-date-group';
|
import { ListDateGroup } from '../list-date-group';
|
||||||
import { useGroupDateOnStore, useGroupDateStore } from '@/shared/model/store';
|
import { useGroupDateOnStore, useGroupDateStore } from '@/shared/model/store';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { GetListHeight, IMAGE_ROOT, ListScrollOn } from '@/shared/constants/common';
|
import { GetListHeight, IMAGE_ROOT, ListScrollOn, setScrollAction } from '@/shared/constants/common';
|
||||||
|
|
||||||
export const LinkPaymentWaitList = ({
|
export const LinkPaymentWaitList = ({
|
||||||
additionalServiceCategory,
|
additionalServiceCategory,
|
||||||
@@ -68,62 +68,21 @@ export const LinkPaymentWaitList = ({
|
|||||||
return rs;
|
return rs;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getMax = (data: Array<Record<string, any>>) => {
|
|
||||||
let maxItem = null;
|
|
||||||
if(data.length > 0){
|
|
||||||
let numberArr = data.map((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top;
|
|
||||||
});
|
|
||||||
let max = Math.max(...numberArr);
|
|
||||||
maxItem = data.filter((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top === max;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return maxItem? maxItem[0]: null;
|
|
||||||
};
|
|
||||||
|
|
||||||
const setScrollAction = (e: Event) => {
|
|
||||||
let dateHeader = document.querySelectorAll('.date-header');
|
|
||||||
let posData: Array<Record<string, any>> = [];
|
|
||||||
dateHeader.forEach((value, index) => {
|
|
||||||
let date: string = value.innerHTML;
|
|
||||||
let top: number = value.getBoundingClientRect().top;
|
|
||||||
if(top < 10){
|
|
||||||
posData.push({
|
|
||||||
date: date,
|
|
||||||
top: top
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
let maxItem = getMax(posData);
|
|
||||||
if(maxItem){
|
|
||||||
setGroupDateOn(true);
|
|
||||||
setGroupDate(maxItem.date);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
setGroupDateOn(false);
|
|
||||||
setGroupDate('');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
ListScrollOn(true);
|
ListScrollOn(true);
|
||||||
let heightList = GetListHeight();
|
let heightList = GetListHeight();
|
||||||
setListHeight(heightList.listHeight);
|
setListHeight(heightList.listHeight);
|
||||||
|
|
||||||
let tabContent = document.querySelector('.tab-content');
|
let tabContent = document.querySelector('.tab-content');
|
||||||
tabContent?.addEventListener('scroll', setScrollAction);
|
tabContent?.addEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
ListScrollOn(false);
|
ListScrollOn(false);
|
||||||
tabContent?.removeEventListener('scroll', setScrollAction);
|
tabContent?.removeEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { AdditionalServiceCategory } from "../../model/types";
|
|||||||
import { ListDateGroup } from "../list-date-group";
|
import { ListDateGroup } from "../list-date-group";
|
||||||
import { useGroupDateOnStore, useGroupDateStore } from "@/shared/model/store";
|
import { useGroupDateOnStore, useGroupDateStore } from "@/shared/model/store";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { GetListHeight, IMAGE_ROOT, ListScrollOn } from "@/shared/constants/common";
|
import { GetListHeight, IMAGE_ROOT, ListScrollOn, setScrollAction } from "@/shared/constants/common";
|
||||||
|
|
||||||
export const PayoutList = ({
|
export const PayoutList = ({
|
||||||
additionalServiceCategory,
|
additionalServiceCategory,
|
||||||
@@ -71,62 +71,21 @@ export const PayoutList = ({
|
|||||||
return rs;
|
return rs;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getMax = (data: Array<Record<string, any>>) => {
|
|
||||||
let maxItem = null;
|
|
||||||
if(data.length > 0){
|
|
||||||
let numberArr = data.map((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top;
|
|
||||||
});
|
|
||||||
let max = Math.max(...numberArr);
|
|
||||||
maxItem = data.filter((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top === max;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return maxItem? maxItem[0]: null;
|
|
||||||
};
|
|
||||||
|
|
||||||
const setScrollAction = (e: Event) => {
|
|
||||||
let dateHeader = document.querySelectorAll('.date-header');
|
|
||||||
let posData: Array<Record<string, any>> = [];
|
|
||||||
dateHeader.forEach((value, index) => {
|
|
||||||
let date: string = value.innerHTML;
|
|
||||||
let top: number = value.getBoundingClientRect().top;
|
|
||||||
if(top < 10){
|
|
||||||
posData.push({
|
|
||||||
date: date,
|
|
||||||
top: top
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
let maxItem = getMax(posData);
|
|
||||||
if(maxItem){
|
|
||||||
setGroupDateOn(true);
|
|
||||||
setGroupDate(maxItem.date);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
setGroupDateOn(false);
|
|
||||||
setGroupDate('');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
ListScrollOn(true);
|
ListScrollOn(true);
|
||||||
let heightList = GetListHeight();
|
let heightList = GetListHeight();
|
||||||
setListHeight(heightList.listHeight);
|
setListHeight(heightList.listHeight);
|
||||||
|
|
||||||
let tabContent = document.querySelector('.tab-content');
|
let tabContent = document.querySelector('.tab-content');
|
||||||
tabContent?.addEventListener('scroll', setScrollAction);
|
tabContent?.addEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
ListScrollOn(false);
|
ListScrollOn(false);
|
||||||
tabContent?.removeEventListener('scroll', setScrollAction);
|
tabContent?.removeEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { SmsPaymentListProps } from '../../model/sms-payment/types';
|
|||||||
import { ListDateGroup } from '../list-date-group';
|
import { ListDateGroup } from '../list-date-group';
|
||||||
import { useGroupDateOnStore, useGroupDateStore } from '@/shared/model/store';
|
import { useGroupDateOnStore, useGroupDateStore } from '@/shared/model/store';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { GetListHeight, IMAGE_ROOT, ListScrollOn } from '@/shared/constants/common';
|
import { GetListHeight, IMAGE_ROOT, ListScrollOn, setScrollAction } from '@/shared/constants/common';
|
||||||
|
|
||||||
export const SmsPaymentList = ({
|
export const SmsPaymentList = ({
|
||||||
listItems,
|
listItems,
|
||||||
@@ -68,62 +68,21 @@ export const SmsPaymentList = ({
|
|||||||
return rs;
|
return rs;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getMax = (data: Array<Record<string, any>>) => {
|
|
||||||
let maxItem = null;
|
|
||||||
if(data.length > 0){
|
|
||||||
let numberArr = data.map((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top;
|
|
||||||
});
|
|
||||||
let max = Math.max(...numberArr);
|
|
||||||
maxItem = data.filter((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top === max;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return maxItem? maxItem[0]: null;
|
|
||||||
};
|
|
||||||
|
|
||||||
const setScrollAction = (e: Event) => {
|
|
||||||
let dateHeader = document.querySelectorAll('.date-header');
|
|
||||||
let posData: Array<Record<string, any>> = [];
|
|
||||||
dateHeader.forEach((value, index) => {
|
|
||||||
let date: string = value.innerHTML;
|
|
||||||
let top: number = value.getBoundingClientRect().top;
|
|
||||||
if(top < 10){
|
|
||||||
posData.push({
|
|
||||||
date: date,
|
|
||||||
top: top
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
let maxItem = getMax(posData);
|
|
||||||
if(maxItem){
|
|
||||||
setGroupDateOn(true);
|
|
||||||
setGroupDate(maxItem.date);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
setGroupDateOn(false);
|
|
||||||
setGroupDate('');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
ListScrollOn(true);
|
ListScrollOn(true);
|
||||||
let heightList = GetListHeight();
|
let heightList = GetListHeight();
|
||||||
setListHeight(heightList.listHeight);
|
setListHeight(heightList.listHeight);
|
||||||
|
|
||||||
let tabContent = document.querySelector('.tab-content');
|
let tabContent = document.querySelector('.tab-content');
|
||||||
tabContent?.addEventListener('scroll', setScrollAction);
|
tabContent?.addEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
ListScrollOn(false);
|
ListScrollOn(false);
|
||||||
tabContent?.removeEventListener('scroll', setScrollAction);
|
tabContent?.removeEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { GetListHeight, IMAGE_ROOT, ListScrollOn } from '@/shared/constants/common';
|
import { GetListHeight, IMAGE_ROOT, ListScrollOn, setScrollAction } from '@/shared/constants/common';
|
||||||
import { ListDateGroup } from './list-date-group';
|
import { ListDateGroup } from './list-date-group';
|
||||||
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
|
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
|
||||||
import { DEFAULT_PAGE_PARAM } from '@/entities/common/model/constant';
|
import { DEFAULT_PAGE_PARAM } from '@/entities/common/model/constant';
|
||||||
@@ -426,51 +426,6 @@ export const ListWrap = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getMax = (data: Array<Record<string, any>>) => {
|
|
||||||
let maxItem = null;
|
|
||||||
if(data.length > 0){
|
|
||||||
let numberArr = data.map((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top;
|
|
||||||
});
|
|
||||||
let max = Math.max(...numberArr);
|
|
||||||
maxItem = data.filter((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top === max;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return maxItem? maxItem[0]: null;
|
|
||||||
};
|
|
||||||
|
|
||||||
const setScrollAction = (e: Event) => {
|
|
||||||
let dateHeader = document.querySelectorAll('.date-header');
|
|
||||||
let posData: Array<Record<string, any>> = [];
|
|
||||||
dateHeader.forEach((value, index) => {
|
|
||||||
let date: string = value.innerHTML;
|
|
||||||
let top: number = value.getBoundingClientRect().top;
|
|
||||||
if(top < 10){
|
|
||||||
posData.push({
|
|
||||||
date: date,
|
|
||||||
top: top
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
let maxItem = getMax(posData);
|
|
||||||
if(maxItem){
|
|
||||||
setGroupDateOn(true);
|
|
||||||
setGroupDate(maxItem.date);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
setGroupDateOn(false);
|
|
||||||
setGroupDate('');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
callList();
|
callList();
|
||||||
}, [
|
}, [
|
||||||
@@ -485,11 +440,15 @@ export const ListWrap = ({
|
|||||||
setListHeight(heightList.listHeight);
|
setListHeight(heightList.listHeight);
|
||||||
|
|
||||||
let tabContent = document.querySelector('.tab-content');
|
let tabContent = document.querySelector('.tab-content');
|
||||||
tabContent?.addEventListener('scroll', setScrollAction);
|
tabContent?.addEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
ListScrollOn(false);
|
ListScrollOn(false);
|
||||||
tabContent?.removeEventListener('scroll', setScrollAction);
|
tabContent?.removeEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { AllTransactionListProps, ListItemProps } from '../model/types';
|
import { AllTransactionListProps, ListItemProps } from '../model/types';
|
||||||
import { ListDateGroup } from './list-date-group';
|
import { ListDateGroup } from './list-date-group';
|
||||||
import { GetListHeight, IMAGE_ROOT, ListScrollOn } from '@/shared/constants/common';
|
import { GetListHeight, IMAGE_ROOT, ListScrollOn, setScrollAction } from '@/shared/constants/common';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useGroupDateOnStore, useGroupDateStore } from '@/shared/model/store';
|
import { useGroupDateOnStore, useGroupDateStore } from '@/shared/model/store';
|
||||||
|
|
||||||
@@ -64,51 +64,6 @@ export const AllTransactionList = ({
|
|||||||
}
|
}
|
||||||
return rs;
|
return rs;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getMax = (data: Array<Record<string, any>>) => {
|
|
||||||
let maxItem = null;
|
|
||||||
if(data.length > 0){
|
|
||||||
let numberArr = data.map((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top;
|
|
||||||
});
|
|
||||||
let max = Math.max(...numberArr);
|
|
||||||
maxItem = data.filter((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top === max;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return maxItem? maxItem[0]: null;
|
|
||||||
};
|
|
||||||
|
|
||||||
const setScrollAction = (e: Event) => {
|
|
||||||
let dateHeader = document.querySelectorAll('.date-header');
|
|
||||||
let posData: Array<Record<string, any>> = [];
|
|
||||||
dateHeader.forEach((value, index) => {
|
|
||||||
let date: string = value.innerHTML;
|
|
||||||
let top: number = value.getBoundingClientRect().top;
|
|
||||||
if(top < 10){
|
|
||||||
posData.push({
|
|
||||||
date: date,
|
|
||||||
top: top
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
let maxItem = getMax(posData);
|
|
||||||
if(maxItem){
|
|
||||||
setGroupDateOn(true);
|
|
||||||
setGroupDate(maxItem.date);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
setGroupDateOn(false);
|
|
||||||
setGroupDate('');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
ListScrollOn(true);
|
ListScrollOn(true);
|
||||||
@@ -116,11 +71,15 @@ export const AllTransactionList = ({
|
|||||||
setListHeight(heightList.listHeight);
|
setListHeight(heightList.listHeight);
|
||||||
|
|
||||||
let tabContent = document.querySelector('.tab-content');
|
let tabContent = document.querySelector('.tab-content');
|
||||||
tabContent?.addEventListener('scroll', setScrollAction);
|
tabContent?.addEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
ListScrollOn(false);
|
ListScrollOn(false);
|
||||||
tabContent?.removeEventListener('scroll', setScrollAction);
|
tabContent?.removeEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { ListDateGroup } from './list-date-group';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useGroupDateOnStore, useGroupDateStore } from '@/shared/model/store';
|
import { useGroupDateOnStore, useGroupDateStore } from '@/shared/model/store';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { GetListHeight, IMAGE_ROOT, ListScrollOn } from '@/shared/constants/common';
|
import { GetListHeight, IMAGE_ROOT, ListScrollOn, setScrollAction } from '@/shared/constants/common';
|
||||||
|
|
||||||
export const BillingList = ({
|
export const BillingList = ({
|
||||||
transactionCategory,
|
transactionCategory,
|
||||||
@@ -63,51 +63,6 @@ export const BillingList = ({
|
|||||||
}
|
}
|
||||||
return rs;
|
return rs;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getMax = (data: Array<Record<string, any>>) => {
|
|
||||||
let maxItem = null;
|
|
||||||
if(data.length > 0){
|
|
||||||
let numberArr = data.map((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top;
|
|
||||||
});
|
|
||||||
let max = Math.max(...numberArr);
|
|
||||||
maxItem = data.filter((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top === max;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return maxItem? maxItem[0]: null;
|
|
||||||
};
|
|
||||||
|
|
||||||
const setScrollAction = (e: Event) => {
|
|
||||||
let dateHeader = document.querySelectorAll('.date-header');
|
|
||||||
let posData: Array<Record<string, any>> = [];
|
|
||||||
dateHeader.forEach((value, index) => {
|
|
||||||
let date: string = value.innerHTML;
|
|
||||||
let top: number = value.getBoundingClientRect().top;
|
|
||||||
if(top < 10){
|
|
||||||
posData.push({
|
|
||||||
date: date,
|
|
||||||
top: top
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
let maxItem = getMax(posData);
|
|
||||||
if(maxItem){
|
|
||||||
setGroupDateOn(true);
|
|
||||||
setGroupDate(maxItem.date);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
setGroupDateOn(false);
|
|
||||||
setGroupDate('');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
ListScrollOn(true);
|
ListScrollOn(true);
|
||||||
@@ -115,11 +70,15 @@ export const BillingList = ({
|
|||||||
setListHeight(heightList.listHeight);
|
setListHeight(heightList.listHeight);
|
||||||
|
|
||||||
let tabContent = document.querySelector('.tab-content');
|
let tabContent = document.querySelector('.tab-content');
|
||||||
tabContent?.addEventListener('scroll', setScrollAction);
|
tabContent?.addEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
ListScrollOn(false);
|
ListScrollOn(false);
|
||||||
tabContent?.removeEventListener('scroll', setScrollAction);
|
tabContent?.removeEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { CashReceiptListProps } from '../model/types';
|
|||||||
import { ListDateGroup } from './list-date-group';
|
import { ListDateGroup } from './list-date-group';
|
||||||
import { useGroupDateOnStore, useGroupDateStore } from '@/shared/model/store';
|
import { useGroupDateOnStore, useGroupDateStore } from '@/shared/model/store';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { GetListHeight, IMAGE_ROOT, ListScrollOn } from '@/shared/constants/common';
|
import { GetListHeight, IMAGE_ROOT, ListScrollOn, setScrollAction } from '@/shared/constants/common';
|
||||||
|
|
||||||
export const CashReceiptList = ({
|
export const CashReceiptList = ({
|
||||||
transactionCategory,
|
transactionCategory,
|
||||||
@@ -64,62 +64,21 @@ export const CashReceiptList = ({
|
|||||||
return rs;
|
return rs;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getMax = (data: Array<Record<string, any>>) => {
|
|
||||||
let maxItem = null;
|
|
||||||
if(data.length > 0){
|
|
||||||
let numberArr = data.map((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top;
|
|
||||||
});
|
|
||||||
let max = Math.max(...numberArr);
|
|
||||||
maxItem = data.filter((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top === max;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return maxItem? maxItem[0]: null;
|
|
||||||
};
|
|
||||||
|
|
||||||
const setScrollAction = (e: Event) => {
|
|
||||||
let dateHeader = document.querySelectorAll('.date-header');
|
|
||||||
let posData: Array<Record<string, any>> = [];
|
|
||||||
dateHeader.forEach((value, index) => {
|
|
||||||
let date: string = value.innerHTML;
|
|
||||||
let top: number = value.getBoundingClientRect().top;
|
|
||||||
if(top < 10){
|
|
||||||
posData.push({
|
|
||||||
date: date,
|
|
||||||
top: top
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
let maxItem = getMax(posData);
|
|
||||||
if(maxItem){
|
|
||||||
setGroupDateOn(true);
|
|
||||||
setGroupDate(maxItem.date);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
setGroupDateOn(false);
|
|
||||||
setGroupDate('');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
ListScrollOn(true);
|
ListScrollOn(true);
|
||||||
let heightList = GetListHeight();
|
let heightList = GetListHeight();
|
||||||
setListHeight(heightList.listHeight);
|
setListHeight(heightList.listHeight);
|
||||||
|
|
||||||
let tabContent = document.querySelector('.tab-content');
|
let tabContent = document.querySelector('.tab-content');
|
||||||
tabContent?.addEventListener('scroll', setScrollAction);
|
tabContent?.addEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
ListScrollOn(false);
|
ListScrollOn(false);
|
||||||
tabContent?.removeEventListener('scroll', setScrollAction);
|
tabContent?.removeEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { EscrowListProps } from '../model/types';
|
|||||||
import { ListDateGroup } from './list-date-group';
|
import { ListDateGroup } from './list-date-group';
|
||||||
import { useGroupDateOnStore, useGroupDateStore } from '@/shared/model/store';
|
import { useGroupDateOnStore, useGroupDateStore } from '@/shared/model/store';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { GetListHeight, IMAGE_ROOT, ListScrollOn } from '@/shared/constants/common';
|
import { GetListHeight, IMAGE_ROOT, ListScrollOn, setScrollAction } from '@/shared/constants/common';
|
||||||
|
|
||||||
export const EscrowList = ({
|
export const EscrowList = ({
|
||||||
transactionCategory,
|
transactionCategory,
|
||||||
@@ -63,51 +63,6 @@ export const EscrowList = ({
|
|||||||
}
|
}
|
||||||
return rs;
|
return rs;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getMax = (data: Array<Record<string, any>>) => {
|
|
||||||
let maxItem = null;
|
|
||||||
if(data.length > 0){
|
|
||||||
let numberArr = data.map((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top;
|
|
||||||
});
|
|
||||||
let max = Math.max(...numberArr);
|
|
||||||
maxItem = data.filter((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top === max;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return maxItem? maxItem[0]: null;
|
|
||||||
};
|
|
||||||
|
|
||||||
const setScrollAction = (e: Event) => {
|
|
||||||
let dateHeader = document.querySelectorAll('.date-header');
|
|
||||||
let posData: Array<Record<string, any>> = [];
|
|
||||||
dateHeader.forEach((value, index) => {
|
|
||||||
let date: string = value.innerHTML;
|
|
||||||
let top: number = value.getBoundingClientRect().top;
|
|
||||||
if(top < 10){
|
|
||||||
posData.push({
|
|
||||||
date: date,
|
|
||||||
top: top
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
let maxItem = getMax(posData);
|
|
||||||
if(maxItem){
|
|
||||||
setGroupDateOn(true);
|
|
||||||
setGroupDate(maxItem.date);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
setGroupDateOn(false);
|
|
||||||
setGroupDate('');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
ListScrollOn(true);
|
ListScrollOn(true);
|
||||||
@@ -115,11 +70,15 @@ export const EscrowList = ({
|
|||||||
setListHeight(heightList.listHeight);
|
setListHeight(heightList.listHeight);
|
||||||
|
|
||||||
let tabContent = document.querySelector('.tab-content');
|
let tabContent = document.querySelector('.tab-content');
|
||||||
tabContent?.addEventListener('scroll', setScrollAction);
|
tabContent?.addEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
ListScrollOn(false);
|
ListScrollOn(false);
|
||||||
tabContent?.removeEventListener('scroll', setScrollAction);
|
tabContent?.removeEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { GetListHeight, IMAGE_ROOT, ListScrollOn } from '@/shared/constants/common';
|
import { GetListHeight, IMAGE_ROOT, ListScrollOn, setScrollAction } from '@/shared/constants/common';
|
||||||
import { ListFilter } from './filter/list-filter';
|
import { ListFilter } from './filter/list-filter';
|
||||||
import { SortTypeBox } from '@/entities/common/ui/sort-type-box';
|
import { SortTypeBox } from '@/entities/common/ui/sort-type-box';
|
||||||
import { DefaultRequestPagination, SortTypeKeys } from '@/entities/common/model/types';
|
import { DefaultRequestPagination, SortTypeKeys } from '@/entities/common/model/types';
|
||||||
@@ -214,51 +214,6 @@ export const ListWrap = () => {
|
|||||||
return rs;
|
return rs;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getMax = (data: Array<Record<string, any>>) => {
|
|
||||||
let maxItem = null;
|
|
||||||
if(data.length > 0){
|
|
||||||
let numberArr = data.map((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top;
|
|
||||||
});
|
|
||||||
let max = Math.max(...numberArr);
|
|
||||||
maxItem = data.filter((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top === max;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return maxItem? maxItem[0]: null;
|
|
||||||
};
|
|
||||||
|
|
||||||
const setScrollAction = (e: Event) => {
|
|
||||||
let dateHeader = document.querySelectorAll('.date-header');
|
|
||||||
let posData: Array<Record<string, any>> = [];
|
|
||||||
dateHeader.forEach((value, index) => {
|
|
||||||
let date: string = value.innerHTML;
|
|
||||||
let top: number = value.getBoundingClientRect().top;
|
|
||||||
if(top < 10){
|
|
||||||
posData.push({
|
|
||||||
date: date,
|
|
||||||
top: top
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
let maxItem = getMax(posData);
|
|
||||||
if(maxItem){
|
|
||||||
setGroupDateOn(true);
|
|
||||||
setGroupDate(maxItem.date);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
setGroupDateOn(false);
|
|
||||||
setGroupDate('');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
callList();
|
callList();
|
||||||
}, [
|
}, [
|
||||||
@@ -272,11 +227,15 @@ export const ListWrap = () => {
|
|||||||
setListHeight(heightList.listHeight);
|
setListHeight(heightList.listHeight);
|
||||||
|
|
||||||
let tabContent = document.querySelector('.tab-content');
|
let tabContent = document.querySelector('.tab-content');
|
||||||
tabContent?.addEventListener('scroll', setScrollAction);
|
tabContent?.addEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
ListScrollOn(false);
|
ListScrollOn(false);
|
||||||
tabContent?.removeEventListener('scroll', setScrollAction);
|
tabContent?.removeEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { PATHS } from '@/shared/constants/paths';
|
import { PATHS } from '@/shared/constants/paths';
|
||||||
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
|
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
|
||||||
import { DefaultRequestPagination, HeaderType, SortTypeKeys } from '@/entities/common/model/types';
|
import { DefaultRequestPagination, HeaderType, SortTypeKeys } from '@/entities/common/model/types';
|
||||||
import { GetListHeight, IMAGE_ROOT, ListScrollOn } from '@/shared/constants/common';
|
import { GetListHeight, IMAGE_ROOT, ListScrollOn, setScrollAction } from '@/shared/constants/common';
|
||||||
import {
|
import {
|
||||||
useSetHeaderTitle,
|
useSetHeaderTitle,
|
||||||
useSetHeaderType,
|
useSetHeaderType,
|
||||||
@@ -282,62 +282,21 @@ export const AlimtalkListPage = () => {
|
|||||||
sendCl
|
sendCl
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const getMax = (data: Array<Record<string, any>>) => {
|
|
||||||
let maxItem = null;
|
|
||||||
if(data.length > 0){
|
|
||||||
let numberArr = data.map((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top;
|
|
||||||
});
|
|
||||||
let max = Math.max(...numberArr);
|
|
||||||
maxItem = data.filter((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top === max;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return maxItem? maxItem[0]: null;
|
|
||||||
};
|
|
||||||
|
|
||||||
const setScrollAction = (e: Event) => {
|
|
||||||
let dateHeader = document.querySelectorAll('.date-header');
|
|
||||||
let posData: Array<Record<string, any>> = [];
|
|
||||||
dateHeader.forEach((value, index) => {
|
|
||||||
let date: string = value.innerHTML;
|
|
||||||
let top: number = value.getBoundingClientRect().top;
|
|
||||||
if(top < 10){
|
|
||||||
posData.push({
|
|
||||||
date: date,
|
|
||||||
top: top
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
let maxItem = getMax(posData);
|
|
||||||
if(maxItem){
|
|
||||||
setGroupDateOn(true);
|
|
||||||
setGroupDate(maxItem.date);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
setGroupDateOn(false);
|
|
||||||
setGroupDate('');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
ListScrollOn(true);
|
ListScrollOn(true);
|
||||||
let heightList = GetListHeight();
|
let heightList = GetListHeight();
|
||||||
setListHeight(heightList.listHeight);
|
setListHeight(heightList.listHeight);
|
||||||
|
|
||||||
let tabContent = document.querySelector('.tab-content');
|
let tabContent = document.querySelector('.tab-content');
|
||||||
tabContent?.addEventListener('scroll', setScrollAction);
|
tabContent?.addEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
ListScrollOn(false);
|
ListScrollOn(false);
|
||||||
tabContent?.removeEventListener('scroll', setScrollAction);
|
tabContent?.removeEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { DefaultRequestPagination, HeaderType, SortTypeKeys } from '@/entities/c
|
|||||||
import { SortTypeBox } from '@/entities/common/ui/sort-type-box';
|
import { SortTypeBox } from '@/entities/common/ui/sort-type-box';
|
||||||
import { DEFAULT_PAGE_PARAM } from '@/entities/common/model/constant';
|
import { DEFAULT_PAGE_PARAM } from '@/entities/common/model/constant';
|
||||||
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
|
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
|
||||||
import { GetListHeight, IMAGE_ROOT, ListScrollOn } from '@/shared/constants/common';
|
import { GetListHeight, IMAGE_ROOT, ListScrollOn, setScrollAction } from '@/shared/constants/common';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { useGroupDateOnStore, useGroupDateStore, useStore } from '@/shared/model/store';
|
import { useGroupDateOnStore, useGroupDateStore, useStore } from '@/shared/model/store';
|
||||||
import { PATHS } from '@/shared/constants/paths';
|
import { PATHS } from '@/shared/constants/paths';
|
||||||
@@ -238,62 +238,21 @@ export const FaceAuthPage = () => {
|
|||||||
sortType
|
sortType
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const getMax = (data: Array<Record<string, any>>) => {
|
|
||||||
let maxItem = null;
|
|
||||||
if(data.length > 0){
|
|
||||||
let numberArr = data.map((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top;
|
|
||||||
});
|
|
||||||
let max = Math.max(...numberArr);
|
|
||||||
maxItem = data.filter((
|
|
||||||
value: Record<string, any>,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
return value.top === max;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return maxItem? maxItem[0]: null;
|
|
||||||
};
|
|
||||||
|
|
||||||
const setScrollAction = (e: Event) => {
|
|
||||||
let dateHeader = document.querySelectorAll('.date-header');
|
|
||||||
let posData: Array<Record<string, any>> = [];
|
|
||||||
dateHeader.forEach((value, index) => {
|
|
||||||
let date: string = value.innerHTML;
|
|
||||||
let top: number = value.getBoundingClientRect().top;
|
|
||||||
if(top < 10){
|
|
||||||
posData.push({
|
|
||||||
date: date,
|
|
||||||
top: top
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
let maxItem = getMax(posData);
|
|
||||||
if(maxItem){
|
|
||||||
setGroupDateOn(true);
|
|
||||||
setGroupDate(maxItem.date);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
setGroupDateOn(false);
|
|
||||||
setGroupDate('');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
ListScrollOn(true);
|
ListScrollOn(true);
|
||||||
let heightList = GetListHeight();
|
let heightList = GetListHeight();
|
||||||
setListHeight(heightList.listHeight);
|
setListHeight(heightList.listHeight);
|
||||||
|
|
||||||
let tabContent = document.querySelector('.tab-content');
|
let tabContent = document.querySelector('.tab-content');
|
||||||
tabContent?.addEventListener('scroll', setScrollAction);
|
tabContent?.addEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
ListScrollOn(false);
|
ListScrollOn(false);
|
||||||
tabContent?.removeEventListener('scroll', setScrollAction);
|
tabContent?.removeEventListener('scroll', (e: Event) => {
|
||||||
|
setScrollAction(e, setGroupDate, setGroupDateOn);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import packageInfo from '../../../package.json';
|
import packageInfo from '../../../package.json';
|
||||||
|
import { useGroupDateOnStore, useGroupDateStore } from '../model/store';
|
||||||
|
|
||||||
export const IMAGE_ROOT = '/images';
|
export const IMAGE_ROOT = '/images';
|
||||||
export const RELEASE_VERSION = packageInfo.version;
|
export const RELEASE_VERSION = packageInfo.version;
|
||||||
@@ -32,4 +33,53 @@ export const GetListHeight = () => {
|
|||||||
filterSectionHeight: filterSectionHeight,
|
filterSectionHeight: filterSectionHeight,
|
||||||
listHeight: innerHeight - headerHeight - summarySectionHeight - filterSectionHeight
|
listHeight: innerHeight - headerHeight - summarySectionHeight - filterSectionHeight
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getMax = (data: Array<Record<string, any>>) => {
|
||||||
|
let maxItem = null;
|
||||||
|
if(data.length > 0){
|
||||||
|
let numberArr = data.map((
|
||||||
|
value: Record<string, any>,
|
||||||
|
index: number
|
||||||
|
) => {
|
||||||
|
return value.top;
|
||||||
|
});
|
||||||
|
let max = Math.max(...numberArr);
|
||||||
|
maxItem = data.filter((
|
||||||
|
value: Record<string, any>,
|
||||||
|
index: number
|
||||||
|
) => {
|
||||||
|
return value.top === max;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return maxItem? maxItem[0]: null;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const setScrollAction = (
|
||||||
|
e: Event,
|
||||||
|
setGroupDate: (groupDate: string) => void,
|
||||||
|
setGroupDateOn: (groupDateOn: boolean) => void
|
||||||
|
) => {
|
||||||
|
let dateHeader = document.querySelectorAll('.date-header');
|
||||||
|
let posData: Array<Record<string, any>> = [];
|
||||||
|
dateHeader.forEach((value, index) => {
|
||||||
|
let date: string = value.innerHTML;
|
||||||
|
let top: number = value.getBoundingClientRect().top;
|
||||||
|
if(top < 10){
|
||||||
|
posData.push({
|
||||||
|
date: date,
|
||||||
|
top: top
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
let maxItem = getMax(posData);
|
||||||
|
if(maxItem){
|
||||||
|
setGroupDateOn(true);
|
||||||
|
setGroupDate(maxItem.date);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
setGroupDateOn(false);
|
||||||
|
setGroupDate('');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user