|
@@ -1,8 +1,6 @@
|
|
|
import { useCallback, useState, useEffect } from 'react'
|
|
import { useCallback, useState, useEffect } from 'react'
|
|
|
import PropTypes from 'prop-types'
|
|
import PropTypes from 'prop-types'
|
|
|
-import { Button, Col, Row } from 'react-bootstrap'
|
|
|
|
|
import { useTranslation } from 'react-i18next'
|
|
import { useTranslation } from 'react-i18next'
|
|
|
-import Tooltip from '@/shared/components/tooltip'
|
|
|
|
|
import Icon from '@/shared/components/icon'
|
|
import Icon from '@/shared/components/icon'
|
|
|
import { useShareProjectContext } from './share-project-modal'
|
|
import { useShareProjectContext } from './share-project-modal'
|
|
|
import { setProjectAccessLevel } from '../../utils/api'
|
|
import { setProjectAccessLevel } from '../../utils/api'
|
|
@@ -15,6 +13,12 @@ import { getJSON } from '../../../../infrastructure/fetch-json'
|
|
|
import useAbortController from '@/shared/hooks/use-abort-controller'
|
|
import useAbortController from '@/shared/hooks/use-abort-controller'
|
|
|
import { debugConsole } from '@/utils/debugging'
|
|
import { debugConsole } from '@/utils/debugging'
|
|
|
import getMeta from '@/utils/meta'
|
|
import getMeta from '@/utils/meta'
|
|
|
|
|
+import OLRow from '@/features/ui/components/ol/ol-row'
|
|
|
|
|
+import OLCol from '@/features/ui/components/ol/ol-col'
|
|
|
|
|
+import OLButton from '@/features/ui/components/ol/ol-button'
|
|
|
|
|
+import OLTooltip from '@/features/ui/components/ol/ol-tooltip'
|
|
|
|
|
+import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher'
|
|
|
|
|
+import MaterialIcon from '@/shared/components/material-icon'
|
|
|
|
|
|
|
|
export default function LinkSharing() {
|
|
export default function LinkSharing() {
|
|
|
const [inflight, setInflight] = useState(false)
|
|
const [inflight, setInflight] = useState(false)
|
|
@@ -88,13 +92,12 @@ export default function LinkSharing() {
|
|
|
function PrivateSharing({ setAccessLevel, inflight, projectId, setShowLinks }) {
|
|
function PrivateSharing({ setAccessLevel, inflight, projectId, setShowLinks }) {
|
|
|
const { t } = useTranslation()
|
|
const { t } = useTranslation()
|
|
|
return (
|
|
return (
|
|
|
- <Row className="public-access-level">
|
|
|
|
|
- <Col xs={12} className="text-center">
|
|
|
|
|
|
|
+ <OLRow className="public-access-level">
|
|
|
|
|
+ <OLCol xs={12} className="text-center">
|
|
|
<strong>{t('link_sharing_is_off_short')}</strong>
|
|
<strong>{t('link_sharing_is_off_short')}</strong>
|
|
|
<span> </span>
|
|
<span> </span>
|
|
|
- <Button
|
|
|
|
|
- type="button"
|
|
|
|
|
- bsStyle="link"
|
|
|
|
|
|
|
+ <OLButton
|
|
|
|
|
+ variant="link"
|
|
|
className="btn-inline-link"
|
|
className="btn-inline-link"
|
|
|
onClick={() => {
|
|
onClick={() => {
|
|
|
setAccessLevel('tokenBased')
|
|
setAccessLevel('tokenBased')
|
|
@@ -104,11 +107,11 @@ function PrivateSharing({ setAccessLevel, inflight, projectId, setShowLinks }) {
|
|
|
disabled={inflight}
|
|
disabled={inflight}
|
|
|
>
|
|
>
|
|
|
{t('turn_on_link_sharing')}
|
|
{t('turn_on_link_sharing')}
|
|
|
- </Button>
|
|
|
|
|
|
|
+ </OLButton>
|
|
|
<span> </span>
|
|
<span> </span>
|
|
|
<LinkSharingInfo />
|
|
<LinkSharingInfo />
|
|
|
- </Col>
|
|
|
|
|
- </Row>
|
|
|
|
|
|
|
+ </OLCol>
|
|
|
|
|
+ </OLRow>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -139,53 +142,58 @@ function TokenBasedSharing({
|
|
|
}, [projectId, signal])
|
|
}, [projectId, signal])
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
- <Row className="public-access-level">
|
|
|
|
|
- <Col xs={12} className="text-center">
|
|
|
|
|
|
|
+ <OLRow className="public-access-level">
|
|
|
|
|
+ <OLCol xs={12} className="text-center">
|
|
|
<strong>{t('link_sharing_is_on')}</strong>
|
|
<strong>{t('link_sharing_is_on')}</strong>
|
|
|
<span> </span>
|
|
<span> </span>
|
|
|
- <Button
|
|
|
|
|
- bsStyle="link"
|
|
|
|
|
|
|
+ <OLButton
|
|
|
|
|
+ variant="link"
|
|
|
className="btn-inline-link"
|
|
className="btn-inline-link"
|
|
|
onClick={() => setAccessLevel('private')}
|
|
onClick={() => setAccessLevel('private')}
|
|
|
disabled={inflight}
|
|
disabled={inflight}
|
|
|
>
|
|
>
|
|
|
{t('turn_off_link_sharing')}
|
|
{t('turn_off_link_sharing')}
|
|
|
- </Button>
|
|
|
|
|
|
|
+ </OLButton>
|
|
|
<span> </span>
|
|
<span> </span>
|
|
|
<LinkSharingInfo />
|
|
<LinkSharingInfo />
|
|
|
- <Button
|
|
|
|
|
- bsStyle="link"
|
|
|
|
|
- className="btn-chevron"
|
|
|
|
|
|
|
+ <OLButton
|
|
|
|
|
+ variant="link"
|
|
|
|
|
+ className="btn-chevron align-middle"
|
|
|
onClick={() => setShowLinks(!showLinks)}
|
|
onClick={() => setShowLinks(!showLinks)}
|
|
|
>
|
|
>
|
|
|
- <Icon type={showLinks ? 'chevron-up' : 'chevron-down'} fw />
|
|
|
|
|
- </Button>
|
|
|
|
|
- </Col>
|
|
|
|
|
- {showLinks && (
|
|
|
|
|
- <>
|
|
|
|
|
- <Col xs={12} className="access-token-display-area">
|
|
|
|
|
- <div className="access-token-wrapper">
|
|
|
|
|
- <strong>{t('anyone_with_link_can_edit')}</strong>
|
|
|
|
|
- <AccessToken
|
|
|
|
|
- token={tokens?.readAndWrite}
|
|
|
|
|
- tokenHashPrefix={tokens?.readAndWriteHashPrefix}
|
|
|
|
|
- path="/"
|
|
|
|
|
- tooltipId="tooltip-copy-link-rw"
|
|
|
|
|
- />
|
|
|
|
|
- </div>
|
|
|
|
|
- <div className="access-token-wrapper">
|
|
|
|
|
- <strong>{t('anyone_with_link_can_view')}</strong>
|
|
|
|
|
- <AccessToken
|
|
|
|
|
- token={tokens?.readOnly}
|
|
|
|
|
- tokenHashPrefix={tokens?.readOnlyHashPrefix}
|
|
|
|
|
- path="/read/"
|
|
|
|
|
- tooltipId="tooltip-copy-link-ro"
|
|
|
|
|
|
|
+ <BootstrapVersionSwitcher
|
|
|
|
|
+ bs3={<Icon type={showLinks ? 'chevron-up' : 'chevron-down'} fw />}
|
|
|
|
|
+ bs5={
|
|
|
|
|
+ <MaterialIcon
|
|
|
|
|
+ type={showLinks ? 'keyboard_arrow_up' : 'keyboard_arrow_down'}
|
|
|
/>
|
|
/>
|
|
|
- </div>
|
|
|
|
|
- </Col>
|
|
|
|
|
- </>
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ />
|
|
|
|
|
+ </OLButton>
|
|
|
|
|
+ </OLCol>
|
|
|
|
|
+ {showLinks && (
|
|
|
|
|
+ <OLCol xs={12} className="access-token-display-area">
|
|
|
|
|
+ <div className="access-token-wrapper">
|
|
|
|
|
+ <strong>{t('anyone_with_link_can_edit')}</strong>
|
|
|
|
|
+ <AccessToken
|
|
|
|
|
+ token={tokens?.readAndWrite}
|
|
|
|
|
+ tokenHashPrefix={tokens?.readAndWriteHashPrefix}
|
|
|
|
|
+ path="/"
|
|
|
|
|
+ tooltipId="tooltip-copy-link-rw"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div className="access-token-wrapper">
|
|
|
|
|
+ <strong>{t('anyone_with_link_can_view')}</strong>
|
|
|
|
|
+ <AccessToken
|
|
|
|
|
+ token={tokens?.readOnly}
|
|
|
|
|
+ tokenHashPrefix={tokens?.readOnlyHashPrefix}
|
|
|
|
|
+ path="/read/"
|
|
|
|
|
+ tooltipId="tooltip-copy-link-ro"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </OLCol>
|
|
|
)}
|
|
)}
|
|
|
- </Row>
|
|
|
|
|
|
|
+ </OLRow>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -200,26 +208,25 @@ function LegacySharing({ accessLevel, setAccessLevel, inflight }) {
|
|
|
const { t } = useTranslation()
|
|
const { t } = useTranslation()
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
- <Row className="public-access-level">
|
|
|
|
|
- <Col xs={12} className="text-center">
|
|
|
|
|
|
|
+ <OLRow className="public-access-level">
|
|
|
|
|
+ <OLCol xs={12} className="text-center">
|
|
|
<strong>
|
|
<strong>
|
|
|
{accessLevel === 'readAndWrite' && t('this_project_is_public')}
|
|
{accessLevel === 'readAndWrite' && t('this_project_is_public')}
|
|
|
{accessLevel === 'readOnly' && t('this_project_is_public_read_only')}
|
|
{accessLevel === 'readOnly' && t('this_project_is_public_read_only')}
|
|
|
</strong>
|
|
</strong>
|
|
|
<span> </span>
|
|
<span> </span>
|
|
|
- <Button
|
|
|
|
|
- type="button"
|
|
|
|
|
- bsStyle="link"
|
|
|
|
|
|
|
+ <OLButton
|
|
|
|
|
+ variant="link"
|
|
|
className="btn-inline-link"
|
|
className="btn-inline-link"
|
|
|
onClick={() => setAccessLevel('private')}
|
|
onClick={() => setAccessLevel('private')}
|
|
|
disabled={inflight}
|
|
disabled={inflight}
|
|
|
>
|
|
>
|
|
|
{t('make_private')}
|
|
{t('make_private')}
|
|
|
- </Button>
|
|
|
|
|
|
|
+ </OLButton>
|
|
|
<span> </span>
|
|
<span> </span>
|
|
|
<LinkSharingInfo />
|
|
<LinkSharingInfo />
|
|
|
- </Col>
|
|
|
|
|
- </Row>
|
|
|
|
|
|
|
+ </OLCol>
|
|
|
|
|
+ </OLRow>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -244,8 +251,8 @@ export function ReadOnlyTokenLink() {
|
|
|
}, [projectId, signal])
|
|
}, [projectId, signal])
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
- <Row className="public-access-level">
|
|
|
|
|
- <Col xs={12} className="access-token-display-area">
|
|
|
|
|
|
|
+ <OLRow className="public-access-level">
|
|
|
|
|
+ <OLCol className="access-token-display-area">
|
|
|
<div className="access-token-wrapper">
|
|
<div className="access-token-wrapper">
|
|
|
<strong>{t('anyone_with_link_can_view')}</strong>
|
|
<strong>{t('anyone_with_link_can_view')}</strong>
|
|
|
<AccessToken
|
|
<AccessToken
|
|
@@ -255,8 +262,8 @@ export function ReadOnlyTokenLink() {
|
|
|
tooltipId="tooltip-copy-link-ro"
|
|
tooltipId="tooltip-copy-link-ro"
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
|
- </Col>
|
|
|
|
|
- </Row>
|
|
|
|
|
|
|
+ </OLCol>
|
|
|
|
|
+ </OLRow>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -299,7 +306,7 @@ function LinkSharingInfo() {
|
|
|
const { t } = useTranslation()
|
|
const { t } = useTranslation()
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
- <Tooltip
|
|
|
|
|
|
|
+ <OLTooltip
|
|
|
id="link-sharing-info"
|
|
id="link-sharing-info"
|
|
|
description={t('learn_more_about_link_sharing')}
|
|
description={t('learn_more_about_link_sharing')}
|
|
|
>
|
|
>
|
|
@@ -308,8 +315,11 @@ function LinkSharingInfo() {
|
|
|
target="_blank"
|
|
target="_blank"
|
|
|
rel="noopener"
|
|
rel="noopener"
|
|
|
>
|
|
>
|
|
|
- <Icon type="question-circle" />
|
|
|
|
|
|
|
+ <BootstrapVersionSwitcher
|
|
|
|
|
+ bs3={<Icon type="question-circle" />}
|
|
|
|
|
+ bs5={<MaterialIcon type="help" className="align-middle" />}
|
|
|
|
|
+ />
|
|
|
</a>
|
|
</a>
|
|
|
- </Tooltip>
|
|
|
|
|
|
|
+ </OLTooltip>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|