Skip to content
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

Checklist #2168

Merged
merged 9 commits into from
May 27, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix
  • Loading branch information
timmo001 committed May 27, 2023
commit 64917455047276f97f64fb0f9949c7c107fb45d3
21 changes: 6 additions & 15 deletions src/components/dashboard/views/widgets/Checklist.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
CheckBoxRounded,
AddRounded,
} from "@mui/icons-material";
import { useRouter } from "next/navigation";
import { useState } from "react";

import type { WidgetChecklistModel, WidgetModel } from "@/types/widget.type";
Expand All @@ -23,12 +22,10 @@ function WidgetChecklistItem({
dashboardId,
item,
sectionId,
handleDeleted,
}: {
dashboardId: string;
item: WidgetChecklistItemModel;
sectionId: string;
handleDeleted: () => void;
}): JSX.Element {
const { id, checklistWidgetId, content } = item;
const [checked, setChecked] = useState<boolean>(item.checked);
Expand Down Expand Up @@ -78,7 +75,6 @@ function WidgetChecklistItem({
"id",
"DELETE"
);
handleDeleted();
}}
edge="end"
>
Expand Down Expand Up @@ -111,20 +107,18 @@ export function WidgetChecklist({
sectionId: string;
widget: WidgetModel<WidgetChecklistModel>;
}): JSX.Element {
const router = useRouter();
const { id } = widget;
if (!widget.data) return <div>Widget data not found</div>;
const { items } = widget.data;

return (
<Grid2 container direction="column">
{widget.data.items.map((item: WidgetChecklistItemModel) => (
{items.map((item: WidgetChecklistItemModel) => (
<WidgetChecklistItem
key={item.id}
dashboardId={dashboardId}
item={item}
sectionId={sectionId}
handleDeleted={() => {
// startTransition(() => {
// router.refresh();
// });
}}
/>
))}
<Grid2>
Expand All @@ -136,14 +130,11 @@ export function WidgetChecklist({
await widgetChecklistUpdate(
dashboardId,
sectionId,
widget.id,
id,
"",
"content",
""
);
// startTransition(() => {
// router.refresh();
// });
}}
>
<AddRounded />
Expand Down
Loading