Skip to content

Commit e768e32

Browse files
committed
last changes
1 parent 05a49da commit e768e32

17 files changed

Lines changed: 330 additions & 156 deletions

File tree

.DS_Store

2 KB
Binary file not shown.

bundle.zip

431 KB
Binary file not shown.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@
3232
"eruda-code": "^2.0.0",
3333
"eruda-dom": "^2.0.0",
3434
"firebase": "^7.16.1",
35+
"node-sass": "^4.14.1",
3536
"prop-types": "^15.7.2",
3637
"react": "^16.13.1",
3738
"react-deck-swiper": "^1.0.9",
3839
"react-dom": "^16.13.1",
40+
"react-icons": "^3.10.0",
3941
"react-tinder-card": "^1.1.4"
4042
},
4143
"browserslist": {

src/.DS_Store

0 Bytes
Binary file not shown.

src/App.js

Lines changed: 34 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import React, { useState, useEffect } from "react";
22
import bridge from "@vkontakte/vk-bridge";
33
import ScreenSpinner from "@vkontakte/vkui/dist/components/ScreenSpinner/ScreenSpinner"
4-
import { View, Root, Alert, Avatar, Snackbar, ModalRoot, ModalPage, ModalPageHeader, PanelHeaderButton, Div, Button, Group, RichCell } from "@vkontakte/vkui";
5-
import Icon16Done from "@vkontakte/icons/dist/16/done";
4+
import { Root, View, Alert, Avatar, Snackbar } from "@vkontakte/vkui";
65
import Icon24Camera from "@vkontakte/icons/dist/24/camera";
76
import Icon24Place from "@vkontakte/icons/dist/24/place";
87
import Icon24NotificationCheckOutline from "@vkontakte/icons/dist/24/notification_check_outline";
98
import Icon24Done from "@vkontakte/icons/dist/24/done";
10-
import Icon24Repeat from "@vkontakte/icons/dist/24/repeat";
11-
import Icon28EditOutline from "@vkontakte/icons/dist/28/edit_outline";
129
import Icon16CheckCircleOutline from '@vkontakte/icons/dist/16/check_circle_outline';
1310
import Icon16CancelCircleOutline from '@vkontakte/icons/dist/16/cancel_circle_outline';
11+
import Icon28UserOutline from '@vkontakte/icons/dist/28/user_outline';
12+
import Icon28FireOutline from '@vkontakte/icons/dist/28/fire_outline';
13+
import Icon28LikeOutline from '@vkontakte/icons/dist/28/like_outline';
1414
import "@vkontakte/vkui/dist/vkui.css";
1515
import "./css/Home.css";
1616

@@ -43,24 +43,7 @@ const App = () => {
4343
// Основные константы
4444
const [activeView, setActiveView] = useState("home");
4545
const [activePanel, setActivePanel] = useState("screen1");
46-
const [fetchedUser, setUser] = useState({
47-
id: 0,
48-
first_name: "",
49-
last_name: "",
50-
sex: 0,
51-
city: {
52-
id: 0,
53-
title: ""
54-
},
55-
country: {
56-
id: 0,
57-
title: ""
58-
},
59-
photo_100: "",
60-
photo_max_orig: "",
61-
photo_200: "",
62-
timezone: 0,
63-
});
46+
const [fetchedUser, setUser] = useState(null);
6447

6548
const [popout, setPopout] = useState(null);
6649
const [snackbarIsActive, setSnackbarIsActive] = useState(false)
@@ -87,21 +70,20 @@ const App = () => {
8770
const [notDecidedArray, setNotDecidedArray] = useState([]);
8871

8972
useEffect(() => {
90-
// Theme changer
91-
bridge.subscribe(({ detail: { type, data }}) => {
92-
if (type === "VKWebAppUpdateConfig") {
93-
const schemeAttribute = document.createAttribute("scheme");
94-
schemeAttribute.value = data.scheme ? data.scheme : "bright_light";
95-
document.body.attributes.setNamedItem(schemeAttribute);
96-
}
97-
});
73+
// bridge.subscribe(({ detail: { type, data }}) => {
74+
// if (type === "VKWebAppUpdateConfig") {
75+
// const schemeAttribute = document.createAttribute("scheme");
76+
// schemeAttribute.value = data.scheme;
77+
// document.body.attributes.setNamedItem(schemeAttribute);
78+
// }
79+
// });
9880

9981
// Функция для получения данных о пользователе
10082
async function fetchData() {
10183
const user = await bridge.send("VKWebAppGetUserInfo");
10284

10385
// Присваиваем данные в константу fetchedUser
104-
setUser({...user});
86+
setUser(user);
10587
}
10688

10789
// Вызываем функцию
@@ -120,7 +102,6 @@ const App = () => {
120102
// Метод для проверки если ли Юзер в БД
121103
async function onUserData() {
122104
console.log('onUserData')
123-
setPopout(<ScreenSpinner size="large"/>);
124105
if (fetchedUser) {
125106
await usersRef.doc("id" + fetchedUser.id).get().then(function(doc) {
126107
// Если есть
@@ -137,12 +118,10 @@ const App = () => {
137118

138119
// Вызываем метод для Получения и Сортировки всех пользователей
139120
getAllUsers();
140-
setPopout(null);
141121
setActiveView("home");
142122
// Если нету
143123
} else {
144124
console.log("User does not exist");
145-
setPopout(null);
146125
setActiveView("onboarding");
147126
}
148127
});
@@ -172,7 +151,7 @@ const App = () => {
172151
// Кладем в массив likedYouArray тех юзеров, которых лайкнул текущий юзер
173152
await usersRef.doc("id" + fetchedUser.id).collection("liked_you").get().then(function(querySnapshot) {
174153
querySnapshot.forEach(function(doc) {
175-
if (doc.data().status == "none") {
154+
if (doc.data().status === "none") {
176155
notDecided.push(doc.data());
177156
}
178157
likedYouArray.push(doc.data());
@@ -196,14 +175,13 @@ const App = () => {
196175
return;
197176
} else {
198177
// Проверка нужна чтобы убрать карточку самого себя
199-
if (doc.data().id == userId) {
178+
if (doc.data().id === userId) {
200179
return;
201180
} else {
202-
let distance = sortAllUsers(lat, long, doc.data().lat, doc.data().long);
203-
204181
// Когда в прилоежниее будет больше человек
205-
// if (distance <= 50) {
206-
// }
182+
// let distance = sortAllUsers(lat, long, doc.data().lat, doc.data().long);
183+
// if (distance <= 50) {
184+
// }
207185

208186
// Пока что отображаем всех пользователей
209187
dataArray.push(doc.data());
@@ -382,7 +360,7 @@ const App = () => {
382360
}
383361
} catch (error) {
384362
const result = Object.assign({ success: false, message: error.message, imageFile });
385-
console.log("Error");
363+
console.log(result);
386364
setCancelPhoto(true);
387365
setPopout(null);
388366
}
@@ -643,16 +621,6 @@ const App = () => {
643621
)
644622
}
645623

646-
// Метод для перехода на другие View
647-
const goToNextView = e => {
648-
setActiveView(e.currentTarget.dataset.to);
649-
};
650-
651-
// Метод для перехода на другие Panel
652-
const goToNextPanel = e => {
653-
setActivePanel(e.currentTarget.dataset.to);
654-
};
655-
656624
// Метод для отправклю уведомлений принимая само сообщение и id человека которому пойдет уведомление
657625
const sendNotifications = (message, senderId) => {
658626
if (fetchedUser) {
@@ -677,6 +645,16 @@ const App = () => {
677645
}
678646
}
679647

648+
// Метод для перехода на другие Panel
649+
const goToNextView = e => {
650+
setActiveView(e.currentTarget.dataset.to);
651+
};
652+
653+
// Метод для перехода на другие Panel
654+
const goToNextPanel = e => {
655+
setActivePanel(e.currentTarget.dataset.to);
656+
};
657+
680658
// Возвращаем все экраны по уровням
681659
return (
682660
<Root activeView={activeView} popout={popout} snackbar={snackbar}>
@@ -690,41 +668,40 @@ const App = () => {
690668
<View id="home" activePanel="home">
691669
<Home
692670
id="home"
693-
goToNextView={goToNextView}
694671
usersData={usersData}
695672
updateLike={updateLike}
696673
sendNotifications={sendNotifications}
697674
snackbar={snackbar}
698675
notDecidedArray={notDecidedArray}
699676
openLikeSnackbar={openLikeSnackbar}
700677
openDislikeSnackbar={openDislikeSnackbar}
678+
goToNextView={goToNextView}
701679
/>
702680
</View>
703681
<View id="likes" activePanel="likes">
704682
<Likes
705683
id="likes"
706-
goToNextView={goToNextView}
707684
likedYou={likedYou}
708685
updateStatus={updateStatus}
709686
sendNotifications={sendNotifications}
687+
goToNextView={goToNextView}
710688
/>
711689
</View>
712690
<View id="show" activePanel="show">
713691
<Show
714692
id="show"
715-
goToNextView={goToNextView}
716693
username={username}
717694
userAge={userAge}
718695
userBio={userBio}
719696
userFileUrl={userFileUrl}
720697
showAskAlert={showAskAlert}
721698
snackbar={snackbar}
699+
goToNextView={goToNextView}
722700
/>
723701
</View>
724702
<View id="edit" activePanel="edit">
725703
<Edit
726704
id="edit"
727-
goToNextView={goToNextView}
728705
onFileChange={onFileChange}
729706
confirmLocation={confirmLocation}
730707
username={username}
@@ -733,18 +710,19 @@ const App = () => {
733710
updatePersonalData={updatePersonalData}
734711
showEditAlert={showEditAlert}
735712
snackbar={snackbar}
713+
goToNextView={goToNextView}
736714
/>
737715
</View>
738716
<View id="create" activePanel="create">
739717
<Create
740718
id="create"
741-
goToNextView={goToNextView}
742719
onFileChange={onFileChange}
743720
savePersonalData={savePersonalData}
744721
showCreateAlert={showCreateAlert}
745722
showPhotoAlert={showPhotoAlert}
746723
cancelPhoto={cancelPhoto}
747724
snackbar={snackbar}
725+
goToNextView={goToNextView}
748726
/>
749727
</View>
750728
</Root>

src/components/.DS_Store

6 KB
Binary file not shown.

src/components/CardButtons.js

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import React from 'react';
1+
import React, { useEffect } from 'react';
22
import { makeStyles } from '@material-ui/core/styles';
33
import Grid from '@material-ui/core/Grid';
4-
import IconButton from '@material-ui/core/IconButton';
5-
import ThumbDownIcon from '@material-ui/icons/ThumbDown';
6-
import ThumbUpIcon from '@material-ui/icons/ThumbUp';
4+
import { FaThumbsDown, FaThumbsUp } from "react-icons/fa";
5+
import './css/demo.scss';
76

87
const useStyles = makeStyles((theme) => ({
98
root: {
@@ -16,34 +15,40 @@ const useStyles = makeStyles((theme) => ({
1615
iconButtonContainerRight: {
1716
display: 'flex',
1817
justifyContent: 'flex-end',
19-
},
18+
}
2019
}));
2120

22-
export default function CardButtons({
23-
right,
24-
left,
25-
}) {
21+
export default function CardButtons({right, left,}) {
2622
const classes = useStyles();
2723

24+
useEffect(() => {
25+
let animateButton = function(e) {
26+
e.target.classList.remove('animate');
27+
e.target.classList.add('animate');
28+
setTimeout(() => {
29+
e.target.classList.remove('animate');
30+
}, 800);
31+
};
32+
let likeButtons = document.getElementsByClassName("like-button");
33+
let dislikeButtons = document.getElementsByClassName("dislike-button");
34+
35+
for (var i = 0; i < likeButtons.length; i++) {
36+
likeButtons[i].addEventListener('click', animateButton, false);
37+
dislikeButtons[i].addEventListener('click', animateButton, false);
38+
}
39+
}, []);
40+
2841
return (
2942
<Grid container justify="space-between" className={classes.root}>
3043
<Grid item xs={6} className={classes.iconButtonContainerLeft}>
31-
<IconButton
32-
onClick={left}
33-
aria-label="dislike"
34-
className={classes.margin}
35-
>
36-
<ThumbDownIcon color="secondary" fontSize="large"/>
37-
</IconButton>
44+
<button onClick={left} className="dislike-button">
45+
<FaThumbsDown color="rgb(247, 18, 18)" size={38} style={{position: 'relative', zIndex: -9999 }} />
46+
</button>
3847
</Grid>
3948
<Grid item xs={6} className={classes.iconButtonContainerRight}>
40-
<IconButton
41-
onClick={right}
42-
aria-label="like"
43-
className={classes.margin}
44-
>
45-
<ThumbUpIcon color="primary" fontSize="large" />
46-
</IconButton>
49+
<button onClick={right} className="like-button">
50+
<FaThumbsUp color="rgb(64, 233, 31)" size={38} style={{position: 'relative', zIndex: -9999 }} />
51+
</button>
4752
</Grid>
4853
</Grid>
4954
);

0 commit comments

Comments
 (0)