box-ui-elements 16.0.0-beta.21 → 16.0.0-beta.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/explorer.css +1 -1
  2. package/dist/explorer.js +14 -14
  3. package/dist/openwith.js +5 -5
  4. package/dist/picker.js +7 -7
  5. package/dist/preview.css +1 -1
  6. package/dist/preview.js +14 -14
  7. package/dist/sharing.js +11 -11
  8. package/dist/sidebar.css +1 -1
  9. package/dist/sidebar.js +13 -13
  10. package/dist/uploader.js +5 -5
  11. package/es/elements/content-sidebar/activity-feed/activity-feed/ActiveState.js +22 -2
  12. package/es/elements/content-sidebar/activity-feed/activity-feed/ActiveState.js.flow +28 -2
  13. package/es/elements/content-sidebar/activity-feed/activity-feed/ActiveState.js.map +1 -1
  14. package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThread.js +82 -6
  15. package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThread.js.flow +92 -4
  16. package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThread.js.map +1 -1
  17. package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThread.scss +17 -0
  18. package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplies.js +68 -0
  19. package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplies.js.flow +87 -0
  20. package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplies.js.map +1 -0
  21. package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplies.scss +16 -0
  22. package/es/elements/content-sidebar/activity-feed/activity-feed/fixtures.js +55 -0
  23. package/es/elements/content-sidebar/activity-feed/activity-feed/fixtures.js.map +1 -0
  24. package/es/elements/content-sidebar/activity-feed/activity-feed/messages.js +8 -0
  25. package/es/elements/content-sidebar/activity-feed/activity-feed/messages.js.flow +10 -0
  26. package/es/elements/content-sidebar/activity-feed/activity-feed/messages.js.map +1 -1
  27. package/es/src/elements/content-sidebar/activity-feed/activity-feed/fixtures.d.ts +55 -0
  28. package/i18n/bn-IN.js +17 -15
  29. package/i18n/bn-IN.properties +17 -15
  30. package/i18n/da-DK.js +17 -15
  31. package/i18n/da-DK.properties +17 -15
  32. package/i18n/de-DE.js +17 -15
  33. package/i18n/de-DE.properties +17 -15
  34. package/i18n/en-AU.js +4 -2
  35. package/i18n/en-AU.properties +4 -2
  36. package/i18n/en-CA.js +9 -7
  37. package/i18n/en-CA.properties +9 -7
  38. package/i18n/en-GB.js +4 -2
  39. package/i18n/en-GB.properties +4 -2
  40. package/i18n/en-US.js +2 -0
  41. package/i18n/en-US.properties +4 -0
  42. package/i18n/en-x-pseudo.js +876 -874
  43. package/i18n/en-x-pseudo.properties +875 -873
  44. package/i18n/es-419.js +17 -15
  45. package/i18n/es-419.properties +17 -15
  46. package/i18n/es-ES.js +17 -15
  47. package/i18n/es-ES.properties +17 -15
  48. package/i18n/fi-FI.js +17 -15
  49. package/i18n/fi-FI.properties +17 -15
  50. package/i18n/fr-CA.js +17 -15
  51. package/i18n/fr-CA.properties +17 -15
  52. package/i18n/fr-FR.js +17 -15
  53. package/i18n/fr-FR.properties +17 -15
  54. package/i18n/hi-IN.js +17 -15
  55. package/i18n/hi-IN.properties +17 -15
  56. package/i18n/it-IT.js +17 -15
  57. package/i18n/it-IT.properties +17 -15
  58. package/i18n/ja-JP.js +2 -0
  59. package/i18n/ja-JP.properties +2 -0
  60. package/i18n/ko-KR.js +17 -15
  61. package/i18n/ko-KR.properties +17 -15
  62. package/i18n/nb-NO.js +17 -15
  63. package/i18n/nb-NO.properties +17 -15
  64. package/i18n/nl-NL.js +17 -15
  65. package/i18n/nl-NL.properties +17 -15
  66. package/i18n/pl-PL.js +17 -15
  67. package/i18n/pl-PL.properties +17 -15
  68. package/i18n/pt-BR.js +17 -15
  69. package/i18n/pt-BR.properties +17 -15
  70. package/i18n/ru-RU.js +17 -15
  71. package/i18n/ru-RU.properties +17 -15
  72. package/i18n/sv-SE.js +17 -15
  73. package/i18n/sv-SE.properties +17 -15
  74. package/i18n/tr-TR.js +17 -15
  75. package/i18n/tr-TR.properties +17 -15
  76. package/i18n/zh-CN.js +17 -15
  77. package/i18n/zh-CN.properties +17 -15
  78. package/i18n/zh-TW.js +17 -15
  79. package/i18n/zh-TW.properties +17 -15
  80. package/package.json +1 -1
  81. package/src/elements/content-sidebar/activity-feed/activity-feed/ActiveState.js +28 -2
  82. package/src/elements/content-sidebar/activity-feed/activity-feed/ActivityThread.js +92 -4
  83. package/src/elements/content-sidebar/activity-feed/activity-feed/ActivityThread.scss +17 -0
  84. package/src/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplies.js +87 -0
  85. package/src/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplies.scss +16 -0
  86. package/src/elements/content-sidebar/activity-feed/activity-feed/__tests__/ActivityThread.test.js +57 -11
  87. package/src/elements/content-sidebar/activity-feed/activity-feed/__tests__/ActivityThreadReplies.test.js +24 -0
  88. package/src/elements/content-sidebar/activity-feed/activity-feed/__tests__/__snapshots__/ActiveState.test.js.snap +12 -0
  89. package/src/elements/content-sidebar/activity-feed/activity-feed/fixtures.ts +56 -0
  90. package/src/elements/content-sidebar/activity-feed/activity-feed/messages.js +10 -0
