Skip to content

Commit

Permalink
Update Search screen dashboard widgets, #110
Browse files Browse the repository at this point in the history
  • Loading branch information
sabkuah committed Apr 16, 2021
1 parent d4c2e6d commit ae7326f
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions client/src/views/dashboard/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@ const Dashboard = ({ children }) => {
const [value, onChange] = useState(new Date());
const location = useLocation();
const USER_COMMUNITY_URL = '/user/communities';
const USER_SEARCH_URL = '/user/communities/search';
const [token] = useLocalStorage('token');
const [community, setCommunity] = useState(null);

useEffect(() => {
const communityId = location.pathname.substr(18, 35);
// console.log('community ID >>', communityId);
console.log('community ID >>', communityId);
// console.log('location', location);
communityId &&
communityId !== 'search' &&
(async () => {
const response = await getCommunity({ id: communityId, token });
console.log('community response', response.community);
console.log('community response', response?.community);
setCommunity(response.community);
})();
}, []);
Expand All @@ -34,13 +36,15 @@ const Dashboard = ({ children }) => {

<div className='col-xs-12 col-lg-3 col-xs-12 col-lg-3 animate__animated animate__fadeInRight '>
<div className='d-flex justify-content-center flex-column'>
{location.pathname !== USER_COMMUNITY_URL && (
<Weather community={community} />
)}
{location.pathname !== USER_COMMUNITY_URL &&
location.pathname !== USER_SEARCH_URL && (
<Weather community={community} />
)}
<Calendar onChange={onChange} value={value} />
{location.pathname !== USER_COMMUNITY_URL && (
<Messaging community={community} />
)}
{location.pathname !== USER_COMMUNITY_URL &&
location.pathname !== USER_SEARCH_URL && (
<Messaging community={community} />
)}
</div>
</div>
</div>
Expand Down

0 comments on commit ae7326f

Please sign in to comment.