Skip to content

Commit

Permalink
fix: page link given to feedback button
Browse files Browse the repository at this point in the history
  • Loading branch information
benfurber committed Aug 21, 2024
1 parent bd929c0 commit 3ee18a3
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
30 changes: 30 additions & 0 deletions packages/cypress/src/integration/common.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,36 @@ describe('[Common]', () => {
cy.url().should('include', '/how-to')
})

describe.only('[User feeback button]', () => {
it('[Desktop]', () => {
cy.visit('/how-to')
cy.get('[data-cy=feedback]').should('contain', 'Report a Problem')
cy.get('[data-cy=feedback]')
.should('have.attr', 'href')
.and('contain', '/how-to?sort=Newest')

cy.visit('/map')
cy.get('[data-cy=feedback]')
.should('have.attr', 'href')
.and('contain', '/map')
})

it('[Mobile]', () => {
cy.viewport('iphone-6')

cy.visit('/how-to')
cy.get('[data-cy=feedback]').should('contain', 'Problem?')
cy.get('[data-cy=feedback]')
.should('have.attr', 'href')
.and('contain', '/how-to?sort=Newest')

cy.visit('/map')
cy.get('[data-cy=feedback]')
.should('have.attr', 'href')
.and('contain', '/map')
})
})

describe('[User Menu]', () => {
it('[By Anonymous]', () => {
cy.step('Login and Join buttons are available')
Expand Down
11 changes: 10 additions & 1 deletion src/pages/common/StickyButton.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
import { useEffect, useState } from 'react'
import { useLocation } from 'react-router'
import { Button, ExternalLink } from 'oa-components'
import { Box, Text } from 'theme-ui'

const FORM_URL =
'https://onearmy.retool.com/form/c48a8f5a-4f53-4c58-adda-ef4f3cd8dee1'

export const StickyButton = () => {
const href = `${FORM_URL}#page=${window.location.href}`
const location = useLocation()
const [page, setPage] = useState<string>(window.location.href)

useEffect(() => {
setPage(window.location.href)
}, [location])

const href = `${FORM_URL}#page=${page}`

return (
<Box
Expand Down

0 comments on commit 3ee18a3

Please sign in to comment.