From 63eb48835f2ba7c6fe6d151b9efdf67abc43434c Mon Sep 17 00:00:00 2001 From: GiseleN523 Date: Sat, 24 Aug 2024 10:55:17 -0500 Subject: [PATCH] don't let row title be blank, updating row titles when title changes externally, switched row onclick to a link overlay --- client/src/Tools/_framework/Paths/Home.tsx | 1 + client/src/Widgets/ActivityTable.tsx | 399 ++++++++++----------- 2 files changed, 200 insertions(+), 200 deletions(-) diff --git a/client/src/Tools/_framework/Paths/Home.tsx b/client/src/Tools/_framework/Paths/Home.tsx index 0b1f77576..c551da561 100644 --- a/client/src/Tools/_framework/Paths/Home.tsx +++ b/client/src/Tools/_framework/Paths/Home.tsx @@ -178,6 +178,7 @@ export function Home() { justifyContent="center" bg={blackColor} py="30px" + overflow="hidden" > + + + + + {activity.authorRow ? ( + + ) : ( + + )} + + + + + + + setRowTitle(txt)} + onSubmit={saveUpdatedTitle} + > + + { + // prevent click default/propagation behavior one time (aka right now as user is clicking to blur input) + document.addEventListener( + "click", + (e) => { + e.preventDefault(); + e.stopPropagation(); + }, + { capture: true, once: true }, + ); + }} + /> + + {activity.isPublic || activity.isShared ? ( + + ) : null} + + + {showAssignmentStatus ? ( + {assignmentStatusString} + ) : null} + + + {showPublicStatus ? ( + {activity.isPublic ? "Public" : "Private"} + ) : null} + + {showAssignmentStatus ? ( + {assignmentStatusString} + ) : null} + + {(!suppressAvatar && !activity.authorRow) || + (showOwnerName) ? ( + + + {suppressAvatar || activity.authorRow ? null : ( + + + + )} + {showOwnerName && !activity.authorRow ? ( + {activity.ownerName} + ) : null} + + + ) : null} + + {activity.menuItems ? ( + + + + + + {activity.menuItems} + + + ) : null} + + + ); +} + export default forwardRef(function ActivityTable( { content, @@ -59,15 +254,9 @@ export default forwardRef(function ActivityTable( }, ref: React.ForwardedRef, ) { - const navigate = useNavigate(); - const fetcher = useFetcher(); - - // this state does not do much; its purpose is to prevent the edge case of someone clicking to select the text input, and, - // without letting go, dragging it on top of a link so that the link is triggered - const [titleBeingEdited, setTitleBeingEdited] = useState(false); return ( - + @@ -82,197 +271,7 @@ export default forwardRef(function ActivityTable( - {content.map(function (activity) { - - const rowLink = activity.cardLink && !titleBeingEdited ? activity.cardLink : ""; - - let assignmentStatusString: string = - activity.assignmentStatus !== null && - activity.assignmentStatus !== undefined && - activity.assignmentStatus !== "Unassigned" - ? activity.assignmentStatus - : ""; - - if ( - activity.assignmentStatus === "Open" && - activity.closeTime !== undefined - ) { - assignmentStatusString = - assignmentStatusString + " until " + activity.closeTime; - } - - function saveUpdatedTitle(newTitle: string) { - if (newTitle !== activity.title && activity.id !== undefined) { - fetcher.submit( - { - _action: "update title", - id: activity.id, - cardTitle: newTitle, - isFolder: Boolean(activity.isFolder), - }, - { method: "post" }, - ); - } - } - - return ( - - // activity.cardLink && !titleBeingEdited - // ? navigate(activity.cardLink) - // : null - // } - > - - - {showPublicStatus ? ( - - ) : null} - - {showAssignmentStatus ? ( - - ) : null} - - {(!suppressAvatar && !activity.authorRow) || - (showOwnerName && !activity.authorRow) ? ( - - ) : null} - - - ); - })} + {content.map((activity) => )}
- - - {activity.authorRow ? ( - - ) : ( - - )} - - - - - activity.editableTitle ? e.stopPropagation() : null} - onEdit={() => setTitleBeingEdited(true)} - onSubmit={(txt) => { - saveUpdatedTitle(txt); - setTitleBeingEdited(false); - }} - > - - { - // prevent click default/propagation behavior one time (aka right now as user is clicking to blur input) - document.addEventListener( - "click", - (e) => { - e.preventDefault(); - e.stopPropagation(); - }, - { capture: true, once: true }, - ); - }} - /> - - {activity.isPublic || activity.isShared ? ( - - ) : null} - - - {showAssignmentStatus ? ( - {assignmentStatusString} - ) : null} - - {activity.isPublic ? "Public" : "Private"}{assignmentStatusString} - - {suppressAvatar || activity.authorRow ? null : ( - - - - )} - {showOwnerName && !activity.authorRow ? ( - {activity.ownerName} - ) : null} - - - {activity.menuItems ? ( - - e.stopPropagation()} - > - - - e.stopPropagation()} - > - {activity.menuItems} - - - ) : null} -