diff --git a/apps/fishing-map/features/workspace/save/WorkspaceCreateModal.tsx b/apps/fishing-map/features/workspace/save/WorkspaceCreateModal.tsx index 358d4a995f..0ab76b4888 100644 --- a/apps/fishing-map/features/workspace/save/WorkspaceCreateModal.tsx +++ b/apps/fishing-map/features/workspace/save/WorkspaceCreateModal.tsx @@ -49,13 +49,11 @@ function CreateWorkspaceModal({ title, onFinish }: CreateWorkspaceModalProps) { const containsPrivateDatasets = privateDatasets.length > 0 const [name, setName] = useState('') - const [viewAccess, setViewAccess] = useState( - containsPrivateDatasets ? WORKSPACE_PRIVATE_ACCESS : WORKSPACE_PUBLIC_ACCESS - ) + const [viewAccess, setViewAccess] = useState(WORKSPACE_PUBLIC_ACCESS) const [editAccess, setEditAccess] = useState(WORKSPACE_PRIVATE_ACCESS) const [password, setPassword] = useState('') - const viewOptions = getViewAccessOptions() + const viewOptions = getViewAccessOptions(containsPrivateDatasets) const { timeRangeOptions, timeRangeOption, @@ -100,12 +98,6 @@ function CreateWorkspaceModal({ title, onFinish }: CreateWorkspaceModalProps) { } } - useEffect(() => { - if (containsPrivateDatasets) { - setViewAccess(WORKSPACE_PRIVATE_ACCESS) - } - }, [containsPrivateDatasets]) - useEffect(() => { if (workspaceModalOpen) { setDefaultWorkspaceName() @@ -230,12 +222,11 @@ function CreateWorkspaceModal({ title, onFinish }: CreateWorkspaceModalProps) { options={viewOptions} direction="top" label={t('workspace.viewAccess', 'View access')} - disabled={containsPrivateDatasets} infoTooltip={ containsPrivateDatasets ? `${t( - 'workspace.uploadPublicDisabled', - "This workspace can't be shared publicly because it contains private datasets" + 'workspace.sharePrivateDisclaimer', + 'This workspace contains datasets that require special permissions' )}: ${privateDatasets.join(', ')}` : '' } diff --git a/apps/fishing-map/features/workspace/save/workspace-save.utils.ts b/apps/fishing-map/features/workspace/save/workspace-save.utils.ts index 5df841c0ed..63a4f1fdcd 100644 --- a/apps/fishing-map/features/workspace/save/workspace-save.utils.ts +++ b/apps/fishing-map/features/workspace/save/workspace-save.utils.ts @@ -31,12 +31,20 @@ const formatTimerangeBoundary = ( }).replace(/[.,]/g, '') } -export function getViewAccessOptions(): SelectOption[] { +export function getViewAccessOptions( + containsPrivateDatasets = false +): SelectOption[] { + const permissionsLabel = containsPrivateDatasets + ? `(${t('common.permissions', 'permissions required')})` + : '' return [ - { id: WORKSPACE_PUBLIC_ACCESS, label: t('common.anyoneWithTheLink', 'Anyone with the link') }, + { + id: WORKSPACE_PUBLIC_ACCESS, + label: `${t('common.anyoneWithTheLink', 'Anyone with the link')} ${permissionsLabel}`, + }, { id: WORKSPACE_PASSWORD_ACCESS, - label: t('common.anyoneWithThePassword', 'Anyone with the password'), + label: `${t('common.anyoneWithThePassword', 'Anyone with the password')} ${permissionsLabel}`, }, { id: WORKSPACE_PRIVATE_ACCESS, label: t('common.onlyMe', 'Only me') }, ] @@ -83,11 +91,7 @@ export function getEditAccessOptionsByViewAccess( return getEditAccessOptions() } -const getStaticWorkspaceName = ({ - timerange, -}: { - timerange: { start: string; end: string } -}) => { +const getStaticWorkspaceName = ({ timerange }: { timerange: { start: string; end: string } }) => { if (timerange?.start && timerange?.end) { const dateFormat = pickDateFormatByRange(timerange.start as string, timerange.end as string) return t('common.timerangeDescription', { diff --git a/apps/fishing-map/public/locales/source/translations.json b/apps/fishing-map/public/locales/source/translations.json index b609a37009..08117050cc 100644 --- a/apps/fishing-map/public/locales/source/translations.json +++ b/apps/fishing-map/public/locales/source/translations.json @@ -1054,6 +1054,8 @@ "saved": "Current view was saved and it's available in your user profile", "saveLogin": "You need to login to save views", "saveOwnerOnly": "This workspace can only be edited by its creator", + "sharePrivateDisclaimer": "This workspace contains datasets that require special permissions", + "sharePrivatePermissionsRequired": "permissions required", "siteDescription": { "default": "The Global Fishing Watch map is the first open-access platform for visualization and analysis of marine traffic and vessel-based human activity at sea.", "fishing-activity": "The Global Fishing Watch map is the first open-access platform for visualization and analysis of marine traffic and vessel-based human activity at sea.", diff --git a/libs/deck-layers/src/layers/vessel/VesselLayer.ts b/libs/deck-layers/src/layers/vessel/VesselLayer.ts index 0df11bc14b..5f19c94e33 100644 --- a/libs/deck-layers/src/layers/vessel/VesselLayer.ts +++ b/libs/deck-layers/src/layers/vessel/VesselLayer.ts @@ -468,6 +468,9 @@ export class VesselLayer extends CompositeLayer { } getVesselTracksLayersLoaded() { + if (this.getTrackLayers().length === 0) { + return true + } return ( (this.getTrackLayers().length > 0 && this.getTrackLayers().every((l) => l.isLoaded)) || this.getVesselLayersError('track')