From ef22efd9174bf5fa441ff3bbe17d231eb53bcb9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Grzegorz=20Ta=C5=84czyk?= Date: Wed, 3 Nov 2021 13:57:03 +0100 Subject: [PATCH] [GH-1278] Confirm delete when deleting board (#1339) * Delete board confirmation modal (#1278) * dialog should fill the screen on small resolution * Updating delete board confirm UI * Pass onClose callback to Dialog props * lint * removing danger-button-bg-rgb from shared variables, adjusting dialog styles to work both in plugin and standalone version of focalboard * lint * remove set timeout * Update button.scss * update snpashot Co-authored-by: Asaad Mahmood Co-authored-by: Hossein Ahmadian-Yazdi Co-authored-by: Harshil Sharma --- webapp/cypress/integration/createBoard.js | 2 + webapp/i18n/en.json | 6 +- .../__snapshots__/cardDialog.test.tsx.snap | 9 -- webapp/src/components/dialog.scss | 1 + webapp/src/components/dialog.tsx | 1 - .../deleteBoardDialog.test.tsx.snap | 17 ++++ .../components/sidebar/deleteBoardDialog.scss | 49 +++++++++++ .../sidebar/deleteBoardDialog.test.tsx | 57 +++++++++++++ .../components/sidebar/deleteBoardDialog.tsx | 85 +++++++++++++++++++ .../components/sidebar/sidebarBoardItem.tsx | 47 ++++++---- .../src/components/viewHeader/viewHeader.scss | 4 - webapp/src/widgets/buttons/button.scss | 38 ++++++++- webapp/src/widgets/buttons/button.tsx | 2 + 13 files changed, 282 insertions(+), 36 deletions(-) create mode 100644 webapp/src/components/sidebar/__snapshots__/deleteBoardDialog.test.tsx.snap create mode 100644 webapp/src/components/sidebar/deleteBoardDialog.scss create mode 100644 webapp/src/components/sidebar/deleteBoardDialog.test.tsx create mode 100644 webapp/src/components/sidebar/deleteBoardDialog.tsx diff --git a/webapp/cypress/integration/createBoard.js b/webapp/cypress/integration/createBoard.js index 71fd41cfb..d344e0946 100644 --- a/webapp/cypress/integration/createBoard.js +++ b/webapp/cypress/integration/createBoard.js @@ -117,6 +117,8 @@ describe('Create and delete board / card', () => { cy.contains('Delete board').click({force: true}); + cy.get('.DeleteBoardDialog button.danger').click({force: true}); + // Board should not exist cy.contains(boardTitle).should('not.exist'); }); diff --git a/webapp/i18n/en.json b/webapp/i18n/en.json index e3813f5aa..be44c719b 100644 --- a/webapp/i18n/en.json +++ b/webapp/i18n/en.json @@ -47,6 +47,10 @@ "DashboardPage.CenterPanel.NoWorkspacesDescription": "Please try searching for another term", "DashboardPage.showEmpty": "Show empty", "DashboardPage.title": "Dashboard", + "DeleteBoardDialog.confirm-cancel": "Cancel", + "DeleteBoardDialog.confirm-delete": "Delete", + "DeleteBoardDialog.confirm-info": "Are you sure you want to delete the board “{boardTitle}”? Deleting it will delete the property from all cards in this board.", + "DeleteBoardDialog.confirm-tite": "Confirm Delete Board", "Dialog.closeDialog": "Close dialog", "EditableDayPicker.today": "Today", "EmptyCenterPanel.no-content": "Add or select a board from the sidebar to get started.", @@ -200,4 +204,4 @@ "login.register-button": "or create an account if you don't have one", "register.login-button": "or log in if you already have an account", "register.signup-title": "Sign up for your account" -} \ No newline at end of file +} diff --git a/webapp/src/components/__snapshots__/cardDialog.test.tsx.snap b/webapp/src/components/__snapshots__/cardDialog.test.tsx.snap index 437ed9577..e77e3b1a8 100644 --- a/webapp/src/components/__snapshots__/cardDialog.test.tsx.snap +++ b/webapp/src/components/__snapshots__/cardDialog.test.tsx.snap @@ -24,9 +24,6 @@ exports[`components/cardDialog return a cardDialog readonly 1`] = ` class="CompassIcon icon-close CloseIcon" /> -
-
) }) diff --git a/webapp/src/components/viewHeader/viewHeader.scss b/webapp/src/components/viewHeader/viewHeader.scss index f8dc80b86..08cfc5ac9 100644 --- a/webapp/src/components/viewHeader/viewHeader.scss +++ b/webapp/src/components/viewHeader/viewHeader.scss @@ -41,8 +41,4 @@ background: rgba(var(--center-channel-color-rgb), 0.1); } } - - .octo-spacer { - flex: 1; - } } diff --git a/webapp/src/widgets/buttons/button.scss b/webapp/src/widgets/buttons/button.scss index 0bca7dcdc..91fb1435e 100644 --- a/webapp/src/widgets/buttons/button.scss +++ b/webapp/src/widgets/buttons/button.scss @@ -1,4 +1,6 @@ .Button { + --danger-button-bg-rgb: 247, 67, 67; + font-family: 'Open Sans', sans-serif; display: flex; flex: 0 0 auto; @@ -15,6 +17,7 @@ color: inherit; height: 32px; padding: 0 10px; + font-weight: 600; &:hover { background-color: rgba(var(--center-channel-color-rgb), 0.08); @@ -43,6 +46,18 @@ &:hover { background-color: rgb(var(--button-bg-rgb), 0.8); } + + &.danger { + background: linear-gradient(rgb(var(--danger-button-bg-rgb)), rgb(var(--danger-button-bg-rgb))); + + &:hover { + background: linear-gradient(rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.08)), linear-gradient(rgb(var(--danger-button-bg-rgb)), rgb(var(--danger-button-bg-rgb))); + } + + &:active { + background: linear-gradient(rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0.16)), linear-gradient(rgb(var(--danger-button-bg-rgb)), rgb(var(--danger-button-bg-rgb))); + } + } } &.emphasis--secondary { @@ -58,6 +73,19 @@ } } + &.emphasis--tertiary { + color: rgb(var(--button-bg-rgb)); + background-color: rgb(var(--button-bg-rgb), 0.08); + + &:hover { + background-color: rgb(var(--button-bg-rgb), 0.12); + } + + &:active { + background-color: rgb(var(--button-bg-rgb), 0.16); + } + } + &.emphasis--danger { color: rgb(var(--button-danger-color-rgb)); background-color: rgb(var(--button-danger-bg-rgb)); @@ -65,25 +93,27 @@ &:hover { background-color: rgb(var(--button-danger-bg-rgb), 0.8); } - } &.active { background: rgba(var(--button-bg-rgb), 0.08); color: rgb(var(--button-bg-rgb)); - font-weight: 600; } &.size--small { font-size: 12px; - font-weight: 600; padding: 0 16px; height: 32px; } + &.size--medium { + font-size: 14px; + padding: 0 20px; + height: 40px; + } + &.size--large { font-size: 16px; - font-weight: 600; height: 48px; padding: 0 24px; diff --git a/webapp/src/widgets/buttons/button.tsx b/webapp/src/widgets/buttons/button.tsx index f04489f14..5efc21b26 100644 --- a/webapp/src/widgets/buttons/button.tsx +++ b/webapp/src/widgets/buttons/button.tsx @@ -16,6 +16,7 @@ type Props = { submit?: boolean emphasis?: string size?: string + danger?: boolean className?: string } @@ -24,6 +25,7 @@ function Button(props: Props): JSX.Element { Button: true, active: Boolean(props.active), filled: Boolean(props.filled), + danger: Boolean(props.danger), } classNames[`emphasis--${props.emphasis}`] = Boolean(props.emphasis) classNames[`size--${props.size}`] = Boolean(props.size)