From 41ec733caae0f9c1db5b2a4d074f5b7eaa2ddacd Mon Sep 17 00:00:00 2001 From: saithsab877 Date: Tue, 24 Sep 2024 23:08:11 +0500 Subject: [PATCH] fix(add-content): hide location step --- cypress/e2e/addContent/addTweet.cy.ts | 3 +-- cypress/e2e/addContent/addWebpage.cy.ts | 3 +-- cypress/e2e/addContent/addYoutube.cy.ts | 3 +-- src/components/AddContentModal/index.tsx | 20 +++++++------------- 4 files changed, 10 insertions(+), 19 deletions(-) diff --git a/cypress/e2e/addContent/addTweet.cy.ts b/cypress/e2e/addContent/addTweet.cy.ts index db24f684d..9cb147cd3 100644 --- a/cypress/e2e/addContent/addTweet.cy.ts +++ b/cypress/e2e/addContent/addTweet.cy.ts @@ -12,11 +12,10 @@ describe('Add Tweet Content', () => { cy.get('#addContent').should('exist') cy.get('[id="cy-youtube-channel-id"]').type('https://twitter.com/ijbguy/status/1771096005162729663') cy.get('[data-testid="add-content-btn"]').click() - cy.get('[data-testid="skip-location-btn"').click() cy.get('[data-testid="check-icon"]').click() cy.wait('@addTweet').then((interception) => { - //check we get a 402 response code, when trying to add content for the first time + // check we get a 402 response code, when trying to add content for the first time expect(interception.response.statusCode).to.eq(402) }) diff --git a/cypress/e2e/addContent/addWebpage.cy.ts b/cypress/e2e/addContent/addWebpage.cy.ts index 8224ea6d2..842569727 100644 --- a/cypress/e2e/addContent/addWebpage.cy.ts +++ b/cypress/e2e/addContent/addWebpage.cy.ts @@ -12,11 +12,10 @@ describe('Add Webpage Content', () => { cy.get('[id="cy-youtube-channel-id"]').type('https://www.netflix.com/browse') cy.wait(1000) cy.get('[data-testid="add-content-btn"]').should('not.be.disabled').click() - cy.get('[data-testid="skip-location-btn"').click() cy.get('[data-testid="check-icon"]').click() cy.wait('@addWebpage').then((interception) => { - //check we get a 402 response code, when trying to add content for the first time + // check we get a 402 response code, when trying to add content for the first time expect(interception.response.statusCode).to.eq(402) }) diff --git a/cypress/e2e/addContent/addYoutube.cy.ts b/cypress/e2e/addContent/addYoutube.cy.ts index 288569bbf..1ad17d679 100644 --- a/cypress/e2e/addContent/addYoutube.cy.ts +++ b/cypress/e2e/addContent/addYoutube.cy.ts @@ -12,11 +12,10 @@ describe('Add Youtube Content', () => { cy.get('[id="cy-youtube-channel-id"]').type('https://www.youtube.com/watch?v=dPLPSaFqJmY') cy.wait(1000) cy.get('[data-testid="add-content-btn"]').should('not.be.disabled').click() - cy.get('[data-testid="skip-location-btn"').click() cy.get('[data-testid="check-icon"]').click() cy.wait('@addYoutube').then((interception) => { - //check we get a 402 response code, when trying to add content for the first time + // check we get a 402 response code, when trying to add content for the first time expect(interception.response.statusCode).to.eq(402) }) diff --git a/src/components/AddContentModal/index.tsx b/src/components/AddContentModal/index.tsx index 36bc7b043..f1f06c093 100644 --- a/src/components/AddContentModal/index.tsx +++ b/src/components/AddContentModal/index.tsx @@ -22,7 +22,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' @@ -165,9 +164,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) @@ -181,7 +177,11 @@ export const AddContentModal = () => { } const onNextStep = () => { - setCurrentStep(currentStep + 1) + if (currentStep === 0) { + setCurrentStep(isSource(type) ? 1 : 2) + } else { + setCurrentStep(currentStep + 1) + } } const onPrevStep = () => { @@ -218,14 +218,8 @@ export const AddContentModal = () => {
{currentStep === 0 && } - {currentStep === 1 && ( - <> - {!isSource(type) ? ( - - ) : ( - - )} - + {currentStep === 1 && isSource(type) && ( + )} {currentStep === 2 && null} type={type} />}