-
Notifications
You must be signed in to change notification settings - Fork 1
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
fixed table sizing with length of notes #68
base: main
Are you sure you want to change the base?
Changes from 14 commits
a0a4ec5
a558039
1058a1e
c18c146
d8a6ded
a66d29e
1c1601d
9eea14c
98222b9
5133385
eea8688
6c78ffc
df16b52
e148262
5bce935
c002066
ddfebe5
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 +1 @@ | ||
VITE_API_URL=api-url:port | ||
VITE_API_URL=api-url:port |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import { Table } from "@mantine/core"; | ||
import { useMantineTheme } from "@mantine/core"; | ||
import { Input, Textarea } from "@mantine/core"; | ||
|
||
interface DataTableProps { | ||
data?: MCAPFileInformation[]; | ||
|
@@ -17,7 +18,7 @@ export default function DataTable({ | |
setSelectedData, | ||
}: DataTableProps) { | ||
const theme = useMantineTheme(); | ||
|
||
const setPreviewData = (file: MCAPFileInformation) => { | ||
if (selectedRow === file.id) { | ||
setSelectedRow(""); | ||
|
@@ -30,8 +31,10 @@ export default function DataTable({ | |
|
||
// Take out when API server team implements filename id in their get route | ||
const getFileNameWithoutExtension = (fileNameWithExtension: string) => { | ||
const lastDotIndex = fileNameWithExtension.lastIndexOf('.'); | ||
return lastDotIndex !== -1 ? fileNameWithExtension.slice(0, lastDotIndex) : fileNameWithExtension; | ||
const lastDotIndex = fileNameWithExtension.lastIndexOf("."); | ||
return lastDotIndex !== -1 | ||
? fileNameWithExtension.slice(0, lastDotIndex) | ||
: fileNameWithExtension; | ||
}; | ||
|
||
const rows = !data ? ( | ||
|
@@ -51,18 +54,42 @@ export default function DataTable({ | |
<Table.Tr | ||
key={file.id} | ||
onClick={() => setPreviewData(file)} | ||
|
||
bg={selectedRow === file.id ? theme.primaryColor : ""} | ||
> | ||
<Table.Td>{getFileNameWithoutExtension(file.mcap_files[0].file_name)}</Table.Td> | ||
<Table.Td> | ||
{getFileNameWithoutExtension(file.mcap_files[0].file_name)} | ||
</Table.Td> | ||
<Table.Td>{file.date}</Table.Td> | ||
<Table.Td>{file.location}</Table.Td> | ||
<Table.Td>{file.notes}</Table.Td> | ||
|
||
{/* Change back to notes once notes field is implemented in the server */} | ||
{/* <Table.Td>{file.car_model}</Table.Td> */} | ||
<Table.Td> | ||
<Input.Wrapper> | ||
<Textarea | ||
variant="unstyled" | ||
value=" | ||
testing long text text text text text text text text text text text text text text text text text text text text text text" | ||
// now with four rows rows rows rows rows rows rows rows rows rows rows rows rows rows rows rows rows rows rows rows" | ||
// now with four rows rows rows rows rows rows rows rows rows rows rows rows rows rows rows rows rows rows rows rows" | ||
// now with four rows rows rows rows rows rows rows rows rows rows rows rows rows rows rows rows rows rows rows rows" | ||
style={{ whiteSpace: "normal", wordWrap: "break-word" }} | ||
readOnly | ||
placeholder="Note" | ||
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. |
||
rows={4} | ||
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. Can you avoid hard coding the amount of rows? Maybe make it dynamic? |
||
/> | ||
</Input.Wrapper> | ||
</Table.Td> | ||
|
||
</Table.Tr> | ||
)) | ||
); | ||
return ( | ||
<Table.ScrollContainer h="100%" minWidth={800} style={{ overflowY: 'auto' }}> | ||
<Table.ScrollContainer | ||
h="100%" | ||
minWidth={800} | ||
style={{ overflowY: "auto" }} | ||
> | ||
<Table | ||
stickyHeader | ||
highlightOnHover={data && data.length > 0} | ||
|
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.
Change this back to file.note