Skip to content

Commit

Permalink
SMA-82 unify font sizes (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
markpernia authored Apr 16, 2024
1 parent 0fc029e commit 3372bc2
Show file tree
Hide file tree
Showing 22 changed files with 114 additions and 129 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ public List<Event> addEvents(List<Sport> sports, List<Place> places) {
places.get(4)));
eventRepository.save(
new Event(
LocalDateTime.of(2024, 6, 15, 10, 0),
LocalDateTime.of(2024, 6, 15, 12, 0),
LocalDateTime.of(2023, 6, 15, 10, 0),
LocalDateTime.of(2023, 6, 15, 12, 0),
"Prague Stvanice",
1000,
1800,
Expand All @@ -244,8 +244,8 @@ public List<Event> addEvents(List<Sport> sports, List<Place> places) {
places.get(4)));
eventRepository.save(
new Event(
LocalDateTime.of(2024, 6, 15, 10, 0),
LocalDateTime.of(2024, 6, 15, 12, 0),
LocalDateTime.of(2023, 6, 15, 10, 0),
LocalDateTime.of(2023, 6, 15, 12, 0),
"Prague Stvanice",
1000,
1800,
Expand All @@ -254,8 +254,8 @@ public List<Event> addEvents(List<Sport> sports, List<Place> places) {
places.get(4)));
eventRepository.save(
new Event(
LocalDateTime.of(2024, 6, 15, 10, 0),
LocalDateTime.of(2024, 6, 15, 12, 0),
LocalDateTime.of(2023, 6, 15, 10, 0),
LocalDateTime.of(2023, 6, 15, 12, 0),
"Prague Stvanice",
1000,
1800,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.sportsmatch.dtos;

import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.*;
Expand All @@ -16,8 +17,10 @@ public class EventDTO {
private Long id;

@NotNull
@JsonFormat(pattern = "dd.MM.yyyy HH:mm")
private LocalDateTime dateStart;
@NotNull
@JsonFormat(pattern = "dd.MM.yyyy HH:mm")
private LocalDateTime dateEnd;
@NotNull
private Integer minElo;
Expand Down
11 changes: 7 additions & 4 deletions frontend/sportsmatch-app/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@
--sm-btn-size-regular: 3.125em;
--sm-btn-size-small: 1.875em;

--sm-h1-size: 3em;
--sm-h2-size: 1em;
--sm-text-size: 1em;
/* font-sizes */
--sm-h1-heading: 3em;
--sm-text-content: 1em;
--sm-text-medium-content: 1.2em;
}

svg {
color: var(--sm-white);
}

body, html, #root {
body,
html,
#root {
height: 100%;
margin: 0;
padding: 0;
Expand Down
60 changes: 30 additions & 30 deletions frontend/sportsmatch-app/src/components/JoinEventComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ export default function JoinEventComponent(p: JoinEventProps) {
}
}

const date = new Date(
parseInt(p.event.dateStart[0]),
parseInt(p.event.dateStart[1]),
parseInt(p.event.dateStart[2]),
)

const eventTime = () => {
const hour = p.event.dateStart[3]
const min = p.event.dateStart[4] == '0' ? '00' : p.event.dateStart[4]
return hour + ':' + min
const getDateAndTime = (type: string) => {
const dateStart: string[] = p.event.dateStart.split(' ')
if (type === 'date') {
return dateStart[0]
} else if (type === 'time') {
return dateStart[1]
} else {
return null
}
}

return (
<>
{p.isInRank ? (
Expand All @@ -51,32 +51,32 @@ export default function JoinEventComponent(p: JoinEventProps) {
{' at ' +
p.event.placeDTO?.name +
' on ' +
date.toLocaleDateString('en', { month: 'long' }) +
' ' +
date.getDay() +
', ' +
date.getFullYear() +
getDateAndTime('date') +
', at ' +
eventTime() +
getDateAndTime('time') +
'?'}
</p>
</div>
</div>
<div className="row">
<div className="col-12">
<button
className="join-event-btn-orange"
onClick={handleJoinEvent}
>
Join
</button>
</div>
</div>
<div className="row">
<div className="col-12">
<button className="join-event-btn-grey" onClick={p.toggle}>
Cancel
</button>
<div className="col">
<div className="row">
<div className="col-12">
<button
className="join-event-btn-orange"
onClick={handleJoinEvent}
>
Join
</button>
</div>
</div>
<div className="row">
<div className="col-12">
<button className="join-event-btn-grey" onClick={p.toggle}>
Cancel
</button>
</div>
</div>
</div>
</div>
</div>
Expand Down
32 changes: 2 additions & 30 deletions frontend/sportsmatch-app/src/components/Match.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,6 @@ function InProgress({ event }: InProgressProps) {
fetchUserInfo()
}, [])

const eventDate = new Date(
parseInt(event.dateStart[0]),
parseInt(event.dateStart[1]),
parseInt(event.dateStart[2]),
)

const eventStartTime = () => {
const hour = event.dateStart[3]
const min = event.dateStart[4] === '0' ? '00' : event.dateStart[4]
return hour + ':' + (min.length === 1 ? min + '0' : min)
}
const eventEndTime = () => {
const hour = event.dateEnd[3]
const min = event.dateEnd[4] === '0' ? '00' : event.dateEnd[4]
return hour + ':' + (min.length === 1 ? min + '0' : min)
}
return (
<>
<div className="container-fluid">
Expand Down Expand Up @@ -86,23 +70,11 @@ function InProgress({ event }: InProgressProps) {
</li>
<li>
<LuCalendarCheck />
{eventDate.getDay() +
'.' +
eventDate.getMonth() +
'.' +
eventDate.getFullYear() +
', ' +
eventStartTime()}
{event.dateStart}
</li>
<li>
<LuCalendarX />
{eventDate.getDay() +
'.' +
eventDate.getMonth() +
'.' +
eventDate.getFullYear() +
', ' +
eventEndTime()}
{event.dateEnd}
</li>
</ul>
</div>
Expand Down
4 changes: 2 additions & 2 deletions frontend/sportsmatch-app/src/components/SportEvent.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ describe('SportEvent', async () => {
id: 1,
maxElo: 2000,
minElo: 1800,
dateEnd: '2024-01-27',
dateStart: '2024-01-26',
dateEnd: '27.01.2024 17:00',
dateStart: '26.01.2024 15:00',
placeDTO: {
name: 'Test Location',
address: 'address',
Expand Down
15 changes: 0 additions & 15 deletions frontend/sportsmatch-app/src/components/SportEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,6 @@ import { EventDTO } from '../generated/api'
import '../styles/SportEvent.css'
import { LuMapPin, LuMedal, LuCalendarCheck, LuCalendarX } from 'react-icons/lu'

// interface SportEventProps {
// event: {
// id: number
// maxElo: number
// minElo: number
// dateEnd: string
// dateStart: string
// location: string
// title: string
// sport: string
// playerOne: string
// playerTwo?: string
// }
// }

function SportEvent({ event }: { event: EventDTO }) {
return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function SportsButtonComponent({

const navigate = useNavigate()
const handleMoreSportsButton = () => {
navigate('/allsports', { state: { selectedButtonSports } })
navigate('/all-sports', { state: { selectedButtonSports } })
}

const [sports, setSports] = useState<SportDTO[]>([])
Expand Down
2 changes: 1 addition & 1 deletion frontend/sportsmatch-app/src/pages/AllSportsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function AllSportsList() {
]

// this url should be dynamic
const url = '/index'
const url = '/'
const location = useLocation()
const selectedButtonSports = location.state.selectedButtonSports

Expand Down
2 changes: 1 addition & 1 deletion frontend/sportsmatch-app/src/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function Home() {
<div className="history-wrapper">
<div className="row">
<div className="col">
{upcomingMatch.length === 0 ? (
{eventsHistory.length === 0 ? (
<p>No match history</p>
) : (
eventsHistory.map((e, index) => (
Expand Down
10 changes: 5 additions & 5 deletions frontend/sportsmatch-app/src/pages/Index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export default function MainPage() {
const [page, setPage] = useState<number>(0)
const size = 5

console.log(`query`, searchQuery)

// handle sports name selected from sportButtoncomponent
const handleSportSelectionChange = (selectedButtonSports: string[]) => {
setSelectedSports(selectedButtonSports)
Expand All @@ -49,6 +51,9 @@ export default function MainPage() {
navigate(location.pathname, { state: undefined })
setSelectedSports([])
setClearFilters(true)
setTimeout(() => {
setClearFilters(false)
}, 100)
}

useEffect(() => {
Expand All @@ -66,7 +71,6 @@ export default function MainPage() {
}
const data: EventDTO[] = response as EventDTO[]
// set filtered events based on api response
console.log(data)
if (page === 0) {
setFilteredEvent(data as EventDTO[])
} else {
Expand Down Expand Up @@ -99,10 +103,6 @@ export default function MainPage() {
toggle()
}

console.log(`all sport selected:`, location.state)
console.log(`sport button selected:`, selectedSports)
console.log(`query`, searchQuery)

// retrieving users rank
useEffect(() => {
const fetchUsersRank = async () => {
Expand Down
8 changes: 4 additions & 4 deletions frontend/sportsmatch-app/src/styles/EventHistoryItem.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
display: grid;
color: var(--sm-secondary-orange);
font-weight: bold;
font-size: 16px;
font-size: var(--sm-text-content);
text-align: center;
grid-column: 2;
padding: 9px 9px 0 9px;
Expand All @@ -21,7 +21,7 @@
grid-template-columns: 8fr 0.5fr 8fr;
width: 100%;
min-height: 106px;
font-size: 10px;
font-size: var(--sm-text-content);
background-color: var(--sm-primary-bg);
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.05);
border: 2px solid var(--sm-secondary-orange);
Expand Down Expand Up @@ -52,7 +52,7 @@
height: 35px;
color: var(--sm-secondary-orange);
font-weight: bold;
font-size: 16px;
font-size: var(--sm-text-content);
grid-row: 1;
display: grid;
}
Expand Down Expand Up @@ -100,7 +100,7 @@
.match-status {
color: var(--sm-secondary-orange);
font-weight: bold;
font-size: 12px;;
font-size: var(--sm-text-content);
position: relative;
padding: 4px 4px 8px 8px;
letter-spacing: 10%;
Expand Down
2 changes: 1 addition & 1 deletion frontend/sportsmatch-app/src/styles/Index.css
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
border-radius: 40px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
cursor: pointer;
font-size: 18px;
font-size: var(--sm-text-medium-content);
color: #fff;
font-weight: 400;
margin: 20px 0;
Expand Down
2 changes: 1 addition & 1 deletion frontend/sportsmatch-app/src/styles/JoinEvent.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
.join-event-message {
padding: 0;
margin-right: 0;
font-size: var(--sm-text-size);
font-size: var(--sm-text-content);
}
Loading

0 comments on commit 3372bc2

Please sign in to comment.