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

feat: add remove button to pub page #987

Merged
merged 4 commits into from
Feb 25, 2025
Merged

feat: add remove button to pub page #987

merged 4 commits into from
Feb 25, 2025

Conversation

tefkah
Copy link
Member

@tefkah tefkah commented Feb 25, 2025

Issue(s) Resolved

Can't remove pub from pub page, only from Pub list or stages page.

High-level Explanation of PR

Just add the PubRemoveButton to /c/[communitySlug]/pubs/[pubId]

Test Plan

  1. Create new Pub
  2. Go to Pub page
  3. Press remove button

Screenshots (if applicable)

image

Notes

Copy link
Contributor

@allisonking allisonking left a comment

Choose a reason for hiding this comment

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

works great! only thing is after deletion, we're left with an unauthorized page, maybe it'd be better to redirect back to the all pubs page?

image

@tefkah
Copy link
Member Author

tefkah commented Feb 25, 2025

oh good catch! that is kind of weird yeah, i will make it redirect

@tefkah tefkah requested a review from allisonking February 25, 2025 16:59
@tefkah
Copy link
Member Author

tefkah commented Feb 25, 2025

@allisonking ive fixed this now, but the redirect can be a bit janky...

eg if the actions after the pub has been removed take a long time, you will still see the "Not authorized page"

to see this, replace this

const onSubmit = async () => {
const result = await runRemovePub({
pubId,
});
if (result && "success" in result) {
toast({
title: "Success",
description: result.report,
});
closeForm();
}
};

with

	const onSubmit = async () => {
		const result = await runRemovePub({
			pubId,
		});

		if (result && "success" in result) {
			toast({
				title: "Success",
				description: result.report,
			});
			// simulating... a slow computer?
			await new Promise((resolve) => setTimeout(resolve, 2_000));
			closeForm();
		}
	};

Here in action

Screen.Recording.2025-02-25.at.18.02.15.mov

The alternative would be to add the redirect to the server action instead, but then we can't show the user a confirmation dialogue (easily).

Do you think this is good enough?

@allisonking
Copy link
Contributor

ah yeah I think that's ok for now! thanks for implementing it!!

@tefkah tefkah merged commit bc57639 into main Feb 25, 2025
6 checks passed
@tefkah tefkah deleted the tfk/remove-pub-button branch February 25, 2025 17:22
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.

3 participants