fix: unpublished org/team avatar and i18n (#11429)

* fix: unpublished org/team avatar and i18n

* Fixing e2e
This commit is contained in:
Leo Giovanetti 2023-09-19 17:15:39 -03:00 committed by GitHub
parent 64850b54f0
commit bc89fe00ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 11 deletions

View File

@ -9,7 +9,7 @@ test.describe.configure({ mode: "parallel" });
const title = (name: string) => `${name} is unpublished`;
const description = (entity: string) =>
`This ${entity} link is currently not available. Please contact the ${entity} owner or ask them to publish it.`;
const avatar = (slug: string) => `/team/${slug}/avatar.png`;
const avatar = (slug: string, entity = "team") => `/${entity}/${slug}/avatar.png`;
test.afterAll(async ({ users }) => {
await users.deleteAll();
@ -52,7 +52,7 @@ test.describe("Unpublished", () => {
expect(await page.locator('[data-testid="empty-screen"]').count()).toBe(1);
expect(await page.locator(`h2:has-text("${title(org.name)}")`).count()).toBe(1);
expect(await page.locator(`div:text("${description("organization")}")`).count()).toBe(1);
await expect(page.locator(`img`)).toHaveAttribute("src", avatar(requestedSlug));
await expect(page.locator(`img`)).toHaveAttribute("src", avatar(requestedSlug, "org"));
});
test("Organization sub-team", async ({ users, page }) => {
@ -70,7 +70,7 @@ test.describe("Unpublished", () => {
expect(await page.locator('[data-testid="empty-screen"]').count()).toBe(1);
expect(await page.locator(`h2:has-text("${title(org.name)}")`).count()).toBe(1);
expect(await page.locator(`div:text("${description("organization")}")`).count()).toBe(1);
await expect(page.locator(`img`)).toHaveAttribute("src", avatar(requestedSlug));
await expect(page.locator(`img`)).toHaveAttribute("src", avatar(requestedSlug, "org"));
});
test("Organization sub-team event-type", async ({ users, page }) => {
@ -90,7 +90,7 @@ test.describe("Unpublished", () => {
expect(await page.locator('[data-testid="empty-screen"]').count()).toBe(1);
expect(await page.locator(`h2:has-text("${title(org.name)}")`).count()).toBe(1);
expect(await page.locator(`div:text("${description("organization")}")`).count()).toBe(1);
await expect(page.locator(`img`)).toHaveAttribute("src", avatar(requestedSlug));
await expect(page.locator(`img`)).toHaveAttribute("src", avatar(requestedSlug, "org"));
});
test("Organization user", async ({ users, page }) => {
@ -102,7 +102,7 @@ test.describe("Unpublished", () => {
expect(await page.locator('[data-testid="empty-screen"]').count()).toBe(1);
expect(await page.locator(`h2:has-text("${title(org.name)}")`).count()).toBe(1);
expect(await page.locator(`div:text("${description("organization")}")`).count()).toBe(1);
await expect(page.locator(`img`)).toHaveAttribute("src", avatar(requestedSlug));
await expect(page.locator(`img`)).toHaveAttribute("src", avatar(requestedSlug, "org"));
});
test("Organization user event-type", async ({ users, page }) => {
@ -115,6 +115,6 @@ test.describe("Unpublished", () => {
expect(await page.locator('[data-testid="empty-screen"]').count()).toBe(1);
expect(await page.locator(`h2:has-text("${title(org.name)}")`).count()).toBe(1);
expect(await page.locator(`div:text("${description("organization")}")`).count()).toBe(1);
await expect(page.locator(`img`)).toHaveAttribute("src", avatar(requestedSlug));
await expect(page.locator(`img`)).toHaveAttribute("src", avatar(requestedSlug, "org"));
});
});

View File

@ -1743,7 +1743,8 @@
"show_on_booking_page": "Show on booking page",
"get_started_zapier_templates": "Get started with Zapier templates",
"team_is_unpublished": "{{team}} is unpublished",
"team_is_unpublished_description": "This {{entity}} link is currently not available. Please contact the {{entity}} owner or ask them to publish it.",
"org_is_unpublished_description": "This organization link is currently not available. Please contact the organization owner or ask them to publish it.",
"team_is_unpublished_description": "This team link is currently not available. Please contact the team owner or ask them to publish it.",
"team_member": "Team member",
"a_routing_form": "A Routing Form",
"form_description_placeholder": "Form Description",

View File

@ -13,13 +13,17 @@ export function UnpublishedEntity(props: UnpublishedEntityProps) {
return (
<div className="m-8 flex items-center justify-center">
<EmptyScreen
avatar={<Avatar alt={slug ?? ""} imageSrc={`/team/${slug}/avatar.png`} size="lg" />}
avatar={
<Avatar
alt={slug ?? ""}
imageSrc={props.orgSlug ? `/org/${slug}/avatar.png` : `/team/${slug}/avatar.png`}
size="lg"
/>
}
headline={t("team_is_unpublished", {
team: props.name,
})}
description={t("team_is_unpublished_description", {
entity: props.orgSlug ? t("organization").toLowerCase() : t("team").toLowerCase(),
})}
description={t(`${props.orgSlug ? "org" : "team"}_is_unpublished_description`)}
/>
</div>
);