Skip to content

Commit

Permalink
fix up type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Connor Bechthold committed Dec 4, 2023
1 parent 1818e36 commit e5a5ed7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 19 deletions.
15 changes: 3 additions & 12 deletions frontend/src/components/pages/AdminControls/SignInLogs.tsx
Original file line number Diff line number Diff line change
@@ -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<User[]>([]);
Expand Down Expand Up @@ -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 (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<HTMLDivElement>;
};

Expand Down Expand Up @@ -46,18 +45,14 @@ const SignInLogsTable = ({
const { date, time } = getFormattedDateAndTime(dateObj);

return (

<Tr key={log.id} style={{ verticalAlign: "middle" }}>
<Td width="33%">{`${log.name}`}</Td>
<Td width="33%">{date}</Td>
<Td width="5%">{time}</Td>
</Tr>
);
})}

</Tbody>


</Table>
</TableContainer>
</Box>
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/types/SignInLogsTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export type SignInLog = {
id: number,
name: string,
date: string
}

0 comments on commit e5a5ed7

Please sign in to comment.