Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jenniferarnesen committed Dec 15, 2023
1 parent 2921804 commit bed67cd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 31 deletions.
6 changes: 5 additions & 1 deletion src/AppWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const d2Config = {
],
}

const AppWrapper = () => {
const replaceLegacyUrl = () => {
// support legacy urls
const queryParams = queryString.parse(window.location.search, {
parseBooleans: true,
Expand Down Expand Up @@ -74,6 +74,10 @@ const AppWrapper = () => {
window.history.replaceState({}, '', `${base}#/currentAnalyticalObject`)
history.replace('/currentAnalyticalObject')
}
}

const AppWrapper = () => {
replaceLegacyUrl()

return (
<ReduxProvider store={store}>
Expand Down
9 changes: 0 additions & 9 deletions src/components/app/FileMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ const FileMenu = ({ onFileMenuAction }) => {
const fileMenuErrorAlert = useAlert(ALERT_MESSAGE_DYNAMIC, ALERT_CRITICAL)

const onSaveComplete = ({ id, name, isSaveAs }) => {
console.log('jj onSaveComplete', id, name, isSaveAs)

if (isSaveAs) {
saveAsAlert.show({ msg: getSavedMessage(name) })
} else {
Expand All @@ -81,13 +79,6 @@ const FileMenu = ({ onFileMenuAction }) => {
isSaving: true,
}

// const onSaveAsComplete = async (res) => {
// // const newMapConfig = await fetchMap(newMapId, engine, defaultBasemap)
// // delete newMapConfig.basemap
// // delete newMapConfig.mapViews
// // dispatch(setMapProps(newMapConfig))
// }

if (isSaveAs) {
history.push(locationObject, locationState)
} else {
Expand Down
25 changes: 4 additions & 21 deletions src/components/app/useLoadMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,32 +24,20 @@ import history from '../../util/history.js'
import { fetchMap } from '../../util/requests.js'

const getUrlParams = (hashLocation) => {
const hashQueryParams = queryString.parse(hashLocation.search, {
const params = queryString.parse(hashLocation.search, {
parseBooleans: true,
})

const params = {}
const pathParts = hashLocation.pathname.slice(1).split('/')
if (pathParts[0]) {
if (pathParts[0]?.length === 11) {
params.mapId = pathParts[0]
} else if (pathParts[0] === 'currentAnalyticalObject') {
if (pathParts[0] === 'currentAnalyticalObject') {
params.isCurrentAO = true
} else {
// TODO throw error - unrecognized path
params.mapId = pathParts[0]
}

if (pathParts[1] === 'download') {
params.isDownload = true

if (hashQueryParams.isPushAnalytics) {
params.isPushAnalytics = true
}
}

if (params.mapId) {
params.interpretationId = hashQueryParams.interpretationId

params.initialFocus = hashQueryParams.initialFocus
}
}

Expand All @@ -70,8 +58,6 @@ export const useLoadMap = () => {

const loadMap = useCallback(
async (hashLocation) => {
console.log('jj loadMap')

if (hashLocation.pathname === '/') {
dispatch(newMap())
return
Expand All @@ -88,7 +74,6 @@ export const useLoadMap = () => {

if (mapId) {
try {
// throw new Error('test')
const map = await fetchMap(mapId, engine, defaultBasemap)

engine.mutate(dataStatisticsMutation, {
Expand Down Expand Up @@ -185,8 +170,6 @@ export const useLoadMap = () => {
!isDownloadOpening &&
!isDownloadClosing

// TODO navigation confirm dialog

if (isDownloadOpening) {
dispatch(
setDownloadMode({
Expand Down

0 comments on commit bed67cd

Please sign in to comment.