-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spinner #214
Spinner #214
Changes from all commits
e65cc1a
f75caba
8f551eb
38014ff
529ef90
c8b135f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import React, { useEffect, useRef, useState } from "react"; | ||
import { Box, Flex } from "@chakra-ui/react"; | ||
import { Box, Flex, Spinner } from "@chakra-ui/react"; | ||
|
||
import Pagination from "../../common/Pagination"; | ||
import NavigationBar from "../../common/NavigationBar"; | ||
|
@@ -18,10 +18,13 @@ const EmployeeDirectoryPage = (): React.ReactElement => { | |
const [pageNum, setPageNum] = useState<number>(1); | ||
const [userPageNum, setUserPageNum] = useState(pageNum); | ||
|
||
const [tableLoaded, setTableLoaded] = useState(false) | ||
|
||
// Table reference | ||
const tableRef = useRef<HTMLDivElement>(null); | ||
|
||
const getUsers = async (pageNumber: number) => { | ||
setTableLoaded(false) | ||
const data = await UserAPIClient.getUsers({ pageNumber, resultsPerPage }); | ||
|
||
// Reset table scroll | ||
|
@@ -35,6 +38,8 @@ const EmployeeDirectoryPage = (): React.ReactElement => { | |
} else { | ||
setPageNum(pageNumber); | ||
} | ||
|
||
setTableLoaded(true) | ||
}; | ||
|
||
const countUsers = async () => { | ||
|
@@ -71,23 +76,34 @@ const EmployeeDirectoryPage = (): React.ReactElement => { | |
/> | ||
</Flex> | ||
|
||
<EmployeeDirectoryTable | ||
users={users} | ||
tableRef={tableRef} | ||
userPageNum={userPageNum} | ||
setUserPageNum={setUserPageNum} | ||
getRecords={getUsers} | ||
countUsers={countUsers} | ||
/> | ||
<Pagination | ||
numRecords={numUsers} | ||
pageNum={pageNum} | ||
userPageNum={userPageNum} | ||
setUserPageNum={setUserPageNum} | ||
resultsPerPage={resultsPerPage} | ||
setResultsPerPage={setResultsPerPage} | ||
getRecords={getUsers} | ||
/> | ||
{!tableLoaded ? ( | ||
<Spinner | ||
thickness="4px" | ||
speed="0.65s" | ||
emptyColor="gray.200" | ||
size="xl" | ||
/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is no way to put these props in the default props section in the SpinnerStyles.tsx file. it just won't work. trust me, me and gpt have tried There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. skill issue |
||
) : ( | ||
connor-bechthold marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<Box> | ||
<EmployeeDirectoryTable | ||
users={users} | ||
tableRef={tableRef} | ||
userPageNum={userPageNum} | ||
setUserPageNum={setUserPageNum} | ||
getRecords={getUsers} | ||
countUsers={countUsers} | ||
/> | ||
<Pagination | ||
numRecords={numUsers} | ||
pageNum={pageNum} | ||
userPageNum={userPageNum} | ||
setUserPageNum={setUserPageNum} | ||
resultsPerPage={resultsPerPage} | ||
setResultsPerPage={setResultsPerPage} | ||
getRecords={getUsers} | ||
/> | ||
</Box> | ||
)} | ||
</Box> | ||
</Box> | ||
); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import type { ComponentStyleConfig } from "@chakra-ui/theme"; | ||
|
||
// Spinner styling | ||
const Spinner: ComponentStyleConfig = { | ||
baseStyle: { | ||
color: "teal.400", | ||
marginTop: "5%", | ||
}, | ||
defaultProps: { | ||
size: "xl", | ||
}, | ||
}; | ||
|
||
export default Spinner; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there some sort of error that appears that required this to be changed? residents should never be null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't recall changing this file in this PR, but yeah there is some error that requires this to be changed. i believe owen made a pr for it