-
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 13 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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import "@mantine/core/styles.css"; | ||
import { MantineProvider } from "@mantine/core"; | ||
import { theme } from "@/theme"; | ||
import { data } from "@/data/sampledata"; | ||
import { useState } from "react"; | ||
import Navbar from "@/components/Navbar"; | ||
import SearchBar from "@/components/SearchBar"; | ||
import "@/css/App.css"; | ||
import DataTable from "@/components/DataTable"; | ||
import PreviewCard from "@/components/PreviewCard"; | ||
|
||
export default function App() { | ||
const [filteredData, setFilteredData] = useState<MCAPFileInformation[]>(data); | ||
|
||
return ( | ||
<MantineProvider theme={theme}> | ||
<div className="app-container"> | ||
<header className="navbar"> | ||
<Navbar /> | ||
</header> | ||
|
||
<div className="main-content static"> | ||
<div className="results-container"> | ||
|
||
<div className="table-contain-result scrollable-container"> | ||
<div className="scrollable"> | ||
<DataTable data={filteredData} /> | ||
</div> | ||
</div> | ||
|
||
<div className="search-container scrollable"> | ||
<SearchBar setFilteredData={setFilteredData}/> | ||
</div> | ||
|
||
</div> | ||
<div className="preview-contain-result"> | ||
<PreviewCard /> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
{/* <PreviewCard /> */} | ||
</MantineProvider> | ||
); | ||
} |
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=" | ||
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. Change this back to file.note |
||
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.
You should look at how the main branch deals with utilizing main.tsx! We decided to add in new pages for changelog and documentation so this will be helpful in understanding the frontend structure :)
(so basically we are not using App.tsx anymore and it should be deleted!)