Skip to content

Commit 22c6d55

Browse files
feat(PDYE-1119): prop textos
1 parent 2c3d8f2 commit 22c6d55

File tree

5 files changed

+34
-30
lines changed

5 files changed

+34
-30
lines changed

src/organisms/Calendar/Dropdown/CalendarDropdown.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ICalendarDropdown } from './types'
33

44
export const CalendarDropdown = ({
55
redirectToCalendar,
6-
t,
6+
text,
77
courseColors,
88
now,
99
events,
@@ -19,7 +19,7 @@ export const CalendarDropdown = ({
1919
now={isoDate}
2020
courseColors={courseColors}
2121
redirectToCalendar={redirectToCalendar}
22-
t={t}
22+
text={text}
2323
/>
2424
)
2525
}

src/organisms/Calendar/Dropdown/CalendarDropdown/CalendarDropdownContainer.tsx

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { ICalendarDropdown } from '../types'
1111
export const CalendarDropdownContainer = ({
1212
events,
1313
loading,
14-
t,
14+
text,
1515
now,
1616
redirectToCalendar,
1717
courseColors: colors,
@@ -22,20 +22,6 @@ export const CalendarDropdownContainer = ({
2222
const [isTooltipDisabled, setTooltipDisabled] = useState(false)
2323
const [isMenuOpen, setMenuOpen] = useState(false)
2424

25-
const text = {
26-
buttonCalendar: t('CalendarGoto'),
27-
course: t('CalendarCourse'),
28-
empty: t('CalendarDontEvent'),
29-
events: {
30-
today: t('CalendarToday'),
31-
tomorrow: t('CalendarTomorrow'),
32-
next: t('CalendarNext'),
33-
},
34-
header: t('CalendarNextDates'),
35-
loading: t('Cargando'),
36-
tooltip: t('Calendar'),
37-
}
38-
3925
// Resuelve tooltip que se mantiene visible al cerrar el menu
4026
useEffect(() => {
4127
if (isMenuOpen) {
@@ -87,15 +73,18 @@ export const CalendarDropdownContainer = ({
8773
<>
8874
<GoToCalendar
8975
hasNew={hasNew ?? false}
90-
text={text.tooltip}
76+
text={text?.tooltip || 'Ir a Mi Calendario'}
9177
tooltipDisabled={isTooltipDisabled}
9278
/>
9379
<MenuList>
94-
<Header text={text.header} isMobile={isMobile} />
80+
<Header
81+
text={text?.header || 'Próximas fechas importantes de tus cursos'}
82+
isMobile={isMobile}
83+
/>
9584
{loading ? (
96-
<Loading text={text.loading} />
85+
<Loading text={text?.loading || 'Cargando'} />
9786
) : events.length === 0 || empty ? (
98-
<Empty text={text.empty} />
87+
<Empty text={text?.empty || 'Aún no tienes eventos en tu calendario'} />
9988
) : (
10089
<Events
10190
colors={colors}

src/organisms/Calendar/Dropdown/CalendarDropdown/Components/Events.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ import { Box, MenuGroup } from '@chakra-ui/react'
33
import { Key } from 'react'
44

55
import { EventsList } from '../../../EventsList/EventsList'
6+
import { Text } from '../../types'
67

78
interface EventsProps {
89
events: {
910
today: Event[]
1011
tomorrow: Event[]
1112
next: Event[]
1213
}
13-
text: any
14+
text: Text
1415
redirecToCalendar: () => void
1516
isMobile: boolean
1617
colors: any
@@ -50,25 +51,25 @@ export const Events = ({
5051
}}
5152
>
5253
<BtnSecondary onClick={redirecToCalendar} m="72px 0 0 24px">
53-
{text.buttonCalendar ?? 'Ir a Mi Calendario'}
54+
{text?.buttonCalendar ?? 'Ir a Mi Calendario'}
5455
</BtnSecondary>
5556
</Box>
5657
)}
5758
<EventsGroup
5859
colors={colors}
59-
text={text}
60+
text={text.course}
6061
title={text?.events?.today ?? 'Hoy'}
6162
events={today}
6263
/>
6364
<EventsGroup
6465
colors={colors}
65-
text={text}
66+
text={text.course}
6667
title={text?.events?.tomorrow ?? 'Mañana'}
6768
events={tomorrow}
6869
/>
6970
<EventsGroup
7071
colors={colors}
71-
text={text}
72+
text={text.course}
7273
title={text?.events?.next ?? 'Próximos'}
7374
events={next}
7475
/>
@@ -87,7 +88,7 @@ interface Event {
8788
interface EventsGroupProps {
8889
title: string
8990
events: Event[]
90-
text: any
91+
text: string
9192
colors: any
9293
}
9394

@@ -144,7 +145,7 @@ const EventsGroup = ({ title, events, text, colors }: EventsGroupProps): JSX.Ele
144145
date={event.formatedDate.start}
145146
hours={event.formatedDate.hours}
146147
color={event.course_id && colors?.[event.course_id]}
147-
text={text.events.course}
148+
text={text}
148149
hasNotification={event.isNew}
149150
isDropdown
150151
/>

src/organisms/Calendar/Dropdown/types.d.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,25 @@ interface Event {
2424

2525
export type Events = Event[]
2626

27+
export interface Text {
28+
buttonCalendar: string
29+
course: string
30+
empty: string
31+
events: {
32+
today: string
33+
tomorrow: string
34+
next: string
35+
}
36+
header: string
37+
loading: string
38+
tooltip: string
39+
}
40+
2741
interface ICalendarDropdown {
2842
courseColors?: Record<string, string>
2943
events: any
3044
loading?: boolean
3145
now: string
3246
redirectToCalendar: () => void
33-
t?: Function
47+
text: Text
3448
}

src/organisms/Calendar/EventsList/EventsList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export interface IEventList {
1010
name: string
1111
color?: string
1212
courseName?: string
13-
text?: string
13+
text: string
1414
date: string
1515
hours: string
1616
}

0 commit comments

Comments
 (0)