@@ -12,6 +12,8 @@ interface CalendarItemProps {
1212 event : Event & { originalType ?: string } ;
1313 attendeeCount ?: number ;
1414 inPersonalSchedule ?: boolean ;
15+ hideAddButton ?: boolean ;
16+ disableAddButton ?: boolean ;
1517 onAddToSchedule ?: ( ) => void ;
1618 onRemoveFromSchedule ?: ( ) => void ;
1719 isRecommended ?: boolean ;
@@ -27,6 +29,8 @@ export function CalendarItem({
2729 event,
2830 attendeeCount,
2931 inPersonalSchedule = false ,
32+ hideAddButton = false ,
33+ disableAddButton = false ,
3034 tags,
3135 host,
3236 onAddToSchedule,
@@ -40,6 +44,9 @@ export function CalendarItem({
4044 ? normalizedType
4145 : 'GENERAL' ;
4246 const eventStyle = SCHEDULE_EVENT_STYLES [ displayType ] ;
47+ const actionIconPath = inPersonalSchedule
48+ ? '/icons/check.svg'
49+ : '/icons/plus.svg' ;
4350
4451 // Handle different time display scenarios
4552 const timeDisplay = formatScheduleTimeRange (
@@ -49,27 +56,14 @@ export function CalendarItem({
4956
5057 return (
5158 < div
52- className = { `w-full py-[24px] flex-shrink-0 rounded-[16px] px-[20px] 2xs:px-[38px] 2xs:py-[24px] lg:px-[40px] lg:py-[32px] mb-[8px] flex ${
53- displayType === 'ACTIVITIES' ? 'flex-row' : 'flex-col justify-center'
54- } `}
59+ className = "w-full py-[24px] flex-shrink-0 rounded-[16px] px-[20px] 2xs:px-[38px] 2xs:py-[24px] lg:px-[40px] lg:py-[32px] mb-[8px] flex flex-col justify-center"
5560 style = { {
5661 backgroundColor : eventStyle . bgColor ,
5762 color : eventStyle . textColor ,
5863 } }
5964 >
60- < div
61- className = { `flex items-start justify-between sm:items-center gap-[40px] md:gap-[60px] relative ${
62- displayType === 'ACTIVITIES'
63- ? 'w-full flex-col sm:flex-row'
64- : 'flex-col'
65- } `}
66- >
67- < div
68- className = { `flex flex-col sm:flex-row justify-between items-start gap-4 sm:gap-6 ${
69- // top
70- displayType !== 'ACTIVITIES' ? 'w-full' : ''
71- } `}
72- >
65+ < div className = "flex items-start justify-between sm:items-center gap-[40px] relative flex-col" >
66+ < div className = "flex flex-col sm:flex-row justify-between items-start gap-4 sm:gap-6 w-full" >
7367 < div className = "w-full sm:w-auto" >
7468 < h2 className = "font-metropolis text-[18px] md:text-[20px] font-semibold tracking-[0.72px] mb-1 text-balance" >
7569 { name }
@@ -123,13 +117,8 @@ export function CalendarItem({
123117 ) }
124118 </ div >
125119 { displayType !== 'GENERAL' && displayType !== 'MEALS' && (
126- < div
127- className = { `flex flex-row justify-between items-center gap-2 sm:gap-6 w-full ${
128- //bottom
129- displayType !== 'ACTIVITIES' ? '' : 'sm:w-auto'
130- } `}
131- >
132- { displayType === 'WORKSHOPS' && (
120+ < div className = "flex flex-row justify-between items-center gap-2 sm:gap-6 w-full" >
121+ { ( displayType === 'WORKSHOPS' || displayType === 'ACTIVITIES' ) && (
133122 < div
134123 className = { `flex gap-2 items-center w-full sm:w-auto ${
135124 attendeeCount && attendeeCount > 0
@@ -150,47 +139,46 @@ export function CalendarItem({
150139 </ div >
151140 ) }
152141
153- < div className = "flex flex-col gap-2 items-end sm:w-auto ml-auto" >
154- < Button
155- onClick = {
156- inPersonalSchedule ? onRemoveFromSchedule : onAddToSchedule
157- }
158- className = "w-auto h-auto px-9 py-4 rounded-3xl cursor-pointer relative shrink-0 hover:brightness-[97%] hover:saturate-[140%]"
159- style = { {
160- backgroundColor :
161- eventStyle . addButtonColor || 'rgba(0, 0, 0, 0)' ,
162- color : eventStyle . textColor ,
163- } }
164- variant = "ghost"
165- >
166- < p className = "font-semibold relative text-[14px] z-10 inline-flex items-center gap-2" >
167- < span
168- aria-hidden
169- className = "inline-block w-4 h-4"
170- style = { {
171- backgroundColor : 'currentColor' ,
172- WebkitMaskImage : `url(${
173- inPersonalSchedule
174- ? '/icons/check.svg'
175- : '/icons/plus.svg'
176- } )`,
177- WebkitMaskRepeat : 'no-repeat' ,
178- WebkitMaskPosition : 'center' ,
179- WebkitMaskSize : 'contain' ,
180- maskImage : `url(${
181- inPersonalSchedule
182- ? '/icons/check.svg'
183- : '/icons/plus.svg'
184- } )`,
185- maskRepeat : 'no-repeat' ,
186- maskPosition : 'center' ,
187- maskSize : 'contain' ,
188- } }
189- />
190- { inPersonalSchedule ? 'Added' : 'Add' }
191- </ p >
192- </ Button >
193- </ div >
142+ { ! hideAddButton && (
143+ < div className = "flex flex-col gap-2 items-end sm:w-auto ml-auto" >
144+ < Button
145+ onClick = {
146+ inPersonalSchedule ? onRemoveFromSchedule : onAddToSchedule
147+ }
148+ disabled = { disableAddButton }
149+ className = { `w-auto h-auto px-9 py-4 rounded-3xl relative shrink-0 ${
150+ disableAddButton
151+ ? 'cursor-not-allowed opacity-60'
152+ : 'cursor-pointer hover:brightness-[97%] hover:saturate-[140%]'
153+ } `}
154+ style = { {
155+ backgroundColor :
156+ eventStyle . addButtonColor || 'rgba(0, 0, 0, 0)' ,
157+ color : eventStyle . textColor ,
158+ } }
159+ variant = "ghost"
160+ >
161+ < p className = "font-semibold relative text-[14px] z-10 inline-flex items-center gap-2" >
162+ < span
163+ aria-hidden
164+ className = "inline-block w-4 h-4"
165+ style = { {
166+ backgroundColor : 'currentColor' ,
167+ WebkitMaskImage : `url(${ actionIconPath } )` ,
168+ WebkitMaskRepeat : 'no-repeat' ,
169+ WebkitMaskPosition : 'center' ,
170+ WebkitMaskSize : 'contain' ,
171+ maskImage : `url(${ actionIconPath } )` ,
172+ maskRepeat : 'no-repeat' ,
173+ maskPosition : 'center' ,
174+ maskSize : 'contain' ,
175+ } }
176+ />
177+ { inPersonalSchedule ? 'Added' : 'Add' }
178+ </ p >
179+ </ Button >
180+ </ div >
181+ ) }
194182 </ div >
195183 ) }
196184 </ div >
0 commit comments