Skip to content

Commit

Permalink
update with latest from develop
Browse files Browse the repository at this point in the history
  • Loading branch information
g-saracca committed Dec 18, 2024
2 parents 2cba117 + 07f1c9c commit be414ee
Show file tree
Hide file tree
Showing 21 changed files with 452 additions and 49 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
</details>

Expand Down
55 changes: 45 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
Expand All @@ -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 ",
Expand All @@ -77,9 +77,7 @@
"pre-commit": [
"typecheck",
"lint:fix",
"git:add",
"test:unit",
"test:coverage"
"git:add"
],
"eslintConfig": {
"extends": [
Expand Down
2 changes: 1 addition & 1 deletion packages/design-system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,12 @@ export const NestedButtonGroups: Story = {
render: () => (
<ButtonToolbar ariaLabel="Toolbar with button groups">
<ButtonGroup vertical>
<DropdownButton asButtonGroup withSpacing title="Access File" id="access-file">
<DropdownButton asButtonGroup title="Access File" id="access-file">
<DropdownButtonItem href="/item-1">Item 1</DropdownButtonItem>
<DropdownButtonItem href="/item-2">Item 2</DropdownButtonItem>
<DropdownButtonItem href="/item-3">Item 3</DropdownButtonItem>
</DropdownButton>
<DropdownButton
asButtonGroup
withSpacing
title="Edit File"
id="edit-file"
variant="secondary">
<DropdownButton asButtonGroup title="Edit File" id="edit-file" variant="secondary">
<DropdownButtonItem href="/item-1">Item 1</DropdownButtonItem>
<DropdownButtonItem href="/item-2">Item 2</DropdownButtonItem>
<DropdownButtonItem href="/item-3">Item 3</DropdownButtonItem>
Expand Down
4 changes: 4 additions & 0 deletions public/locales/en/collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
"publishedAlert": "Your collection is now public.",
"addFacetFilter": "Add {{labelName}} facet filter",
"removeSelectedFacet": "Remove {{labelName}} facet filter",
"share": {
"shareCollection": "Share Collection",
"helpText": "Share this collection on your favorite social media networks."
},
"editedAlert": "You have successfully updated your collection!",
"editCollection": {
"edit": "Edit",
Expand Down
7 changes: 6 additions & 1 deletion public/locales/en/dataset.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 2 additions & 0 deletions public/locales/en/shared.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
"remove": "Remove",
"add": "Add",
"cancel": "Cancel",
"close": "Close",
"continue": "Continue",
"more": "More...",
"less": "Less...",
"share": "Share",
"pageNumberNotFound": {
"heading": "Page Number Not Found",
"message": "The page number you requested does not exist. Please try a different page number."
Expand Down
15 changes: 12 additions & 3 deletions src/sections/collection/Collection.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,19 @@
gap: 10px;
}

.action-buttons {
.metrics-actions-container {
display: flex;
justify-content: flex-end;
margin-bottom: 1rem;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
margin-bottom: 2rem;

.right-content {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
align-items: center;
}
}

.subtext {
Expand Down
35 changes: 22 additions & 13 deletions src/sections/collection/Collection.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useTranslation } from 'react-i18next'
import { Alert, ButtonGroup, Col, Row } from '@iqss/dataverse-design-system'

import { CollectionRepository } from '../../collection/domain/repositories/CollectionRepository'
import { useCollection } from './useCollection'
import { useScrollTop } from '../../shared/hooks/useScrollTop'
Expand All @@ -14,6 +13,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-button/ShareCollectionButton'
import { EditCollectionDropdown } from './edit-collection-dropdown/EditCollectionDropdown'
import styles from './Collection.module.scss'

Expand Down Expand Up @@ -81,19 +81,28 @@ export function Collection({
{t('publishedAlert')}
</Alert>
)}
{(showPublishButton || showEditButton) && (
<div className={styles['action-buttons']}>
<ButtonGroup>
{showPublishButton && (
<PublishCollectionButton
repository={collectionRepository}
collectionId={collection.id}
/>
)}
{showEditButton && <EditCollectionDropdown collection={collection} />}
</ButtonGroup>

<div className={styles['metrics-actions-container']}>
<div className={styles.metrics}></div>
<div className={styles['right-content']}>
{/* 👇 Here should go Contact button also */}
{/* <ContactButton /> */}

<ShareCollectionButton />

{(showPublishButton || showEditButton) && (
<ButtonGroup>
{showPublishButton && (
<PublishCollectionButton
repository={collectionRepository}
collectionId={collection.id}
/>
)}
{showEditButton && <EditCollectionDropdown collection={collection} />}
</ButtonGroup>
)}
</div>
)}
</div>

<CollectionItemsPanel
key={collection.id}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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)
const closeShareModal = () => setShowShareModal(false)

return (
<>
<Tooltip overlay={t('share.shareCollection')} placement="top">
<Button
variant="link"
onClick={openShareModal}
icon={<ShareFill style={{ marginRight: '0.3rem', marginBottom: '0.2rem' }} />}>
{tShared('share')}
</Button>
</Tooltip>

<SocialShareModal
shareUrl={window.location.href}
show={showShareModal}
handleClose={closeShareModal}
title={t('share.shareCollection')}
helpText={t('share.helpText')}
/>
</>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@
width: 100%;
margin: 0.5rem 0;
}

.contact-owner-and-share-group {
> button {
width: 50%;
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { Dataset } from '../../../dataset/domain/models/Dataset'
import { ButtonGroup } from '@iqss/dataverse-design-system'
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
Expand All @@ -22,6 +23,7 @@ export function DatasetActionButtons({
collectionRepository
}: DatasetActionButtonsProps) {
const { t } = useTranslation('dataset')

return (
<ButtonGroup aria-label={t('datasetActionButtons.title')} vertical className={styles.group}>
<AccessDatasetMenu
Expand All @@ -39,6 +41,12 @@ export function DatasetActionButtons({
<SubmitForReviewButton dataset={dataset} />
<EditDatasetMenu dataset={dataset} />
<LinkDatasetButton dataset={dataset} />
<ButtonGroup className={styles['contact-owner-and-share-group']}>
<Button disabled variant="secondary" size="sm">
{t('datasetActionButtons.contactOwner')}
</Button>
<ShareDatasetButton />
</ButtonGroup>
</ButtonGroup>
)
}
Loading

0 comments on commit be414ee

Please sign in to comment.