Skip to content

Commit

Permalink
Revert name refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
ev-sc committed Dec 11, 2024
1 parent 37156d7 commit e692617
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ type FormInputs = CreateExternalDataSourceInput &
}

export default function Page({
params: { externalDataProviderType },
params: { externalDataSourceType },
}: {
params: { externalDataProviderType: keyof CreateExternalDataSourceInput }
params: { externalDataSourceType: keyof CreateExternalDataSourceInput }
}) {
const orgId = useAtomValue(currentOrganisationIdAtom)
const router = useRouter()
Expand Down Expand Up @@ -429,13 +429,13 @@ export default function Page({
}, [airtableUrl])

async function submitTestConnection(formData: FormInputs) {
if (!formData[externalDataProviderType]) {
if (!formData[externalDataSourceType]) {
throw Error('Need some CRM connection details to proceed!')
}

// To avoid mutation of the form data
const genericCRMData = Object.assign({}, formData)
const CRMSpecificData = formData[externalDataProviderType]
const CRMSpecificData = formData[externalDataSourceType]

// Remove specific CRM data from the generic data
// TODO: make this less fragile. Currently it assumes any nested
Expand All @@ -447,7 +447,7 @@ export default function Page({
}

const input: TestDataSourceQueryVariables['input'] = {
[externalDataProviderType]: {
[externalDataSourceType]: {
...genericCRMData,
...CRMSpecificData,
},
Expand Down Expand Up @@ -477,12 +477,12 @@ export default function Page({
}

async function submitCreateSource(formData: FormInputs) {
if (!formData[externalDataProviderType]) {
if (!formData[externalDataSourceType]) {
throw Error('Need some CRM connection details to proceed!')
}
// To avoid mutation of the form data
const genericCRMData = Object.assign({}, formData)
let CRMSpecificData = formData[externalDataProviderType]
let CRMSpecificData = formData[externalDataSourceType]

// Remove specific CRM data from the generic data
// TODO: make this less fragile. Currently it assumes any nested
Expand All @@ -494,7 +494,7 @@ export default function Page({
}

let input: CreateExternalDataSourceInput = {
[externalDataProviderType]: {
[externalDataSourceType]: {
...genericCRMData,
...CRMSpecificData,
organisation: { set: orgId },
Expand Down Expand Up @@ -762,15 +762,15 @@ export default function Page({
<h1 className="text-hLg">Testing connection...</h1>
<p className="text-meepGray-400 max-w-lg">
Please wait whilst we try to connect to your{' '}
{formatCrmNames(externalDataProviderType || 'CRM')} using the
{formatCrmNames(externalDataSourceType || 'CRM')} using the
information you provided
</p>
<LoadingIcon />
</div>
)
}

if (externalDataProviderType === 'airtable') {
if (externalDataSourceType === 'airtable') {
return (
<div className="space-y-7">
<header>
Expand Down Expand Up @@ -919,7 +919,7 @@ export default function Page({
)
}

if (externalDataProviderType === 'mailchimp') {
if (externalDataSourceType === 'mailchimp') {
return (
<div className="space-y-7">
<header>
Expand Down Expand Up @@ -1010,7 +1010,7 @@ export default function Page({
</div>
)
}
if (externalDataProviderType === 'actionnetwork') {
if (externalDataSourceType === 'actionnetwork') {
const groupSlug = form.watch('actionnetwork.groupSlug')
const actionNetworkApiUrl = groupSlug
? `https://actionnetwork.org/groups/${groupSlug}/apis`
Expand Down Expand Up @@ -1109,7 +1109,7 @@ export default function Page({
</div>
)
}
if (externalDataProviderType === 'editablegooglesheets') {
if (externalDataSourceType === 'editablegooglesheets') {
const hasOauthParams = searchParams.get('state') && searchParams.get('code')
// The presence of the params and absence of an oauthCredentialsResult
// means the query has either not yet been sent, or is in progress.
Expand Down Expand Up @@ -1283,7 +1283,7 @@ export default function Page({
)
}

if (externalDataProviderType === 'tickettailor') {
if (externalDataSourceType === 'tickettailor') {
return (
<div className="space-y-7">
<header>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ const GET_UPDATE_CONFIG = gql`
`

export default function Page({
params: { externalDataProviderId },
params: { externalDataSourceId },
}: {
params: { externalDataProviderId: string }
params: { externalDataSourceId: string }
}) {
const router = useRouter()
const context = useContext(CreateAutoUpdateFormContext)
Expand All @@ -65,7 +65,7 @@ export default function Page({
AutoUpdateCreationReviewQueryVariables
>(GET_UPDATE_CONFIG, {
variables: {
ID: externalDataProviderId,
ID: externalDataSourceId,
},
})

Expand Down Expand Up @@ -145,7 +145,7 @@ export default function Page({
</div>
<div>
<TriggerUpdateButton
id={externalDataProviderId}
id={externalDataSourceId}
className="w-full"
variant="reverse"
/>
Expand Down

0 comments on commit e692617

Please sign in to comment.