feat: show checklist progress on public board page
This commit is contained in:
@@ -10,7 +10,7 @@ interface Props {
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
type ModalContextType = {
|
||||
interface ModalContextType {
|
||||
isOpen: boolean;
|
||||
openModal: (
|
||||
contentType: string,
|
||||
@@ -26,7 +26,7 @@ type ModalContextType = {
|
||||
getModalState: (modalType: string) => any;
|
||||
clearModalState: (modalType: string) => void;
|
||||
clearAllModalStates: () => void;
|
||||
};
|
||||
}
|
||||
|
||||
const ModalContext = createContext<ModalContextType | undefined>(undefined);
|
||||
|
||||
@@ -46,11 +46,11 @@ export const ModalProvider: React.FC<Props> = ({ children }) => {
|
||||
entityLabel?: string,
|
||||
) => {
|
||||
const newModal: ModalState = { contentType, entityId, entityLabel };
|
||||
setModalStack(prev => [...prev, newModal]);
|
||||
setModalStack((prev) => [...prev, newModal]);
|
||||
};
|
||||
|
||||
const closeModal = () => {
|
||||
setModalStack(prev => {
|
||||
setModalStack((prev) => {
|
||||
if (prev.length <= 1) {
|
||||
return [];
|
||||
}
|
||||
@@ -59,9 +59,9 @@ export const ModalProvider: React.FC<Props> = ({ children }) => {
|
||||
};
|
||||
|
||||
const setModalState = (modalType: string, state: any) => {
|
||||
setModalStates(prev => ({
|
||||
setModalStates((prev) => ({
|
||||
...prev,
|
||||
[modalType]: state
|
||||
[modalType]: state,
|
||||
}));
|
||||
};
|
||||
|
||||
@@ -70,7 +70,7 @@ export const ModalProvider: React.FC<Props> = ({ children }) => {
|
||||
};
|
||||
|
||||
const clearModalState = (modalType: string) => {
|
||||
setModalStates(prev => {
|
||||
setModalStates((prev) => {
|
||||
const newStates = { ...prev };
|
||||
delete newStates[modalType];
|
||||
return newStates;
|
||||
|
||||
@@ -13,7 +13,6 @@ import type { UpdateBoardInput } from "@kan/api/types";
|
||||
|
||||
import Button from "~/components/Button";
|
||||
import { DeleteLabelConfirmation } from "~/components/DeleteLabelConfirmation";
|
||||
import FeedbackModal from "~/components/FeedbackModal";
|
||||
import { LabelForm } from "~/components/LabelForm";
|
||||
import Modal from "~/components/modal";
|
||||
import { NewWorkspaceForm } from "~/components/NewWorkspaceForm";
|
||||
@@ -492,7 +491,7 @@ export default function BoardPage() {
|
||||
title={card.title}
|
||||
labels={card.labels}
|
||||
members={card.members}
|
||||
checklists={card.checklists}
|
||||
checklists={card.checklists ?? []}
|
||||
/>
|
||||
</Link>
|
||||
)}
|
||||
|
||||
@@ -175,6 +175,7 @@ export default function PublicBoardView() {
|
||||
<Card
|
||||
title={card.title}
|
||||
labels={card.labels}
|
||||
checklists={card.checklists ?? []}
|
||||
members={[]}
|
||||
/>
|
||||
</Link>
|
||||
|
||||
@@ -303,6 +303,27 @@ export const getBySlug = async (
|
||||
},
|
||||
},
|
||||
},
|
||||
checklists: {
|
||||
columns: {
|
||||
publicId: true,
|
||||
name: true,
|
||||
index: true,
|
||||
},
|
||||
where: isNull(checklists.deletedAt),
|
||||
orderBy: asc(checklists.index),
|
||||
with: {
|
||||
items: {
|
||||
columns: {
|
||||
publicId: true,
|
||||
title: true,
|
||||
completed: true,
|
||||
index: true,
|
||||
},
|
||||
where: isNull(checklistItems.deletedAt),
|
||||
orderBy: asc(checklistItems.index),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
where: and(
|
||||
cardIds.length > 0 ? inArray(cards.publicId, cardIds) : undefined,
|
||||
|
||||
Reference in New Issue
Block a user