From 406aca1cae97a4ba4e1d0965518c535c0809bef4 Mon Sep 17 00:00:00 2001 From: Leszek Pietrzak Date: Mon, 27 Jan 2025 14:09:01 +0100 Subject: [PATCH] refactor(frontend): move landing, summary and map files into separate directories (#5454) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### 💭 Notes As preparation for migrating them to TS --- jsapp/js/components/{ => formLanding}/formLanding.js | 12 ++++++------ jsapp/js/components/formSubScreens.js | 2 +- jsapp/js/components/{ => formSummary}/formSummary.js | 2 +- .../js/components/{ => formSummary}/formSummary.scss | 0 .../{ => formSummary}/formSummaryProjectInfo.tsx | 4 ++-- jsapp/js/components/{ => map}/map.es6 | 8 ++++---- jsapp/js/components/{ => map}/map.marker-colors.scss | 0 jsapp/js/components/{ => map}/map.scss | 0 jsapp/js/components/{ => map}/mapSettings.es6 | 4 ++-- jsapp/js/router/router.tsx | 4 ++-- 10 files changed, 18 insertions(+), 18 deletions(-) rename jsapp/js/components/{ => formLanding}/formLanding.js (98%) rename jsapp/js/components/{ => formSummary}/formSummary.js (98%) rename jsapp/js/components/{ => formSummary}/formSummary.scss (100%) rename jsapp/js/components/{ => formSummary}/formSummaryProjectInfo.tsx (98%) rename jsapp/js/components/{ => map}/map.es6 (99%) rename jsapp/js/components/{ => map}/map.marker-colors.scss (100%) rename jsapp/js/components/{ => map}/map.scss (100%) rename jsapp/js/components/{ => map}/mapSettings.es6 (99%) diff --git a/jsapp/js/components/formLanding.js b/jsapp/js/components/formLanding/formLanding.js similarity index 98% rename from jsapp/js/components/formLanding.js rename to jsapp/js/components/formLanding/formLanding.js index 3846091d55..57ca568a17 100644 --- a/jsapp/js/components/formLanding.js +++ b/jsapp/js/components/formLanding/formLanding.js @@ -3,17 +3,17 @@ import reactMixin from 'react-mixin'; import autoBind from 'react-autobind'; import Reflux from 'reflux'; import bem from 'js/bem'; -import {dataInterface} from '../dataInterface'; +import {dataInterface} from 'js/dataInterface'; import sessionStore from 'js/stores/session'; import PopoverMenu from 'js/popoverMenu'; import LoadingSpinner from 'js/components/common/loadingSpinner'; import InlineMessage from 'js/components/common/inlineMessage'; import CollectMethodSelector from 'js/project/collectMethodSelector.component'; -import mixins from '../mixins'; -import {actions} from '../actions'; +import mixins from 'js/mixins'; +import {actions} from 'js/actions'; import DocumentTitle from 'react-document-title'; import CopyToClipboard from 'react-copy-to-clipboard'; -import {MODAL_TYPES, COLLECTION_METHODS} from '../constants'; +import {MODAL_TYPES, COLLECTION_METHODS} from 'js/constants'; import {ROUTES} from 'js/router/routerConstants'; import {formatTime, notify} from 'utils'; import {buildUserUrl, ANON_USERNAME} from 'js/users/utils'; @@ -27,8 +27,8 @@ import { import permConfig from 'js/components/permissions/permConfig'; import {PERMISSIONS_CODENAMES} from 'js/components/permissions/permConstants'; import {HELP_ARTICLE_ANON_SUBMISSIONS_URL} from 'js/constants'; -import AnonymousSubmission from './anonymousSubmission.component'; -import NewFeatureDialog from './newFeatureDialog.component'; +import AnonymousSubmission from 'js/components/anonymousSubmission.component'; +import NewFeatureDialog from 'js/components/newFeatureDialog.component'; import pageState from 'js/pageState.store'; import Button from 'js/components/common/button'; diff --git a/jsapp/js/components/formSubScreens.js b/jsapp/js/components/formSubScreens.js index ec326964b8..bf4d1f2479 100644 --- a/jsapp/js/components/formSubScreens.js +++ b/jsapp/js/components/formSubScreens.js @@ -9,7 +9,7 @@ import SharingForm from './permissions/sharingForm.component'; import ProjectSettings from './modalForms/projectSettings'; import FormMedia from './modalForms/formMedia'; import {PROJECT_SETTINGS_CONTEXTS} from '../constants'; -import FormMap from './map'; +import FormMap from './map/map'; import RESTServices from './RESTServices'; import LoadingSpinner from 'js/components/common/loadingSpinner'; import {ROUTES} from 'js/router/routerConstants'; diff --git a/jsapp/js/components/formSummary.js b/jsapp/js/components/formSummary/formSummary.js similarity index 98% rename from jsapp/js/components/formSummary.js rename to jsapp/js/components/formSummary/formSummary.js index 4d108eef41..bde48e1e1d 100644 --- a/jsapp/js/components/formSummary.js +++ b/jsapp/js/components/formSummary/formSummary.js @@ -8,7 +8,7 @@ import bem from 'js/bem'; import DocumentTitle from 'react-document-title'; import Icon from 'js/components/common/icon'; import Avatar from 'js/components/common/avatar'; -import {getFormDataTabs} from './formViewSideTabs'; +import {getFormDataTabs} from 'js/components/formViewSideTabs'; import {getUsernameFromUrl, ANON_USERNAME} from 'js/users/utils'; import {MODAL_TYPES} from 'js/constants'; import './formSummary.scss'; diff --git a/jsapp/js/components/formSummary.scss b/jsapp/js/components/formSummary/formSummary.scss similarity index 100% rename from jsapp/js/components/formSummary.scss rename to jsapp/js/components/formSummary/formSummary.scss diff --git a/jsapp/js/components/formSummaryProjectInfo.tsx b/jsapp/js/components/formSummary/formSummaryProjectInfo.tsx similarity index 98% rename from jsapp/js/components/formSummaryProjectInfo.tsx rename to jsapp/js/components/formSummary/formSummaryProjectInfo.tsx index 47d0e8afb2..c0ec6eaf1a 100644 --- a/jsapp/js/components/formSummaryProjectInfo.tsx +++ b/jsapp/js/components/formSummary/formSummaryProjectInfo.tsx @@ -13,8 +13,8 @@ import type { import {dataInterface} from 'js/dataInterface'; import {handleApiFail} from 'js/api'; import {formatTime} from 'js/utils'; -import AssetStatusBadge from './common/assetStatusBadge'; -import Avatar from './common/avatar'; +import AssetStatusBadge from 'js/components/common/assetStatusBadge'; +import Avatar from 'js/components/common/avatar'; import envStore from 'js/envStore'; interface FormSummaryProjectInfoProps { diff --git a/jsapp/js/components/map.es6 b/jsapp/js/components/map/map.es6 similarity index 99% rename from jsapp/js/components/map.es6 rename to jsapp/js/components/map/map.es6 index d719db361d..08544eca36 100644 --- a/jsapp/js/components/map.es6 +++ b/jsapp/js/components/map/map.es6 @@ -2,9 +2,9 @@ import React from 'react'; import reactMixin from 'react-mixin'; import autoBind from 'react-autobind'; import Reflux from 'reflux'; -import {dataInterface} from '../dataInterface'; +import {dataInterface} from 'js/dataInterface'; import bem from 'js/bem'; -import {actions} from '../actions'; +import {actions} from 'js/actions'; import PopoverMenu from 'js/popoverMenu'; import Modal from 'js/components/common/modal'; import classNames from 'classnames'; @@ -25,9 +25,9 @@ import { MODAL_TYPES, QUESTION_TYPES, QUERY_LIMIT_DEFAULT, -} from '../constants'; +} from 'js/constants'; -import {notify, checkLatLng} from 'utils'; +import {notify, checkLatLng} from 'js/utils'; import {getSurveyFlatPaths} from 'js/assetUtils'; import LoadingSpinner from 'js/components/common/loadingSpinner'; import CenteredMessage from 'js/components/common/centeredMessage.component'; diff --git a/jsapp/js/components/map.marker-colors.scss b/jsapp/js/components/map/map.marker-colors.scss similarity index 100% rename from jsapp/js/components/map.marker-colors.scss rename to jsapp/js/components/map/map.marker-colors.scss diff --git a/jsapp/js/components/map.scss b/jsapp/js/components/map/map.scss similarity index 100% rename from jsapp/js/components/map.scss rename to jsapp/js/components/map/map.scss diff --git a/jsapp/js/components/mapSettings.es6 b/jsapp/js/components/map/mapSettings.es6 similarity index 99% rename from jsapp/js/components/mapSettings.es6 rename to jsapp/js/components/map/mapSettings.es6 index 4eb2a4dfad..7a3934b609 100644 --- a/jsapp/js/components/mapSettings.es6 +++ b/jsapp/js/components/map/mapSettings.es6 @@ -4,7 +4,7 @@ import Reflux from 'reflux'; import bem from 'js/bem'; import Modal from 'js/components/common/modal'; import autoBind from 'react-autobind'; -import {actions} from '../actions'; +import {actions} from 'js/actions'; import Dropzone from 'react-dropzone'; import alertify from 'alertifyjs'; import {notify} from 'js/utils'; @@ -12,7 +12,7 @@ import { QUERY_LIMIT_DEFAULT, ASSET_FILE_TYPES, } from 'js/constants'; -import { dataInterface } from '../dataInterface'; +import { dataInterface } from 'js/dataInterface'; import {userCan} from 'js/components/permissions/utils'; import Button from 'js/components/common/button'; import cx from 'classnames'; diff --git a/jsapp/js/router/router.tsx b/jsapp/js/router/router.tsx index 70012e873f..ed89f494ab 100644 --- a/jsapp/js/router/router.tsx +++ b/jsapp/js/router/router.tsx @@ -23,10 +23,10 @@ const Reports = React.lazy( () => import(/* webpackPrefetch: true */ 'js/components/reports/reports') ); const FormLanding = React.lazy( - () => import(/* webpackPrefetch: true */ 'js/components/formLanding') + () => import(/* webpackPrefetch: true */ 'js/components/formLanding/formLanding') ); const FormSummary = React.lazy( - () => import(/* webpackPrefetch: true */ 'js/components/formSummary') + () => import(/* webpackPrefetch: true */ 'js/components/formSummary/formSummary') ); const FormSubScreens = React.lazy( () => import(/* webpackPrefetch: true */ 'js/components/formSubScreens')