@@ -8,7 +8,7 @@ import BookmarkedEvents from './BookmarkedEvents';
88import Calendar from './Calendar' ;
99import Loader from './Loader' ;
1010import NewEvents from './NewEvents' ;
11- import Publications from './Publications' ;
11+ // import Publications from './Publications';
1212import Stats from './Stats' ;
1313
1414const useStyles = makeStyles ( theme => ( {
@@ -23,6 +23,7 @@ export default function Dashboard() {
2323 const user = useSelector ( state => state . account . user ) ;
2424 const [ userEvents , setUserEvents ] = useState ( [ ] ) ;
2525 const [ loading , setLoading ] = useState ( true ) ;
26+ const [ attending , setAttending ] = useState ( 0 ) ;
2627
2728 useEffect ( ( ) => {
2829 const fetchUserEvents = async ( ) => {
@@ -34,6 +35,14 @@ export default function Dashboard() {
3435 . where ( 'createdBy' , '==' , `${ userId } ` )
3536 . get ( ) ;
3637
38+ const userRef = await db . collection ( 'users' ) . doc ( userId ) ;
39+ userRef . get ( ) . then ( doc => {
40+ if ( doc . exists ) {
41+ let data = doc . data ( ) ;
42+ setAttending ( data . attending . length ) ;
43+ }
44+ } ) ;
45+
3746 setUserEvents (
3847 userEventCollection . docs . map ( doc => doc . data ( ) ) ,
3948 setLoading ( false )
@@ -49,12 +58,12 @@ export default function Dashboard() {
4958 < Box display = "flex" >
5059 < Box flexGrow = { 1 } >
5160 { userEvents . length > 0 && < Calendar userEvents = { userEvents } /> }
52- < Stats conducted = { userEvents . length } />
61+ < Stats conducted = { userEvents . length } attending = { attending } />
5362 < BookmarkedEvents />
5463 </ Box >
5564 < Box maxWidth = "28em" minWidth = "24em" >
5665 < NewEvents />
57- < Publications />
66+ { /* <Publications /> */ }
5867 </ Box >
5968 </ Box >
6069 </ main >
0 commit comments