Skip to content

Commit

Permalink
FS: Bug fixes and entering final phase
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhinav Bhattarai committed Jan 21, 2021
1 parent 42add66 commit a018142
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 46 deletions.
1 change: 1 addition & 0 deletions client/debug.log
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
[0119/093126.682:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3)
[0121/094456.011:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3)
[0121/162819.573:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3)
[0121/201523.771:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3)
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const ImageConfig = ({ history, RemoveProfileCard, SetNewProfile }) => {
ProfilePicture: profile_pic,
MainPost: main_post
}
axios.post(`http://locahost:8000/profile-confirm/${localStorage.getItem('Username')}`, context).then(()=>{})
axios.post(`http://localhost:8000/profile-confirm/${localStorage.getItem('Username')}`, context);
RemoveProfileCard();
}
}
Expand Down
18 changes: 3 additions & 15 deletions client/src/Components/UI/Dropdown/dropdown.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React, { Fragment } from 'react';
import { IconContext } from 'react-icons';
import { FaCog, FaLock, FaPowerOff } from 'react-icons/fa';
import { FaLock, FaPowerOff } from 'react-icons/fa';
import './dropdown.scss';
import { withRouter } from 'react-router';

const Icon = ()=>{
return (
Expand All @@ -28,15 +27,8 @@ const LockIcon = ()=>{
)
}

const SettingsIcon = ()=>{
return (
<IconContext.Provider value={{ style: { border: '1px solid #fff', padding: '10px 10px', fontSize: '20px', borderRadius: '50%' } }}>
<FaCog/>
</IconContext.Provider>
)
}

const Dropdown = ({ profile, TriggerDropdown, TriggerLogoutPopup, history }) => {
const Dropdown = ({ profile, TriggerDropdown, TriggerLogoutPopup }) => {
return (
<Fragment>
<main className='dropdown' onMouseLeave={ TriggerDropdown }>
Expand All @@ -50,10 +42,6 @@ const Dropdown = ({ profile, TriggerDropdown, TriggerLogoutPopup, history }) =>
<LockIcon/>
</header>

<nav className='dropdown-nav' onClick={ ()=>history.push('/settings') }>
<SettingsIcon/>
<div className='dropdown-nav-name'>Settings</div>
</nav>
<nav className='dropdown-nav' onClick={ TriggerLogoutPopup }>
<Icon/>
<div className='dropdown-nav-name'>Logout</div>
Expand All @@ -63,4 +51,4 @@ const Dropdown = ({ profile, TriggerDropdown, TriggerLogoutPopup, history }) =>
)
}

export default withRouter(Dropdown);
export default Dropdown;
25 changes: 1 addition & 24 deletions client/src/Containers/MainPage/mainPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ const AsyncMessageRoute = React.lazy(() => {
return import("../../Components/Messages/messages");
});

const AsyncSettings = React.lazy(() => {
return import("../Settings/settings");
});

const MainPage = ({ authenticate, history }) => {
const [ people_list, SetPeopleList ] = useState(null);
const [ requests, SetRequests ] = useState(null);
Expand Down Expand Up @@ -657,6 +653,7 @@ const MainPage = ({ authenticate, history }) => {
SetApiLimiter(true);
}
} else {
SetPostList(dummy_list)
SetTempPostList(null);
}
}
Expand Down Expand Up @@ -977,26 +974,6 @@ const MainPage = ({ authenticate, history }) => {
}}
/>

<Route
path="/settings"
exact
render={() => {
return (
<Suspense fallback={
<main className="main-post-container">
<LoadSpinner />
</main>}>

<AsyncSettings
blur={profile_alert || logout_popup || match_found_timeout ? "5px" : "0px"}
Profile={ my_profile_pic }
ChangeProfile = { (profile)=>SetMyProfilePic(profile) }
/>
</Suspense>
);
}}
/>

<Route
render={() => {
return (
Expand Down
3 changes: 2 additions & 1 deletion server/Routes/profile-confirm.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const cache = redis.createClient();
const router = express.Router();

router.post('/:Username', (req, res)=>{
console.log(true);
const ProfilePicture = req.body.ProfilePicture;
const Username = req.params.Username;
const MainPost = req.body.MainPost;
Expand All @@ -15,8 +16,8 @@ router.post('/:Username', (req, res)=>{
response.ProfilePicture = ProfilePicture;
response.MainPost = MainPost;
response.save().then(()=>{
cache.del(`profile-pic/${Username}`);
cache.set(`profile-pic/${Username}`, ProfilePicture, ()=>{
console.log('added')
return res.json({profile_added: true});
})
})
Expand Down
6 changes: 1 addition & 5 deletions server/Routes/profile-route.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import express from 'express';
import ProfilePictureCache from '../Middleware/redis-profile-cache.js';
import RegistrationModel from '../Models/register-model.js';
import redis from 'redis';
const cache = redis.createClient();

const router = express.Router();

Expand All @@ -11,9 +9,7 @@ router.get('/:Username', ProfilePictureCache, (req, res)=>{
RegistrationModel.findOne({ Username: Username }).exec().then((response)=>{
const ProfilePicture = response.ProfilePicture;
if(ProfilePicture.length >= 10){
cache.set(`profile-pic/${Username}`, ProfilePicture, ()=>{
return res.json(ProfilePicture);
})
return res.json(ProfilePicture);
}else{
return res.json(ProfilePicture);
}
Expand Down

0 comments on commit a018142

Please sign in to comment.