Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jermxt committed Oct 16, 2022
2 parents 1be64ac + de5851c commit ca18b59
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 30 deletions.
Binary file added frontend/src/assets/angybees.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 22 additions & 1 deletion frontend/src/components/CountdownTimer/CountdownTimer.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,30 @@
import React from 'react';
import "./datetime.css"
import "./datetime.css";
import DateTimeDisplay from './DateTimeDisplay';
import { useCountdown } from './useCountdown';

const ExpiredNotice = () => {

const notifyTwilio = async () => {
searchUrl = `http://localhost:4000/twlio/activateAlarm`
const response = await fetch(searchUrl, {
mode: 'cors',
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Origin' : 'http://localhost:3000'
},
body: JSON.stringify({
"username" : user,
})
});
};

useEffect(() => {
notifyTwilio()
}, []);

return (
<div className="expired-notice">
<span>Expired!!!</span>
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/components/FriendSearch/FriendSearch.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,9 @@
align-items: center;
}

.angybee {
max-width: 25%;
height: auto;
margin-left: 10px;
margin-bottom: -20px;
}
17 changes: 2 additions & 15 deletions frontend/src/components/FriendSearch/FriendSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,6 @@ function FriendSearch() {
// }
};

const getFriends = async () => {
const endpoint = `http://34.168.40.206:4000/users/getFriends/?username=${user}`
fetch(endpoint, {
mode: 'cors',
method: 'GET',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Origin' : 'http://localhost:3000'
}
}).then(response =>
response.json().then(data => console.log(data['friends'])))
}

useEffect(() => {
getFriends();
console.log(user)
Expand All @@ -101,6 +87,7 @@ function FriendSearch() {
return (
<div className="outer-box">
<div className="main">
<img className="angybee" src={require("../../assets/angybees.png")}></img>
<div className="title">find friends</div>
<div className="search">
<TextField
Expand All @@ -122,7 +109,7 @@ function FriendSearch() {
</Button>
</div>
<p class="title"> current friends</p>
<List>
<List style={{ textAlignLast: "center" }}>
<>
{
friends.map(friend =>
Expand Down
44 changes: 30 additions & 14 deletions frontend/src/components/FriendsDropdown/FriendsDropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,6 @@ const MenuProps = {
},
};

const names = [
'Oliver Hansen',
'Van Henry',
'April Tucker',
'Ralph Hubbard',
'Omar Alexander',
'Carlos Abbott',
'Miriam Wagner',
'Bradley Wilkerson',
'Virginia Andrews',
'Kelly Snyder',
];

function getStyles(name, personName, theme) {
return {
fontWeight:
Expand All @@ -54,8 +41,37 @@ export default function FriendsDropdown() {
const [personName, setPersonName] = React.useState([]);
const [user] = useAtom(currUserAtom);
const [onCall, setOnCall] = React.useState([]);
const [friends, setFriends] = React.useState([]);
const navigate = useNavigate();

const getFriends = async () => {
const endpoint = `http://localhost:4000/users/getFriends/?username=${user}`
const res = await fetch(endpoint, {
mode: 'cors',
method: 'GET',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Origin' : 'http://localhost:3000'
}
})
const data = await res.json();
console.log(data)
setFriends(data['friends'])
// ).then(response =>
// response.json().then(data => data['friends'])
// .then(data => {
// setFriends(data)
// }))
}

React.useEffect(() => {
getFriends();
// console.log(user)
// console.log(typeof friends)
console.log(friends)
}, [])

const handleChange = (event) => {
const {
target: { value },
Expand Down Expand Up @@ -103,7 +119,7 @@ export default function FriendsDropdown() {
input={<OutlinedInput label="Friends" />}
MenuProps={MenuProps}
>
{names.map((name) => (
{friends.map((name) => (
<MenuItem
key={name}
value={name}
Expand Down

0 comments on commit ca18b59

Please sign in to comment.