-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix-landingpage
- Loading branch information
Showing
17 changed files
with
748 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Cypress Tests | ||
|
||
on: push | ||
|
||
jobs: | ||
cypress-run: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Check envs | ||
run: echo "url env is $NEXT_PUBLIC_SUPABASE_URL" | ||
# Install NPM dependencies, cache them correctly | ||
# and run all Cypress tests | ||
- name: Cypress run | ||
uses: cypress-io/github-action@v5 | ||
with: | ||
build: npm run build | ||
start: npm start | ||
env: | ||
NEXT_PUBLIC_GOOGLE_MAPS_API_KEY: ${{ secrets.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY}} | ||
NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY}} | ||
NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL}} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
describe('A landlord should be able to submit a property, with feedback', () => { | ||
it('should attempt to submit an empty form and not be able to submit', () => { | ||
cy.visit('/add-listing') | ||
cy.get('[data-testid="flowbite-card"] button[type="submit"]').click() | ||
cy.url().should('include', '/add-listing') | ||
}) | ||
// it('should submit a valid form and be able to submit', () => { | ||
// cy.visit('/add-listing') | ||
// // checkbox | ||
// cy.get('input[type="checkbox"]').check() | ||
// // // radio | ||
// // cy.get('input[type="radio"]').check() | ||
|
||
// // // select | ||
// // cy.get('input[type="select"]').select(0) | ||
|
||
// // text | ||
// cy.get('input[type="text"]').each(($el) => {cy.wrap($el).type('test')}) | ||
// // number | ||
// cy.get('input[type="number"]').each(($el) => {cy.wrap($el).type('2')}) | ||
|
||
// // files | ||
// // cy.get('#floor_plans[type="file"]').selectFile(['cypress/images/jpgTest.jpg', 'cypress/images/pdfTest.pdf']) | ||
// // cy.get('#property_video[type="file"]').selectFile('cypress/images/movTest.mov') | ||
// // cy.get('#property_images[type="file"]').selectFile('cypress/images/pngTest.png') | ||
// // cy.get('#epcCertificate[type="file"]').selectFile('cypress/images/pdfTest.pdf') | ||
|
||
// // submit | ||
// cy.get('[data-testid="flowbite-card"] button[type="submit"]').click() | ||
|
||
// // if successful it will redirect | ||
// cy.url().should('include', '/listings') | ||
// }) | ||
// // it('should display an error message or indicate that something went wrong', () => { | ||
// // button should say try again rather than advertise listings | ||
// // }) | ||
}) | ||
|
||
// describe('Only a landlord should be able to land on the add-listings page', () => { | ||
|
||
// }) | ||
|
||
// describe('Should throw an error if a landlord tries to submit a property where either required fields are missing, or supabase couldnt connect', () => { | ||
|
||
// }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,16 +4,32 @@ import Link from 'next/link' | |
import { Dropdown, Navbar, Avatar } from 'flowbite-react' | ||
import { RxHamburgerMenu } from 'react-icons/rx' | ||
import HamburgerSidebar from './HamburgerSidebar' | ||
import { useState } from 'react' | ||
import { useEffect, useState } from 'react' | ||
import { useRouter } from 'next/navigation' | ||
import { createClientComponentClient } from '@supabase/auth-helpers-nextjs' | ||
import { | ||
Session, | ||
createClientComponentClient, | ||
} from '@supabase/auth-helpers-nextjs' | ||
import { Database } from '../../types/supabase' | ||
|
||
const Header = () => { | ||
const [showSidebar, setShowSidebar] = useState(false) | ||
const [session, setSession] = useState<Session | null>(null) | ||
const router = useRouter() | ||
const supabase = createClientComponentClient<Database>() | ||
|
||
useEffect(() => { | ||
// check whether user is logged in | ||
const getSession = async () => { | ||
const { | ||
data: { session }, | ||
} = await supabase.auth.getSession() | ||
console.log(session) | ||
if (session) return setSession(session) | ||
} | ||
getSession() | ||
}, []) | ||
|
||
const handleLogout = async () => { | ||
await supabase.auth.signOut() | ||
router.refresh() | ||
|
@@ -30,11 +46,11 @@ const Header = () => { | |
<Navbar.Brand href="/" className="flex gap-3 items-center"> | ||
{ | ||
<Image | ||
width="30" | ||
height="30" | ||
src="/rs-logo.svg" | ||
width={30} | ||
height={30} | ||
alt="Rent-shield logo" | ||
className="h-6 sm:h-9" | ||
src="/rs-logo.svg" | ||
/> | ||
} | ||
<span className="hidden whitespace-nowrap text-xl font-semibold dark:text-white md:block"> | ||
|
@@ -54,16 +70,39 @@ const Header = () => { | |
/> | ||
} | ||
> | ||
<Dropdown.Header> | ||
<span className="block text-lg">Gertrude Pickle</span> | ||
<span className="block truncate text-md font-medium"> | ||
[email protected] | ||
</span> | ||
</Dropdown.Header> | ||
<Dropdown.Item>Settings</Dropdown.Item> | ||
<Dropdown.Divider /> | ||
<Dropdown.Item>Sign out</Dropdown.Item> | ||
<Dropdown.Divider /> | ||
{session ? ( | ||
<> | ||
<Dropdown.Header> | ||
{/* <span className="block text-lg">Gertrude Pickle</span> */} | ||
<span className="block truncate text-lg font-medium"> | ||
{session.user.email} | ||
</span> | ||
</Dropdown.Header> | ||
<Dropdown.Item>Settings</Dropdown.Item> | ||
{session.user.user_metadata.role_id === 2 ? ( | ||
<> | ||
<Dropdown.Divider /> | ||
<Link href="/add-listing"> | ||
<Dropdown.Item>Add Listing</Dropdown.Item> | ||
</Link> | ||
</> | ||
) : ( | ||
'' | ||
)} | ||
|
||
<Dropdown.Divider /> | ||
<Dropdown.Item>Sign out</Dropdown.Item> | ||
</> | ||
) : ( | ||
<> | ||
<Link href="/log-in"> | ||
<Dropdown.Item>Log In</Dropdown.Item> | ||
</Link> | ||
<Link href="/sign-up"> | ||
<Dropdown.Item>Sign Up</Dropdown.Item> | ||
</Link> | ||
</> | ||
)} | ||
</Dropdown> | ||
</div> | ||
</Navbar> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.