add autoclick saving
This commit is contained in:
parent
51f4599031
commit
07915ca426
|
@ -9,6 +9,7 @@ import { checkIOS } from '../../../utils/checkMobile';
|
|||
import axios from 'axios';
|
||||
import { useAppSelector } from '../../hooks/useAppSelector';
|
||||
import { saveMult } from '../../../store/mult';
|
||||
import { sendAutoClickData } from '../../hooks/sendAutoClickData';
|
||||
|
||||
interface IPointsZoom {
|
||||
points: number,
|
||||
|
@ -47,13 +48,11 @@ export function PointsZoom({ points, sameCoords, setSameCoords, setCloseAutoClic
|
|||
avtTime = clickTimeInit / (initPoints - 1);
|
||||
}
|
||||
|
||||
//block function
|
||||
initSameCoords = false;
|
||||
|
||||
setClickTime(0);
|
||||
setSameCoords(false);
|
||||
|
||||
if (avtTime < 100 && initSameCoords && points > 30) {
|
||||
if (avtTime < 100 && initSameCoords && points > 40) {
|
||||
sendAutoClickData(userData.tgId, points, avtTime);
|
||||
setCloseAutoClick(false);
|
||||
const returnEnergy = energy + initPoints;
|
||||
setEnergy(returnEnergy);
|
||||
|
|
|
@ -9,7 +9,6 @@ import { useNavigate } from 'react-router-dom';
|
|||
import { UsersIcons } from '../../Elements/UsersIcons';
|
||||
import { formatNumber } from '../../../utils/formatNumber';
|
||||
import { useAppSelector } from '../../hooks/useAppSelector';
|
||||
import { isWhiteList } from '../../../utils/isWhiteList';
|
||||
import { IUserRank } from '../../../store/friends/actions';
|
||||
|
||||
interface ISectionsBlock {
|
||||
|
@ -22,16 +21,11 @@ export function SectionsBlock({ mult }: ISectionsBlock) {
|
|||
const referralStorage = Number(useAppSelector<string | undefined>(state => state.me.data.referralStorage));
|
||||
const maxReferralStorage = useAppSelector<number>(state => state.me.data.maxStorage);
|
||||
const [referralPercent, serReferralPercent] = useState(0);
|
||||
const [isDev, setIsDev] = useState(true);
|
||||
const [isDev, setIsDev] = useState(false);
|
||||
const userRank = useAppSelector<number | undefined>(state => state.me.data.rank);
|
||||
const rankData = useAppSelector<Array<IUserRank>>(state => state.rank.data);
|
||||
const [topImgs, setTopImgs] = useState<Array<string>>([]);
|
||||
|
||||
useEffect(() => {
|
||||
const whiteList = isWhiteList();
|
||||
setIsDev(!whiteList)
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const imgs:Array<string> = [];
|
||||
if(rankData.length != 0) {
|
||||
|
|
|
@ -6,10 +6,13 @@ interface IPersonIcon {
|
|||
img ?: string,
|
||||
className?: string,
|
||||
left?: number,
|
||||
letter?: string,
|
||||
}
|
||||
|
||||
export function PersonIcon({ size = 25, img = '', className, left=0 }: IPersonIcon) {
|
||||
export function PersonIcon({ size = 25, img = '', className, left=0, letter }: IPersonIcon) {
|
||||
return (
|
||||
<div className={`${styles.container} ${className}`} style={{width: `${size}px`, height: `${size}px`, backgroundImage: `url(${img})`, left: `${left}px`}}></div>
|
||||
<div className={`${styles.container} ${className}`} style={{width: `${size}px`, height: `${size}px`, backgroundImage: `url(${img})`, left: `${left}px`}}>
|
||||
{img.length === 0 && <span className={styles.letter}>{letter?.toUpperCase()}</span> }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -3,5 +3,13 @@
|
|||
background-size: cover;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
background-color: var(--white);
|
||||
background-color: var(--grey35);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.letter {
|
||||
color: var(--primary);
|
||||
font-weight: 700;
|
||||
}
|
|
@ -32,7 +32,7 @@ export function RatingCard({number, name, score, index, friend=false, img}: IRat
|
|||
<Icon icon={EIcons.MedalThird} />
|
||||
</div>}
|
||||
{(order > 3 ) && <div className={styles.number} style={ETextStyles.InSb14120}>{order}</div>}
|
||||
<PersonIcon size={20} img={img} className={styles.img}/>
|
||||
<PersonIcon size={20} img={img} className={styles.img} letter={name[0]}/>
|
||||
<p style={ETextStyles.RwSb14120} className={styles.name}>{name}</p>
|
||||
</div>
|
||||
<PointsBlock points={score}/>
|
||||
|
|
|
@ -6,13 +6,11 @@ import { generateRandomString } from '../../../utils/generateRandom';
|
|||
import { useRankData } from '../../hooks/useRankData';
|
||||
import { Spinner } from '../../Elements/Spinner';
|
||||
import { ErrorPage } from '../ErrorPage';
|
||||
import { checkWhiteList } from '../../hooks/checkWhiteList';
|
||||
|
||||
export function RatingPage() {
|
||||
const { dataRank, loadingRank, errorRank } = useRankData();
|
||||
const [topBlock, setTopBlock] = useState(<div></div>);
|
||||
const [otherBlock, setOtherBlock] = useState(<div></div>);
|
||||
checkWhiteList();
|
||||
|
||||
useEffect(() => {
|
||||
if (dataRank.length != 0) {
|
||||
|
|
|
@ -17,14 +17,9 @@ export function StoragePage() {
|
|||
const [page, setPage] = useState('storage');
|
||||
const refLink = `https://t.me/sapphirecrown_bot?start=user_${userId}`;
|
||||
const [showNotif, setShow] = useState(false);
|
||||
const [isDev, setIsDev] = useState(true);
|
||||
const [isDev, setIsDev] = useState(false);
|
||||
const navigate = useNavigate();
|
||||
|
||||
useEffect(() => {
|
||||
const whiteList = isWhiteList();
|
||||
setIsDev(!whiteList)
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1 style={ETextStyles.RwSb30100} className={styles.title}>Реферальная программа</h1>
|
||||
|
|
|
@ -7,15 +7,9 @@ import { useFriendsData } from '../../hooks/useFriendsData';
|
|||
import { ErrorPage } from '../../Pages/ErrorPage';
|
||||
import { Spinner } from '../../Elements/Spinner';
|
||||
|
||||
interface IRating {
|
||||
name: string,
|
||||
score: string
|
||||
}
|
||||
|
||||
export function FriendsPageBlock() {
|
||||
const { dataFriends, loadingFriends, errorFriends } = useFriendsData();
|
||||
const [ratingBlock, setRatingBlock] = useState(<div></div>);
|
||||
const loading = true;
|
||||
|
||||
useEffect(() => {
|
||||
if (dataFriends.length != 0) {
|
||||
|
|
13
frontend/src/shared/hooks/sendAutoClickData.ts
Normal file
13
frontend/src/shared/hooks/sendAutoClickData.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
import axios from "axios"
|
||||
|
||||
export const sendAutoClickData = (userId: number | undefined, points: number, time: number) => {
|
||||
axios.post('https://script.google.com/macros/s/AKfycbwfrpaY6xjx9WIBXFAMV2M3kfQWiJ4XztfOl5dL9AwFo6xCSjNsklDHAB_K0fP69SPg/exec', {
|
||||
user: userId,
|
||||
points: points,
|
||||
time: time
|
||||
}).then(resp=> {
|
||||
//console.log(resp);
|
||||
}).catch(err => {
|
||||
//console.log(err)
|
||||
})
|
||||
}
|
|
@ -2,7 +2,6 @@ import { useDispatch } from 'react-redux';
|
|||
import { useEffect } from 'react';
|
||||
import { useAppSelector } from './useAppSelector';
|
||||
import { IUserRank, friendsRequestAsync } from '../../store/friends/actions';
|
||||
import { isWhiteList } from '../../utils/isWhiteList';
|
||||
|
||||
export function useFriendsData() {
|
||||
const dataFriends = useAppSelector<Array<IUserRank>>(state => state.friends.data);
|
||||
|
@ -12,12 +11,7 @@ export function useFriendsData() {
|
|||
const dispatch = useDispatch();
|
||||
|
||||
useEffect(() => {
|
||||
const whiteList = isWhiteList();
|
||||
|
||||
if(whiteList) {
|
||||
dispatch<any>(friendsRequestAsync());
|
||||
}
|
||||
|
||||
dispatch<any>(friendsRequestAsync());
|
||||
}, [token]);
|
||||
|
||||
return { dataFriends, loadingFriends, errorFriends };
|
||||
|
|
|
@ -3,7 +3,6 @@ import { useEffect } from 'react';
|
|||
import { useAppSelector } from './useAppSelector';
|
||||
import { IUserRank } from '../../store/friends/actions';
|
||||
import { rankRequestAsync } from '../../store/rank/actions';
|
||||
import { isWhiteList } from '../../utils/isWhiteList';
|
||||
|
||||
export function useRankData() {
|
||||
const dataRank = useAppSelector<Array<IUserRank>>(state => state.rank.data);
|
||||
|
@ -13,10 +12,7 @@ export function useRankData() {
|
|||
const dispatch = useDispatch();
|
||||
|
||||
useEffect(() => {
|
||||
const whiteList = isWhiteList();
|
||||
if(whiteList) {
|
||||
dispatch<any>(rankRequestAsync());
|
||||
}
|
||||
dispatch<any>(rankRequestAsync());
|
||||
}, [token]);
|
||||
|
||||
return { dataRank, loadingRank, errorRank };
|
||||
|
|
|
@ -5,7 +5,7 @@ export const isWhiteList = () => {
|
|||
//123456,
|
||||
const whiteList = [
|
||||
342495217, 6374536117, 322861155, 5219438370, 193428034, 402449803,
|
||||
406350282, 1083462027,
|
||||
406350282
|
||||
];
|
||||
|
||||
const userId = Number(getTgUserId());
|
||||
|
|
Loading…
Reference in New Issue
Block a user