package/i18n/zh-CN.js CHANGED
@@ -5,6 +5,8 @@ export default {
5
5
  "be.activitySidebar.activityFeed.annotationMissingError": "此评论已不存在",
6
6
  "be.activitySidebar.activityFeed.commentMissingError": "此评论已不存在",
7
7
  "be.activitySidebar.activityFeed.feedInlineErrorTitle": "错误",
8
+ "be.activitySidebar.activityFeed.hideReplies": "Hide replies",
9
+ "be.activitySidebar.activityFeed.showReplies": "See {repliesToLoadCount, plural, one {# reply} other {# replies}}",
8
10
  "be.activitySidebar.activityFeed.taskMissingError": "此任务已不存在",
9
11
  "be.activitySidebarFilter.status.all": "全部评论",
10
12
  "be.activitySidebarFilter.status.open": "未解决评论",
@@ -34,21 +36,21 @@ export default {
34
36
  "be.choose": "选择",
35
37
  "be.close": "关闭",
36
38
  "be.collapse": "折叠",
37
- "be.contentInsights.contentAnalyticsErrorText": "There was a problem loading content insights. Please try again.",
38
- "be.contentInsights.contentInsightsTitle": "Content Insights",
39
- "be.contentInsights.downloadGraphLabel": "Chart displaying the number of downloads over the selected time period",
40
- "be.contentInsights.downloadGraphType": "DOWNLOADS",
41
- "be.contentInsights.openContentInsightsButton": "See Details",
42
- "be.contentInsights.peopleGraphLabel": "Chart displaying the number of users over the selected time period",
43
- "be.contentInsights.peopleTitle": "PEOPLE",
44
- "be.contentInsights.previewGraphLabel": "Chart displaying the number of previews over the selected time period",
45
- "be.contentInsights.previewGraphType": "PREVIEWS",
46
- "be.contentInsights.trendDown": "Trending down",
47
- "be.contentInsights.trendMonth": "PAST MONTH",
48
- "be.contentInsights.trendThreeMonths": "PAST 3 MONTHS",
49
- "be.contentInsights.trendUp": "Trending up",
50
- "be.contentInsights.trendWeek": "PAST WEEK",
51
- "be.contentInsights.trendYear": "PAST YEAR",
39
+ "be.contentInsights.contentAnalyticsErrorText": "加载内容见解时出现问题。请重试。",
40
+ "be.contentInsights.contentInsightsTitle": "内容见解",
41
+ "be.contentInsights.downloadGraphLabel": "显示所选时间段内下载次数的图表",
42
+ "be.contentInsights.downloadGraphType": "下载",
43
+ "be.contentInsights.openContentInsightsButton": "查看详细信息",
44
+ "be.contentInsights.peopleGraphLabel": "显示所选时间段内用户数量的图表",
45
+ "be.contentInsights.peopleTitle": "人员",
46
+ "be.contentInsights.previewGraphLabel": "显示所选时间段内预览次数的图表",
47
+ "be.contentInsights.previewGraphType": "预览",
48
+ "be.contentInsights.trendDown": "呈下降趋势",
49
+ "be.contentInsights.trendMonth": "过去一个月",
50
+ "be.contentInsights.trendThreeMonths": "过去 3 个月",
51
+ "be.contentInsights.trendUp": "呈上升趋势",
52
+ "be.contentInsights.trendWeek": "过去一周",
53
+ "be.contentInsights.trendYear": "过去一年",
52
54
  "be.contentSharing.badRequestError": "此项目的请求格式不正确。",
53
55
  "be.contentSharing.collaboratorsLoadingError": "无法检索此项目的协作者。",
54
56
  "be.contentSharing.getContactsError": "无法检索联系人。",
@@ -69,35 +69,35 @@ be.close = 关闭
69
69
  # Message to the user to collapse the Transcript entries
70
70
  be.collapse = 折叠
71
71
  # Text shown to users when opening the content insights flyout and there is an error
72
- be.contentInsights.contentAnalyticsErrorText = There was a problem loading content insights. Please try again.
72
+ be.contentInsights.contentAnalyticsErrorText = 加载内容见解时出现问题。请重试。
73
73
  # Title for Content Insights section in file sidebar
74
- be.contentInsights.contentInsightsTitle = Content Insights
74
+ be.contentInsights.contentInsightsTitle = 内容见解
75
75
  # Label for the chart displaying the number of downloads over the selected time period
76
- be.contentInsights.downloadGraphLabel = Chart displaying the number of downloads over the selected time period
76
+ be.contentInsights.downloadGraphLabel = 显示所选时间段内下载次数的图表
77
77
  # Title for the content insights graph card regarding number of Previews
78
- be.contentInsights.downloadGraphType = DOWNLOADS
78
+ be.contentInsights.downloadGraphType = 下载
79
79
  # Open Content Insights button which opens the Content Insights Modal
80
- be.contentInsights.openContentInsightsButton = See Details
80
+ be.contentInsights.openContentInsightsButton = 查看详细信息
81
81
  # Label for the chart displaying the number of users over the selected time period
82
- be.contentInsights.peopleGraphLabel = Chart displaying the number of users over the selected time period
82
+ be.contentInsights.peopleGraphLabel = 显示所选时间段内用户数量的图表
83
83
  # Title used to represent how many users have interacted with the file
84
- be.contentInsights.peopleTitle = PEOPLE
84
+ be.contentInsights.peopleTitle = 人员
85
85
  # Label for the chart displaying the number of previews over the selected time period
86
- be.contentInsights.previewGraphLabel = Chart displaying the number of previews over the selected time period
86
+ be.contentInsights.previewGraphLabel = 显示所选时间段内预览次数的图表
87
87
  # Title for the content insights graph card regarding number of Previews
88
- be.contentInsights.previewGraphType = PREVIEWS
88
+ be.contentInsights.previewGraphType = 预览
89
89
  # Label for the arrow indicator in the trend pill
90
- be.contentInsights.trendDown = Trending down
90
+ be.contentInsights.trendDown = 呈下降趋势
91
91
  # Trend description for the content insights graph card regarding the count of events from the past month
92
- be.contentInsights.trendMonth = PAST MONTH
92
+ be.contentInsights.trendMonth = 过去一个月
93
93
  # Trend description for the content insights graph card regarding the count of events from the past three months
94
- be.contentInsights.trendThreeMonths = PAST 3 MONTHS
94
+ be.contentInsights.trendThreeMonths = 过去 3 个月
95
95
  # Label for the arrow indicator in the trend pill
96
- be.contentInsights.trendUp = Trending up
96
+ be.contentInsights.trendUp = 呈上升趋势
97
97
  # Trend description for the content insights graph card regarding the count of events from the past week
98
- be.contentInsights.trendWeek = PAST WEEK
98
+ be.contentInsights.trendWeek = 过去一周
99
99
  # Trend description for the content insights graph card regarding the count of events from the past year
100
- be.contentInsights.trendYear = PAST YEAR
100
+ be.contentInsights.trendYear = 过去一年
101
101
  # Message that appears when the request for the ContentSharing Element is malformed.
102
102
  be.contentSharing.badRequestError = 此项目的请求格式不正确。
103
103
  # Message that appears when collaborators cannot be retrieved in the ContentSharing Element.
@@ -1558,6 +1558,8 @@ boxui.unifiedShare.contactRestrictionNotice = 无法将邀请发送给 {count, p
1558
1558
  boxui.unifiedShare.contactRestrictionNoticeInformationBarrier = 由于安全政策,无法向 {count, plural, other {{count} 人}}发送邀请。
1559
1559
  # Text for the notice that is displayed when there are Information Barrier collaboration restrictions that apply to only one of the selected contacts
1560
1560
  boxui.unifiedShare.contactRestrictionNoticeInformationBarrierSingular = 由于安全政策,无法向 {email} 发送邀请。
1561
+ # Text for the notice that is displayed when there are Information Barrier collaboration restrictions that apply to only one of the selected contacts, which is a group
1562
+ boxui.unifiedShare.contactRestrictionNoticeInformationBarrierSingularGroup = Invitations cannot be sent to "{groupName}" due to a security policy.
1561
1563
  # Text for the notice that is displayed when there are collaboration restrictions that apply to one or more of the selected contacts
1562
1564
  boxui.unifiedShare.contactRestrictionNoticeSingular = 无法将邀请发送给 {email},因为外部协作因所应用的安全策略而受到限制。
1563
1565
  # Label for the button that removes restricted contacts on the contact restriction notice
package/i18n/zh-TW.js CHANGED
@@ -5,6 +5,8 @@ export default {
5
5
  "be.activitySidebar.activityFeed.annotationMissingError": "此留言已經不存在",
6
6
  "be.activitySidebar.activityFeed.commentMissingError": "此留言已經不存在",
7
7
  "be.activitySidebar.activityFeed.feedInlineErrorTitle": "錯誤",
8
+ "be.activitySidebar.activityFeed.hideReplies": "Hide replies",
9
+ "be.activitySidebar.activityFeed.showReplies": "See {repliesToLoadCount, plural, one {# reply} other {# replies}}",
8
10
  "be.activitySidebar.activityFeed.taskMissingError": "此工作已經不存在",
9
11
  "be.activitySidebarFilter.status.all": "所有留言",
10
12
  "be.activitySidebarFilter.status.open": "未回覆的留言",
@@ -34,21 +36,21 @@ export default {
34
36
  "be.choose": "選擇",
35
37
  "be.close": "關閉",
36
38
  "be.collapse": "摺疊",
37
- "be.contentInsights.contentAnalyticsErrorText": "There was a problem loading content insights. Please try again.",
38
- "be.contentInsights.contentInsightsTitle": "Content Insights",
39
- "be.contentInsights.downloadGraphLabel": "Chart displaying the number of downloads over the selected time period",
40
- "be.contentInsights.downloadGraphType": "DOWNLOADS",
41
- "be.contentInsights.openContentInsightsButton": "See Details",
42
- "be.contentInsights.peopleGraphLabel": "Chart displaying the number of users over the selected time period",
43
- "be.contentInsights.peopleTitle": "PEOPLE",
44
- "be.contentInsights.previewGraphLabel": "Chart displaying the number of previews over the selected time period",
45
- "be.contentInsights.previewGraphType": "PREVIEWS",
46
- "be.contentInsights.trendDown": "Trending down",
47
- "be.contentInsights.trendMonth": "PAST MONTH",
48
- "be.contentInsights.trendThreeMonths": "PAST 3 MONTHS",
49
- "be.contentInsights.trendUp": "Trending up",
50
- "be.contentInsights.trendWeek": "PAST WEEK",
51
- "be.contentInsights.trendYear": "PAST YEAR",
39
+ "be.contentInsights.contentAnalyticsErrorText": "載入內容深入探索時發生問題。請再試一次。",
40
+ "be.contentInsights.contentInsightsTitle": "內容深入探索",
41
+ "be.contentInsights.downloadGraphLabel": "顯示所選時段期間內下載次數的圖表",
42
+ "be.contentInsights.downloadGraphType": "下載",
43
+ "be.contentInsights.openContentInsightsButton": "查看詳細資料",
44
+ "be.contentInsights.peopleGraphLabel": "顯示所選時段期間內使用者人數的圖表",
45
+ "be.contentInsights.peopleTitle": "人員",
46
+ "be.contentInsights.previewGraphLabel": "顯示所選時段期間內預覽次數的圖表",
47
+ "be.contentInsights.previewGraphType": "預覽",
48
+ "be.contentInsights.trendDown": "向下趨勢",
49
+ "be.contentInsights.trendMonth": "過去一個月",
50
+ "be.contentInsights.trendThreeMonths": "過去 3 個月",
51
+ "be.contentInsights.trendUp": "向上趨勢",
52
+ "be.contentInsights.trendWeek": "過去一週",
53
+ "be.contentInsights.trendYear": "過去一年",
52
54
  "be.contentSharing.badRequestError": "此項目之要求的格式錯誤。",
53
55
  "be.contentSharing.collaboratorsLoadingError": "無法擷取此項目的共同作業者。",
54
56
  "be.contentSharing.getContactsError": "無法擷取連絡人。",
@@ -69,35 +69,35 @@ be.close = 關閉
69
69
  # Message to the user to collapse the Transcript entries
70
70
  be.collapse = 摺疊
71
71
  # Text shown to users when opening the content insights flyout and there is an error
72
- be.contentInsights.contentAnalyticsErrorText = There was a problem loading content insights. Please try again.
72
+ be.contentInsights.contentAnalyticsErrorText = 載入內容深入探索時發生問題。請再試一次。
73
73
  # Title for Content Insights section in file sidebar
74
- be.contentInsights.contentInsightsTitle = Content Insights
74
+ be.contentInsights.contentInsightsTitle = 內容深入探索
75
75
  # Label for the chart displaying the number of downloads over the selected time period
76
- be.contentInsights.downloadGraphLabel = Chart displaying the number of downloads over the selected time period
76
+ be.contentInsights.downloadGraphLabel = 顯示所選時段期間內下載次數的圖表
77
77
  # Title for the content insights graph card regarding number of Previews
78
- be.contentInsights.downloadGraphType = DOWNLOADS
78
+ be.contentInsights.downloadGraphType = 下載
79
79
  # Open Content Insights button which opens the Content Insights Modal
80
- be.contentInsights.openContentInsightsButton = See Details
80
+ be.contentInsights.openContentInsightsButton = 查看詳細資料
81
81
  # Label for the chart displaying the number of users over the selected time period
82
- be.contentInsights.peopleGraphLabel = Chart displaying the number of users over the selected time period
82
+ be.contentInsights.peopleGraphLabel = 顯示所選時段期間內使用者人數的圖表
83
83
  # Title used to represent how many users have interacted with the file
84
- be.contentInsights.peopleTitle = PEOPLE
84
+ be.contentInsights.peopleTitle = 人員
85
85
  # Label for the chart displaying the number of previews over the selected time period
86
- be.contentInsights.previewGraphLabel = Chart displaying the number of previews over the selected time period
86
+ be.contentInsights.previewGraphLabel = 顯示所選時段期間內預覽次數的圖表
87
87
  # Title for the content insights graph card regarding number of Previews
88
- be.contentInsights.previewGraphType = PREVIEWS
88
+ be.contentInsights.previewGraphType = 預覽
89
89
  # Label for the arrow indicator in the trend pill
90
- be.contentInsights.trendDown = Trending down
90
+ be.contentInsights.trendDown = 向下趨勢
91
91
  # Trend description for the content insights graph card regarding the count of events from the past month
92
- be.contentInsights.trendMonth = PAST MONTH
92
+ be.contentInsights.trendMonth = 過去一個月
93
93
  # Trend description for the content insights graph card regarding the count of events from the past three months
94
- be.contentInsights.trendThreeMonths = PAST 3 MONTHS
94
+ be.contentInsights.trendThreeMonths = 過去 3 個月
95
95
  # Label for the arrow indicator in the trend pill
96
- be.contentInsights.trendUp = Trending up
96
+ be.contentInsights.trendUp = 向上趨勢
97
97
  # Trend description for the content insights graph card regarding the count of events from the past week
98
- be.contentInsights.trendWeek = PAST WEEK
98
+ be.contentInsights.trendWeek = 過去一週
99
99
  # Trend description for the content insights graph card regarding the count of events from the past year
100
- be.contentInsights.trendYear = PAST YEAR
100
+ be.contentInsights.trendYear = 過去一年
101
101
  # Message that appears when the request for the ContentSharing Element is malformed.
102
102
  be.contentSharing.badRequestError = 此項目之要求的格式錯誤。
103
103
  # Message that appears when collaborators cannot be retrieved in the ContentSharing Element.
@@ -1558,6 +1558,8 @@ boxui.unifiedShare.contactRestrictionNotice = 無法傳送邀請給 {count, plur
1558
1558
  boxui.unifiedShare.contactRestrictionNoticeInformationBarrier = 由於安全政策,無法向 {count, plural, other {{count} 人}}發送邀請。
1559
1559
  # Text for the notice that is displayed when there are Information Barrier collaboration restrictions that apply to only one of the selected contacts
1560
1560
  boxui.unifiedShare.contactRestrictionNoticeInformationBarrierSingular = 由於安全政策,無法向 {email} 發送邀請。
1561
+ # Text for the notice that is displayed when there are Information Barrier collaboration restrictions that apply to only one of the selected contacts, which is a group
1562
+ boxui.unifiedShare.contactRestrictionNoticeInformationBarrierSingularGroup = Invitations cannot be sent to "{groupName}" due to a security policy.
1561
1563
  # Text for the notice that is displayed when there are collaboration restrictions that apply to one or more of the selected contacts
1562
1564
  boxui.unifiedShare.contactRestrictionNoticeSingular = 無法傳送邀請給 {email},因為外部共同作業受到所套用之安全性原則的限制。
1563
1565
  # Label for the button that removes restricted contacts on the contact restriction notice
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "box-ui-elements",
3
- "version": "16.0.0-beta.21",
3
+ "version": "16.0.0-beta.23",
4
4
  "description": "Box UI Elements",
5
5
  "author": "Box (https://www.box.com/)",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -110,7 +110,20 @@ const ActiveState = ({
110
110
  isFocused={isFocused}
111
111
  ref={refValue}
112
112
  >
113
- <ActivityThread hasReplies={hasReplies} data-testid="activity-thread">
113
+ <ActivityThread
114
+ data-testid="activity-thread"
115
+ onReplyDelete={onCommentDelete}
116
+ onReplyEdit={onCommentEdit}
117
+ currentUser={currentUser}
118
+ getAvatarUrl={getAvatarUrl}
119
+ hasReplies={hasReplies}
120
+ getMentionWithQuery={getMentionWithQuery}
121
+ getUserProfileUrl={getUserProfileUrl}
122
+ mentionSelectorContacts={mentionSelectorContacts}
123
+ repliesTotalCount={item.total_reply_count}
124
+ replies={item.replies}
125
+ translations={translations}
126
+ >
114
127
  <Comment
115
128
  {...item}
116
129
  currentUser={currentUser}
@@ -187,7 +200,20 @@ const ActiveState = ({
187
200
  isFocused={isFocused}
188
201
  ref={refValue}
189
202
  >
190
- <ActivityThread hasReplies={hasReplies} data-testid="activity-thread">
203
+ <ActivityThread
204
+ data-testid="activity-thread"
205
+ onReplyDelete={onCommentDelete}
206
+ onReplyEdit={onCommentEdit}
207
+ currentUser={currentUser}
208
+ getAvatarUrl={getAvatarUrl}
209
+ getMentionWithQuery={getMentionWithQuery}
210
+ getUserProfileUrl={getUserProfileUrl}
211
+ hasReplies={hasReplies}
212
+ mentionSelectorContacts={mentionSelectorContacts}
213
+ repliesTotalCount={item.total_reply_count}
214
+ replies={item.replies}
215
+ translations={translations}
216
+ >
191
217
  <AnnotationActivity
192
218
  currentUser={currentUser}
193
219
  getAvatarUrl={getAvatarUrl}
@@ -1,16 +1,104 @@
1
1
  // @flow
2
2
  import * as React from 'react';
3
+ import { FormattedMessage } from 'react-intl';
4
+ import noop from 'lodash/noop';
5
+
6
+ import LoadingIndicator from '../../../../components/loading-indicator';
7
+ import PlainButton from '../../../../components/plain-button';
8
+ import ActivityThreadReplies from './ActivityThreadReplies';
9
+
10
+ import type { GetAvatarUrlCallback, GetProfileUrlCallback } from '../../../common/flowTypes';
11
+ import type { Translations } from '../../flowTypes';
12
+ import type { SelectorItems, User } from '../../../../common/types/core';
13
+ import type { Comment as CommentType } from '../../../../common/types/feed';
14
+
15
+ import messages from './messages';
16
+ import './ActivityThread.scss';
3
17
 
4
18
  type Props = {
5
19
  children: React.Node,
20
+ currentUser?: User,
21
+ getAvatarUrl: GetAvatarUrlCallback,
22
+ getMentionWithQuery?: Function,
23
+ getUserProfileUrl?: GetProfileUrlCallback,
6
24
  hasReplies: boolean,
25
+ isRepliesLoading?: boolean,
26
+ mentionSelectorContacts?: SelectorItems<>,
27
+ onGetReplies?: () => void,
28
+ onReplyDelete?: Function,
29
+ onReplyEdit?: Function,
30
+ replies?: Array<CommentType>,
31
+ repliesTotalCount?: number,
32
+ translations?: Translations,
7
33
  };
8
34
 
9
- const ActivityThread = ({ children, hasReplies }: Props) => {
10
- if (hasReplies) {
11
- return <div className="bcs-ActivityThread">{children}</div>;
35
+ const ActivityThread = ({
36
+ children,
37
+ currentUser,
38
+ getAvatarUrl,
39
+ getMentionWithQuery,
40
+ getUserProfileUrl,
41
+ hasReplies,
42
+ isRepliesLoading,
43
+ mentionSelectorContacts,
44
+ onGetReplies = noop,
45
+ onReplyDelete = noop,
46
+ onReplyEdit = noop,
47
+ replies = [],
48
+ repliesTotalCount = 0,
49
+ translations,
50
+ }: Props) => {
51
+ const [isExpanded, setIsExpanded] = React.useState(false);
52
+
53
+ const toggleButtonLabel = isExpanded ? messages.hideReplies : messages.showReplies;
54
+ const repliesToLoadCount = Math.max(repliesTotalCount - 1, 0);
55
+
56
+ const toggleReplies = () => {
57
+ if (!isExpanded) {
58
+ onGetReplies();
59
+ }
60
+ setIsExpanded(previousState => !previousState);
61
+ };
62
+
63
+ if (!hasReplies) {
64
+ return children;
12
65
  }
13
- return children;
66
+ return (
67
+ <div className="bcs-ActivityThread" data-testid="activity-thread">
68
+ {children}
69
+
70
+ {isRepliesLoading && (
71
+ <div className="bcs-ActivityThread-loading" data-testid="activity-thread-loading">
72
+ <LoadingIndicator />
73
+ </div>
74
+ )}
75
+ {!isRepliesLoading && repliesTotalCount > 1 && (
76
+ <PlainButton
77
+ className="bcs-ActivityThread-toggle"
78
+ onClick={toggleReplies}
79
+ type="button"
80
+ data-testid="activity-thread-button"
81
+ >
82
+ <FormattedMessage values={{ repliesToLoadCount }} {...toggleButtonLabel} />
83
+ </PlainButton>
84
+ )}
85
+
86
+ {!isRepliesLoading && repliesTotalCount > 0 && replies.length && (
87
+ <ActivityThreadReplies
88
+ currentUser={currentUser}
89
+ getAvatarUrl={getAvatarUrl}
90
+ getMentionWithQuery={getMentionWithQuery}
91
+ getUserProfileUrl={getUserProfileUrl}
92
+ isExpanded={isExpanded}
93
+ mentionSelectorContacts={mentionSelectorContacts}
94
+ onDelete={onReplyDelete}
95
+ onEdit={onReplyEdit}
96
+ replies={replies}
97
+ translations={translations}
98
+ />
99
+ )}
100
+ </div>
101
+ );
14
102
  };
15
103
 
16
104
  export default ActivityThread;
@@ -0,0 +1,17 @@
1
+ @import '../../../common/variables';
2
+
3
+ .bcs-ActivityThread-toggle {
4
+ margin-left: $sidebarActivityFeedSpacingHorizontal;
5
+ color: $bdl-box-blue;
6
+ font-weight: bold;
7
+
8
+ &:hover,
9
+ &:active {
10
+ margin-left: $sidebarActivityFeedSpacingHorizontal;
11
+ font-weight: bold;
12
+ }
13
+ }
14
+
15
+ .bcs-ActivityThread-loading {
16
+ padding-bottom: $bdl-grid-unit * 5;
17
+ }
@@ -0,0 +1,87 @@
1
+ // @flow
2
+ import React from 'react';
3
+ import Comment from '../comment';
4
+
5
+ import type { GetAvatarUrlCallback, GetProfileUrlCallback } from '../../../common/flowTypes';
6
+ import type { Translations } from '../../flowTypes';
7
+ import type { SelectorItems, User } from '../../../../common/types/core';
8
+ import type { BoxCommentPermission, Comment as CommentType } from '../../../../common/types/feed';
9
+
10
+ import './ActivityThreadReplies.scss';
11
+
12
+ type Props = {
13
+ currentUser?: User,
14
+ getAvatarUrl: GetAvatarUrlCallback,
15
+ getMentionWithQuery?: Function,
16
+ getUserProfileUrl?: GetProfileUrlCallback,
17
+ isExpanded: boolean,
18
+ mentionSelectorContacts?: SelectorItems<>,
19
+ onDelete?: Function,
20
+ onEdit?: Function,
21
+ replies: Array<CommentType>,
22
+ translations?: Translations,
23
+ };
24
+
25
+ const ActivityThreadReplies = ({
26
+ currentUser,
27
+ getAvatarUrl,
28
+ getMentionWithQuery,
29
+ getUserProfileUrl,
30
+ isExpanded,
31
+ mentionSelectorContacts,
32
+ onDelete,
33
+ onEdit,
34
+ replies,
35
+ translations,
36
+ }: Props) => {
37
+ const lastReply = replies[replies.length - 1];
38
+
39
+ const getReplyPermissions = (reply: CommentType): BoxCommentPermission => {
40
+ const {
41
+ permissions: { can_delete = false, can_edit = false, can_resolve = false },
42
+ } = reply;
43
+ return {
44
+ can_delete,
45
+ can_edit,
46
+ can_resolve,
47
+ };
48
+ };
49
+
50
+ return (
51
+ <div className="bcs-ActivityThreadReplies" data-testid="activity-thread-replies">
52
+ {!isExpanded ? (
53
+ <Comment
54
+ key={lastReply.type + lastReply.id}
55
+ {...lastReply}
56
+ currentUser={currentUser}
57
+ getAvatarUrl={getAvatarUrl}
58
+ getMentionWithQuery={getMentionWithQuery}
59
+ getUserProfileUrl={getUserProfileUrl}
60
+ mentionSelectorContacts={mentionSelectorContacts}
61
+ onDelete={onDelete}
62
+ onEdit={onEdit}
63
+ permissions={getReplyPermissions(lastReply)}
64
+ translations={translations}
65
+ />
66
+ ) : (
67
+ replies.map((reply: CommentType) => (
68
+ <Comment
69
+ key={reply.type + reply.id}
70
+ {...reply}
71
+ currentUser={currentUser}
72
+ getAvatarUrl={getAvatarUrl}
73
+ getMentionWithQuery={getMentionWithQuery}
74
+ getUserProfileUrl={getUserProfileUrl}
75
+ mentionSelectorContacts={mentionSelectorContacts}
76
+ onDelete={onDelete}
77
+ onEdit={onEdit}
78
+ permissions={getReplyPermissions(reply)}
79
+ translations={translations}
80
+ />
81
+ ))
82
+ )}
83
+ </div>
84
+ );
85
+ };
86
+
87
+ export default ActivityThreadReplies;
@@ -0,0 +1,16 @@
1
+ @import '../../../common/variables';
2
+
3
+ .bcs-ActivityThreadReplies {
4
+ position: relative;
5
+ padding-left: $sidebarActivityFeedSpacingHorizontal;
6
+
7
+ &::before {
8
+ position: absolute;
9
+ top: $sidebarActivityFeedSpacingVertical;
10
+ bottom: $sidebarActivityFeedSpacingVertical;
11
+ left: $sidebarActivityFeedSpacingHorizontal;
12
+ width: 4px;
13
+ background: $bdl-gray-10;
14
+ content: '';
15
+ }
16
+ }
@@ -1,22 +1,68 @@
1
1
  // @flow
2
2
  import React from 'react';
3
- import { shallow, ShallowWrapper } from 'enzyme';
4
-
3
+ import { render, screen, fireEvent } from '@testing-library/react';
4
+ import { IntlProvider } from 'react-intl';
5
5
  import ActivityThread from '../ActivityThread.js';
6
+ import localize from '../../../../../../test/support/i18n';
7
+ import { replies } from '../fixtures';
8
+ import messages from '../messages';
6
9
 
10
+ jest.mock('react-intl', () => jest.requireActual('react-intl'));
7
11
  describe('src/elements/content-sidebar/activity-feed/activity-feed/ActivityThread', () => {
8
- const getWrapper = (props = {}): ShallowWrapper => shallow(<ActivityThread {...props}>Test</ActivityThread>);
12
+ const Wrapper = ({ children }: { children?: React.ReactNode }) => {
13
+ return <IntlProvider locale="en">{children}</IntlProvider>;
14
+ };
15
+
16
+ const getWrapper = props =>
17
+ render(
18
+ <ActivityThread replies={replies} repliesTotalCount={2} hasReplies {...props}>
19
+ Test
20
+ </ActivityThread>,
21
+ { wrapper: Wrapper },
22
+ );
23
+
24
+ test('should render children component wrapped in ActivityThread if hasReplies is true', () => {
25
+ getWrapper();
26
+
27
+ expect(screen.queryByTestId('activity-thread')).toBeInTheDocument();
28
+ expect(screen.getByText('Test')).toBeVisible();
29
+ });
9
30
 
10
- test('should render children component wrapped in ActivityCard if hasReplies is true', () => {
11
- const wrapper = getWrapper({ hasReplies: true });
31
+ test('should render children component if hasReplies is false', () => {
32
+ const { getByText } = getWrapper({ hasReplies: false });
12
33
 
13
- expect(wrapper.find('.bcs-ActivityThread')).toHaveLength(1);
14
- expect(wrapper.text()).toEqual('Test');
34
+ expect(screen.queryByTestId('activity-thread')).not.toBeInTheDocument();
35
+ expect(getByText('Test')).toBeVisible();
15
36
  });
16
- test('should render children component if hasReplies if false', () => {
17
- const wrapper = getWrapper({ hasReplies: false });
18
37
 
19
- expect(wrapper.find('bcs-ActivityThread')).toHaveLength(0);
20
- expect(wrapper.text()).toEqual('Test');
38
+ test('should call onGetReplies on button click', () => {
39
+ const onGetReplies = jest.fn();
40
+ const { getByText } = getWrapper({ onGetReplies });
41
+
42
+ const button = getByText(localize(messages.showReplies.id, { repliesToLoadCount: 1 }));
43
+ expect(button).toBeVisible();
44
+ fireEvent.click(button);
45
+
46
+ expect(onGetReplies).toBeCalled();
47
+ expect(getByText(localize(messages.hideReplies.id))).toBeVisible();
48
+ });
49
+
50
+ test('should not render button if total_reply_count is 1 or less', () => {
51
+ const { queryByTestId } = getWrapper({ repliesTotalCount: 1 });
52
+ expect(queryByTestId('activity-thread-button')).not.toBeInTheDocument();
53
+ });
54
+
55
+ test('should not render replies if there is no replies', () => {
56
+ const { queryByTestId } = getWrapper({ replies: [] });
57
+
58
+ expect(queryByTestId('activity-thread-replies')).not.toBeInTheDocument();
59
+ });
60
+
61
+ test('should render LoadingIndicator and do not render replies or button if repliesLoading is true', () => {
62
+ const { queryByTestId } = getWrapper({ isRepliesLoading: true });
63
+
64
+ expect(queryByTestId('activity-thread-replies')).not.toBeInTheDocument();
65
+ expect(queryByTestId('activity-thread-button')).not.toBeInTheDocument();
66
+ expect(queryByTestId('activity-thread-loading')).toBeInTheDocument();
21
67
  });
22
68
  });
@@ -0,0 +1,24 @@
1
+ // @flow
2
+
3
+ import React from 'react';
4
+ import { render } from '@testing-library/react';
5
+ import ActivityThreadReplies from '../ActivityThreadReplies.js';
6
+ import { replies } from '../fixtures';
7
+
8
+ describe('src/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplies', () => {
9
+ const getWrapper = props => render(<ActivityThreadReplies replies={replies} isExpanded={false} {...props} />);
10
+
11
+ test('should render last reply by default', () => {
12
+ const { queryByText } = getWrapper();
13
+
14
+ expect(queryByText(replies[1].message)).toBeVisible();
15
+ expect(queryByText(replies[0].message)).not.toBeInTheDocument();
16
+ });
17
+
18
+ test('should render all replies if isExpanded is true', () => {
19
+ const { queryByText } = getWrapper({ isExpanded: true });
20
+
21
+ expect(queryByText(replies[1].message)).toBeVisible();
22
+ expect(queryByText(replies[0].message)).toBeVisible();
23
+ });
24
+ });
@@ -50,6 +50,12 @@ exports[`elements/content-sidebar/ActiveState/activity-feed/ActiveState should r
50
50
  key="annotationanno_123"
51
51
  >
52
52
  <ActivityThread
53
+ currentUser={
54
+ Object {
55
+ "id": "user_123445",
56
+ "name": "Rihanna",
57
+ }
58
+ }
53
59
  data-testid="activity-thread"
54
60
  hasReplies={false}
55
61
  >
@@ -94,6 +100,12 @@ exports[`elements/content-sidebar/ActiveState/activity-feed/ActiveState should r
94
100
  key="commentc_123"
95
101
  >
96
102
  <ActivityThread
103
+ currentUser={
104
+ Object {
105
+ "id": "user_123445",
106
+ "name": "Rihanna",
107
+ }
108
+ }
97
109
  data-testid="activity-thread"
98
110
  hasReplies={false}
99
111
  >