Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

closed #2169

Closed
wants to merge 3 commits into from
Closed

closed #2169

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,4 @@ jobs:

- name: Stop Stack
working-directory: ./stack
run: docker compose down
run: docker compose down
3 changes: 1 addition & 2 deletions cypress/e2e/addContent/addTweet.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})

Expand Down
3 changes: 1 addition & 2 deletions cypress/e2e/addContent/addWebpage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})

Expand Down
3 changes: 1 addition & 2 deletions cypress/e2e/addContent/addYoutube.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})

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 @@ -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'
Expand Down Expand Up @@ -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)
Expand All @@ -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 = () => {
Expand Down Expand Up @@ -218,14 +218,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
Loading