Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
j8seangel committed Sep 27, 2024
2 parents c0e2803 + 01697b4 commit 3fa534c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
17 changes: 4 additions & 13 deletions apps/fishing-map/features/workspace/save/WorkspaceCreateModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,11 @@ function CreateWorkspaceModal({ title, onFinish }: CreateWorkspaceModalProps) {
const containsPrivateDatasets = privateDatasets.length > 0

const [name, setName] = useState('')
const [viewAccess, setViewAccess] = useState<WorkspaceViewAccessType>(
containsPrivateDatasets ? WORKSPACE_PRIVATE_ACCESS : WORKSPACE_PUBLIC_ACCESS
)
const [viewAccess, setViewAccess] = useState<WorkspaceViewAccessType>(WORKSPACE_PUBLIC_ACCESS)
const [editAccess, setEditAccess] = useState<WorkspaceEditAccessType>(WORKSPACE_PRIVATE_ACCESS)
const [password, setPassword] = useState<string>('')

const viewOptions = getViewAccessOptions()
const viewOptions = getViewAccessOptions(containsPrivateDatasets)
const {
timeRangeOptions,
timeRangeOption,
Expand Down Expand Up @@ -100,12 +98,6 @@ function CreateWorkspaceModal({ title, onFinish }: CreateWorkspaceModalProps) {
}
}

useEffect(() => {
if (containsPrivateDatasets) {
setViewAccess(WORKSPACE_PRIVATE_ACCESS)
}
}, [containsPrivateDatasets])

useEffect(() => {
if (workspaceModalOpen) {
setDefaultWorkspaceName()
Expand Down Expand Up @@ -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(', ')}`
: ''
}
Expand Down
20 changes: 12 additions & 8 deletions apps/fishing-map/features/workspace/save/workspace-save.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,20 @@ const formatTimerangeBoundary = (
}).replace(/[.,]/g, '')
}

export function getViewAccessOptions(): SelectOption<WorkspaceViewAccessType>[] {
export function getViewAccessOptions(
containsPrivateDatasets = false
): SelectOption<WorkspaceViewAccessType>[] {
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') },
]
Expand Down Expand Up @@ -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', {
Expand Down
2 changes: 2 additions & 0 deletions apps/fishing-map/public/locales/source/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
3 changes: 3 additions & 0 deletions libs/deck-layers/src/layers/vessel/VesselLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,9 @@ export class VesselLayer extends CompositeLayer<VesselLayerProps & LayerProps> {
}

getVesselTracksLayersLoaded() {
if (this.getTrackLayers().length === 0) {
return true
}
return (
(this.getTrackLayers().length > 0 && this.getTrackLayers().every((l) => l.isLoaded)) ||
this.getVesselLayersError('track')
Expand Down

0 comments on commit 3fa534c

Please sign in to comment.