From 50020ce8b10192388b41f483e97d354bd91972ac Mon Sep 17 00:00:00 2001 From: Scott Bishel Date: Wed, 2 Mar 2022 14:16:54 -0700 Subject: [PATCH] Update Share Button (#2432) * update shareboard button to always display * lint fixes * fix/update unit tests * update shareboard button to always display * lint fixes * fix/update unit tests * Updating UI for share dialog * Updating test * update tests * update to include view Co-authored-by: Asaad Mahmood --- .../__snapshots__/centerPanel.test.tsx.snap | 18 +- webapp/src/components/centerPanel.tsx | 4 +- .../__snapshots__/shareBoard.test.tsx.snap | 377 ++++++++++-------- .../src/components/shareBoard/shareBoard.scss | 66 ++- .../components/shareBoard/shareBoard.test.tsx | 37 +- .../src/components/shareBoard/shareBoard.tsx | 101 ++++- .../shareBoard/shareBoardButton.test.tsx | 1 + .../shareBoard/shareBoardButton.tsx | 2 + .../src/components/viewHeader/viewHeader.tsx | 9 +- webapp/src/telemetry/telemetryClient.ts | 1 + 10 files changed, 418 insertions(+), 198 deletions(-) diff --git a/webapp/src/components/__snapshots__/centerPanel.test.tsx.snap b/webapp/src/components/__snapshots__/centerPanel.test.tsx.snap index c72a91e6e..3b05bd45b 100644 --- a/webapp/src/components/__snapshots__/centerPanel.test.tsx.snap +++ b/webapp/src/components/__snapshots__/centerPanel.test.tsx.snap @@ -8377,7 +8377,23 @@ exports[`components/centerPanel should match snapshot for Kanban, not shared 1`]
+ > +
+ +
+
{ readonly={this.props.readonly} />
- {!this.props.readonly && this.props.showShared && + {!this.props.readonly && ( ) } @@ -237,7 +238,6 @@ class CenterPanel extends React.Component { addCardTemplate={this.addCardTemplate} editCardTemplate={this.editCardTemplate} readonly={this.props.readonly} - showShared={this.props.showShared} />
diff --git a/webapp/src/components/shareBoard/__snapshots__/shareBoard.test.tsx.snap b/webapp/src/components/shareBoard/__snapshots__/shareBoard.test.tsx.snap index b4edb0b00..45ab5d527 100644 --- a/webapp/src/components/shareBoard/__snapshots__/shareBoard.test.tsx.snap +++ b/webapp/src/components/shareBoard/__snapshots__/shareBoard.test.tsx.snap @@ -18,7 +18,7 @@ exports[`src/components/shareBoard/shareBoard return shareBoard and click Copy l

- Share Board +

+ + +
+
- Publish to the web + Share internally
- Publish and share a “read only” link with everyone on the web -
-
-
-
-
+ Users who have permissions will be able to use this link
@@ -70,29 +75,15 @@ exports[`src/components/shareBoard/shareBoard return shareBoard and click Copy l > - http://localhost/workspace/1/shared/1/1?r=oneToken + http://localhost/undefined/workspace/1/1/1 -
- -
+ + +
- Publish to the web + Share internally
- Publish and share a “read only” link with everyone on the web -
-
-
-
-
+ Users who have permissions will be able to use this link
@@ -180,29 +176,15 @@ exports[`src/components/shareBoard/shareBoard return shareBoard and click Copy l > - http://localhost/workspace/1/shared/1/1?r=oneToken + http://localhost/undefined/workspace/1/1/1 -
- -
+ + +
+ + +
+
+ + +
+
+ + +
+
- Publish to the web + Share internally
- Publish and share a “read only” link with everyone on the web -
-
-
-
-
+ Users who have permissions will be able to use this link
+
@@ -637,7 +693,7 @@ exports[`src/components/shareBoard/shareBoard should match snapshot with sharing

- Share Board +

+ + +
+
- Publish to the web + Share internally
- Publish and share a “read only” link with everyone on the web -
-
-
-
-
+ Users who have permissions will be able to use this link
@@ -689,29 +750,15 @@ exports[`src/components/shareBoard/shareBoard should match snapshot with sharing > - http://localhost/workspace/1/shared/1/1?r=oneToken + http://localhost/undefined/workspace/1/1/1 -
- -
+ + +
- Publish to the web + Share internally
- Publish and share a “read only” link with everyone on the web -
-
-
-
-
+ Users who have permissions will be able to use this link
@@ -799,29 +851,15 @@ exports[`src/components/shareBoard/shareBoard should match snapshot with sharing > - http://localhost/test-subpath/plugins/boards/workspace/1/shared/1/1?r=oneToken + http://localhost/undefined/workspace/1/1/1 -
- -
+ + +
- Publish to the web + Share internally
- Publish and share a “read only” link with everyone on the web -
-
-
-
-
+ Users who have permissions will be able to use this link
@@ -909,29 +952,15 @@ exports[`src/components/shareBoard/shareBoard should match snapshot with sharing > - http://localhost/test-subpath/plugins/boards/shared/1/1?r=oneToken + http://localhost/test-subpath/plugins/boards1/1 -
- -
+ + + )} + {(props.enableSharedBoards && publish) && + (
@@ -147,7 +177,7 @@ export default function ShareBoardDialog(props: Props): JSX.Element {
+ )} + + {!publish && ( +
+
+
+
+
{intl.formatMessage({id: 'ShareBoard.ShareInternal', defaultMessage: 'Share internally'})}
+
{intl.formatMessage({id: 'ShareBoard.ShareInternalDescription', defaultMessage: 'Users who have permissions will be able to use this link'})}
+
+
+
+
+ + +
+
+ )} ) } diff --git a/webapp/src/components/shareBoard/shareBoardButton.test.tsx b/webapp/src/components/shareBoard/shareBoardButton.test.tsx index fb3027018..f095dd685 100644 --- a/webapp/src/components/shareBoard/shareBoardButton.test.tsx +++ b/webapp/src/components/shareBoard/shareBoardButton.test.tsx @@ -21,6 +21,7 @@ describe('src/components/shareBoard/shareBoard', () => { wrapDNDIntl( )) const renderer = result.container diff --git a/webapp/src/components/shareBoard/shareBoardButton.tsx b/webapp/src/components/shareBoard/shareBoardButton.tsx index 18f7f8aa4..39dc7834c 100644 --- a/webapp/src/components/shareBoard/shareBoardButton.tsx +++ b/webapp/src/components/shareBoard/shareBoardButton.tsx @@ -15,6 +15,7 @@ import ShareBoardDialog from './shareBoard' type Props = { boardId: string + enableSharedBoards: boolean } const ShareBoardButton = (props: Props) => { const [showShareDialog, setShowShareDialog] = useState(false) @@ -45,6 +46,7 @@ const ShareBoardButton = (props: Props) => { setShowShareDialog(false)} boardId={props.boardId} + enableSharedBoards={props.enableSharedBoards} /> }
diff --git a/webapp/src/components/viewHeader/viewHeader.tsx b/webapp/src/components/viewHeader/viewHeader.tsx index ea390920a..9a24019db 100644 --- a/webapp/src/components/viewHeader/viewHeader.tsx +++ b/webapp/src/components/viewHeader/viewHeader.tsx @@ -54,14 +54,13 @@ type Props = { editCardTemplate: (cardTemplateId: string) => void readonly: boolean dateDisplayProperty?: IPropertyTemplate - showShared?: boolean } const ViewHeader = (props: Props) => { const [showFilter, setShowFilter] = useState(false) const intl = useIntl() - const {board, activeView, views, groupByProperty, cards, dateDisplayProperty, showShared} = props + const {board, activeView, views, groupByProperty, cards, dateDisplayProperty} = props const withGroupBy = activeView.fields.viewType === 'board' || activeView.fields.viewType === 'table' const withDisplayBy = activeView.fields.viewType === 'calendar' @@ -100,14 +99,12 @@ const ViewHeader = (props: Props) => { }, [showTourBaseCondition]) useEffect(() => { - if (showShared && !BoardTourSteps.SHARE_BOARD) { + if (!BoardTourSteps.SHARE_BOARD) { BoardTourSteps.SHARE_BOARD = 2 - } else if (!showShared) { - delete BoardTourSteps.SHARE_BOARD } TourCategoriesMapToSteps[TOUR_BOARD] = BoardTourSteps - }, [showShared]) + }, []) const showAddViewTourStep = showTourBaseCondition && delayComplete diff --git a/webapp/src/telemetry/telemetryClient.ts b/webapp/src/telemetry/telemetryClient.ts index 4516ec04c..893deea14 100644 --- a/webapp/src/telemetry/telemetryClient.ts +++ b/webapp/src/telemetry/telemetryClient.ts @@ -32,6 +32,7 @@ export const TelemetryActions = { ViewSharedBoard: 'viewSharedBoard', ShareBoardOpenModal: 'shareBoard_openModal', ShareLinkPublicCopy: 'shareLinkPublic_copy', + ShareLinkInternalCopy: 'shareLinkInternal_copy', ImportArchive: 'settings_importArchive', ImportTrello: 'settings_importTrello', ImportAsana: 'settings_importAsana',