-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* search implemented * group fix * Delete app/backend/src/main/resources/application.properties --------- Co-authored-by: Ömer Talip Akalın <[email protected]>
- Loading branch information
1 parent
9662651
commit fda2052
Showing
7 changed files
with
204 additions
and
43 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,21 +1,25 @@ | ||
import React from 'react'; | ||
import React from 'react' | ||
|
||
const Group = ({ item }) => { | ||
return ( | ||
<div className="card compact bg-neutral-200 text-neutral-800 shadow-xl m-2"> | ||
<figure className="px-4 pt-4"> | ||
<img src={item.image} alt="Group" className="rounded-lg h-20 w-20 object-cover" /> | ||
</figure> | ||
<div className="card-body"> | ||
<h2 className="card-title text-neutral-700">{item.header}</h2> | ||
<p className="text-xs">{item.text}</p> | ||
<div className="flex justify-between items-center text-xs"> | ||
<span>Players: {item.players}</span> | ||
<button className="btn bg-[#b46161] border-[#b46161] text-neutral-100 hover:bg-[#8c4646] hover:border-[#8c4646] btn-sm">Join</button> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
return ( | ||
<div className='card compact bg-neutral-200 text-neutral-800 shadow-xl m-2'> | ||
<figure className='px-4 pt-4'> | ||
<img src={item.profilePicture} alt='Group' className='rounded-lg h-20 w-20 object-cover' /> | ||
</figure> | ||
<div className='card-body'> | ||
<h2 className='card-title text-neutral-700'>{item.title}</h2> | ||
<p className='text-xs'>{item.text}</p> | ||
<div className='flex justify-between items-center text-xs'> | ||
<span> | ||
Players: {item.totalMembers}/{item.memberCapacity} | ||
</span> | ||
<button className='btn bg-[#b46161] border-[#b46161] text-neutral-100 hover:bg-[#8c4646] hover:border-[#8c4646] btn-sm'> | ||
Join | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default Group; | ||
export default Group |
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,127 @@ | ||
import Game from '../HomePage/Game' | ||
import Group from '../HomePage/Group' | ||
import Post from '../HomePage/Post' | ||
import Navbarx from '../../components/navbar/Navbar' | ||
import React, { useEffect, useState } from 'react' | ||
import { useLocation } from 'react-router-dom' | ||
export default function Search() { | ||
const location = useLocation() | ||
const searchData = location.state && location.state.searchData | ||
console.log(searchData) | ||
const [gamesData, setGamesData] = useState([]) | ||
const [postData, setPostData] = useState([]) | ||
const [groupData, setGroupData] = useState([]) | ||
|
||
useEffect(() => { | ||
const fetchGames = async () => { | ||
try { | ||
setGamesData(searchData.gameResults) | ||
} catch (error) { | ||
console.log(error) | ||
} | ||
} | ||
const fetchPosts = async () => { | ||
try { | ||
setPostData(searchData.postResults) | ||
} catch (error) { | ||
console.log(error) | ||
} | ||
} | ||
const fetchGroup = async () => { | ||
try { | ||
setGroupData(searchData.lfgResults) | ||
} catch (error) { | ||
console.log(error) | ||
} | ||
} | ||
|
||
fetchPosts() | ||
fetchGames() | ||
fetchGroup() | ||
}, [searchData]) | ||
|
||
// const postData = [ | ||
// { | ||
// image: `https://primefaces.org/cdn/primereact/images/product/game-controller.jpg}`, | ||
// header: 'Resident Evil 4 Remake', | ||
// content: | ||
// "Looking for someone to join me in my Resident Evil 4 adventure! Let's team up and face the horrors together.️ #ResidentEvil4 #GamingBuddyWanted", | ||
// date: '29.10.2023 00.00' | ||
// }, | ||
// { | ||
// image: 'https://primefaces.org/cdn/primereact/images/product/game-controller.jpg', | ||
// header: 'Fifa', | ||
// content: | ||
// 'FIFA is one of the most popular football simulation games developed by EA Sports. It offers an immersive gaming experience with realistic graphics, player mechanics, and stadiums.', | ||
// date: '29.10.2023 00.00' | ||
// }, | ||
// { | ||
// image: `https://primefaces.org/cdn/primereact/images/product/game-controller.jpg}`, | ||
// header: 'The Witcher 3: Wild Hunt', | ||
// content: | ||
// "The Witcher 3 is an unforgettable gaming experience. Its open world, rich storytelling, and captivating characters make it a must-play RPG. If you love epic adventures, this one's a masterpiece.", | ||
// date: '29.10.2023 00.00' | ||
// } | ||
// ] | ||
|
||
console.log(postData) | ||
|
||
return ( | ||
<> | ||
<Navbarx></Navbarx> | ||
<div className='flex flex-row grow bg-neutral-100 justify-center items-center'> | ||
{/* Make elements flex, these will be in a row */} | ||
{/* <div className='w-1/5 flex flex-col gap-4'> */} | ||
{/* Take 1/5 width of the screen, flex elements in a column, add gap between elements */} | ||
{/* </div> */} | ||
<div className='flex flex-col gap-4 ml-12 mr-12'> | ||
{/* Take 4/5 width of the screen, flex elements in a column, add gap between elements */} | ||
|
||
<div className='flex flex-row mx-4'> | ||
{/* Flex elements in a row, add margin on the left and right */} | ||
<div className='flex flex-col w-1/3 ml-12 mr-12 pb-8'> | ||
<div className='flex w-full items-center justify-center mt-4'> | ||
<h1> | ||
<b>Games</b> | ||
</h1> | ||
</div> | ||
{/* Take 1/2 width of the screen, flex elements in a column, add margin on the left and right */} | ||
<div> | ||
{gamesData | ||
.filter((game) => game.status === 'APPROVED') | ||
.map((game) => ( | ||
<Game key={game.gameId} game={game} /> | ||
))} | ||
</div> | ||
</div> | ||
<div className='flex flex-col w-1/3 ml-12 mr-12 pb-8'> | ||
<div className='flex w-full items-center justify-center mt-4'> | ||
<h1> | ||
<b>Groups</b> | ||
</h1> | ||
</div> | ||
{/* Take 1/2 width of the screen, flex elements in a column, add margin on the left and right */} | ||
{groupData.map((item, key) => ( | ||
<Group item={item} key={key} /> | ||
))} | ||
</div> | ||
|
||
<div className='flex flex-col w-1/3 ml-12 mr-12 pb-8'> | ||
<div className='flex w-full items-center justify-center mt-4'> | ||
<h1> | ||
<b>Posts</b> | ||
</h1> | ||
</div> | ||
{postData.map((post) => ( | ||
<Post key={post.postId} post={post} /> | ||
))} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div className='bg-black text-white text-center p-8'> | ||
<p className='text-m'>@2023 Game Lounge, All rights reserved.</p> | ||
</div> | ||
</> | ||
) | ||
} |
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 @@ | ||
export { default as Search } from './Search' |
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,14 @@ | ||
import axios from 'axios' | ||
|
||
const axiosInstance = axios.create({ | ||
baseURL: process.env.REACT_APP_API_URL | ||
}) | ||
|
||
axiosInstance.defaults.withCredentials = true | ||
|
||
export const getAllSearch = (search) => { | ||
const url = `/search/all?query=${search}` | ||
return axiosInstance.get(url, { | ||
withCredentials: true | ||
}) | ||
} |