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
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions core/app/c/[communitySlug]/pubs/[pubId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { MembersList } from "~/app/components//Memberships/MembersList";
import { PubsRunActionDropDownMenu } from "~/app/components/ActionUI/PubsRunActionDropDownMenu";
import { AddMemberDialog } from "~/app/components/Memberships/AddMemberDialog";
import { CreatePubButton } from "~/app/components/pubs/CreatePubButton";
import { RemovePubButton } from "~/app/components/pubs/RemovePubButton";
import SkeletonTable from "~/app/components/skeletons/SkeletonTable";
import { db } from "~/kysely/database";
import { getPageLoginData } from "~/lib/authentication/loginData";
Expand Down Expand Up @@ -156,12 +157,20 @@ export default async function Page(props: {
</div>
<h1 className="mb-2 text-xl font-bold">{getPubTitle(pub)} </h1>
</div>
<Button variant="outline" asChild className="flex items-center gap-1">
<Link href={`/c/${communitySlug}/pubs/${pub.id}/edit`}>
<Pencil size="14" />
Update
</Link>
</Button>
<div className="flex items-center gap-2">
<Button
variant="outline"
size="sm"
asChild
className="flex items-center gap-x-2 py-4"
>
<Link href={`/c/${communitySlug}/pubs/${pub.id}/edit`}>
<Pencil size="12" />
<span>Update</span>
</Link>
</Button>
<RemovePubButton pubId={pub.id} />
</div>
</div>

<div className="flex flex-wrap space-x-4">
Expand Down
6 changes: 3 additions & 3 deletions core/playwright/pub.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ test.describe("Moving a pub", () => {
await pubDetailsPage.goTo();
await expect(page.getByTestId("current-stage")).toHaveText("Submitted");
// For this initial stage, there are only destinations ,no sources
await page.getByRole("button", { name: "Move" }).click();
await page.getByRole("button", { name: "Move", exact: true }).click();
const sources = page.getByTestId("sources");
const destinations = page.getByTestId("destinations");
await expect(sources).toHaveCount(0);
await destinations.getByRole("button", { name: "Ask Author For Consent" }).click();
await expect(page.getByTestId("current-stage")).toHaveText("Ask Author for Consent");

// Open the move modal again and expect to be able to move to sources and destinations
await page.getByRole("button", { name: "Move" }).click();
await page.getByRole("button", { name: "Move", exact: true }).click();
await expect(sources.getByRole("button", { name: "Submitted" })).toHaveCount(1);
await expect(destinations.getByRole("button", { name: "To Evaluate" })).toHaveCount(1);
});
Expand All @@ -91,7 +91,7 @@ test.describe("Moving a pub", () => {
const pubDetailsPage = new PubDetailsPage(page, COMMUNITY_SLUG, pubId);
await pubDetailsPage.goTo();
await expect(page.getByTestId("current-stage")).toHaveText("Shelved");
await expect(page.getByRole("button", { name: "Move" })).toHaveCount(0);
await expect(page.getByRole("button", { name: "Move", exact: true })).toHaveCount(0);
});
});

Expand Down
Loading