From 3285d466d5a682885bc0deb6ed2804f2cfb01db3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Germ=C3=A1n=20Saracca?=
Date: Wed, 20 Nov 2024 15:14:41 -0300
Subject: [PATCH 01/18] chore: upgrade bootstrap icons version
---
package-lock.json | 21 ++++++++++++++++-----
package.json | 2 +-
packages/design-system/package.json | 2 +-
3 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 42ddaf1e7..8e940a23b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -30,7 +30,7 @@
"lodash": "^4.17.21",
"moment-timezone": "0.5.43",
"react-bootstrap": "2.7.2",
- "react-bootstrap-icons": "1.10.3",
+ "react-bootstrap-icons": "1.11.4",
"react-hook-form": "7.51.2",
"react-i18next": "12.1.5",
"react-infinite-scroll-hook": "4.1.1",
@@ -36324,9 +36324,9 @@
}
},
"node_modules/react-bootstrap-icons": {
- "version": "1.10.3",
- "resolved": "https://registry.npmjs.org/react-bootstrap-icons/-/react-bootstrap-icons-1.10.3.tgz",
- "integrity": "sha512-j4hSby6gT9/enhl3ybB1tfr1slZNAYXDVntcRrmVjxB3//2WwqrzpESVqKhyayYVaWpEtnwf9wgUQ03cuziwrw==",
+ "version": "1.11.4",
+ "resolved": "https://registry.npmjs.org/react-bootstrap-icons/-/react-bootstrap-icons-1.11.4.tgz",
+ "integrity": "sha512-lnkOpNEZ/Zr7mNxvjA9efuarCPSgtOuGA55XiRj7ASJnBjb1wEAdtJOd2Aiv9t07r7FLI1IgyZPg9P6jqWD/IA==",
"dependencies": {
"prop-types": "^15.7.2"
},
@@ -44412,7 +44412,7 @@
"@types/react": "18.0.27",
"bootstrap": "5.2.3",
"react-bootstrap": "2.7.2",
- "react-bootstrap-icons": "1.10.3",
+ "react-bootstrap-icons": "1.11.4",
"sass": "1.58.1",
"typescript": "4.9.5",
"vite-plugin-istanbul": "4.0.1"
@@ -44529,6 +44529,17 @@
"dev": true,
"license": "MIT"
},
+ "packages/design-system/node_modules/react-bootstrap-icons": {
+ "version": "1.10.3",
+ "resolved": "https://registry.npmjs.org/react-bootstrap-icons/-/react-bootstrap-icons-1.10.3.tgz",
+ "integrity": "sha512-j4hSby6gT9/enhl3ybB1tfr1slZNAYXDVntcRrmVjxB3//2WwqrzpESVqKhyayYVaWpEtnwf9wgUQ03cuziwrw==",
+ "dependencies": {
+ "prop-types": "^15.7.2"
+ },
+ "peerDependencies": {
+ "react": ">=16.8.6"
+ }
+ },
"packages/design-system/node_modules/supports-color": {
"version": "8.1.1",
"dev": true,
diff --git a/package.json b/package.json
index db411a652..e514064dd 100644
--- a/package.json
+++ b/package.json
@@ -34,7 +34,7 @@
"lodash": "^4.17.21",
"moment-timezone": "0.5.43",
"react-bootstrap": "2.7.2",
- "react-bootstrap-icons": "1.10.3",
+ "react-bootstrap-icons": "1.11.4",
"react-hook-form": "7.51.2",
"react-i18next": "12.1.5",
"react-infinite-scroll-hook": "4.1.1",
diff --git a/packages/design-system/package.json b/packages/design-system/package.json
index 1eb3708cd..88966e1d2 100644
--- a/packages/design-system/package.json
+++ b/packages/design-system/package.json
@@ -50,7 +50,7 @@
"@types/react": "18.0.27",
"bootstrap": "5.2.3",
"react-bootstrap": "2.7.2",
- "react-bootstrap-icons": "1.10.3",
+ "react-bootstrap-icons": "1.11.4",
"sass": "1.58.1",
"typescript": "4.9.5",
"vite-plugin-istanbul": "4.0.1"
From 63a307f76e83c52c98ac7f7798a4e2f439ef16a8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Germ=C3=A1n=20Saracca?=
Date: Wed, 20 Nov 2024 15:15:06 -0300
Subject: [PATCH 02/18] feat: layout for share button
---
.../collection/Collection.module.scss | 13 ++++++--
src/sections/collection/Collection.tsx | 30 ++++++++++++++-----
2 files changed, 33 insertions(+), 10 deletions(-)
diff --git a/src/sections/collection/Collection.module.scss b/src/sections/collection/Collection.module.scss
index f3d91b901..a6730da0b 100644
--- a/src/sections/collection/Collection.module.scss
+++ b/src/sections/collection/Collection.module.scss
@@ -11,10 +11,19 @@
gap: 10px;
}
-.action-buttons {
+.metrics-actions-container {
display: flex;
- justify-content: flex-end;
+ flex-wrap: wrap;
+ align-items: center;
+ justify-content: space-between;
margin-bottom: 1rem;
+
+ .right-content {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 0.5rem;
+ align-items: center;
+ }
}
.subtext {
diff --git a/src/sections/collection/Collection.tsx b/src/sections/collection/Collection.tsx
index f90964f0b..a2acddc5a 100644
--- a/src/sections/collection/Collection.tsx
+++ b/src/sections/collection/Collection.tsx
@@ -14,6 +14,7 @@ import { CollectionSkeleton } from './CollectionSkeleton'
import { PageNotFound } from '../page-not-found/PageNotFound'
import { CreatedAlert } from './CreatedAlert'
import { PublishCollectionButton } from './publish-collection/PublishCollectionButton'
+import { ShareButton } from './share-button/ShareButton'
import styles from './Collection.module.scss'
interface CollectionProps {
@@ -47,9 +48,11 @@ export function Collection({
const canUserAddCollection = Boolean(collectionUserPermissions?.canAddCollection)
const canUserAddDataset = Boolean(collectionUserPermissions?.canAddDataset)
- const canUserPublishCollection = user && Boolean(collectionUserPermissions?.canPublishCollection)
+ const canUserPublishCollection = Boolean(collectionUserPermissions?.canPublishCollection)
const showAddDataActions = Boolean(user && (canUserAddCollection || canUserAddDataset))
+ const showPublishButton = user && !collection?.isReleased && canUserPublishCollection
+
const { t } = useTranslation('collection')
if (!isLoading && !collection) {
@@ -71,14 +74,25 @@ export function Collection({
{t('publishedAlert')}
)}
- {!collection.isReleased && canUserPublishCollection && (
-
-
+
+
+
Metrics
+
+
+ {/* 👇 Here should go Contact button also */}
+ {/* */}
+
+
+
+
+ {showPublishButton && (
+
+ )}
- )}
+
Date: Wed, 20 Nov 2024 15:16:00 -0300
Subject: [PATCH 03/18] feat: share modal ui done
---
.../share-button/ShareButton.module.scss | 57 +++++++++++++++++++
.../collection/share-button/ShareButton.tsx | 28 +++++++++
.../collection/share-button/ShareModal.tsx | 52 +++++++++++++++++
3 files changed, 137 insertions(+)
create mode 100644 src/sections/collection/share-button/ShareButton.module.scss
create mode 100644 src/sections/collection/share-button/ShareButton.tsx
create mode 100644 src/sections/collection/share-button/ShareModal.tsx
diff --git a/src/sections/collection/share-button/ShareButton.module.scss b/src/sections/collection/share-button/ShareButton.module.scss
new file mode 100644
index 000000000..ce6285b05
--- /dev/null
+++ b/src/sections/collection/share-button/ShareButton.module.scss
@@ -0,0 +1,57 @@
+@import 'node_modules/@iqss/dataverse-design-system/src/lib/assets/styles/design-tokens/colors.module';
+
+.share-icon {
+ margin-right: 0.3rem;
+ margin-bottom: 0.2rem;
+}
+
+// Modal styles
+
+.help-block {
+ color: $dv-subtext-color;
+ font-size: 14px;
+}
+
+.social-btn {
+ display: grid;
+ place-items: center;
+ padding: 8px 12px;
+ background-color: transparent;
+ border: 0;
+ border-radius: 6px;
+ transition: all 0.15s ease-in-out;
+
+ &:hover {
+ scale: 1.1;
+ box-shadow: 2px 2px 10px rgb(0 0 0 / 30%);
+ }
+
+ &:active {
+ scale: 1;
+ box-shadow: none;
+ }
+
+ &.fb {
+ background-color: #3a5795;
+
+ svg {
+ color: #fff;
+ }
+ }
+
+ &.x {
+ background-color: #000;
+
+ svg {
+ color: #fff;
+ }
+ }
+
+ &.linkedin {
+ background-color: #6f5499;
+
+ svg {
+ color: #fff;
+ }
+ }
+}
diff --git a/src/sections/collection/share-button/ShareButton.tsx b/src/sections/collection/share-button/ShareButton.tsx
new file mode 100644
index 000000000..cc7e75078
--- /dev/null
+++ b/src/sections/collection/share-button/ShareButton.tsx
@@ -0,0 +1,28 @@
+import { useState } from 'react'
+import { Button, Tooltip } from '@iqss/dataverse-design-system'
+import { ShareFill } from 'react-bootstrap-icons'
+import { ShareModal } from './ShareModal'
+import styles from './ShareButton.module.scss'
+
+export const ShareButton = () => {
+ const [showShareModal, setShowShareModal] = useState(false)
+
+ const openShareModal = () => setShowShareModal(true)
+ const closeShareModal = () => setShowShareModal(false)
+
+ return (
+ <>
+
+ }>
+ Share
+
+
+
+
+ >
+ )
+}
diff --git a/src/sections/collection/share-button/ShareModal.tsx b/src/sections/collection/share-button/ShareModal.tsx
new file mode 100644
index 000000000..a04256c4d
--- /dev/null
+++ b/src/sections/collection/share-button/ShareModal.tsx
@@ -0,0 +1,52 @@
+import { Button, Modal, Stack } from '@iqss/dataverse-design-system'
+import { Facebook, Linkedin, TwitterX } from 'react-bootstrap-icons'
+import styles from './ShareButton.module.scss'
+
+interface ShareModalProps {
+ show: boolean
+ handleClose: () => void
+}
+
+export const ShareModal = ({ show, handleClose }: ShareModalProps) => {
+ return (
+
+
+ Share Collection
+
+
+
+ Share this collection on your favorite social media networks.
+
+
+
+
+
+
+
+
+
+
+
+
+ )
+}
From 8d8f6314dc1c3fe406886e38f8652609a92870bb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Germ=C3=A1n=20Saracca?=
Date: Wed, 20 Nov 2024 17:01:17 -0300
Subject: [PATCH 04/18] feat: use links instead of buttons
---
index.html | 3 ++
src/sections/collection/Collection.tsx | 4 +-
.../ShareCollection.module.scss} | 0
.../ShareCollectionButton.tsx} | 8 +--
.../ShareCollectionModal.tsx} | 52 +++++++++++++------
5 files changed, 46 insertions(+), 21 deletions(-)
rename src/sections/collection/{share-button/ShareButton.module.scss => share-collection/ShareCollection.module.scss} (100%)
rename src/sections/collection/{share-button/ShareButton.tsx => share-collection/ShareCollectionButton.tsx} (72%)
rename src/sections/collection/{share-button/ShareModal.tsx => share-collection/ShareCollectionModal.tsx} (55%)
diff --git a/index.html b/index.html
index 565fbf246..b8088f5f4 100644
--- a/index.html
+++ b/index.html
@@ -9,6 +9,9 @@
Dataverse
+
+
+
diff --git a/src/sections/collection/Collection.tsx b/src/sections/collection/Collection.tsx
index a2acddc5a..2a1cf27c9 100644
--- a/src/sections/collection/Collection.tsx
+++ b/src/sections/collection/Collection.tsx
@@ -14,7 +14,7 @@ import { CollectionSkeleton } from './CollectionSkeleton'
import { PageNotFound } from '../page-not-found/PageNotFound'
import { CreatedAlert } from './CreatedAlert'
import { PublishCollectionButton } from './publish-collection/PublishCollectionButton'
-import { ShareButton } from './share-button/ShareButton'
+import { ShareCollectionButton } from './share-collection/ShareCollectionButton'
import styles from './Collection.module.scss'
interface CollectionProps {
@@ -82,7 +82,7 @@ export function Collection({
{/* 👇 Here should go Contact button also */}
{/* */}
-
+
{showPublishButton && (
diff --git a/src/sections/collection/share-button/ShareButton.module.scss b/src/sections/collection/share-collection/ShareCollection.module.scss
similarity index 100%
rename from src/sections/collection/share-button/ShareButton.module.scss
rename to src/sections/collection/share-collection/ShareCollection.module.scss
diff --git a/src/sections/collection/share-button/ShareButton.tsx b/src/sections/collection/share-collection/ShareCollectionButton.tsx
similarity index 72%
rename from src/sections/collection/share-button/ShareButton.tsx
rename to src/sections/collection/share-collection/ShareCollectionButton.tsx
index cc7e75078..75043b880 100644
--- a/src/sections/collection/share-button/ShareButton.tsx
+++ b/src/sections/collection/share-collection/ShareCollectionButton.tsx
@@ -1,10 +1,10 @@
import { useState } from 'react'
import { Button, Tooltip } from '@iqss/dataverse-design-system'
import { ShareFill } from 'react-bootstrap-icons'
-import { ShareModal } from './ShareModal'
-import styles from './ShareButton.module.scss'
+import { ShareCollectionModal } from './ShareCollectionModal'
+import styles from './ShareCollection.module.scss'
-export const ShareButton = () => {
+export const ShareCollectionButton = () => {
const [showShareModal, setShowShareModal] = useState(false)
const openShareModal = () => setShowShareModal(true)
@@ -22,7 +22,7 @@ export const ShareButton = () => {
-
+
>
)
}
diff --git a/src/sections/collection/share-button/ShareModal.tsx b/src/sections/collection/share-collection/ShareCollectionModal.tsx
similarity index 55%
rename from src/sections/collection/share-button/ShareModal.tsx
rename to src/sections/collection/share-collection/ShareCollectionModal.tsx
index a04256c4d..8b34ea504 100644
--- a/src/sections/collection/share-button/ShareModal.tsx
+++ b/src/sections/collection/share-collection/ShareCollectionModal.tsx
@@ -1,13 +1,28 @@
import { Button, Modal, Stack } from '@iqss/dataverse-design-system'
import { Facebook, Linkedin, TwitterX } from 'react-bootstrap-icons'
-import styles from './ShareButton.module.scss'
+import styles from './ShareCollection.module.scss'
-interface ShareModalProps {
+interface ShareCollectionModalProps {
show: boolean
handleClose: () => void
}
-export const ShareModal = ({ show, handleClose }: ShareModalProps) => {
+// TODO:ME - Add storybook
+// TODO:ME - Add component test to check url is correct
+
+export const ShareCollectionModal = ({ show, handleClose }: ShareCollectionModalProps) => {
+ const currentUrl = window.location.href
+
+ const shareOnLinkedInURL = `https://www.linkedin.com/shareArticle?url=${encodeURIComponent(
+ currentUrl
+ )}`
+
+ const shareOnXURL = `https://twitter.com/intent/tweet?url=${encodeURIComponent(currentUrl)}`
+
+ const shareOnFacebookURL = `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(
+ currentUrl
+ )}`
+
return (
@@ -19,27 +34,34 @@ export const ShareModal = ({ show, handleClose }: ShareModalProps) => {
-
-
-
+
From 2dcbd0001fe2d3367ac149b345bcf9b5320164b1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Germ=C3=A1n=20Saracca?=
Date: Thu, 21 Nov 2024 10:37:12 -0300
Subject: [PATCH 05/18] feat: create reusable social share modal
---
.../button-group/ButtonGroup.stories.tsx | 9 ++-----
src/sections/collection/Collection.tsx | 2 +-
.../ShareCollectionButton.tsx | 13 ++++++----
.../SocialShareModal.module.scss} | 7 -----
.../social-share-modal/SocialShareModal.tsx} | 26 +++++++++----------
5 files changed, 24 insertions(+), 33 deletions(-)
rename src/sections/collection/{share-collection => share-collection-button}/ShareCollectionButton.tsx (59%)
rename src/sections/{collection/share-collection/ShareCollection.module.scss => shared/social-share-modal/SocialShareModal.module.scss} (89%)
rename src/sections/{collection/share-collection/ShareCollectionModal.tsx => shared/social-share-modal/SocialShareModal.tsx} (79%)
diff --git a/packages/design-system/src/lib/stories/button-group/ButtonGroup.stories.tsx b/packages/design-system/src/lib/stories/button-group/ButtonGroup.stories.tsx
index ddf2f812c..2fbd7422a 100644
--- a/packages/design-system/src/lib/stories/button-group/ButtonGroup.stories.tsx
+++ b/packages/design-system/src/lib/stories/button-group/ButtonGroup.stories.tsx
@@ -55,17 +55,12 @@ export const NestedButtonGroups: Story = {
render: () => (
-
+
Item 1
Item 2
Item 3
-
+
Item 1
Item 2
Item 3
diff --git a/src/sections/collection/Collection.tsx b/src/sections/collection/Collection.tsx
index 2a1cf27c9..3884dd4d4 100644
--- a/src/sections/collection/Collection.tsx
+++ b/src/sections/collection/Collection.tsx
@@ -14,7 +14,7 @@ import { CollectionSkeleton } from './CollectionSkeleton'
import { PageNotFound } from '../page-not-found/PageNotFound'
import { CreatedAlert } from './CreatedAlert'
import { PublishCollectionButton } from './publish-collection/PublishCollectionButton'
-import { ShareCollectionButton } from './share-collection/ShareCollectionButton'
+import { ShareCollectionButton } from './share-collection-button/ShareCollectionButton'
import styles from './Collection.module.scss'
interface CollectionProps {
diff --git a/src/sections/collection/share-collection/ShareCollectionButton.tsx b/src/sections/collection/share-collection-button/ShareCollectionButton.tsx
similarity index 59%
rename from src/sections/collection/share-collection/ShareCollectionButton.tsx
rename to src/sections/collection/share-collection-button/ShareCollectionButton.tsx
index 75043b880..3bb89159e 100644
--- a/src/sections/collection/share-collection/ShareCollectionButton.tsx
+++ b/src/sections/collection/share-collection-button/ShareCollectionButton.tsx
@@ -1,8 +1,7 @@
import { useState } from 'react'
import { Button, Tooltip } from '@iqss/dataverse-design-system'
import { ShareFill } from 'react-bootstrap-icons'
-import { ShareCollectionModal } from './ShareCollectionModal'
-import styles from './ShareCollection.module.scss'
+import { SocialShareModal } from '@/sections/shared/social-share-modal/SocialShareModal'
export const ShareCollectionButton = () => {
const [showShareModal, setShowShareModal] = useState(false)
@@ -16,13 +15,17 @@ export const ShareCollectionButton = () => {
}>
+ icon={}>
Share
-
+
>
)
}
diff --git a/src/sections/collection/share-collection/ShareCollection.module.scss b/src/sections/shared/social-share-modal/SocialShareModal.module.scss
similarity index 89%
rename from src/sections/collection/share-collection/ShareCollection.module.scss
rename to src/sections/shared/social-share-modal/SocialShareModal.module.scss
index ce6285b05..2f3ebf793 100644
--- a/src/sections/collection/share-collection/ShareCollection.module.scss
+++ b/src/sections/shared/social-share-modal/SocialShareModal.module.scss
@@ -1,12 +1,5 @@
@import 'node_modules/@iqss/dataverse-design-system/src/lib/assets/styles/design-tokens/colors.module';
-.share-icon {
- margin-right: 0.3rem;
- margin-bottom: 0.2rem;
-}
-
-// Modal styles
-
.help-block {
color: $dv-subtext-color;
font-size: 14px;
diff --git a/src/sections/collection/share-collection/ShareCollectionModal.tsx b/src/sections/shared/social-share-modal/SocialShareModal.tsx
similarity index 79%
rename from src/sections/collection/share-collection/ShareCollectionModal.tsx
rename to src/sections/shared/social-share-modal/SocialShareModal.tsx
index 8b34ea504..1ee4809dd 100644
--- a/src/sections/collection/share-collection/ShareCollectionModal.tsx
+++ b/src/sections/shared/social-share-modal/SocialShareModal.tsx
@@ -1,16 +1,18 @@
import { Button, Modal, Stack } from '@iqss/dataverse-design-system'
import { Facebook, Linkedin, TwitterX } from 'react-bootstrap-icons'
-import styles from './ShareCollection.module.scss'
+import styles from './SocialShareModal.module.scss'
-interface ShareCollectionModalProps {
+// TODO:ME - Add storybook
+// TODO:ME - Add component test to check url is correct
+
+interface SocialShareModalProps {
show: boolean
+ title: string
+ helpText: string
handleClose: () => void
}
-// TODO:ME - Add storybook
-// TODO:ME - Add component test to check url is correct
-
-export const ShareCollectionModal = ({ show, handleClose }: ShareCollectionModalProps) => {
+export const SocialShareModal = ({ show, title, helpText, handleClose }: SocialShareModalProps) => {
const currentUrl = window.location.href
const shareOnLinkedInURL = `https://www.linkedin.com/shareArticle?url=${encodeURIComponent(
@@ -26,12 +28,10 @@ export const ShareCollectionModal = ({ show, handleClose }: ShareCollectionModal
return (
- Share Collection
+ {title}
-
- Share this collection on your favorite social media networks.
-
+ {helpText}
@@ -49,7 +49,7 @@ export const ShareCollectionModal = ({ show, handleClose }: ShareCollectionModal
target="_blank"
rel="noreferrer"
title="X, formerly Twitter"
- aria-label="X, formerly Twitter"
+ aria-label="Share on X, formerly Twitter"
className={`${styles['social-btn']} ${styles.x}`}>
@@ -58,7 +58,7 @@ export const ShareCollectionModal = ({ show, handleClose }: ShareCollectionModal
target="_blank"
rel="noreferrer"
title="Facebook"
- aria-label="Facebook"
+ aria-label="Share on Facebook"
className={`${styles['social-btn']} ${styles.fb}`}>
From ebb64d9355711d2d694fefcf61d8cb5c2598a503 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Germ=C3=A1n=20Saracca?=
Date: Thu, 21 Nov 2024 10:45:51 -0300
Subject: [PATCH 06/18] feat: reuse social share modal for sharing dataset
---
.../DatasetActionButtons.module.scss | 6 +++++
.../DatasetActionButtons.tsx | 9 ++++++-
.../ShareDatasetButton.tsx | 25 +++++++++++++++++++
3 files changed, 39 insertions(+), 1 deletion(-)
create mode 100644 src/sections/dataset/dataset-action-buttons/share-dataset-button/ShareDatasetButton.tsx
diff --git a/src/sections/dataset/dataset-action-buttons/DatasetActionButtons.module.scss b/src/sections/dataset/dataset-action-buttons/DatasetActionButtons.module.scss
index fdb73c0cd..5dfd7feb5 100644
--- a/src/sections/dataset/dataset-action-buttons/DatasetActionButtons.module.scss
+++ b/src/sections/dataset/dataset-action-buttons/DatasetActionButtons.module.scss
@@ -3,3 +3,9 @@
width: 100%;
margin: 0.5rem 0;
}
+
+.contact-owner-and-share-group {
+ > button {
+ width: 50%;
+ }
+}
diff --git a/src/sections/dataset/dataset-action-buttons/DatasetActionButtons.tsx b/src/sections/dataset/dataset-action-buttons/DatasetActionButtons.tsx
index ce5c3f4cd..62d3afb1a 100644
--- a/src/sections/dataset/dataset-action-buttons/DatasetActionButtons.tsx
+++ b/src/sections/dataset/dataset-action-buttons/DatasetActionButtons.tsx
@@ -1,5 +1,5 @@
import { Dataset } from '../../../dataset/domain/models/Dataset'
-import { ButtonGroup } from '@iqss/dataverse-design-system'
+import { Button, ButtonGroup } from '@iqss/dataverse-design-system'
import { AccessDatasetMenu } from './access-dataset-menu/AccessDatasetMenu'
import { PublishDatasetMenu } from './publish-dataset-menu/PublishDatasetMenu'
import styles from './DatasetActionButtons.module.scss'
@@ -9,6 +9,7 @@ import { LinkDatasetButton } from './link-dataset-button/LinkDatasetButton'
import { useTranslation } from 'react-i18next'
import { DatasetRepository } from '../../../dataset/domain/repositories/DatasetRepository'
import { CollectionRepository } from '../../../collection/domain/repositories/CollectionRepository'
+import { ShareDatasetButton } from './share-dataset-button/ShareDatasetButton'
interface DatasetActionButtonsProps {
dataset: Dataset
@@ -39,6 +40,12 @@ export function DatasetActionButtons({
+
+
+
+
)
}
diff --git a/src/sections/dataset/dataset-action-buttons/share-dataset-button/ShareDatasetButton.tsx b/src/sections/dataset/dataset-action-buttons/share-dataset-button/ShareDatasetButton.tsx
new file mode 100644
index 000000000..dcaaf6def
--- /dev/null
+++ b/src/sections/dataset/dataset-action-buttons/share-dataset-button/ShareDatasetButton.tsx
@@ -0,0 +1,25 @@
+import { useState } from 'react'
+import { Button } from '@iqss/dataverse-design-system'
+import { SocialShareModal } from '@/sections/shared/social-share-modal/SocialShareModal'
+
+export const ShareDatasetButton = () => {
+ const [showShareModal, setShowShareModal] = useState(false)
+
+ const openShareModal = () => setShowShareModal(true)
+ const closeShareModal = () => setShowShareModal(false)
+
+ return (
+ <>
+
+
+
+ >
+ )
+}
From 509c5c917b3478344544f5c1eb7c66d17811ea67 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Germ=C3=A1n=20Saracca?=
Date: Thu, 21 Nov 2024 10:59:32 -0300
Subject: [PATCH 07/18] feat: add locales
---
public/locales/en/collection.json | 6 +++++-
public/locales/en/dataset.json | 7 ++++++-
public/locales/en/shared.json | 2 ++
.../ShareCollectionButton.tsx | 12 ++++++++----
.../dataset-action-buttons/DatasetActionButtons.tsx | 3 ++-
.../share-dataset-button/ShareDatasetButton.tsx | 9 ++++++---
.../shared/social-share-modal/SocialShareModal.tsx | 5 ++++-
7 files changed, 33 insertions(+), 11 deletions(-)
diff --git a/public/locales/en/collection.json b/public/locales/en/collection.json
index f950adb7f..f2c06ddbf 100644
--- a/public/locales/en/collection.json
+++ b/public/locales/en/collection.json
@@ -30,5 +30,9 @@
"question": "Are you sure you want to publish your collection? Once you do so it must remain published.",
"error": "There was an error publishing your collection."
},
- "publishedAlert": "Your collection is now public."
+ "publishedAlert": "Your collection is now public.",
+ "share": {
+ "shareCollection": "Share Collection",
+ "helpText": "Share this collection on your favorite social media networks."
+ }
}
diff --git a/public/locales/en/dataset.json b/public/locales/en/dataset.json
index 0d5c73dcd..c7907b483 100644
--- a/public/locales/en/dataset.json
+++ b/public/locales/en/dataset.json
@@ -59,7 +59,12 @@
"archivalZip": "Archival Format (.tab) ZIP"
}
},
- "uploadFiles": "Upload Files"
+ "uploadFiles": "Upload Files",
+ "share": {
+ "shareDataset": "Share Dataset",
+ "helpText": "Share this dataset on your favorite social media networks."
+ },
+ "contactOwner": "Contact Owner"
},
"alerts": {
"publishInProgress": {
diff --git a/public/locales/en/shared.json b/public/locales/en/shared.json
index 403cf5307..7f0d4dbc9 100644
--- a/public/locales/en/shared.json
+++ b/public/locales/en/shared.json
@@ -3,7 +3,9 @@
"remove": "Remove",
"add": "Add",
"cancel": "Cancel",
+ "close": "Close",
"continue": "Continue",
+ "share": "Share",
"pageNumberNotFound": {
"heading": "Page Number Not Found",
"message": "The page number you requested does not exist. Please try a different page number."
diff --git a/src/sections/collection/share-collection-button/ShareCollectionButton.tsx b/src/sections/collection/share-collection-button/ShareCollectionButton.tsx
index 3bb89159e..7616ad770 100644
--- a/src/sections/collection/share-collection-button/ShareCollectionButton.tsx
+++ b/src/sections/collection/share-collection-button/ShareCollectionButton.tsx
@@ -1,9 +1,13 @@
import { useState } from 'react'
+import { useTranslation } from 'react-i18next'
import { Button, Tooltip } from '@iqss/dataverse-design-system'
import { ShareFill } from 'react-bootstrap-icons'
import { SocialShareModal } from '@/sections/shared/social-share-modal/SocialShareModal'
export const ShareCollectionButton = () => {
+ const { t } = useTranslation('collection')
+ const { t: tShared } = useTranslation('shared')
+
const [showShareModal, setShowShareModal] = useState(false)
const openShareModal = () => setShowShareModal(true)
@@ -11,20 +15,20 @@ export const ShareCollectionButton = () => {
return (
<>
-
+
}>
- Share
+ {tShared('share')}
>
)
diff --git a/src/sections/dataset/dataset-action-buttons/DatasetActionButtons.tsx b/src/sections/dataset/dataset-action-buttons/DatasetActionButtons.tsx
index 62d3afb1a..2a03e4c66 100644
--- a/src/sections/dataset/dataset-action-buttons/DatasetActionButtons.tsx
+++ b/src/sections/dataset/dataset-action-buttons/DatasetActionButtons.tsx
@@ -23,6 +23,7 @@ export function DatasetActionButtons({
collectionRepository
}: DatasetActionButtonsProps) {
const { t } = useTranslation('dataset')
+
return (
diff --git a/src/sections/dataset/dataset-action-buttons/share-dataset-button/ShareDatasetButton.tsx b/src/sections/dataset/dataset-action-buttons/share-dataset-button/ShareDatasetButton.tsx
index dcaaf6def..9bc7644e2 100644
--- a/src/sections/dataset/dataset-action-buttons/share-dataset-button/ShareDatasetButton.tsx
+++ b/src/sections/dataset/dataset-action-buttons/share-dataset-button/ShareDatasetButton.tsx
@@ -1,8 +1,11 @@
import { useState } from 'react'
+import { useTranslation } from 'react-i18next'
import { Button } from '@iqss/dataverse-design-system'
import { SocialShareModal } from '@/sections/shared/social-share-modal/SocialShareModal'
export const ShareDatasetButton = () => {
+ const { t } = useTranslation('dataset')
+ const { t: tShared } = useTranslation('shared')
const [showShareModal, setShowShareModal] = useState(false)
const openShareModal = () => setShowShareModal(true)
@@ -11,14 +14,14 @@ export const ShareDatasetButton = () => {
return (
<>
>
)
diff --git a/src/sections/shared/social-share-modal/SocialShareModal.tsx b/src/sections/shared/social-share-modal/SocialShareModal.tsx
index 1ee4809dd..0e7d35e81 100644
--- a/src/sections/shared/social-share-modal/SocialShareModal.tsx
+++ b/src/sections/shared/social-share-modal/SocialShareModal.tsx
@@ -1,3 +1,4 @@
+import { useTranslation } from 'react-i18next'
import { Button, Modal, Stack } from '@iqss/dataverse-design-system'
import { Facebook, Linkedin, TwitterX } from 'react-bootstrap-icons'
import styles from './SocialShareModal.module.scss'
@@ -13,6 +14,8 @@ interface SocialShareModalProps {
}
export const SocialShareModal = ({ show, title, helpText, handleClose }: SocialShareModalProps) => {
+ const { t } = useTranslation('shared')
+
const currentUrl = window.location.href
const shareOnLinkedInURL = `https://www.linkedin.com/shareArticle?url=${encodeURIComponent(
@@ -66,7 +69,7 @@ export const SocialShareModal = ({ show, title, helpText, handleClose }: SocialS
From a3c9982821c1754caf0e06cfecc19121ee13f3de Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Germ=C3=A1n=20Saracca?=
Date: Thu, 21 Nov 2024 11:50:22 -0300
Subject: [PATCH 08/18] feat: add stories
---
src/sections/collection/Collection.tsx | 2 +-
.../ShareCollectionButton.tsx | 1 +
.../ShareDatasetButton.tsx | 1 +
.../social-share-modal/SocialShareModal.tsx | 26 +++++-----
.../SocialShareModal.stories.tsx | 48 +++++++++++++++++++
5 files changed, 66 insertions(+), 12 deletions(-)
create mode 100644 src/stories/shared/social-share-modal/SocialShareModal.stories.tsx
diff --git a/src/sections/collection/Collection.tsx b/src/sections/collection/Collection.tsx
index 3884dd4d4..5d2cbfd27 100644
--- a/src/sections/collection/Collection.tsx
+++ b/src/sections/collection/Collection.tsx
@@ -76,7 +76,7 @@ export function Collection({
)}
-
Metrics
+
{/* 👇 Here should go Contact button also */}
diff --git a/src/sections/collection/share-collection-button/ShareCollectionButton.tsx b/src/sections/collection/share-collection-button/ShareCollectionButton.tsx
index 7616ad770..e2ee13c6a 100644
--- a/src/sections/collection/share-collection-button/ShareCollectionButton.tsx
+++ b/src/sections/collection/share-collection-button/ShareCollectionButton.tsx
@@ -25,6 +25,7 @@ export const ShareCollectionButton = () => {
{
void
}
-export const SocialShareModal = ({ show, title, helpText, handleClose }: SocialShareModalProps) => {
+export const SocialShareModal = ({
+ show,
+ title,
+ helpText,
+ shareUrl,
+ handleClose
+}: SocialShareModalProps) => {
const { t } = useTranslation('shared')
- const currentUrl = window.location.href
-
- const shareOnLinkedInURL = `https://www.linkedin.com/shareArticle?url=${encodeURIComponent(
- currentUrl
- )}`
+ const shareOnLinkedInURL = `${LINKEDIN_SHARE_URL}${encodeURIComponent(shareUrl)}`
- const shareOnXURL = `https://twitter.com/intent/tweet?url=${encodeURIComponent(currentUrl)}`
+ const shareOnXURL = `${X_SHARE_URL}${encodeURIComponent(shareUrl)}`
- const shareOnFacebookURL = `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(
- currentUrl
- )}`
+ const shareOnFacebookURL = `${FACEBOOK_SHARE_URL}${encodeURIComponent(shareUrl)}`
return (
diff --git a/src/stories/shared/social-share-modal/SocialShareModal.stories.tsx b/src/stories/shared/social-share-modal/SocialShareModal.stories.tsx
new file mode 100644
index 000000000..f378028be
--- /dev/null
+++ b/src/stories/shared/social-share-modal/SocialShareModal.stories.tsx
@@ -0,0 +1,48 @@
+import { Meta, StoryObj } from '@storybook/react'
+import { WithI18next } from '../../WithI18next'
+import { SocialShareModal } from '@/sections/shared/social-share-modal/SocialShareModal'
+
+const meta: Meta = {
+ title: 'Sections/Shared/SocialShareModal',
+ component: SocialShareModal,
+ decorators: [WithI18next]
+}
+
+export default meta
+type Story = StoryObj
+
+export const Default: Story = {
+ render: () => (
+ {}}
+ />
+ )
+}
+
+export const ShareCollection: Story = {
+ render: () => (
+ {}}
+ />
+ )
+}
+
+export const ShareDataset: Story = {
+ render: () => (
+ {}}
+ />
+ )
+}
From 8206ad697dd06e66b882c94185767d97e9b6e5ca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Germ=C3=A1n=20Saracca?=
Date: Thu, 21 Nov 2024 12:34:36 -0300
Subject: [PATCH 09/18] test: add unit tests
---
.../social-share-modal/SocialShareModal.tsx | 2 --
.../sections/collection/Collection.spec.tsx | 25 ++++++++++++++++++-
.../DatasetActionButtons.spec.tsx | 15 +++++++++--
.../ShareDatasetButton.spec.tsx | 16 ++++++++++++
.../SocialShareModal.spec.tsx | 19 ++++++++++++++
5 files changed, 72 insertions(+), 5 deletions(-)
create mode 100644 tests/component/sections/dataset/dataset-action-buttons/share-dataset-button/ShareDatasetButton.spec.tsx
create mode 100644 tests/component/sections/shared/social-share-modal/SocialShareModal.spec.tsx
diff --git a/src/sections/shared/social-share-modal/SocialShareModal.tsx b/src/sections/shared/social-share-modal/SocialShareModal.tsx
index a73b2ff5a..34957726c 100644
--- a/src/sections/shared/social-share-modal/SocialShareModal.tsx
+++ b/src/sections/shared/social-share-modal/SocialShareModal.tsx
@@ -3,8 +3,6 @@ import { Button, Modal, Stack } from '@iqss/dataverse-design-system'
import { Facebook, Linkedin, TwitterX } from 'react-bootstrap-icons'
import styles from './SocialShareModal.module.scss'
-// TODO:ME - Add component test to check url is correct
-
export const LINKEDIN_SHARE_URL = 'https://www.linkedin.com/shareArticle?url='
export const X_SHARE_URL = 'https://x.com/intent/post?url='
export const FACEBOOK_SHARE_URL = 'https://www.facebook.com/sharer/sharer.php?u='
diff --git a/tests/component/sections/collection/Collection.spec.tsx b/tests/component/sections/collection/Collection.spec.tsx
index fdb80ac37..e03b383e7 100644
--- a/tests/component/sections/collection/Collection.spec.tsx
+++ b/tests/component/sections/collection/Collection.spec.tsx
@@ -182,7 +182,7 @@ describe('Collection page', () => {
cy.mountAuthenticated(
{
cy.findByRole('button', { name: /Cancel/i }).click()
cy.findByText('Publish Collection').should('not.exist')
})
+
+ it('opens and close the share collection modal', () => {
+ cy.viewport(1200, 800)
+
+ cy.mountAuthenticated(
+
+ )
+ cy.findByRole('button', { name: /Share/i }).should('exist')
+
+ cy.findByRole('button', { name: /Share/i }).click()
+ cy.findByText('Share this collection on your favorite social media networks.').should('exist')
+
+ cy.findAllByRole('button', { name: /Close/i }).last().click()
+ cy.findByText('Share this collection on your favorite social media networks.').should(
+ 'not.exist'
+ )
+ })
})
diff --git a/tests/component/sections/dataset/dataset-action-buttons/DatasetActionButtons.spec.tsx b/tests/component/sections/dataset/dataset-action-buttons/DatasetActionButtons.spec.tsx
index 00f2dd5c1..5bd905f1e 100644
--- a/tests/component/sections/dataset/dataset-action-buttons/DatasetActionButtons.spec.tsx
+++ b/tests/component/sections/dataset/dataset-action-buttons/DatasetActionButtons.spec.tsx
@@ -1,3 +1,4 @@
+import { CollectionRepository } from '@/collection/domain/repositories/CollectionRepository'
import { DatasetRepository } from '../../../../../src/dataset/domain/repositories/DatasetRepository'
import { FileSizeUnit } from '../../../../../src/files/domain/models/FileMetadata'
import { DatasetActionButtons } from '../../../../../src/sections/dataset/dataset-action-buttons/DatasetActionButtons'
@@ -10,6 +11,8 @@ import {
const datasetRepository: DatasetRepository = {} as DatasetRepository
+const collectionRepository = {} as CollectionRepository
+
describe('DatasetActionButtons', () => {
it('renders the DatasetActionButtons with the Publish button', () => {
const dataset = DatasetMother.create({
@@ -21,7 +24,11 @@ describe('DatasetActionButtons', () => {
})
cy.mountAuthenticated(
-
+
)
cy.findByRole('group', { name: 'Dataset Action Buttons' }).should('exist')
@@ -45,7 +52,11 @@ describe('DatasetActionButtons', () => {
})
cy.mountAuthenticated(
-
+
)
cy.findByRole('group', { name: 'Dataset Action Buttons' }).should('exist')
diff --git a/tests/component/sections/dataset/dataset-action-buttons/share-dataset-button/ShareDatasetButton.spec.tsx b/tests/component/sections/dataset/dataset-action-buttons/share-dataset-button/ShareDatasetButton.spec.tsx
new file mode 100644
index 000000000..d47613c9e
--- /dev/null
+++ b/tests/component/sections/dataset/dataset-action-buttons/share-dataset-button/ShareDatasetButton.spec.tsx
@@ -0,0 +1,16 @@
+import { ShareDatasetButton } from '@/sections/dataset/dataset-action-buttons/share-dataset-button/ShareDatasetButton'
+
+describe('ShareDatasetButton', () => {
+ it('opens and close the share dataset modal', () => {
+ cy.viewport(1200, 800)
+
+ cy.mountAuthenticated()
+ cy.findByRole('button', { name: /Share/i }).should('exist')
+
+ cy.findByRole('button', { name: /Share/i }).click()
+ cy.findByText('Share this dataset on your favorite social media networks.').should('exist')
+
+ cy.findAllByRole('button', { name: /Close/i }).last().click()
+ cy.findByText('Share this dataset on your favorite social media networks.').should('not.exist')
+ })
+})
diff --git a/tests/component/sections/shared/social-share-modal/SocialShareModal.spec.tsx b/tests/component/sections/shared/social-share-modal/SocialShareModal.spec.tsx
new file mode 100644
index 000000000..946c96512
--- /dev/null
+++ b/tests/component/sections/shared/social-share-modal/SocialShareModal.spec.tsx
@@ -0,0 +1,19 @@
+import { SocialShareModal } from '@/sections/shared/social-share-modal/SocialShareModal'
+
+describe('SocialShareModal', () => {
+ it('should render the component title, help text and 3 social links', () => {
+ cy.mount(
+ {}}
+ />
+ )
+
+ cy.findByText('The Title').should('exist')
+ cy.findByText('The Help Text').should('exist')
+ cy.get('a').should('have.length', 3)
+ })
+})
From 761b62636788d95b299ec9ce9d0a84cd0ede5309 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Germ=C3=A1n=20Saracca?=
Date: Thu, 21 Nov 2024 15:51:42 -0300
Subject: [PATCH 10/18] chore: changes in functionality
---
README.md | 4 ++++
index.html | 3 ---
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index fcfdd4684..23eb2b473 100644
--- a/README.md
+++ b/README.md
@@ -223,6 +223,10 @@ The environment is accessible through the following URLs:
> #### Account Page BreadCrumbs
>
> The Account Page has been updated to remove breadcrumbs, as the page is not part of the main navigation.
+>
+> #### Share Collection and Dataset feature
+>
+> Links to share a collection or a dataset via LinkedIn, X or Facebook will now open in a new tab instead of a popup.
diff --git a/index.html b/index.html
index b8088f5f4..565fbf246 100644
--- a/index.html
+++ b/index.html
@@ -9,9 +9,6 @@
Dataverse
-
-
-
From 0c75f1b20476a0c6cf817c942210139e6c6baa69 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Germ=C3=A1n=20Saracca?=
Date: Mon, 25 Nov 2024 08:59:08 -0300
Subject: [PATCH 11/18] chore: imports order
---
.../dataset-action-buttons/DatasetActionButtons.tsx | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/sections/dataset/dataset-action-buttons/DatasetActionButtons.tsx b/src/sections/dataset/dataset-action-buttons/DatasetActionButtons.tsx
index 2a03e4c66..52060d159 100644
--- a/src/sections/dataset/dataset-action-buttons/DatasetActionButtons.tsx
+++ b/src/sections/dataset/dataset-action-buttons/DatasetActionButtons.tsx
@@ -1,15 +1,15 @@
-import { Dataset } from '../../../dataset/domain/models/Dataset'
+import { useTranslation } from 'react-i18next'
import { Button, ButtonGroup } from '@iqss/dataverse-design-system'
+import { Dataset } from '@/dataset/domain/models/Dataset'
+import { DatasetRepository } from '@/dataset/domain/repositories/DatasetRepository'
+import { CollectionRepository } from '@/collection/domain/repositories/CollectionRepository'
import { AccessDatasetMenu } from './access-dataset-menu/AccessDatasetMenu'
import { PublishDatasetMenu } from './publish-dataset-menu/PublishDatasetMenu'
-import styles from './DatasetActionButtons.module.scss'
import { SubmitForReviewButton } from './submit-for-review-button/SubmitForReviewButton'
import { EditDatasetMenu } from './edit-dataset-menu/EditDatasetMenu'
import { LinkDatasetButton } from './link-dataset-button/LinkDatasetButton'
-import { useTranslation } from 'react-i18next'
-import { DatasetRepository } from '../../../dataset/domain/repositories/DatasetRepository'
-import { CollectionRepository } from '../../../collection/domain/repositories/CollectionRepository'
import { ShareDatasetButton } from './share-dataset-button/ShareDatasetButton'
+import styles from './DatasetActionButtons.module.scss'
interface DatasetActionButtonsProps {
dataset: Dataset
From ad3fd021009cdbf5ca2457e022680dbcc5a67442 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Germ=C3=A1n=20Saracca?=
Date: Mon, 25 Nov 2024 09:10:54 -0300
Subject: [PATCH 12/18] chore: remove space
---
src/sections/shared/social-share-modal/SocialShareModal.tsx | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/sections/shared/social-share-modal/SocialShareModal.tsx b/src/sections/shared/social-share-modal/SocialShareModal.tsx
index 34957726c..6915a5c39 100644
--- a/src/sections/shared/social-share-modal/SocialShareModal.tsx
+++ b/src/sections/shared/social-share-modal/SocialShareModal.tsx
@@ -48,7 +48,6 @@ export const SocialShareModal = ({
className={`${styles['social-btn']} ${styles.linkedin}`}>
-
Date: Mon, 25 Nov 2024 09:11:20 -0300
Subject: [PATCH 13/18] chore: add type to keep consistency
---
.../dataset-action-buttons/DatasetActionButtons.spec.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/component/sections/dataset/dataset-action-buttons/DatasetActionButtons.spec.tsx b/tests/component/sections/dataset/dataset-action-buttons/DatasetActionButtons.spec.tsx
index 5bd905f1e..2fbf6ea47 100644
--- a/tests/component/sections/dataset/dataset-action-buttons/DatasetActionButtons.spec.tsx
+++ b/tests/component/sections/dataset/dataset-action-buttons/DatasetActionButtons.spec.tsx
@@ -11,7 +11,7 @@ import {
const datasetRepository: DatasetRepository = {} as DatasetRepository
-const collectionRepository = {} as CollectionRepository
+const collectionRepository: CollectionRepository = {} as CollectionRepository
describe('DatasetActionButtons', () => {
it('renders the DatasetActionButtons with the Publish button', () => {
From bcc062882b6301c94e8305d4542cd5241d87f6b9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Germ=C3=A1n=20Saracca?=
Date: Mon, 25 Nov 2024 09:11:36 -0300
Subject: [PATCH 14/18] test: assert links urls
---
.../SocialShareModal.spec.tsx | 24 ++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/tests/component/sections/shared/social-share-modal/SocialShareModal.spec.tsx b/tests/component/sections/shared/social-share-modal/SocialShareModal.spec.tsx
index 946c96512..228355890 100644
--- a/tests/component/sections/shared/social-share-modal/SocialShareModal.spec.tsx
+++ b/tests/component/sections/shared/social-share-modal/SocialShareModal.spec.tsx
@@ -1,4 +1,11 @@
-import { SocialShareModal } from '@/sections/shared/social-share-modal/SocialShareModal'
+import {
+ FACEBOOK_SHARE_URL,
+ LINKEDIN_SHARE_URL,
+ SocialShareModal,
+ X_SHARE_URL
+} from '@/sections/shared/social-share-modal/SocialShareModal'
+
+const urlToShare = 'some-share-url'
describe('SocialShareModal', () => {
it('should render the component title, help text and 3 social links', () => {
@@ -7,13 +14,24 @@ describe('SocialShareModal', () => {
show={true}
title="The Title"
helpText="The Help Text"
- shareUrl="shareUrl"
+ shareUrl={urlToShare}
handleClose={() => {}}
/>
)
cy.findByText('The Title').should('exist')
cy.findByText('The Help Text').should('exist')
- cy.get('a').should('have.length', 3)
+
+ cy.findByLabelText('Share on LinkedIn')
+ .should('exist')
+ .should('have.attr', 'href', `${LINKEDIN_SHARE_URL}${urlToShare}`)
+
+ cy.findByLabelText('Share on X, formerly Twitter')
+ .should('exist')
+ .should('have.attr', 'href', `${X_SHARE_URL}${urlToShare}`)
+
+ cy.findByLabelText('Share on Facebook')
+ .should('exist')
+ .should('have.attr', 'href', `${FACEBOOK_SHARE_URL}${urlToShare}`)
})
})
From fb4e846c0c12ef1242f5ca72e6ded1faeda74be4 Mon Sep 17 00:00:00 2001
From: Ellen Kraffmiller
Date: Tue, 3 Dec 2024 11:08:32 -0500
Subject: [PATCH 15/18] remove unit and integration tests from pre-commit hook
---
package.json | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/package.json b/package.json
index db411a652..866785bdd 100644
--- a/package.json
+++ b/package.json
@@ -77,9 +77,7 @@
"pre-commit": [
"typecheck",
"lint:fix",
- "git:add",
- "test:unit",
- "test:coverage"
+ "git:add"
],
"eslintConfig": {
"extends": [
From 89f310dcc4a1cb6b4f340d9d8ccdc1edf162765b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Germ=C3=A1n=20Saracca?=
Date: Mon, 16 Dec 2024 13:04:08 -0300
Subject: [PATCH 16/18] chore: update to lastest js-dataverse version
---
package-lock.json | 8 ++++----
package.json | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 8d0ef563d..3924afb75 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -9,7 +9,7 @@
"version": "0.1.0",
"dependencies": {
"@faker-js/faker": "7.6.0",
- "@iqss/dataverse-client-javascript": "2.0.0-alpha.6",
+ "@iqss/dataverse-client-javascript": "2.0.0-alpha.8",
"@iqss/dataverse-design-system": "*",
"@istanbuljs/nyc-config-typescript": "1.0.2",
"@tanstack/react-table": "8.9.2",
@@ -3674,9 +3674,9 @@
},
"node_modules/@iqss/dataverse-client-javascript": {
"name": "@IQSS/dataverse-client-javascript",
- "version": "2.0.0-alpha.6",
- "resolved": "https://npm.pkg.github.com/download/@IQSS/dataverse-client-javascript/2.0.0-alpha.6/bf29f454055e33b7ec6d539090450b5774cd7e70",
- "integrity": "sha512-2f3aF1U8brIQhCBFa0IopIhnmS7CYNZnAqIZz2YKHw4xc81PLtmIkHWZoJkv912jmLYwqqqtlJXF044yLQn7ww==",
+ "version": "2.0.0-alpha.8",
+ "resolved": "https://npm.pkg.github.com/download/@IQSS/dataverse-client-javascript/2.0.0-alpha.8/bb548a68f074bec8b7a87f5d98f0fd03b87d07fb",
+ "integrity": "sha512-g1I1BfdoGUfohwQYPDwM2DHVYPBK+B4oHLO7twmPQDhZiWNTkMz34rbOxzA8ZUst22oxJj8rhuF5CqIO1YOBrw==",
"license": "MIT",
"dependencies": {
"@types/node": "^18.15.11",
diff --git a/package.json b/package.json
index c2a5cc252..d174a8c62 100644
--- a/package.json
+++ b/package.json
@@ -13,7 +13,7 @@
},
"dependencies": {
"@faker-js/faker": "7.6.0",
- "@iqss/dataverse-client-javascript": "2.0.0-alpha.6",
+ "@iqss/dataverse-client-javascript": "2.0.0-alpha.8",
"@iqss/dataverse-design-system": "*",
"@istanbuljs/nyc-config-typescript": "1.0.2",
"@tanstack/react-table": "8.9.2",
From 0ab90ffa637a3da750bee4cefc493bc03b7584bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Germ=C3=A1n=20Saracca?=
Date: Mon, 16 Dec 2024 13:07:50 -0300
Subject: [PATCH 17/18] chore: update to latest typescript
---
package-lock.json | 34 +++++++++++++++++++++++++++++-----
package.json | 2 +-
2 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 3924afb75..2f4b3ba3d 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -39,7 +39,7 @@
"react-router-dom": "6.23.1",
"react-topbar-progress-indicator": "4.1.1",
"sass": "1.58.1",
- "typescript": "4.9.5",
+ "typescript": "5.7.2",
"use-deep-compare": "1.2.1",
"vite-plugin-istanbul": "4.0.1",
"web-vitals": "2.1.4"
@@ -3701,6 +3701,18 @@
"proxy-from-env": "^1.1.0"
}
},
+ "node_modules/@iqss/dataverse-client-javascript/node_modules/typescript": {
+ "version": "4.9.5",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
+ "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
+ "bin": {
+ "tsc": "bin/tsc",
+ "tsserver": "bin/tsserver"
+ },
+ "engines": {
+ "node": ">=4.2.0"
+ }
+ },
"node_modules/@iqss/dataverse-design-system": {
"resolved": "packages/design-system",
"link": true
@@ -42060,15 +42072,15 @@
}
},
"node_modules/typescript": {
- "version": "4.9.5",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
- "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
+ "version": "5.7.2",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz",
+ "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
- "node": ">=4.2.0"
+ "node": ">=14.17"
}
},
"node_modules/typescript-memoize": {
@@ -44542,6 +44554,18 @@
"funding": {
"url": "https://github.com/chalk/supports-color?sponsor=1"
}
+ },
+ "packages/design-system/node_modules/typescript": {
+ "version": "4.9.5",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
+ "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
+ "bin": {
+ "tsc": "bin/tsc",
+ "tsserver": "bin/tsserver"
+ },
+ "engines": {
+ "node": ">=4.2.0"
+ }
}
}
}
diff --git a/package.json b/package.json
index d174a8c62..a2e66317c 100644
--- a/package.json
+++ b/package.json
@@ -43,7 +43,7 @@
"react-router-dom": "6.23.1",
"react-topbar-progress-indicator": "4.1.1",
"sass": "1.58.1",
- "typescript": "4.9.5",
+ "typescript": "5.7.2",
"use-deep-compare": "1.2.1",
"vite-plugin-istanbul": "4.0.1",
"web-vitals": "2.1.4"
From 9c097339d0cfc971a63a60e43970eda662ef04c0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Germ=C3=A1n=20Saracca?=
Date: Mon, 16 Dec 2024 13:09:13 -0300
Subject: [PATCH 18/18] chore: run typecheck on lint script also
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index a2e66317c..62af6da87 100644
--- a/package.json
+++ b/package.json
@@ -52,7 +52,7 @@
"start": "vite --base=/spa",
"build": "tsc && vite build",
"preview": "vite preview",
- "lint": "npm run lint:eslint && npm run lint:stylelint && npm run lint:prettier",
+ "lint": "npm run typecheck && npm run lint:eslint && npm run lint:stylelint && npm run lint:prettier",
"lint:fix": "eslint --fix --ext .ts,.tsx ./src --ignore-path .gitignore . && stylelint --fix **/*.scss && prettier . --write",
"lint:eslint": "eslint --ignore-path .gitignore .",
"lint:stylelint": "stylelint **/*.scss ",