diff --git a/packages/webapp/src/containers/Finances/ManageCustomExpenseTypes/index.jsx b/packages/webapp/src/containers/Finances/ManageCustomExpenseTypes/index.jsx
index 63ed282550..d65825e54e 100644
--- a/packages/webapp/src/containers/Finances/ManageCustomExpenseTypes/index.jsx
+++ b/packages/webapp/src/containers/Finances/ManageCustomExpenseTypes/index.jsx
@@ -20,12 +20,21 @@ import { setPersistedPaths } from '../../hooks/useHookFormPersist/hookFormPersis
import { icons } from '../NewExpense/ExpenseCategories';
import labelIconStyles from '../../../components/Tile/styles.module.scss';
import useCustomExpenseTypeTileContents from '../useCustomExpenseTypeTileContents';
+import {
+ ADD_CUSTOM_EXPENSE_URL,
+ ADD_EXPENSE_URL,
+ EXPENSE_CATEGORIES_URL,
+ FINANCES_HOME_URL,
+ MANAGE_CUSTOM_EXPENSES_URL,
+ createEditCustomExpenseURL,
+ createReadonlyCustomExpenseURL,
+} from '../../../util/siteMapConstants';
-const addCustomTypePath = '/add_custom_expense';
+const addCustomTypePath = ADD_CUSTOM_EXPENSE_URL;
const getPaths = (typeId) => ({
- readOnly: `/readonly_custom_expense/${typeId}`,
- edit: `/edit_custom_expense/${typeId}`,
+ readOnly: createReadonlyCustomExpenseURL(typeId),
+ edit: createEditCustomExpenseURL(typeId),
});
export default function ManageExpenseTypes({ history }) {
@@ -41,20 +50,20 @@ export default function ManageExpenseTypes({ history }) {
};
useEffect(() => {
- // Manipulate page navigation by pushing "/expense_categories" on top of "/Finances".
+ // Manipulate page navigation by pushing EXPENSE_CATEGORIES_URL on top of FINANCES_HOME_URL.
// When browser's back button or form's back button is clicked, we want to
- // navigate the user to "/expense_categories" not "/Finances".
+ // navigate the user to EXPENSE_CATEGORIES_URL not FINANCES_HOME_URL.
const unlisten = history.listen(() => {
- if (history.action === 'POP' && history.location.pathname === '/Finances') {
- dispatch(setPersistedPaths(['/expense_categories', '/add_expense']));
+ if (history.action === 'POP' && history.location.pathname === FINANCES_HOME_URL) {
+ dispatch(setPersistedPaths([EXPENSE_CATEGORIES_URL, ADD_EXPENSE_URL]));
unlisten();
- history.push('/expense_categories');
+ history.push(EXPENSE_CATEGORIES_URL);
} else if (
- // unlisten when the user gets out of the page without going back to '/Finances'.
+ // unlisten when the user gets out of the page without going back to FINANCES_HOME_URL.
// pathname: "/manage_custom_expenses" happens when the user lands on this page.
!(
- history.location.pathname === `/manage_custom_expenses` ||
- (history.action === 'POP' && history.location.pathname === '/Finances')
+ history.location.pathname === MANAGE_CUSTOM_EXPENSES_URL ||
+ (history.action === 'POP' && history.location.pathname === FINANCES_HOME_URL)
)
) {
unlisten();
diff --git a/packages/webapp/src/containers/Finances/ManageCustomRevenueTypes/index.jsx b/packages/webapp/src/containers/Finances/ManageCustomRevenueTypes/index.jsx
index 90dba2717d..fcd0e8fcef 100644
--- a/packages/webapp/src/containers/Finances/ManageCustomRevenueTypes/index.jsx
+++ b/packages/webapp/src/containers/Finances/ManageCustomRevenueTypes/index.jsx
@@ -20,12 +20,21 @@ import { setPersistedPaths } from '../../hooks/useHookFormPersist/hookFormPersis
import useSortedCustomRevenueTypes from '../useSortedCustomRevenueTypes';
import { icons } from '../AddSale/RevenueTypes';
import labelIconStyles from '../../../components/Tile/styles.module.scss';
+import {
+ ADD_REVENUE_URL,
+ FINANCES_HOME_URL,
+ MANAGE_CUSTOM_REVENUES_URL,
+ REVENUE_TYPES_URL,
+ ADD_CUSTOM_REVENUE_URL,
+ createReadonlyCustomRevenueUrl,
+ createEditCustomRevenueUrl,
+} from '../../../util/siteMapConstants';
-const addCustomTypePath = '/add_custom_revenue';
+const addCustomTypePath = ADD_CUSTOM_REVENUE_URL;
const getPaths = (typeId) => ({
- readOnly: `/readonly_custom_revenue/${typeId}`,
- edit: `/edit_custom_revenue/${typeId}`,
+ readOnly: createReadonlyCustomRevenueUrl(typeId),
+ edit: createEditCustomRevenueUrl(typeId),
});
export default function ManageRevenueTypes({ history }) {
@@ -41,20 +50,20 @@ export default function ManageRevenueTypes({ history }) {
};
useEffect(() => {
- // Manipulate page navigation by pushing "/revenue_types" on top of "/Finances".
+ // Manipulate page navigation by pushing REVENUE_TYPES_URL on top of FINANCES_HOME_URL.
// When browser's back button or form's back button is clicked, we want to
- // navigate the user to "/revenue_types" not "/Finances".
+ // navigate the user to REVENUE_TYPES_URL not FINANCES_HOME_URL.
const unlisten = history.listen(() => {
- if (history.action === 'POP' && history.location.pathname === '/Finances') {
- dispatch(setPersistedPaths(['/revenue_types', '/add_sale']));
+ if (history.action === 'POP' && history.location.pathname === FINANCES_HOME_URL) {
+ dispatch(setPersistedPaths([REVENUE_TYPES_URL, ADD_REVENUE_URL]));
unlisten();
- history.push('/revenue_types');
+ history.push(REVENUE_TYPES_URL);
} else if (
- // unlisten when the user gets out of the page without going back to '/Finances'.
+ // unlisten when the user gets out of the page without going back to FINANCES_HOME_URL.
// pathname: "/manage_custom_revenue" happens when the user lands on this page.
!(
- history.location.pathname === `/manage_custom_revenues` ||
- (history.action === 'POP' && history.location.pathname === '/Finances')
+ history.location.pathname === MANAGE_CUSTOM_REVENUES_URL ||
+ (history.action === 'POP' && history.location.pathname === FINANCES_HOME_URL)
)
) {
unlisten();
diff --git a/packages/webapp/src/containers/Finances/NewExpense/AddExpense/index.jsx b/packages/webapp/src/containers/Finances/NewExpense/AddExpense/index.jsx
index e4cc8778bc..454504da03 100644
--- a/packages/webapp/src/containers/Finances/NewExpense/AddExpense/index.jsx
+++ b/packages/webapp/src/containers/Finances/NewExpense/AddExpense/index.jsx
@@ -7,6 +7,7 @@ import { userFarmSelector } from '../../../userFarmSlice';
import { withTranslation } from 'react-i18next';
import { HookFormPersistProvider } from '../../../hooks/useHookFormPersist/HookFormPersistProvider';
import PureAddExpense from '../../../../components/Finances/AddExpense';
+import { FINANCES_HOME_URL } from '../../../../util/siteMapConstants';
class AddExpense extends Component {
constructor(props) {
@@ -76,7 +77,7 @@ class AddExpense extends Component {
formattedData.filter((expense) => expense.value < 0 || isNaN(expense.value)).length === 0
) {
this.props.dispatch(addExpenses(formattedData));
- history.push('/finances');
+ history.push(FINANCES_HOME_URL);
}
}
diff --git a/packages/webapp/src/containers/Finances/NewExpense/ExpenseCategories/index.jsx b/packages/webapp/src/containers/Finances/NewExpense/ExpenseCategories/index.jsx
index 7f5753963f..71f1e34732 100644
--- a/packages/webapp/src/containers/Finances/NewExpense/ExpenseCategories/index.jsx
+++ b/packages/webapp/src/containers/Finances/NewExpense/ExpenseCategories/index.jsx
@@ -25,6 +25,7 @@ import { HookFormPersistProvider } from '../../../hooks/useHookFormPersist/HookF
import labelIconStyles from '../../../../components/Tile/styles.module.scss';
import { listItemTypes } from '../../../../components/List/constants';
import { getFinanceTypeSearchableStringFunc } from '../../util';
+import { ADD_EXPENSE_URL, MANAGE_CUSTOM_EXPENSES_URL } from '../../../../util/siteMapConstants';
export const icons = {
EQUIPMENT:
,
@@ -60,7 +61,7 @@ class ExpenseCategories extends Component {
nextPage(event) {
event.preventDefault();
this.props.dispatch(setSelectedExpenseTypes(this.state.selectedTypes));
- history.push('/add_expense');
+ history.push(ADD_EXPENSE_URL);
}
addRemoveType(id) {
@@ -98,7 +99,7 @@ class ExpenseCategories extends Component {
onContinue={this.nextPage}
onGoBack={this.props.history.back}
progressValue={33}
- onGoToManageCustomType={() => history.push('/manage_custom_expenses')}
+ onGoToManageCustomType={() => history.push(MANAGE_CUSTOM_EXPENSES_URL)}
isTypeSelected={!!this.state.selectedTypes.length}
formatListItemData={(data) => {
const {
diff --git a/packages/webapp/src/containers/Finances/OtherExpense/index.jsx b/packages/webapp/src/containers/Finances/OtherExpense/index.jsx
index 75cc046f87..ef545b5746 100644
--- a/packages/webapp/src/containers/Finances/OtherExpense/index.jsx
+++ b/packages/webapp/src/containers/Finances/OtherExpense/index.jsx
@@ -30,6 +30,7 @@ import { useCurrencySymbol } from '../../hooks/useCurrencySymbol';
import { useSelector, useDispatch } from 'react-redux';
import useDateRangeSelector from '../../../components/DateRangeSelector/useDateRangeSelector';
import { SUNDAY } from '../../../util/dateRange';
+import { createExpenseDetailsUrl, FINANCES_HOME_URL } from '../../../util/siteMapConstants';
const OtherExpense = () => {
const { t } = useTranslation();
@@ -185,7 +186,7 @@ const OtherExpense = () => {
return (
-
+
{t('EXPENSE.SUMMARY')}
@@ -220,7 +221,7 @@ const OtherExpense = () => {
onClick: (e, handleOriginal) => {
if (rowInfo && rowInfo.original) {
const expense_id = rowInfo.original.expense_item_id;
- history.push(`/expense/${expense_id}`);
+ history.push(createExpenseDetailsUrl(expense_id));
}
if (handleOriginal) {
handleOriginal();
diff --git a/packages/webapp/src/containers/Finances/RevenueDetail/index.jsx b/packages/webapp/src/containers/Finances/RevenueDetail/index.jsx
index 84115d07f1..84590491f9 100644
--- a/packages/webapp/src/containers/Finances/RevenueDetail/index.jsx
+++ b/packages/webapp/src/containers/Finances/RevenueDetail/index.jsx
@@ -27,6 +27,7 @@ import useHookFormPersist from '../../hooks/useHookFormPersist';
import { mapRevenueFormDataToApiCallFormat, mapRevenueTypesToReactSelectOptions } from '../util';
import useSortedRevenueTypes from '../AddSale/RevenueTypes/useSortedRevenueTypes';
import { REVENUE_TYPE_OPTION } from '../../../components/Forms/GeneralRevenue/constants';
+import { createEditRevenueDetailsUrl } from '../../../util/siteMapConstants';
function RevenueDetail({ history, match }) {
const isEditing = match.path.endsWith('/edit');
@@ -56,8 +57,8 @@ function RevenueDetail({ history, match }) {
};
const handleEdit = () => {
- dispatch(setPersistedPaths([`/revenue/${sale_id}/edit`]));
- history.push(`/revenue/${sale_id}/edit`);
+ dispatch(setPersistedPaths([createEditRevenueDetailsUrl(sale_id)]));
+ history.push(createEditRevenueDetailsUrl(sale_id));
};
const onRetire = () => {
diff --git a/packages/webapp/src/containers/Finances/saga.js b/packages/webapp/src/containers/Finances/saga.js
index d3427b04ad..1ba4f7c49d 100644
--- a/packages/webapp/src/containers/Finances/saga.js
+++ b/packages/webapp/src/containers/Finances/saga.js
@@ -54,6 +54,13 @@ import {
GET_FARM_EXPENSE_TYPE,
UPDATE_SALE,
} from './constants';
+import {
+ ESTIMATED_REVENUE_URL,
+ FINANCES_HOME_URL,
+ MANAGE_CUSTOM_EXPENSES_URL,
+ MANAGE_CUSTOM_REVENUES_URL,
+ OTHER_EXPENSE_URL,
+} from '../../util/siteMapConstants';
export const getSales = createAction('getSales');
@@ -82,7 +89,7 @@ export function* addSale(action) {
const result = yield call(axios.post, salesURL, action.sale, header);
yield put(enqueueSuccessSnackbar(i18n.t('message:SALE.SUCCESS.ADD')));
yield call(getSalesSaga);
- history.push('/finances');
+ history.push(FINANCES_HOME_URL);
} catch (e) {
yield put(enqueueErrorSnackbar(i18n.t('message:SALE.ERROR.ADD')));
}
@@ -101,7 +108,7 @@ export function* updateSaleSaga(action) {
yield call(axios.patch, `${salesURL}/${sale_id}`, sale, header);
yield put(enqueueSuccessSnackbar(i18n.t('message:SALE.SUCCESS.UPDATE')));
yield call(getSalesSaga);
- history.push('/finances');
+ history.push(FINANCES_HOME_URL);
} catch (e) {
console.log(`failed to update sale`);
yield put(enqueueErrorSnackbar(i18n.t('message:SALE.ERROR.UPDATE')));
@@ -118,7 +125,7 @@ export function* deleteSale(action) {
yield call(axios.delete, salesURL + '/' + sale_id, header);
yield put(enqueueSuccessSnackbar(i18n.t('message:SALE.SUCCESS.DELETE')));
yield call(getSalesSaga);
- history.push('/finances');
+ history.push(FINANCES_HOME_URL);
} catch (e) {
console.log(`failed to delete sale`);
yield put(enqueueErrorSnackbar(i18n.t('message:SALE.ERROR.DELETE')));
@@ -175,7 +182,7 @@ export function* addCustomExpenseTypeSaga({ payload: { expense_name, custom_desc
if (result) {
yield put(enqueueSuccessSnackbar(i18n.t('message:EXPENSE_TYPE.SUCCESS.ADD')));
yield call(getFarmExpenseTypeSaga);
- history.push('/manage_custom_expenses');
+ history.push(MANAGE_CUSTOM_EXPENSES_URL);
}
} catch (e) {
console.log('failed to add new expense type to the database');
@@ -202,7 +209,7 @@ export function* updateCustomExpenseTypeSaga({
if (result) {
yield put(enqueueSuccessSnackbar(i18n.t('message:EXPENSE_TYPE.SUCCESS.UPDATE')));
yield call(getFarmExpenseTypeSaga);
- history.push('/manage_custom_expenses');
+ history.push(MANAGE_CUSTOM_EXPENSES_URL);
}
} catch (e) {
console.log('failed to update expense type in the database');
@@ -222,7 +229,7 @@ export function* retireCustomExpenseTypeSaga({ payload: { expense_type_id } }) {
if (result) {
yield put(enqueueSuccessSnackbar(i18n.t('message:EXPENSE_TYPE.SUCCESS.DELETE')));
yield call(getFarmExpenseTypeSaga);
- history.push('/manage_custom_expenses');
+ history.push(MANAGE_CUSTOM_EXPENSES_URL);
}
} catch (e) {
console.log('failed to delete new expense type in the database');
@@ -259,7 +266,7 @@ export function* deleteExpenseSaga(action) {
const result = yield call(axios.delete, `${expenseUrl}/${expense_id}`, header);
if (result) {
yield put(enqueueSuccessSnackbar(i18n.t('message:EXPENSE.SUCCESS.DELETE')));
- history.push('/other_expense');
+ history.push(FINANCES_HOME_URL);
}
} catch (e) {
yield put(enqueueErrorSnackbar(i18n.t('message:EXPENSE.ERROR.DELETE')));
@@ -326,7 +333,7 @@ export function* editExpenseSaga(action) {
yield put(setExpense(result.data));
}
}
- history.push('/other_expense');
+ history.push(FINANCES_HOME_URL);
} catch (e) {
console.log(e);
yield put(enqueueErrorSnackbar(i18n.t('message:EXPENSE.ERROR.UPDATE')));
@@ -363,7 +370,7 @@ export function* deleteRevenueTypeSaga({ payload: id }) {
yield put(deleteRevenueTypeSuccess({ revenue_type_id: id, deleted, retired }));
yield put(enqueueSuccessSnackbar(i18n.t('message:REVENUE_TYPE.SUCCESS.DELETE')));
- history.push('/manage_custom_revenues');
+ history.push(MANAGE_CUSTOM_REVENUES_URL);
} catch (e) {
yield put(enqueueErrorSnackbar(i18n.t('message:REVENUE_TYPE.ERROR.DELETE')));
}
@@ -391,7 +398,7 @@ export function* addRevenueTypeSaga({
yield put(postRevenueTypeSuccess(result.data));
yield put(enqueueSuccessSnackbar(i18n.t('message:REVENUE_TYPE.SUCCESS.ADD')));
- history.push('/manage_custom_revenues');
+ history.push(MANAGE_CUSTOM_REVENUES_URL);
} catch (e) {
yield put(enqueueErrorSnackbar(i18n.t('message:REVENUE_TYPE.ERROR.ADD')));
}
@@ -416,7 +423,7 @@ export function* updateRevenueTypeSaga({
yield put(putRevenueTypeSuccess({ revenue_type_id, revenue_name, custom_description }));
yield put(enqueueSuccessSnackbar(i18n.t('message:REVENUE_TYPE.SUCCESS.UPDATE')));
- history.push('/manage_custom_revenues');
+ history.push(MANAGE_CUSTOM_REVENUES_URL);
} catch (e) {
yield put(enqueueErrorSnackbar(i18n.t('message:REVENUE_TYPE.ERROR.UPDATE')));
}
@@ -437,7 +444,7 @@ export function* patchEstimatedCropRevenueSaga({ payload: managementPlan }) {
);
yield call(getManagementPlanAndPlantingMethodSuccessSaga, { payload: [managementPlan] });
yield put(enqueueSuccessSnackbar(i18n.t('message:REVENUE.SUCCESS.EDIT')));
- history.push(`/estimated_revenue`);
+ history.push(ESTIMATED_REVENUE_URL);
} catch (e) {
console.log('Failed to update managementPlan to database');
yield put(enqueueErrorSnackbar(i18n.t('message:REVENUE.ERROR.EDIT')));
diff --git a/packages/webapp/src/hooks/useGetMenuItems.jsx b/packages/webapp/src/hooks/useGetMenuItems.jsx
index 1e5b42b685..4d7bf92ffa 100644
--- a/packages/webapp/src/hooks/useGetMenuItems.jsx
+++ b/packages/webapp/src/hooks/useGetMenuItems.jsx
@@ -27,6 +27,12 @@ import { useMemo } from 'react';
import { useSelector } from 'react-redux';
import { isAdminSelector } from '../containers/userFarmSlice';
import styles from '../components/Navigation/SideMenu/styles.module.scss';
+import {
+ ESTIMATED_REVENUE_URL,
+ FINANCES_HOME_URL,
+ LABOUR_URL,
+ OTHER_EXPENSE_URL,
+} from '../util/siteMapConstants';
export const useGetMenuItems = () => {
const { t } = useTranslation();
@@ -49,20 +55,20 @@ export const useGetMenuItems = () => {
list.splice(3, 0, {
label: t('MENU.FINANCES'),
icon:
,
- path: '/finances',
+ path: FINANCES_HOME_URL,
key: 'finances',
subMenu: [
{
label: t('MENU.TRANSACTION_LIST'),
- path: '/finances/transactions',
+ path: FINANCES_HOME_URL,
key: 'transactions',
},
{
label: t('MENU.OTHER_EXPENSES'),
- path: '/finances/other_expense',
+ path: OTHER_EXPENSE_URL,
key: 'other_expense',
},
- { label: t('MENU.LABOUR_EXPENSES'), path: '/finances/labour', key: 'labour' },
+ { label: t('MENU.LABOUR_EXPENSES'), path: LABOUR_URL, key: 'labour' },
{
label: t('MENU.ACTUAL_REVENUES'),
path: '/finances/actual_revenue',
@@ -70,7 +76,7 @@ export const useGetMenuItems = () => {
},
{
label: t('MENU.ESTIMATED_REVENUES'),
- path: '/finances/estimated_revenue',
+ path: ESTIMATED_REVENUE_URL,
key: 'estimated_revenue',
},
],
diff --git a/packages/webapp/src/main.jsx b/packages/webapp/src/main.jsx
index 64b082078e..393eb8338a 100644
--- a/packages/webapp/src/main.jsx
+++ b/packages/webapp/src/main.jsx
@@ -86,7 +86,7 @@ if (import.meta.env.VITE_SENTRY_DSN) {
Sentry.init({
dsn: import.meta.env.VITE_SENTRY_DSN,
integrations: [new Integrations.BrowserTracing()],
- release: '3.6.1',
+ release: '3.6.2',
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
diff --git a/packages/webapp/src/routes/DeprecatedRoutes.jsx b/packages/webapp/src/routes/DeprecatedRoutes.jsx
deleted file mode 100644
index 6a5a2f5f50..0000000000
--- a/packages/webapp/src/routes/DeprecatedRoutes.jsx
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2023 LiteFarm.org
- * This file is part of LiteFarm.
- *
- * LiteFarm is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * LiteFarm is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details, see
.
- */
-
-import { Redirect, Route, Switch } from 'react-router-dom';
-
-// Redirects from previous routes
-const DeprecatedRoutes = () => (
-
- {/* Redirect old routes to nested finances routes for backwards compatibility */}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-);
-
-export default DeprecatedRoutes;
diff --git a/packages/webapp/src/routes/FinancesRoutes.jsx b/packages/webapp/src/routes/FinancesRoutes.jsx
index e942d3be18..a3cfefffc8 100644
--- a/packages/webapp/src/routes/FinancesRoutes.jsx
+++ b/packages/webapp/src/routes/FinancesRoutes.jsx
@@ -15,6 +15,29 @@
import React from 'react';
import { Route, Switch, Redirect } from 'react-router-dom';
+import {
+ ADD_CUSTOM_EXPENSE_URL,
+ ADD_CUSTOM_REVENUE_URL,
+ ADD_EXPENSE_URL,
+ ADD_REVENUE_URL,
+ createEditCustomExpenseURL,
+ createEditCustomRevenueUrl,
+ createEditExpenseDetailsUrl,
+ createEditRevenueDetailsUrl,
+ createExpenseDetailsUrl,
+ createManagementPlanEstimatedRevenueURL,
+ createReadonlyCustomExpenseURL,
+ createReadonlyCustomRevenueUrl,
+ createRevenueDetailsUrl,
+ ESTIMATED_REVENUE_URL,
+ EXPENSE_CATEGORIES_URL,
+ FINANCES_HOME_URL,
+ LABOUR_URL,
+ MANAGE_CUSTOM_EXPENSES_URL,
+ MANAGE_CUSTOM_REVENUES_URL,
+ OTHER_EXPENSE_URL,
+ REVENUE_TYPES_URL,
+} from '../util/siteMapConstants';
const Finances = React.lazy(() => import('../containers/Finances'));
const ActualRevenue = React.lazy(() => import('../containers/Finances/ActualRevenue'));
const UpdateEstimatedCropRevenue = React.lazy(() =>
@@ -58,45 +81,45 @@ const EditCustomRevenue = React.lazy(() =>
const FinancesRoutes = () => (
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
diff --git a/packages/webapp/src/routes/index.jsx b/packages/webapp/src/routes/index.jsx
index 37dca60d55..c720bf5980 100644
--- a/packages/webapp/src/routes/index.jsx
+++ b/packages/webapp/src/routes/index.jsx
@@ -30,7 +30,6 @@ import useScrollToTop from '../containers/hooks/useScrollToTop';
import { useReduxSnackbar } from '../containers/Snackbar/useReduxSnackbar';
//dynamic imports
-const DeprecatedRoutes = React.lazy(() => import('./DeprecatedRoutes'));
const Home = React.lazy(() => import('../containers/Home'));
const HelpRequest = React.lazy(() => import('../containers/Help'));
const Account = React.lazy(() => import('../containers/Profile/Account'));
@@ -611,7 +610,6 @@ const Routes = ({ isCompactSideMenu }) => {
/>
-
{
/>
-
diff --git a/packages/webapp/src/util/siteMapConstants.ts b/packages/webapp/src/util/siteMapConstants.ts
new file mode 100644
index 0000000000..322057c870
--- /dev/null
+++ b/packages/webapp/src/util/siteMapConstants.ts
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2024 LiteFarm.org
+ * This file is part of LiteFarm.
+ *
+ * LiteFarm is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * LiteFarm is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details, see
.
+ */
+
+// Type of string has the dual purpose of being used in routes parameter pathing
+// as well as accomodating UUID types.
+
+// Finances
+export const FINANCES_HOME_URL = '/finances/transactions';
+export const REVENUE_TYPES_URL = '/finances/revenue_types';
+export const ADD_REVENUE_URL = '/finances/add_revenue';
+export const MANAGE_CUSTOM_REVENUES_URL = '/finances/manage_custom_revenues';
+export const ESTIMATED_REVENUE_URL = '/finances/estimated_revenue';
+export const LABOUR_URL = '/finances/labour';
+export const OTHER_EXPENSE_URL = '/finances/other_expense';
+export const EXPENSE_CATEGORIES_URL = '/finances/expense_categories';
+export const ADD_EXPENSE_URL = '/finances/add_expense';
+export const MANAGE_CUSTOM_EXPENSES_URL = '/finances/manage_custom_expenses';
+export const ADD_CUSTOM_EXPENSE_URL = '/finances/add_custom_expense';
+export const ADD_CUSTOM_REVENUE_URL = '/finances/add_custom_revenue';
+export const createExpenseDetailsUrl = (id: string | number): string => {
+ return `/finances/expense/${id}`;
+};
+export const createEditExpenseDetailsUrl = (id: string | number): string => {
+ return `${createExpenseDetailsUrl(id)}/edit`;
+};
+export const createRevenueDetailsUrl = (id: string | number): string => {
+ return `/finances/revenue/${id}`;
+};
+export const createEditRevenueDetailsUrl = (id: string | number): string => {
+ return `${createRevenueDetailsUrl(id)}/edit`;
+};
+export const createManagementPlanEstimatedRevenueURL = (id: string | number): string => {
+ return `${ESTIMATED_REVENUE_URL}/plan/${id}}`;
+};
+export const createReadonlyCustomExpenseURL = (id: string | number): string => {
+ return `/finances/readonly_custom_expense/${id}`;
+};
+export const createEditCustomExpenseURL = (id: string | number): string => {
+ return `/finances/edit_custom_expense/${id}`;
+};
+
+export const createEditCustomRevenueUrl = (id: string | number): string => {
+ return `/finances/edit_custom_revenue/${id}`;
+};
+
+export const createReadonlyCustomRevenueUrl = (id: string | number): string => {
+ return `/finances/readonly_custom_revenue/${id}`;
+};