1- import { Button , Heading , HStack , Stack , Text , useToast , VStack } from '@chakra-ui/react'
1+ import { Alert , AlertIcon , AlertTitle , Button , Heading , HStack , Stack , Text , useToast , VStack } from '@chakra-ui/react'
22import { EventState , RatingRole , ratingRoleArray } from '@pontozo/common'
33import { useEffect , useState } from 'react'
44import { FaArrowLeft , FaDatabase , FaMedal } from 'react-icons/fa'
@@ -7,7 +7,6 @@ import { useRatingContext } from 'src/api/contexts/useRatingContext'
77import { useStartRatingMutation } from 'src/api/hooks/ratingHooks'
88import { EventRatingStateBadge } from 'src/components/commons/EventRatingStateBadge'
99import { HelmetTitle } from 'src/components/commons/HelmetTitle'
10- import { LoginNavigate } from 'src/components/commons/LoginNavigate'
1110import { NavigateWithError } from 'src/components/commons/NavigateWithError'
1211import { formatDateRange , getRatingEndDate , getRatingResultPublishedDate } from 'src/util/dateHelpers'
1312import { onError } from 'src/util/onError'
@@ -61,10 +60,6 @@ export const EventDetailsPage = () => {
6160 }
6261 }
6362
64- if ( ! isLoggedIn ) {
65- return < LoginNavigate />
66- }
67-
6863 if ( dbQuery . isLoading ) {
6964 return < LoadingSpinner />
7065 }
@@ -113,6 +108,12 @@ export const EventDetailsPage = () => {
113108 MTFSZ Adatbank
114109 </ Button >
115110 </ HStack >
111+ { ! isLoggedIn && (
112+ < Alert status = "warning" >
113+ < AlertIcon />
114+ < AlertTitle > A verseny értékeléséhez először jelentkezz be!</ AlertTitle >
115+ </ Alert >
116+ ) }
116117 < Heading size = "md" mt = { 3 } >
117118 Szerepkör
118119 </ Heading >
@@ -126,7 +127,7 @@ export const EventDetailsPage = () => {
126127 role = { r }
127128 onSelected = { ( ) => setRole ( r ) }
128129 selected = { role === r }
129- disabled = { ! ! userRating || event . state !== EventState . RATEABLE }
130+ disabled = { ! ! userRating || event . state !== EventState . RATEABLE || ! isLoggedIn }
130131 />
131132 ) ) }
132133 < Heading size = "md" mt = { 3 } >
@@ -142,7 +143,7 @@ export const EventDetailsPage = () => {
142143 < StageListItem
143144 stage = { s }
144145 key = { s . id }
145- disabled = { ! ! userRating || event . state !== EventState . RATEABLE }
146+ disabled = { ! ! userRating || event . state !== EventState . RATEABLE || ! isLoggedIn }
146147 onChecked = { ( c ) => onItemChecked ( c , s . id ) }
147148 checked = { stageIds . includes ( s . id ) }
148149 />
@@ -155,7 +156,7 @@ export const EventDetailsPage = () => {
155156 isLoading = { startRating . isLoading || dbQuery . isLoading }
156157 eventWithRating = { dbQuery . data }
157158 onStartClick = { onStartClick }
158- startDisabled = { ! role || ! stageIds . length }
159+ startDisabled = { ! role || ! stageIds . length || ! isLoggedIn }
159160 continueDisabled = { event . state !== EventState . RATEABLE }
160161 />
161162 </ HStack >
0 commit comments