some swipe to delete little changes

This commit is contained in:
corgifist 2025-08-04 23:57:17 +03:00
parent b5f6a1ee8c
commit 453aef5bfa
2 changed files with 4 additions and 4 deletions

View File

@ -441,7 +441,7 @@ const ProjectContainer = ({
<div className="absolute bottom-0 left-0 p-2 w-[85%] flex flex-col" data-selectable="true" > <div className="absolute bottom-0 left-0 p-2 w-[85%] flex flex-col" data-selectable="true" >
<h3 className="text-sm sm:text-sm md:text-md lg:text-lg font-semibold line-clamp-1" data-selectable="true">{project.title}</h3> <h3 className="text-sm sm:text-sm md:text-md lg:text-lg font-semibold line-clamp-1" data-selectable="true">{project.title}</h3>
{project.description && <p className="text-sm text-secondary-foreground line-clamp-1" data-selectable="true">{project.description}</p>} {project.description && <p className="text-sm text-secondary-foreground line-clamp-1" data-selectable="true">{project.description}</p>}
{project.editDate && <p className="text-sm text-secondary-foreground" data-selectable="true">Last Edit Date: {date.toLocaleDateString()}, {date.toLocaleTimeString([], { timeStyle: "short" })}</p>} {project.editDate && <time dateTime={date.toISOString()} className="text-sm text-secondary-foreground" data-selectable="true">Last Edit Date: {date.toLocaleDateString()}, {date.toLocaleTimeString([], { timeStyle: "short" })}</time>}
</div> </div>
</div> </div>
</LinkComponent> </LinkComponent>

View File

@ -141,10 +141,10 @@ const SwipeToDelete: FC<SwipeToDeleteProps> = ({
text.current?.classList.add('ios-ease'); text.current?.classList.add('ios-ease');
const textWidth = text.current ? text.current.getBoundingClientRect().width : 0; const textWidth = text.current ? text.current.getBoundingClientRect().width : 0;
if (((velocity < 0 && Math.abs(velocity) > 10) || dragX < -textWidth * 1.5 && velocity > 0) && text.current) { if (((velocity < 0 && Math.abs(velocity) > 10) || dragX < -textWidth * 1.5 && velocity > 0) && text.current) {
if (velocity < -10) { if (velocity > window.innerWidth * 0.15) {
setDragX(-textWidth * 1.5);
} else {
setDragX(0); setDragX(0);
} else {
setDragX(-textWidth * 1.5);
} }
} else if (allowOverscroll && dragX > 0 && velocity > 0) { } else if (allowOverscroll && dragX > 0 && velocity > 0) {
setDragX(0); setDragX(0);