From 960caeb08596579c35fe8347fdc4c4ea38bd2954 Mon Sep 17 00:00:00 2001 From: EduardZaydler <117674342+EduardZaydler@users.noreply.github.com> Date: Tue, 10 Dec 2024 16:50:54 +0500 Subject: [PATCH] teams page redesign (#563) --- playwright/e2eTests/teamsOperations.spec.ts | 4 ++- playwright/e2eTests/triggerOperations.spec.ts | 3 +- playwright/pages/teams.page.ts | 8 +++-- .../ChristmasMoodToggle.tsx | 13 ++++++-- src/Components/Grid/Grid.less | 1 - src/Components/Header/Header.tsx | 5 ++-- src/Components/Teams/TeamCard/TeamCard.tsx | 7 ++++- src/Components/Teams/Teams.tsx | 10 ++----- src/Components/TeamsList/TeamsList.tsx | 23 ++++++++++++++ .../AllTeamsContainer/AllTeamsContainer.less | 5 ---- .../AllTeamsContainer/AllTeamsContainer.tsx | 30 ++++--------------- src/Containers/SettingsContainer.tsx | 2 +- src/Containers/TeamContainer.tsx | 25 ---------------- src/Containers/TeamWithUsers.tsx | 25 ---------------- src/Containers/TeamsContainer.tsx | 4 +-- src/Domain/Global.ts | 2 -- src/desktop.bundle.tsx | 2 -- src/hooks/themes/useThemeFeature.ts | 2 +- src/hooks/useChristmasMood.ts | 4 +-- src/hooks/useFeatureFlag.ts | 2 +- src/store/Reducers/UIReducer.slice.ts | 5 +--- yarn.lock | 11 ++----- 22 files changed, 67 insertions(+), 126 deletions(-) create mode 100644 src/Components/TeamsList/TeamsList.tsx delete mode 100644 src/Containers/AllTeamsContainer/AllTeamsContainer.less delete mode 100644 src/Containers/TeamContainer.tsx delete mode 100644 src/Containers/TeamWithUsers.tsx diff --git a/playwright/e2eTests/teamsOperations.spec.ts b/playwright/e2eTests/teamsOperations.spec.ts index 877d4f434..5c8634aef 100644 --- a/playwright/e2eTests/teamsOperations.spec.ts +++ b/playwright/e2eTests/teamsOperations.spec.ts @@ -35,6 +35,7 @@ test("Add team", async ({ page, teamName, teamDescription, teamsPage }) => { }); test("Edit team description", async ({ page, teamDescription, teamsPage, teamName }) => { + await teamsPage.teamCardKebab.click(); await teamsPage.editTeamButton.click(); await expect(teamsPage.nameInput("Team name")).toHaveValue(teamName); await expect(teamsPage.teamDescription).toContainText(teamDescription); @@ -64,7 +65,8 @@ test("Delete user", async ({ page, userName, teamsPage }) => { }); test("Delete team", async ({ page, teamName, teamsPage }) => { - await teamsPage.deleteTeamButton(teamName + " changed").click(); + await teamsPage.teamCardKebab.click(); + await teamsPage.deleteTeamButton.click(); await page.getByRole("button", { name: "Confirm" }).click(); await expect( page.locator(`:text("${teamName}"):right-of(span[data-tid='Delete team ${teamName}'])`) diff --git a/playwright/e2eTests/triggerOperations.spec.ts b/playwright/e2eTests/triggerOperations.spec.ts index 0ebefe729..0775a32b6 100644 --- a/playwright/e2eTests/triggerOperations.spec.ts +++ b/playwright/e2eTests/triggerOperations.spec.ts @@ -79,8 +79,7 @@ test("Set trigger maintenance for all intervals", async ({ triggerName, page }) const requestBody = JSON.parse(setMaintenanceRequest.postData() || "{}"); expect(requestBody).not.toBeNull(); - expect(requestBody.trigger).toEqual(expectedTriggerTime); - + expect(Math.abs(requestBody.trigger - expectedTriggerTime)).toBeLessThanOrEqual(1); if (maintenance === Maintenance.off) { await expect(page.getByText("Maintenance")).toBeVisible(); } else diff --git a/playwright/pages/teams.page.ts b/playwright/pages/teams.page.ts index 1de8d9a39..5b2535bac 100644 --- a/playwright/pages/teams.page.ts +++ b/playwright/pages/teams.page.ts @@ -6,11 +6,12 @@ export class TeamsPage { readonly nameInput: (testId: string) => Locator; readonly teamDescription: Locator; readonly previewButton: Locator; + readonly teamCardKebab: Locator; readonly editTeamButton: Locator; readonly showUsersButton: Locator; readonly addUserModalButton: Locator; readonly deleteUserButton: (userName: string) => Locator; - readonly deleteTeamButton: (teamName: string) => Locator; + readonly deleteTeamButton: Locator; constructor(page: Page) { this.page = page; @@ -18,11 +19,12 @@ export class TeamsPage { this.nameInput = (testId) => page.locator(`label[data-tid='${testId}'] > span > input`); this.teamDescription = page.locator("[data-tid='Team description']"); this.previewButton = page.getByText("Preview"); - this.editTeamButton = page.getByRole("button", { name: "Edit Team" }); + this.teamCardKebab = page.locator("[data-tid='Team card kebab']"); + this.editTeamButton = page.getByRole("button", { name: "Edit" }); this.showUsersButton = page.getByText("Show users"); this.addUserModalButton = page.locator("[data-tid='Add user modal']"); this.deleteUserButton = (userName) => page.locator(`[data-tid="Delete user ${userName}"]`); - this.deleteTeamButton = (teamName) => page.locator(`[data-tid="Delete team ${teamName}"]`); + this.deleteTeamButton = page.getByRole("button", { name: "Delete" }); } async gotoTeamsPage(): Promise { diff --git a/src/Components/ChristmasMoodToggle/ChristmasMoodToggle.tsx b/src/Components/ChristmasMoodToggle/ChristmasMoodToggle.tsx index 75ed25691..c4c1e06ef 100644 --- a/src/Components/ChristmasMoodToggle/ChristmasMoodToggle.tsx +++ b/src/Components/ChristmasMoodToggle/ChristmasMoodToggle.tsx @@ -3,18 +3,25 @@ import { Toggle } from "@skbkontur/react-ui/components/Toggle"; import { useChristmasMood } from "../../hooks/useChristmasMood"; import { useAppDispatch } from "../../store/hooks"; import { toggleChristmasMood } from "../../store/Reducers/UIReducer.slice"; +import { useSelector } from "react-redux"; +import { selectIsChristmasMood } from "../../store/Reducers/ConfigReducer.slice"; export const ChristmasMoodToggle: FC = () => { const dispatch = useAppDispatch(); const [isChristmasMood, setChristmasMood] = useChristmasMood(); + const isChristmasMoodEnabled = useSelector(selectIsChristmasMood); const handleToggleChristmasMood = (selected: boolean) => { setChristmasMood(selected); dispatch(toggleChristmasMood(selected)); }; return ( - - New Year mood - + <> + {isChristmasMoodEnabled ? ( + + New Year mood + + ) : null} + ); }; diff --git a/src/Components/Grid/Grid.less b/src/Components/Grid/Grid.less index 62015ecee..d51e05a9c 100644 --- a/src/Components/Grid/Grid.less +++ b/src/Components/Grid/Grid.less @@ -1,4 +1,3 @@ .grid { display: grid; - align-items: baseline; } diff --git a/src/Components/Header/Header.tsx b/src/Components/Header/Header.tsx index f44b6a91e..1dbc0179a 100644 --- a/src/Components/Header/Header.tsx +++ b/src/Components/Header/Header.tsx @@ -9,7 +9,7 @@ import RouterLink from "../RouterLink/RouterLink"; import svgLogo from "./moira-logo.svg"; import { AdminMenu } from "./Components/AdminMenu"; import { useSelector } from "react-redux"; -import { selectIsChristmasMood, selectPlatform } from "../../store/Reducers/ConfigReducer.slice"; +import { selectPlatform } from "../../store/Reducers/ConfigReducer.slice"; import { useGetConfigQuery } from "../../services/BaseApi"; import { Platform } from "../../Domain/Config"; import { ChristmasHatSVG } from "./Components/ChristmasHat"; @@ -29,7 +29,6 @@ export default function Header(): React.ReactElement { const { isLoading } = useGetConfigQuery(); const theme = useTheme(); const { isChristmasMood } = useAppSelector(UIState); - const isChristmasMoodEnabled = useSelector(selectIsChristmasMood); return (