Skip to content

Add 'delete scratch' button to user profile page#1943

Open
MatBourgon wants to merge 13 commits into
decompme:mainfrom
MatBourgon:profile-scratch-delete-button
Open

Add 'delete scratch' button to user profile page#1943
MatBourgon wants to merge 13 commits into
decompme:mainfrom
MatBourgon:profile-scratch-delete-button

Conversation

@MatBourgon
Copy link
Copy Markdown

These changes add a 'delete scratch' button to the user's profile, only viewable and usable by themselves and admins.
The button starts white and prompts for confirmation before deletion, but can be bypassed by holding shift (which also turns the button red).

image image

Comment thread frontend/src/components/ScratchItem.tsx Outdated
@mkst
Copy link
Copy Markdown
Collaborator

mkst commented May 27, 2026

I'm wondering if the delete button should be a filled red pill that's like [🗑️ delete] to match the 100% pill.. perhaps the pressing shift doesnt need to change the visualisation, just suppresses the prompt?

…k it to match the improvement slot banner sizing a bit better; removed extra whitespace
@MatBourgon
Copy link
Copy Markdown
Author

MatBourgon commented May 27, 2026

I've gone ahead and done that, so it no longer reacts to pressing shift, but the confirmation still gets skipped. I've also resized the button to match the pill's size a bit better:
image

Unless I misunderstood the comment and by 'filled' you meant red bg with white text, in which case I can quickly fix as well.

@mkst
Copy link
Copy Markdown
Collaborator

mkst commented May 27, 2026

Yeh I mean so it looks like it belongs next to the 100% pill 😎

@MatBourgon
Copy link
Copy Markdown
Author

Sounds good 😎
Here's how it looks like now:
image

@mkst
Copy link
Copy Markdown
Collaborator

mkst commented May 27, 2026

Nice!

Could you remove the translate y that i added to the progress pill css... When i was looking on my phone i needed to shift the text down, but now every time i look at it, its definitely wrong to have done so...

transform: translate(-2px, 1px);

This ^^ just change the 1px to 0, and/or make it translateX instead

@mkst
Copy link
Copy Markdown
Collaborator

mkst commented May 27, 2026

What would actually be pretty cool, is to hide the "Delete" word on mobile, so its just the trash can icon on small screens.

You can do something similar to this code :

<span className="hidden md:inline">{text}</span>

@MatBourgon
Copy link
Copy Markdown
Author

I've handled the fix to the translation, but I'm not too sure about the mobile styling. It doesn't quite look right.
image

Unless you're fine with this.

@mkst
Copy link
Copy Markdown
Collaborator

mkst commented May 27, 2026

ah no i meant to shrink the width to be more like a square ignore my poor paint skills but like this (but with the trash icon):

image

@MatBourgon
Copy link
Copy Markdown
Author

Oh gotcha. I'm not too sure how to apply custom stylings specifically for mobile so I can't quite get it to be square shaped, but I've got it like this now:

image image

}

.delete-button {
--warning-color: #ce3a3a;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might be worth trying to use tailwind for styling .. we're slowly moving away from the explicit (s)css to using tailwind. might help with all the !importants


try {
await api.delete_(scratchUrl(scratch), {});
setShowElement(false); // Hide deleted element to avoid performing a page refresh, and allow deleting more scratches
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should disable the delete (have some const [isDeleting, setIsDeleting] = useState(false) and then set isDeleting before the delete (and disable the button to avoid users double-clicking?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants