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

SMA-81: use sports from the api v1 sports all in the register page #72

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,17 @@ public class SecurityConfig {

@Value("${app.sportsmingle.frontend.url}")
private String frontendUrl;

private static final String[] WHITE_LIST_URL = {
"/api/v1/auth/**", "/h2-console/**", "/v3/api-docs", "/v3/api-docs/**", "/swagger-ui/**", "/swagger-ui.html", "/api/v1/places/search", "/api/v1/event/nearby"
"/api/v1/auth/**",
"/h2-console/**",
"/v3/api-docs",
"/v3/api-docs/**",
"/swagger-ui/**",
"/swagger-ui.html",
"/api/v1/places/search",
"/api/v1/event/nearby",
"/api/v1/sports/all"
};
private final JwtAuthFilter jwtAuthFilter;
private final AuthenticationProvider authenticationProvider;
Expand Down
93 changes: 21 additions & 72 deletions frontend/sportsmatch-app/src/components/SportsButtonComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useCallback, useEffect, useState } from 'react'
import '../styles/NewUserComponent.css'
import { useNavigate } from 'react-router-dom'
import { SportControllerService, SportDTO } from '../generated/api'

function SportsButtonComponent({
onSportSelectionChange,
Expand Down Expand Up @@ -40,82 +41,30 @@ function SportsButtonComponent({
navigate('/allsports', { state: { selectedButtonSports } })
}

const [sports, setSports] = useState<SportDTO[]>([])

useEffect(() => {
const fetchSports = async () => {
setSports((await SportControllerService.getSports(0, 5)) as SportDTO[])
}
fetchSports()
}, [])

return (
<div className="wrapper">
<p>Select your sports</p>
<div className="sports-container">
<label>
<input
type="checkbox"
className="sports-checkbox"
checked={selectedButtonSports.includes('Tennis')}
onChange={() => handleCheckboxChange('Tennis')}
/>
<span className="sports-button">🥎 Tennis</span>
</label>
<label>
<input
type="checkbox"
className="sports-checkbox"
checked={selectedButtonSports.includes('Gym')}
onChange={() => handleCheckboxChange('Gym')}
/>
<span className="sports-button">🏋 Gym</span>
</label>
<label>
<input
type="checkbox"
className="sports-checkbox"
checked={selectedButtonSports.includes('Golf')}
onChange={() => handleCheckboxChange('Golf')}
/>
<span className="sports-button">🏌🏽 Golf</span>
</label>
<label>
<input
type="checkbox"
className="sports-checkbox"
checked={selectedButtonSports.includes('Bowling')}
onChange={() => handleCheckboxChange('Bowling')}
/>
<span className="sports-button">🎳 Bowling</span>
</label>
<label>
<input
type="checkbox"
className="sports-checkbox"
checked={selectedButtonSports.includes('Running')}
onChange={() => handleCheckboxChange('Running')}
/>
<span className="sports-button">🏃 Running</span>
</label>
<label>
<input
type="checkbox"
className="sports-checkbox"
checked={selectedButtonSports.includes('Bicycle')}
onChange={() => handleCheckboxChange('Bicycle')}
/>
<span className="sports-button">🚴‍♀️ Bicycle</span>
</label>
<label>
<input
type="checkbox"
className="sports-checkbox"
checked={selectedButtonSports.includes('Boxing')}
onChange={() => handleCheckboxChange('Boxing')}
/>
<span className="sports-button">🥊 Boxing</span>
</label>
<label>
<input
type="checkbox"
className="sports-checkbox"
checked={selectedButtonSports.includes('Ping pong')}
onChange={() => handleCheckboxChange('Ping pong')}
/>
<span className="sports-button">🏓 Ping pong</span>
</label>
{sports.map((s, index) => (
<label key={index}>
<input
type="checkbox"
className="sports-checkbox"
checked={selectedButtonSports.includes(s.name!)}
onChange={() => handleCheckboxChange(s.name!)}
/>
<span className="sports-button">{s.emoji + ' ' + s.name}</span>
</label>
))}
<label>
<input
className="more-sports-button"
Expand Down
Loading