From 56cc64f60883edbfc726c4fdfef735ca2c1d65e5 Mon Sep 17 00:00:00 2001 From: Rajat Dabade Date: Tue, 21 Jun 2022 23:21:58 +0530 Subject: [PATCH] Cherry pick hidden card btn actions (#3261) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Feature added: Pressing enter should create a category * Followed the review request changed and updated the code * Removed the submit attribute as it no longer been used * Create .gitpod.yml (#3010) * update board title when duplicated (#3011) * Displayed only board members in autocomplete (#2969) * Displayed only board members in autocomplete * Removed debug logs * update min version in Plugin and build (#3018) * 2889 - Hiding images on share modal on personal (#2925) Co-authored-by: Mattermod * GH-2469 Add board-bot to team (#3026) * add bot to team before any mention or subscription notification * allow duplicating cards/baords if filecopy fails (#3012) * allow duplicating cards/baords if filecopy fails * change back to error logs * standardize env var naming (#3031) * Translated using Weblate (Malayalam) Currently translated at 100.0% (303 of 303 strings) Translation: Focalboard/webapp Translate-URL: https://translate.mattermost.com/projects/focalboard/webapp/ml/ * Update translation files Updated by "Cleanup translation files" hook in Weblate. Translation: Focalboard/webapp Translate-URL: https://translate.mattermost.com/projects/focalboard/webapp/ Update translation files Updated by "Cleanup translation files" hook in Weblate. Translation: Focalboard/webapp Translate-URL: https://translate.mattermost.com/projects/focalboard/webapp/ Update translation files Updated by "Cleanup translation files" hook in Weblate. Translation: Focalboard/webapp Translate-URL: https://translate.mattermost.com/projects/focalboard/webapp/ * Translated using Weblate (German) Currently translated at 100.0% (312 of 312 strings) Translation: Focalboard/webapp Translate-URL: https://translate.mattermost.com/projects/focalboard/webapp/de/ * implement personal server/desktop cloud advertising * update for standard colors/button, add telemetry * only display if active 24 hours * remove log, update snapshot * lint fixes * more lint fixes * fixes * add copyright * Updating UI * All team users autocomplete new (#3016) * WIP * Made search debounced * Lint fiX * Fixed tests * Calledn un-debounced version on first load * Added delete feature in Table view (#2383) * Added delete feature in Table view * Fixed the build failure * Added test cased for delete the row in table view * Fixes for useMemo, useCallback and proposed CSS solution * UI fixes * Resolved the test-case issue Co-authored-by: Rajat Dabade * fix broken jest test * update singleUser to return workspace UpdateAt as getMe User createAt * Translated using Weblate (Croatian) Currently translated at 100.0% (312 of 312 strings) Translation: Focalboard/webapp Translate-URL: https://translate.mattermost.com/projects/focalboard/webapp/hr/ * Translated using Weblate (Persian) Currently translated at 32.0% (100 of 312 strings) Translation: Focalboard/webapp Translate-URL: https://translate.mattermost.com/projects/focalboard/webapp/fa/ Added translation using Weblate (Persian) * GH-2959 - Updating boards modal styling (#3048) * GH-2959 - Updating boards modal styling * Updating test * update to version 7.2.0 * Refactor notify init (#3043) * remove unneeded store interfaces * - reduce dependencies for notifications service - notifications service no longer concerned with web socket notifications gnored, and an empty message aborts the commit. * use app to add member to board * remove unneeded API * remove dependency on app package * fix webapp jest Co-authored-by: Mattermod * Adding the board default role for public boards (#2884) * Adding the default role concept in the backend * Adding the interface part * Fix golang-ci lint errors * Adding local permissions tests * Address PR review comments * Improving the code a bit * Another small fix * Renaming DefaultRole to MinimumRole * Setting the minimum role at minimum to check the permissions per roles in the integration tests * Adding the new minimum role behavior * Fixing some tests Co-authored-by: Mattermod * [GH-2442] Improve performance for table column resize (#3032) Co-authored-by: Mattermod * update template, remove view (#3080) * update template, remove view * update new template file * Translated using Weblate (Turkish) Currently translated at 100.0% (313 of 313 strings) Translation: Focalboard/webapp Translate-URL: https://translate.mattermost.com/projects/focalboard/webapp/tr/ * Translated using Weblate (Persian) Currently translated at 31.9% (100 of 313 strings) Translation: Focalboard/webapp Translate-URL: https://translate.mattermost.com/projects/focalboard/webapp/fa/ * Translated using Weblate (Hungarian) Currently translated at 100.0% (313 of 313 strings) Translation: Focalboard/webapp Translate-URL: https://translate.mattermost.com/projects/focalboard/webapp/hu/ * Translated using Weblate (Chinese (Simplified)) Currently translated at 56.8% (178 of 313 strings) Translation: Focalboard/webapp Translate-URL: https://translate.mattermost.com/projects/focalboard/webapp/zh_Hans/ * Translated using Weblate (Polish) Currently translated at 100.0% (313 of 313 strings) Translation: Focalboard/webapp Translate-URL: https://translate.mattermost.com/projects/focalboard/webapp/pl/ * Translated using Weblate (English (Australia)) Currently translated at 100.0% (313 of 313 strings) Translation: Focalboard/webapp Translate-URL: https://translate.mattermost.com/projects/focalboard/webapp/en_AU/ * Translated using Weblate (German) Currently translated at 100.0% (313 of 313 strings) Translation: Focalboard/webapp Translate-URL: https://translate.mattermost.com/projects/focalboard/webapp/de/ * Translated using Weblate (Dutch) Currently translated at 100.0% (313 of 313 strings) Translation: Focalboard/webapp Translate-URL: https://translate.mattermost.com/projects/focalboard/webapp/nl/ * Translated using Weblate (Chinese (Traditional)) Currently translated at 82.4% (258 of 313 strings) Translation: Focalboard/webapp Translate-URL: https://translate.mattermost.com/projects/focalboard/webapp/zh_Hant/ * Added a Dialog notification after clicking on the Cards hidden button (#3180) * Added a Dailog notification after clicking on the Cards hidden button * Reverted the unwanted changes * Updated required snapshot * Css fixed * Snapshot update * ESlinter fix * Snapshot update * Removed HiddenCardCountNotification and used cardLimitNotification template * Update Co-authored-by: Mattermod * Translated using Weblate (Malayalam) Currently translated at 100.0% (303 of 303 strings) Translation: Focalboard/webapp Translate-URL: https://translate.mattermost.com/projects/focalboard/webapp/ml/ * Update translation files Updated by "Cleanup translation files" hook in Weblate. Translation: Focalboard/webapp Translate-URL: https://translate.mattermost.com/projects/focalboard/webapp/ Update translation files Updated by "Cleanup translation files" hook in Weblate. Translation: Focalboard/webapp Translate-URL: https://translate.mattermost.com/projects/focalboard/webapp/ Update translation files Updated by "Cleanup translation files" hook in Weblate. Translation: Focalboard/webapp Translate-URL: https://translate.mattermost.com/projects/focalboard/webapp/ * Translated using Weblate (German) Currently translated at 100.0% (312 of 312 strings) Translation: Focalboard/webapp Translate-URL: https://translate.mattermost.com/projects/focalboard/webapp/de/ * Added templates.boardarchive back * Removed unwanted changes * Update webapp/i18n/en.json Co-authored-by: Rajat Dabade Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com> Co-authored-by: Scott Bishel Co-authored-by: Harshil Sharma <18575143+harshilsharma63@users.noreply.github.com> Co-authored-by: Asaad Mahmood Co-authored-by: Mattermod Co-authored-by: Doug Lauder Co-authored-by: Varghese Jose Co-authored-by: Hosted Weblate Co-authored-by: jprusch Co-authored-by: Milo Ivir Co-authored-by: vaheeD khoshnouD Co-authored-by: Jesús Espino Co-authored-by: kamre Co-authored-by: Kaya Zeren Co-authored-by: Abraham Foam Co-authored-by: Tóth Csaba // Online ERP Hungary Kft Co-authored-by: windane Co-authored-by: master7 Co-authored-by: Matthew Williams Co-authored-by: JtheBAB Co-authored-by: Tom De Moor Co-authored-by: Su Jing Jhong --- webapp/i18n/en.json | 3 +- .../__snapshots__/centerPanel.test.tsx.snap | 755 ++++++++++++++++++ .../boardTemplateSelectorPreview.tsx | 3 + .../src/components/cardLimitNotification.tsx | 20 +- webapp/src/components/centerPanel.test.tsx | 128 +++ webapp/src/components/centerPanel.tsx | 14 +- .../__snapshots__/gallery.test.tsx.snap | 2 +- .../src/components/gallery/gallery.test.tsx | 6 + webapp/src/components/gallery/gallery.tsx | 2 + .../hiddenCardCount/hiddenCardCount.scss | 4 + .../hiddenCardCount/hiddenCardCount.tsx | 12 +- webapp/src/components/kanban/kanban.test.tsx | 10 + webapp/src/components/kanban/kanban.tsx | 6 +- .../table/__snapshots__/table.test.tsx.snap | 2 +- webapp/src/components/table/table.test.tsx | 10 + webapp/src/components/table/table.tsx | 2 + webapp/src/components/table/tableRow.scss | 1 + webapp/src/widgets/notification-box.scss | 5 + 18 files changed, 974 insertions(+), 11 deletions(-) diff --git a/webapp/i18n/en.json b/webapp/i18n/en.json index f11b02c23..170076f85 100644 --- a/webapp/i18n/en.json +++ b/webapp/i18n/en.json @@ -249,6 +249,7 @@ "TableHeaderMenu.sort-descending": "Sort descending", "TableRow.delete": "Delete", "TableRow.open": "Open", + "TableRow.delete": "Delete", "TopBar.give-feedback": "Give feedback", "URLProperty.copiedLink": "Copied!", "URLProperty.copy": "Copy", @@ -337,4 +338,4 @@ "tutorial_tip.ok": "Next", "tutorial_tip.out": "Opt out of these tips.", "tutorial_tip.seen": "Seen this before?" -} \ No newline at end of file +} diff --git a/webapp/src/components/__snapshots__/centerPanel.test.tsx.snap b/webapp/src/components/__snapshots__/centerPanel.test.tsx.snap index 340a26c5c..af085b557 100644 --- a/webapp/src/components/__snapshots__/centerPanel.test.tsx.snap +++ b/webapp/src/components/__snapshots__/centerPanel.test.tsx.snap @@ -1,5 +1,760 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`components/centerPanel Clicking on the Hidden card count should open a dailog 1`] = ` +
+
+
+ +
+
+
+ +
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+
+
+
+ +
+ +
+
+
+ + +
+ +
+ +
+ + +
+
+ +
+
+
+ New +
+ +
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+ + + No name + + +
+ + + +
+
+
+
+
+ + + + +
+ + + +
+
+
+ + +
+
+
+
+ i +
+ +
+
+ +
+
+
+
+
+ + +
+
+
+
+ i +
+ +
+
+ +
+
+
+
+
+
+
+ + + + +
+ + + +
+
+
+ +
+
+ Cards hidden +
+ +
+
+
+
+ +
+
+

+ 2 cards hidden from board +

+ Card limit reached, to view older cards, + + upgrade to a paid plan + +
+ +
+
+
+`; + exports[`components/centerPanel return centerPanel and click on card to show card 1`] = `
{ addCard={() => Promise.resolve()} showCard={() => null} hiddenCardsCount={0} + showHiddenCardCountNotification={() => null} />} {activeView?.fields.viewType === 'table' && { addCard={() => Promise.resolve()} showCard={() => null} hiddenCardsCount={0} + showHiddenCardCountNotification={() => null} />} {activeView?.fields.viewType === 'gallery' && { onCardClicked={() => null} addCard={() => Promise.resolve()} hiddenCardsCount={0} + showHiddenCardCountNotification={() => null} />} {activeView?.fields.viewType === 'calendar' && void +} + const snoozeTime = 1000 * 60 * 60 * 24 * 10 const checkSnoozeInterval = 1000 * 60 * 5 -const CardLimitNotification = () => { +const CardLimitNotification = (props: Props) => { const intl = useIntl() const [time, setTime] = useState(Date.now()) @@ -68,6 +73,10 @@ const CardLimitNotification = () => { {cards: hiddenCards}, ) + if (!show && props.showHiddenCardNotification) { + show = true + } + if (hiddenCards > 0 && time > snoozedUntil) { show = true } @@ -110,12 +119,17 @@ const CardLimitNotification = () => { return null } + const hidHiddenCardNotification = () => { + show = false + props.hiddenCardCountNotificationHandler(false) + } + return ( } title={title} - onClose={onClose} - closeTooltip={intl.formatMessage({ + onClose={props.showHiddenCardNotification ? hidHiddenCardNotification : onClose} + closeTooltip={props.showHiddenCardNotification ? '' : intl.formatMessage({ id: 'notification-box-card-limit-reached.close-tooltip', defaultMessage: 'Snooze for 10 days', })} diff --git a/webapp/src/components/centerPanel.test.tsx b/webapp/src/components/centerPanel.test.tsx index db6f120a2..920b8caac 100644 --- a/webapp/src/components/centerPanel.test.tsx +++ b/webapp/src/components/centerPanel.test.tsx @@ -530,3 +530,131 @@ describe('components/centerPanel', () => { }) }) }) + +describe('components/centerPanel', () => { + const board = TestBlockFactory.createBoard() + board.id = '1' + const activeView = TestBlockFactory.createBoardView(board) + activeView.id = '1' + const card1 = TestBlockFactory.createCard(board) + card1.id = '1' + card1.title = 'card1' + card1.fields.properties = {id: 'property_value_id_1'} + card1.limited = true + const card2 = TestBlockFactory.createCard(board) + card2.id = '2' + card2.title = 'card2' + card2.fields.properties = {id: 'property_value_id_1'} + card2.limited = true + const comment1 = TestBlockFactory.createComment(card1) + comment1.id = '1' + const comment2 = TestBlockFactory.createComment(card2) + comment2.id = '2' + const groupProperty: IPropertyTemplate = { + id: 'id', + name: 'name', + type: 'text', + options: [ + { + color: 'propColorOrange', + id: 'property_value_id_1', + value: 'Q1', + }, + { + color: 'propColorBlue', + id: 'property_value_id_2', + value: 'Q2', + }, + ], + } + const state = { + clientConfig: { + value: { + featureFlags: { + subscriptions: true, + }, + }, + }, + searchText: '', + users: { + me: { + id: 'user_id_1', + props: { + focalboard_onboardingTourStarted: false, + }, + }, + workspaceUsers: [ + {username: 'username_1'}, + ], + boardUsers: [ + {username: 'username_1'}, + ], + blockSubscriptions: [], + }, + teams: { + current: {id: 'team-id'}, + }, + boards: { + current: board.id, + boards: { + [board.id]: board, + }, + templates: [], + myBoardMemberships: { + [board.id]: {userId: 'user_id_1', schemeAdmin: true}, + }, + }, + cards: { + templates: [card1, card2], + cards: [card1, card2], + current: card1.id, + }, + views: { + views: { + boardView: activeView, + }, + current: 'boardView', + }, + contents: {}, + comments: { + comments: [comment1, comment2], + }, + limits: { + limits: { + views: 0, + }, + }, + } + const store = mockStateStore([], state) + beforeAll(() => { + mockDOM() + console.error = jest.fn() + }) + beforeEach(() => { + activeView.fields.viewType = 'board' + jest.clearAllMocks() + }) + + test('Clicking on the Hidden card count should open a dailog', () => { + activeView.fields.viewType = 'table' + activeView.fields.defaultTemplateId = '1' + const {container, getByTitle, getByText} = render(wrapDNDIntl( + + + , + )) + fireEvent.click(getByTitle('hidden-card-count')) + expect(getByText('2 cards hidden from board')).not.toBeNull() + expect(container).toMatchSnapshot() + }) +}) diff --git a/webapp/src/components/centerPanel.tsx b/webapp/src/components/centerPanel.tsx index e306f0287..ba9774b12 100644 --- a/webapp/src/components/centerPanel.tsx +++ b/webapp/src/components/centerPanel.tsx @@ -76,6 +76,7 @@ const CenterPanel = (props: Props) => { const intl = useIntl() const [selectedCardIds, setSelectedCardIds] = useState([]) const [cardIdToFocusOnRender, setCardIdToFocusOnRender] = useState('') + const [showHiddenCardCountNotification, setShowHiddenCardCountNotification] = useState(false) const onboardingTourStarted = useAppSelector(getOnboardingTourStarted) const onboardingTourCategory = useAppSelector(getOnboardingTourCategory) @@ -341,6 +342,10 @@ const CenterPanel = (props: Props) => { e.stopPropagation() }, [selectedCardIds, props.activeView, props.cards, showCard]) + const hiddenCardCountNotifyHandler = useCallback((show: boolean) => { + setShowHiddenCardCountNotification(show) + }, [showHiddenCardCountNotification]) + const showShareButton = !props.readonly && me?.id !== 'single-user' const showShareLoginButton = props.readonly && me?.id !== 'single-user' @@ -349,13 +354,11 @@ const CenterPanel = (props: Props) => { () => getVisibleAndHiddenGroups(cards, activeView.fields.visibleOptionIds, activeView.fields.hiddenOptionIds, groupByProperty), [cards, activeView.fields.visibleOptionIds, activeView.fields.hiddenOptionIds, groupByProperty], ) - return (
- {props.shownCardId && { addCard={addCard} showCard={showCard} hiddenCardsCount={props.hiddenCardsCount} + showHiddenCardCountNotification={hiddenCardCountNotifyHandler} />} {activeView.fields.viewType === 'table' &&
{ addCard={addCard} onCardClicked={cardClicked} hiddenCardsCount={props.hiddenCardsCount} + showHiddenCardCountNotification={hiddenCardCountNotifyHandler} />} {activeView.fields.viewType === 'calendar' && { selectedCardIds={selectedCardIds} addCard={(show) => addCard('', show)} hiddenCardsCount={props.hiddenCardsCount} + showHiddenCardCountNotification={hiddenCardCountNotifyHandler} />} + ) } diff --git a/webapp/src/components/gallery/__snapshots__/gallery.test.tsx.snap b/webapp/src/components/gallery/__snapshots__/gallery.test.tsx.snap index e61848a60..a2582d800 100644 --- a/webapp/src/components/gallery/__snapshots__/gallery.test.tsx.snap +++ b/webapp/src/components/gallery/__snapshots__/gallery.test.tsx.snap @@ -65,7 +65,7 @@ exports[`src/components/gallery/Gallery limited card count check 1`] = `
- Cards Hidden + Cards hidden
) diff --git a/webapp/src/components/kanban/kanban.test.tsx b/webapp/src/components/kanban/kanban.test.tsx index 939c08938..8ee0f8716 100644 --- a/webapp/src/components/kanban/kanban.test.tsx +++ b/webapp/src/components/kanban/kanban.test.tsx @@ -128,6 +128,7 @@ describe('src/component/kanban/kanban', () => { addCard={jest.fn()} showCard={jest.fn()} hiddenCardsCount={0} + showHiddenCardCountNotification={jest.fn()} /> , ), {wrapper: MemoryRouter}) @@ -163,6 +164,7 @@ describe('src/component/kanban/kanban', () => { addCard={jest.fn()} showCard={jest.fn()} hiddenCardsCount={0} + showHiddenCardCountNotification={jest.fn()} /> , ), {wrapper: MemoryRouter}) @@ -197,6 +199,7 @@ describe('src/component/kanban/kanban', () => { addCard={jest.fn()} showCard={jest.fn()} hiddenCardsCount={0} + showHiddenCardCountNotification={jest.fn()} /> , ), {wrapper: MemoryRouter}) @@ -233,6 +236,7 @@ describe('src/component/kanban/kanban', () => { addCard={jest.fn()} showCard={jest.fn()} hiddenCardsCount={0} + showHiddenCardCountNotification={jest.fn()} /> , ), {wrapper: MemoryRouter}) @@ -279,6 +283,7 @@ describe('src/component/kanban/kanban', () => { addCard={jest.fn()} showCard={jest.fn()} hiddenCardsCount={0} + showHiddenCardCountNotification={jest.fn()} /> , ), {wrapper: MemoryRouter}) @@ -325,6 +330,7 @@ describe('src/component/kanban/kanban', () => { addCard={jest.fn()} showCard={jest.fn()} hiddenCardsCount={0} + showHiddenCardCountNotification={jest.fn()} /> , ), {wrapper: MemoryRouter}) @@ -372,6 +378,7 @@ describe('src/component/kanban/kanban', () => { addCard={mockedAddCard} showCard={jest.fn()} hiddenCardsCount={0} + showHiddenCardCountNotification={jest.fn()} /> , ), {wrapper: MemoryRouter}) @@ -410,6 +417,7 @@ describe('src/component/kanban/kanban', () => { addCard={jest.fn()} showCard={jest.fn()} hiddenCardsCount={0} + showHiddenCardCountNotification={jest.fn()} /> , ), {wrapper: MemoryRouter}) @@ -448,6 +456,7 @@ describe('src/component/kanban/kanban', () => { addCard={jest.fn()} showCard={jest.fn()} hiddenCardsCount={0} + showHiddenCardCountNotification={jest.fn()} /> , ), {wrapper: MemoryRouter}) @@ -493,6 +502,7 @@ describe('src/component/kanban/kanban', () => { addCard={jest.fn()} showCard={jest.fn()} hiddenCardsCount={0} + showHiddenCardCountNotification={jest.fn()} /> , ), {wrapper: MemoryRouter}) diff --git a/webapp/src/components/kanban/kanban.tsx b/webapp/src/components/kanban/kanban.tsx index 39d14998f..419b51c59 100644 --- a/webapp/src/components/kanban/kanban.tsx +++ b/webapp/src/components/kanban/kanban.tsx @@ -42,6 +42,7 @@ type Props = { addCard: (groupByOptionId?: string, show?:boolean) => Promise showCard: (cardId?: string) => void hiddenCardsCount: number + showHiddenCardCountNotification: (show: boolean) => void } const ScrollingComponent = withScrolling('div') @@ -320,7 +321,10 @@ const Kanban = (props: Props) => { ))} {hiddenCardsCount > 0 &&
- +
} } diff --git a/webapp/src/components/table/__snapshots__/table.test.tsx.snap b/webapp/src/components/table/__snapshots__/table.test.tsx.snap index 3fdbc74e0..e1fa7d16d 100644 --- a/webapp/src/components/table/__snapshots__/table.test.tsx.snap +++ b/webapp/src/components/table/__snapshots__/table.test.tsx.snap @@ -2248,7 +2248,7 @@ exports[`components/table/Table limited card in table view 1`] = `
- Cards Hidden + Cards hidden