Merge pull request #2422 from bluewave-labs/feat/notification-on-click
feat: add row click handling to notificaitons table
This commit is contained in:
2 files changed
+12
-1
No files matched your search
@@ -131,7 +131,7 @@ const useEditNotification = () => {
|
|||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const [error, setError] = useState(null);
|
const [error, setError] = useState(null);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const navigate = useNavigate();
|
||||||
const editNotification = async (id, notification) => {
|
const editNotification = async (id, notification) => {
|
||||||
try {
|
try {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
@@ -139,6 +139,7 @@ const useEditNotification = () => {
|
|||||||
createToast({
|
createToast({
|
||||||
body: t("notifications.edit.success"),
|
body: t("notifications.edit.success"),
|
||||||
});
|
});
|
||||||
|
navigate(`/notifications`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setError(error);
|
setError(error);
|
||||||
createToast({
|
createToast({
|
||||||
|
|||||||
@@ -119,6 +119,16 @@ const Notifications = () => {
|
|||||||
</Stack>
|
</Stack>
|
||||||
<Typography variant="h1">{t("notifications.createTitle")}</Typography>
|
<Typography variant="h1">{t("notifications.createTitle")}</Typography>
|
||||||
<DataTable
|
<DataTable
|
||||||
|
config={{
|
||||||
|
onRowClick: (row) => navigate(`/notifications/${row._id}`),
|
||||||
|
rowSX: {
|
||||||
|
cursor: "pointer",
|
||||||
|
"&:hover td": {
|
||||||
|
backgroundColor: theme.palette.tertiary.main,
|
||||||
|
transition: "background-color .3s ease",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}}
|
||||||
headers={headers}
|
headers={headers}
|
||||||
data={notifications}
|
data={notifications}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in new issue
Block a user