-
Notifications
You must be signed in to change notification settings - Fork 4
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
Move temporary records functionality to crashes list #1654
base: nextjs
Are you sure you want to change the base?
Changes from all commits
82cfd15
8ed3b3a
702b8a2
12aea9d
a81fae3
3aed280
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,25 +1,53 @@ | ||
"use client"; | ||
import { useState, useCallback } from "react"; | ||
import Card from "react-bootstrap/Card"; | ||
import Button from "react-bootstrap/Button"; | ||
import AlignedLabel from "@/components/AlignedLabel"; | ||
import AppBreadCrumb from "@/components/AppBreadCrumb"; | ||
import CreateCrashRecordModal from "@/components/CreateCrashRecordModal"; | ||
import { FaCirclePlus } from "react-icons/fa6"; | ||
import { crashesListViewColumns } from "@/configs/crashesListViewColumns"; | ||
import { crashesListViewQueryConfig } from "@/configs/crashesListViewTable"; | ||
import TableWrapper from "@/components/TableWrapper"; | ||
const localStorageKey = "crashesListViewQueryConfig"; | ||
|
||
export default function Crashes() { | ||
const [refetch, setRefetch] = useState(false); | ||
const [showNewUserModal, setShowNewUserModal] = useState(false); | ||
const onCloseModal = () => setShowNewUserModal(false); | ||
|
||
const onSaveCallback = useCallback(() => { | ||
setRefetch((prev) => !prev); | ||
setShowNewUserModal(false); | ||
}, [setRefetch]); | ||
|
||
return ( | ||
<> | ||
<AppBreadCrumb /> | ||
<Card> | ||
<Card.Header className="fs-5 fw-bold">Crashes</Card.Header> | ||
<Card.Header className="fs-5 fw-bold d-flex justify-content-between"> | ||
Crashes | ||
<Button className="me-2" onClick={() => setShowNewUserModal(true)}> | ||
<AlignedLabel> | ||
<FaCirclePlus className="me-2" /> | ||
<span>Create crash record</span> | ||
</AlignedLabel> | ||
</Button> | ||
</Card.Header> | ||
<Card.Body> | ||
<TableWrapper | ||
columns={crashesListViewColumns} | ||
initialQueryConfig={crashesListViewQueryConfig} | ||
localStorageKey={localStorageKey} | ||
refetch={refetch} | ||
/> | ||
</Card.Body> | ||
</Card> | ||
<CreateCrashRecordModal | ||
onClose={onCloseModal} | ||
show={showNewUserModal} | ||
onSubmitCallback={onSaveCallback} | ||
/> | ||
</> | ||
); | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -203,7 +203,8 @@ const crashesListViewfilterCards: FilterGroup[] = [ | |
{ | ||
id: "internal_filters", | ||
label: "Internal", | ||
groupOperator: "_or", | ||
// because one of the filters is enabled and inverted we need to join using the "_and" operator | ||
groupOperator: "_and", | ||
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. 👍 🙏 |
||
filterGroups: [ | ||
{ | ||
id: "private_drive", | ||
|
@@ -220,6 +221,20 @@ const crashesListViewfilterCards: FilterGroup[] = [ | |
}, | ||
], | ||
}, | ||
{ | ||
id: "is_temp_record", | ||
label: "Temporary records", | ||
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. What would you think about adding the word "Only" to the label here, so it reads "Only temporary records?" The idea being that the two internal filters have a very different interaction to the existing set. "Include private drive crashes" adds to the existing set by allowing in more crashes, and "Temporary records" is unclear if it's going to limit to just temporary records or allow the temporary records to be added to the existing set being shown. Because it ends up doing a different operation (limit as opposed to add-to) as the previous option, I think adding a verb to the label can help the user get the right expectation. I feel like I've done a really poor job in explaining my rational - LMK if i can help explain any of this better. Edit: I was reading more of this as I reviewed, and you pointed out how the one above is |
||
groupOperator: "_and", | ||
enabled: false, | ||
filters: [ | ||
{ | ||
id: "is_temp_record", | ||
column: "is_temp_record", | ||
operator: "_eq", | ||
value: true, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
]; | ||
|
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.
This is totally outside the scope of this PR, but while I was reviewing it, a typo jumped out at me in this file. Would you mind adding a space to the comment
/** Check local storage for initialsidebar state */
on line 42? No big if not!!