Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

feat: revamp homepage (#1264) #1341

Merged
merged 6 commits into from
Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 4 additions & 1 deletion cypress/integration/common/actions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given } from 'cypress-cucumber-preprocessor/steps'
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps'

Given('I open {string} page', (uri) => {
const baseUrl = 'http://localhost:3000'
Expand All @@ -7,6 +7,9 @@ Given('I open {string} page', (uri) => {
case 'home':
path = '/'
break
case 'search':
path = '/search'
break
case 'eddiejaoude':
path = '/eddiejaoude'
break
Expand Down
11 changes: 8 additions & 3 deletions cypress/integration/search.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,25 @@ Feature: Search

Saerch all users

Scenario: Search on the homepage
Scenario: Navigate to the search page
Given I open "home" page
When I click on "search"
Then I see ".search-section" item on the page

Scenario: Search page has a search box
Given I open "search" page
And I see ".search-section" item on the page

Scenario: Search with results
Given I open "home" page
Given I open "search" page
Then I see "Eddie Jaoude" text in section "main"
And I see "Kunal Verma" text in section "main"
When I type "Eddie Jaoude" in ".search-section input"
Then I see "Eddie Jaoude" text in section "main"
And I do not see "Kunal Verma" text in section "main"

Scenario: Search with no results
Given I open "home" page
Given I open "search" page
Then I see "Eddie Jaoude" text in section "main"
When I type "abced" in ".search-section input"
Then I see "No users found, please try with another name." text in section "main"
Expand Down
6 changes: 6 additions & 0 deletions ideas.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Homepage

- [ ] show stats on homepage https://www.primefaces.org/primeblocks-react/#/free
- [ ] pick random users to display
- [ ] display demo as animated gif
- [ ] show instructions and animated gif
Binary file added public/mockup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import 'primeicons/primeicons.css'

import Footer from './Components/Footer'
import User from './Components/UserProfile/User'
import Home from './Components/Home/Home'
import Home from './Components/Home'
import Search from './Components/Search/Search'

import user from './config/user.json'

Expand All @@ -19,6 +20,9 @@ function App() {
{user.username && <User singleUser={user} />}
{!user.username && (
<Switch>
<Route path="/search">
<Search />
</Route>
<Route path="/:username">
<User />
</Route>
Expand Down
40 changes: 40 additions & 0 deletions src/Components/Home.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import React from 'react'
import { Link } from 'react-router-dom'

import Navbar from './Navbar'
import GetIcons from './Icons/GetIcons'

function Home() {
return (
<>
eddiejaoude marked this conversation as resolved.
Show resolved Hide resolved
<Navbar
start={
<Link to="/search" aria-label="Search">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the search icon is a link it turns blue once visited. Is that something we want?

__
sema-logo  Summary: ❓ I have a question  |  Tags: Inefficient

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept this the same as it was before (similar to the back button on the profile page)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be improved 👍 , but I think these changes can come in another PR

<GetIcons iconName="search" size={20} />
</Link>
}
/>
<h2 className="text-4xl text-center">
eddiejaoude marked this conversation as resolved.
Show resolved Hide resolved
LinkFree connects audiences to all of your content with just one link
schmelto marked this conversation as resolved.
Show resolved Hide resolved
</h2>
<p className="text-2xl text-center">
It is an open-source alternative to Linktree implemented in JavaScript
</p>
<p className="text-1xl text-center">
Example profile of <Link to="/eddiejaoude">Eddie Jaoude</Link>. Want to
add your profile, read the{' '}
<a href="https://github.com/EddieHubCommunity/LinkFree#-to-add-your-profile">
instructions
</a>
.
</p>
eddiejaoude marked this conversation as resolved.
Show resolved Hide resolved
<img
className="max-w-screen"
src="/mockup.png"
alt="Exapmle of the LinkFree app on Apple devices"
/>
</>
)
}

export default Home
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import './Home.css'
import './Search.css'

import React, { useState, useEffect, useRef } from 'react'
import { Toast } from 'primereact/toast'

import Placeholders from './Placeholders'
import Users from './Users'

function Home() {
function Search() {
const [list, setList] = useState([])
const [skeleton, setskeleton] = useState(true)
const toast = useRef(null)
Expand All @@ -21,7 +21,7 @@ function Home() {
)
.then((data) => setList(data))
.catch((error) => {
console.log('Home useEffect', error)
console.log('Search useEffect', error)
toast.current.show({
severity: 'error',
summary: 'Error Message',
Expand All @@ -44,4 +44,4 @@ function Home() {
)
}

export default Home
export default Search
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import PropTypes from 'prop-types'
import { InputText } from 'primereact/inputtext'
import GetIcons from '../Icons/GetIcons'
import './Home.css'
import './Search.css'

const Searchbar = ({ searchHandler, searchTerm }) => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Message } from 'primereact/message'
import Navbar from '../Navbar'
import Searchbar from './Searchbar'
import ProfileTypeFilter from './filterProfileType'
import GetIcons from '../Icons/GetIcons'

function Users({ list }) {
const [profileType, setProfileType] = useState('all')
Expand Down Expand Up @@ -58,10 +59,13 @@ function Users({ list }) {
<>
<Navbar
start={
<Searchbar searchTerm={searchTerm} searchHandler={searchHandler} />
<Link to="/" aria-label="Go back to Home">
<GetIcons iconName="arrowLeft" size={20} />
</Link>
}
/>
<div className="mb-2 flex justify-content-center align-items-center">
<Searchbar searchTerm={searchTerm} searchHandler={searchHandler} />
<label className="p-2">Profile Type</label>
<ProfileTypeFilter
profileType={profileType}
Expand Down