@@ -26,6 +26,18 @@ export default function RegistrationDetails() {
26
26
27
27
const { item, registered } = route . params as RegistrationDetailsProps
28
28
29
+ // Mapeamento de categorias
30
+ const categoryMap : { [ key : number ] : string } = {
31
+ 1 : 'Minicurso' ,
32
+ 2 : 'Palestra' ,
33
+ 3 : 'Workshop' ,
34
+ 4 : 'Competição' ,
35
+ 5 : 'SECOMP'
36
+ } ;
37
+
38
+ // Acesse item.categoriaId e garanta que é um número
39
+ const categoriaId = Number ( item . categoriaId ) ;
40
+
29
41
useEffect ( ( ) => {
30
42
async function Subscription ( ) {
31
43
try {
@@ -49,9 +61,9 @@ export default function RegistrationDetails() {
49
61
50
62
async function requestSubscription ( ) {
51
63
try {
52
- const response = await subscribeToActivity ( user . id , item . id ) ;
64
+ const response = await subscribeToActivity ( user . id , item . id ) ;
53
65
const { listaEspera } = response . data ;
54
-
66
+
55
67
if ( listaEspera === true ) {
56
68
if ( Platform . OS === 'web' ) {
57
69
alert ( "Limite de vagas atingido: Você entrou na lista de espera." ) ;
@@ -65,18 +77,18 @@ export default function RegistrationDetails() {
65
77
Alert . alert ( 'Inscrição realizada' , 'Sua inscrição foi realizada com sucesso.' ) ;
66
78
}
67
79
}
68
-
69
- navigation . goBack ( ) ;
80
+
81
+ navigation . goBack ( ) ;
70
82
} catch ( error ) {
71
- console . error ( 'Erro ao tentar se inscrever:' , error ) ;
83
+ console . error ( 'Erro ao tentar se inscrever:' , error ) ;
72
84
if ( Platform . OS === 'web' ) {
73
85
alert ( "Erro: Não foi possível realizar a inscrição. Tente novamente mais tarde." ) ;
74
86
} else {
75
87
Alert . alert ( 'Erro' , 'Não foi possível realizar a inscrição. Tente novamente mais tarde.' ) ;
76
88
}
77
89
}
78
90
}
79
-
91
+
80
92
function requestUnSubscription ( ) {
81
93
if ( Platform . OS === 'web' ) {
82
94
const confirmUnsubscribe = window . confirm ( "Você realmente deseja cancelar sua inscrição nesta atividade?" ) ;
@@ -113,16 +125,16 @@ export default function RegistrationDetails() {
113
125
}
114
126
115
127
return (
116
- < View className = 'bg-white flex-1' >
117
- < View className = { ` flex-row justify-center items-center mt-12 'pb-8'}` } >
128
+ < View className = 'bg-white flex-1 px-8 ' >
129
+ < View className = ' flex-row justify-center items-center mt-12' >
118
130
< TouchableOpacity className = 'py-2 px-3' style = { { position : 'absolute' , left : 0 , top : 0 } } onPress = { ( ) => navigation . goBack ( ) } >
119
131
< FontAwesome6 name = "chevron-left" size = { 14 } color = "#000000" />
120
132
</ TouchableOpacity >
121
133
122
- < Text style = { { fontFamily : 'Inter_600SemiBold' } } className = 'text-xl text-black pt-0.5' > Eventos </ Text >
134
+ < Text style = { { fontFamily : 'Inter_600SemiBold' } } className = 'text-xl text-black pt-0.5' > { categoryMap [ categoriaId ] || 'Evento' } </ Text >
123
135
</ View >
124
136
125
- < View className = "p-8 mt-16 mb-16" >
137
+ < View className = "p-3 mt-6 mb-16" >
126
138
< View className = 'flex flex-col justify-start p-2 bg-white rounded-2xl' style = { ( isIos ) ? [ styles . shadowProp ] : [ styles . elevation ] } >
127
139
< View className = "p-4" >
128
140
< View className = 'pb-4 items-center' >
@@ -155,7 +167,7 @@ export default function RegistrationDetails() {
155
167
< View className = 'flex-row items-center pb-1' >
156
168
< AntDesign name = "enviromento" size = { 24 } color = "#445BE6" />
157
169
< Text className = 'pl-2' > { item . vagas } </ Text >
158
- </ View >
170
+ </ View >
159
171
</ View >
160
172
</ View >
161
173
< View className = "pt-10" > </ View >
0 commit comments