From e5a5ed752c5cdd782a50e641024de9e37adf3a22 Mon Sep 17 00:00:00 2001 From: Connor Bechthold Date: Sun, 3 Dec 2023 19:10:16 -0500 Subject: [PATCH] fix up type errors --- .../components/pages/AdminControls/SignInLogs.tsx | 15 +++------------ .../pages/AdminControls/SignInLogsTable.tsx | 9 ++------- frontend/src/types/SignInLogsTypes.ts | 5 +++++ 3 files changed, 10 insertions(+), 19 deletions(-) create mode 100644 frontend/src/types/SignInLogsTypes.ts diff --git a/frontend/src/components/pages/AdminControls/SignInLogs.tsx b/frontend/src/components/pages/AdminControls/SignInLogs.tsx index b52219b1..70d876da 100644 --- a/frontend/src/components/pages/AdminControls/SignInLogs.tsx +++ b/frontend/src/components/pages/AdminControls/SignInLogs.tsx @@ -1,14 +1,11 @@ -import React, { useEffect, useRef, useState } from "react"; +import React, { useRef, useState } from "react"; import { Box, Flex } from "@chakra-ui/react"; - -import { PassThrough } from "stream"; import Pagination from "../../common/Pagination"; import NavigationBar from "../../common/NavigationBar"; import { User } from "../../../types/UserTypes"; import SignInLogsTable from "./SignInLogsTable"; import UserAPIClient from "../../../APIClients/UserAPIClient"; - - +import { SignInLog } from "../../../types/SignInLogsTypes"; const SignInLogsPage = (): React.ReactElement => { const [users, setUsers] = useState([]); @@ -37,19 +34,13 @@ const SignInLogsPage = (): React.ReactElement => { } }; - // Dummy data - type MyDictionary = { - [key: string]: any; - }; - // Create an array of dictionaries - const signInLogs: MyDictionary[] = [ + const signInLogs: SignInLog[] = [ { id: 1, date: "2023-12-03T13:30:00.000Z" , name: "Aathithan Chandrabalan" }, { id: 1, date: "2023-12-01T12:30:00.000Z" , name: "Phil Dunphy" }, { id: 1, date: "2023-12-04T15:11:00.000Z" , name: "Connor Bechthold" }, { id: 1, date: "2023-12-05T19:45:00.000Z" , name: "Bob Cob" }, { id: 1, date: "2023-12-05T21:23:00.000Z" , name: "Jessica P" }, - ]; return ( diff --git a/frontend/src/components/pages/AdminControls/SignInLogsTable.tsx b/frontend/src/components/pages/AdminControls/SignInLogsTable.tsx index 6742f0f8..c1690af3 100644 --- a/frontend/src/components/pages/AdminControls/SignInLogsTable.tsx +++ b/frontend/src/components/pages/AdminControls/SignInLogsTable.tsx @@ -9,12 +9,11 @@ import { Thead, Tr, } from "@chakra-ui/react"; -import { User } from "../../../types/UserTypes"; // Needs to be changed !! - import getFormattedDateAndTime from "../../../utils/DateUtils"; +import { SignInLog } from "../../../types/SignInLogsTypes"; type Props = { - signInLogs: { id: number; date: string; name: string }[]; + signInLogs: SignInLog[]; tableRef: RefObject; }; @@ -46,7 +45,6 @@ const SignInLogsTable = ({ const { date, time } = getFormattedDateAndTime(dateObj); return ( - {`${log.name}`} {date} @@ -54,10 +52,7 @@ const SignInLogsTable = ({ ); })} - - - diff --git a/frontend/src/types/SignInLogsTypes.ts b/frontend/src/types/SignInLogsTypes.ts new file mode 100644 index 00000000..5019957c --- /dev/null +++ b/frontend/src/types/SignInLogsTypes.ts @@ -0,0 +1,5 @@ +export type SignInLog = { + id: number, + name: string, + date: string +} \ No newline at end of file