|
@@ -6,10 +6,8 @@ import { Header, PageWrapper, Loading } from '../../../../components';
|
|
import { storage, StoreType } from '../../../../storage';
|
|
import { storage, StoreType } from '../../../../storage';
|
|
|
|
|
|
import { Profile } from '../Components/Profile';
|
|
import { Profile } from '../Components/Profile';
|
|
-import { FilterButton, FilterModal } from '../Components/FilterModal';
|
|
|
|
|
|
|
|
-import { applyModalSort, dataRanking } from '../utils';
|
|
|
|
-import { RankingDropdown } from '../utils/types';
|
|
|
|
|
|
+import { dataRanking } from '../utils';
|
|
|
|
|
|
import type { Ranking } from '..';
|
|
import type { Ranking } from '..';
|
|
|
|
|
|
@@ -17,10 +15,6 @@ const InHistoryScreen = () => {
|
|
const [historyRanking, setHistoryRanking] = useState<Ranking[]>([]);
|
|
const [historyRanking, setHistoryRanking] = useState<Ranking[]>([]);
|
|
const [isLoading, setIsLoading] = useState(true);
|
|
const [isLoading, setIsLoading] = useState(true);
|
|
|
|
|
|
- const [filteredData, setFilteredData] = useState<Ranking[]>([]);
|
|
|
|
- const [isModalActive, setIsModalActive] = useState(false);
|
|
|
|
- const [confirmedValueRanking, setConfirmedValueRanking] = useState<RankingDropdown | null>();
|
|
|
|
-
|
|
|
|
useFocusEffect(
|
|
useFocusEffect(
|
|
useCallback(() => {
|
|
useCallback(() => {
|
|
const fetchRanking = async () => {
|
|
const fetchRanking = async () => {
|
|
@@ -39,25 +33,11 @@ const InHistoryScreen = () => {
|
|
|
|
|
|
return (
|
|
return (
|
|
<PageWrapper>
|
|
<PageWrapper>
|
|
- <FilterModal
|
|
|
|
- isModalVisible={isModalActive}
|
|
|
|
- setModalVisible={(value) => setIsModalActive(value)}
|
|
|
|
- applyFilter={(filterAge, filterRanking, filterCountry) => {
|
|
|
|
- setConfirmedValueRanking(filterRanking);
|
|
|
|
- setFilteredData(applyModalSort(historyRanking, filterAge, filterRanking, filterCountry));
|
|
|
|
- setIsModalActive(false);
|
|
|
|
- }}
|
|
|
|
- countriesData={[]}
|
|
|
|
- />
|
|
|
|
-
|
|
|
|
- <Header
|
|
|
|
- label="In History"
|
|
|
|
- rightElement={<FilterButton onPress={() => setIsModalActive(!isModalActive)} />}
|
|
|
|
- />
|
|
|
|
|
|
+ <Header label="In History" />
|
|
|
|
|
|
<FlatList
|
|
<FlatList
|
|
showsVerticalScrollIndicator={false}
|
|
showsVerticalScrollIndicator={false}
|
|
- data={filteredData.length > 0 ? filteredData : historyRanking}
|
|
|
|
|
|
+ data={historyRanking}
|
|
keyExtractor={(item) => item.user_id.toString()}
|
|
keyExtractor={(item) => item.user_id.toString()}
|
|
renderItem={({ item, index }) => (
|
|
renderItem={({ item, index }) => (
|
|
<Profile
|
|
<Profile
|
|
@@ -82,9 +62,7 @@ const InHistoryScreen = () => {
|
|
item.score_whs,
|
|
item.score_whs,
|
|
item.score_kye
|
|
item.score_kye
|
|
]}
|
|
]}
|
|
- active_score={
|
|
|
|
- confirmedValueRanking ? confirmedValueRanking.value - 1 : dataRanking[0].value - 1
|
|
|
|
- }
|
|
|
|
|
|
+ active_score={dataRanking[0].value - 1}
|
|
tbt_score={item.score_tbt}
|
|
tbt_score={item.score_tbt}
|
|
tbt_rank={item.rank_tbt}
|
|
tbt_rank={item.rank_tbt}
|
|
badge_tbt={item.badge_tbt}
|
|
badge_tbt={item.badge_tbt}
|