Switched Portal components to use explicit path imports

- `compilerOptions.baseUrl` is nice but it means we end up with two
  different styles of import paths for project files - relative and from
  `src/`
- to fix this, we're going to standardize on relative imports and remove
  the ability to import relative to the top-level project folder
- this removes the jsconfig line and fixes all existing imports
This commit is contained in:
Daniel Lockyer 2023-03-16 12:06:47 +01:00
parent d04b43aeee
commit e280925a8b
No known key found for this signature in database
16 changed files with 45 additions and 48 deletions

View File

@ -1,6 +1,3 @@
{ {
"compilerOptions": {
"baseUrl": "src"
},
"include": ["src"] "include": ["src"]
} }

View File

@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import AppContext from 'AppContext'; import AppContext from '../../../AppContext';
import {getSupportAddress} from 'utils/helpers'; import {getSupportAddress} from '../../../utils/helpers';
import AccountFooter from './components/AccountFooter'; import AccountFooter from './components/AccountFooter';
import AccountMain from './components/AccountMain'; import AccountMain from './components/AccountMain';

View File

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import {render, fireEvent} from 'utils/test-utils'; import {render, fireEvent} from '../../../utils/test-utils';
import AccountHomePage from './AccountHomePage'; import AccountHomePage from './AccountHomePage';
import {site} from 'utils/fixtures'; import {site} from '../../../utils/fixtures';
const setup = (overrides) => { const setup = (overrides) => {
const {mockOnActionFn, ...utils} = render( const {mockOnActionFn, ...utils} = render(

View File

@ -1,6 +1,6 @@
import AppContext from 'AppContext'; import AppContext from '../../../../AppContext';
import {useContext} from 'react'; import {useContext} from 'react';
import {hasCommentsEnabled, hasMultipleNewsletters, isEmailSuppressed} from 'utils/helpers'; import {hasCommentsEnabled, hasMultipleNewsletters, isEmailSuppressed} from '../../../../utils/helpers';
import PaidAccountActions from './PaidAccountActions'; import PaidAccountActions from './PaidAccountActions';
import EmailNewsletterAction from './EmailNewsletterAction'; import EmailNewsletterAction from './EmailNewsletterAction';

View File

@ -1,4 +1,4 @@
import CloseButton from 'components/common/CloseButton'; import CloseButton from '../../../../components/common/CloseButton';
import UserHeader from './UserHeader'; import UserHeader from './UserHeader';
import AccountWelcome from './AccountWelcome'; import AccountWelcome from './AccountWelcome';

View File

@ -1,6 +1,6 @@
import AppContext from 'AppContext'; import AppContext from '../../../../AppContext';
import {getCompExpiry, getMemberSubscription, hasOnlyFreePlan, isComplimentaryMember, subscriptionHasFreeTrial} from 'utils/helpers'; import {getCompExpiry, getMemberSubscription, hasOnlyFreePlan, isComplimentaryMember, subscriptionHasFreeTrial} from '../../../../utils/helpers';
import {getDateString} from 'utils/date-time'; import {getDateString} from '../../../../utils/date-time';
import {useContext} from 'react'; import {useContext} from 'react';
import SubscribeButton from './SubscribeButton'; import SubscribeButton from './SubscribeButton';

View File

@ -1,7 +1,7 @@
import AppContext from 'AppContext'; import AppContext from '../../../../AppContext';
import ActionButton from 'components/common/ActionButton'; import ActionButton from '../../../common/ActionButton';
import {getMemberSubscription} from 'utils/helpers'; import {getMemberSubscription} from '../../../../utils/helpers';
import {getDateString} from 'utils/date-time'; import {getDateString} from '../../../../utils/date-time';
import {useContext} from 'react'; import {useContext} from 'react';
const ContinueSubscriptionButton = () => { const ContinueSubscriptionButton = () => {

View File

@ -1,6 +1,6 @@
import AppContext from 'AppContext'; import AppContext from '../../../../AppContext';
import Switch from 'components/common/Switch'; import Switch from '../../../common/Switch';
import {getSiteNewsletters, hasMemberGotEmailSuppression} from 'utils/helpers'; import {getSiteNewsletters, hasMemberGotEmailSuppression} from '../../../../utils/helpers';
import {useContext} from 'react'; import {useContext} from 'react';
function EmailNewsletterAction() { function EmailNewsletterAction() {

View File

@ -1,7 +1,7 @@
import AppContext from 'AppContext'; import AppContext from '../../../../AppContext';
import {useContext} from 'react'; import {useContext} from 'react';
import {isEmailSuppressed} from 'utils/helpers'; import {isEmailSuppressed} from '../../../../utils/helpers';
import {ReactComponent as EmailDeliveryFailedIcon} from 'images/icons/email-delivery-failed.svg'; import {ReactComponent as EmailDeliveryFailedIcon} from '../../../../images/icons/email-delivery-failed.svg';
function EmailPreferencesAction() { function EmailPreferencesAction() {
const {onAction, member, t} = useContext(AppContext); const {onAction, member, t} = useContext(AppContext);

View File

@ -1,8 +1,8 @@
import AppContext from 'AppContext'; import AppContext from '../../../../AppContext';
import {allowCompMemberUpgrade, getCompExpiry, getMemberSubscription, getMemberTierName, getUpdatedOfferPrice, hasMultipleProductsFeature, hasOnlyFreePlan, isComplimentaryMember, isInThePast, subscriptionHasFreeTrial} from 'utils/helpers'; import {allowCompMemberUpgrade, getCompExpiry, getMemberSubscription, getMemberTierName, getUpdatedOfferPrice, hasMultipleProductsFeature, hasOnlyFreePlan, isComplimentaryMember, isInThePast, subscriptionHasFreeTrial} from '../../../../utils/helpers';
import {getDateString} from 'utils/date-time'; import {getDateString} from '../../../../utils/date-time';
import {ReactComponent as LoaderIcon} from 'images/icons/loader.svg'; import {ReactComponent as LoaderIcon} from '../../../../images/icons/loader.svg';
import {ReactComponent as OfferTagIcon} from 'images/icons/offer-tag.svg'; import {ReactComponent as OfferTagIcon} from '../../../../images/icons/offer-tag.svg';
import {useContext} from 'react'; import {useContext} from 'react';
const PaidAccountActions = () => { const PaidAccountActions = () => {

View File

@ -1,6 +1,6 @@
import AppContext from 'AppContext'; import AppContext from '../../../../AppContext';
import ActionButton from 'components/common/ActionButton'; import ActionButton from '../../../common/ActionButton';
import {hasOnlyFreePlan} from 'utils/helpers'; import {hasOnlyFreePlan} from '../../../../utils/helpers';
import {useContext} from 'react'; import {useContext} from 'react';
const SubscribeButton = () => { const SubscribeButton = () => {

View File

@ -1,5 +1,5 @@
import AppContext from 'AppContext'; import AppContext from '../../../../AppContext';
import MemberAvatar from 'components/common/MemberGravatar'; import MemberAvatar from '../../../common/MemberGravatar';
import React, {useContext} from 'react'; import React, {useContext} from 'react';
const UserHeader = () => { const UserHeader = () => {

View File

@ -1,8 +1,8 @@
import AppContext from 'AppContext'; import AppContext from '../../AppContext';
import {useContext} from 'react'; import {useContext} from 'react';
import BackButton from 'components/common/BackButton'; import BackButton from '../../components/common/BackButton';
import CloseButton from 'components/common/CloseButton'; import CloseButton from '../../components/common/CloseButton';
import {getDefaultNewsletterSender, getSupportAddress} from 'utils/helpers'; import {getDefaultNewsletterSender, getSupportAddress} from '../../utils/helpers';
export default function EmailReceivingPage() { export default function EmailReceivingPage() {
const {brandColor, onAction, site, lastPage, member} = useContext(AppContext); const {brandColor, onAction, site, lastPage, member} = useContext(AppContext);

View File

@ -1,10 +1,10 @@
import AppContext from 'AppContext'; import AppContext from '../../AppContext';
import {useContext, useEffect} from 'react'; import {useContext, useEffect} from 'react';
import {hasCommentsEnabled, hasMultipleNewsletters} from 'utils/helpers'; import {hasCommentsEnabled, hasMultipleNewsletters} from '../../utils/helpers';
import CloseButton from 'components/common/CloseButton'; import CloseButton from '../../components/common/CloseButton';
import BackButton from 'components/common/BackButton'; import BackButton from '../../components/common/BackButton';
import ActionButton from 'components/common/ActionButton'; import ActionButton from '../../components/common/ActionButton';
import {ReactComponent as EmailDeliveryFailedIcon} from 'images/icons/email-delivery-failed.svg'; import {ReactComponent as EmailDeliveryFailedIcon} from '../../images/icons/email-delivery-failed.svg';
export default function EmailSuppressedPage() { export default function EmailSuppressedPage() {
const {brandColor, lastPage, onAction, action, site, t} = useContext(AppContext); const {brandColor, lastPage, onAction, action, site, t} = useContext(AppContext);

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import {render, fireEvent} from 'utils/test-utils'; import {render, fireEvent} from '../../utils/test-utils';
import EmailSuppressedPage from './EmailSuppressedPage'; import EmailSuppressedPage from './EmailSuppressedPage';
const setup = (overrides) => { const setup = (overrides) => {

View File

@ -1,8 +1,8 @@
import AppContext from 'AppContext'; import AppContext from '../../AppContext';
import {useContext} from 'react'; import {useContext} from 'react';
import BackButton from 'components/common/BackButton'; import BackButton from '../../components/common/BackButton';
import CloseButton from 'components/common/CloseButton'; import CloseButton from '../../components/common/CloseButton';
import {getSupportAddress} from 'utils/helpers'; import {getSupportAddress} from '../../utils/helpers';
export default function EmailSuppressedPage() { export default function EmailSuppressedPage() {
const {brandColor, onAction, site} = useContext(AppContext); const {brandColor, onAction, site} = useContext(AppContext);