Skip to content

Commit

Permalink
added hacker count to analytics tab (#508)
Browse files Browse the repository at this point in the history
* added hacker count to analytics tab

* Run Prettier

* fix userdata

* Run Prettier

* .

* Run Prettier

* prettier please

* Run Prettier

---------

Co-authored-by: Stanley Zheng <[email protected]>
Co-authored-by: szheng31 <[email protected]>
Co-authored-by: lisaliuu <[email protected]>
Co-authored-by: lisaliuu <[email protected]>
  • Loading branch information
5 people authored Sep 17, 2024
1 parent f299ac7 commit 2a9d199
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion components/Organizer/AnalyticsTab/AnalyticsTab.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Table } from 'antd';

import useSWR from 'swr';
import { DietaryData, ResponseError } from '../../../types/database';
import { DietaryData, ResponseError, UserData } from '../../../types/database';
import { RequestType, useCustomSWR } from '../../../utils/request-utils';
import React, { useState, useRef, useEffect } from 'react';

Expand Down Expand Up @@ -34,9 +34,17 @@ export default function Analytics() {
}))
: undefined;

// Hacker data
const { data: hackersData, error: hackersError } = useCustomSWR<UserData[]>({
url: '/api/users?usertype=HACKER',
method: RequestType.GET,
errorMessage: 'Failed to get list of hackers.',
});

return (
<>
<Table columns={columns} dataSource={formattedDietaryData}></Table>
<p>Hacker Count: {hackersData?.length}</p>
</>
);
}

0 comments on commit 2a9d199

Please sign in to comment.