Skip to content

Commit

Permalink
fix(add-content): hide location step
Browse files Browse the repository at this point in the history
  • Loading branch information
saithsab877 committed Sep 24, 2024
1 parent 7ffb3a9 commit dba2015
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ jobs:
wait-on-timeout: 120 # Waits for 2 minutes
# Records to Cypress Dashboard
record: true
args: --disable-dev-shm-usage
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# created by the GH Action automatically
Expand Down
20 changes: 7 additions & 13 deletions src/components/AddContentModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { SubmitErrRes } from '~/types'
import { getLSat, payLsat, updateBudget } from '~/utils'
import { SuccessNotify } from '../common/SuccessToast'
import { BudgetStep } from './BudgetStep'
import { LocationStep } from './LocationStep'
import { SourceStep } from './SourceStep'
import { validateSourceURL } from './SourceStep/utils'
import { SourceTypeStep } from './SourceTypeStep'
Expand Down Expand Up @@ -164,9 +163,6 @@ export const AddContentModal = () => {
const type = watch('inputType')
const sourceValue = watch('source')

const longitude = watch('longitude')
const latitude = watch('latitude')

const source = watch('source')

const isValidSource = validateSourceURL(sourceValue)
Expand All @@ -180,7 +176,11 @@ export const AddContentModal = () => {
}

const onNextStep = () => {
setCurrentStep(currentStep + 1)
if (currentStep === 0) {
setCurrentStep(isSource(type) ? 1 : 2)
} else {
setCurrentStep(currentStep + 1)
}
}

const onPrevStep = () => {
Expand Down Expand Up @@ -217,14 +217,8 @@ export const AddContentModal = () => {
<FormProvider {...form}>
<form id="add-node-form" onSubmit={onSubmit}>
{currentStep === 0 && <SourceStep allowNextStep={isValidSource} onNextStep={onNextStep} type={type} />}
{currentStep === 1 && (
<>
{!isSource(type) ? (
<LocationStep form={form} latitude={latitude} longitude={longitude} onNextStep={onNextStep} />
) : (
<SourceTypeStep onNextStep={onNextStep} onPrevStep={onPrevStep} type={type} value={sourceValue} />
)}
</>
{currentStep === 1 && isSource(type) && (
<SourceTypeStep onNextStep={onNextStep} onPrevStep={onPrevStep} type={type} value={sourceValue} />
)}
{currentStep === 2 && <BudgetStep error={error} loading={loading} onClick={() => null} type={type} />}
</form>
Expand Down

0 comments on commit dba2015

Please sign in to comment.