Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/dropdown calendario #662

Merged
merged 1 commit into from
Mar 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
171 changes: 44 additions & 127 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"@types/eclass__api": "git+ssh://git@gitlab.com/eclass/types-eclass-api.git#v3.108.0",
"@types/eclass__sequelize-models": "git+ssh://git@gitlab.com/eclass/types-sequelize-models.git#v5.40.0",
"@types/jest": "27.5.2",
"@types/node": "^16.11.17",
"@types/react": "17.0.64",
"@types/react-dom": "17.0.20",
"@typescript-eslint/eslint-plugin": "5.17.0",
Expand Down Expand Up @@ -108,7 +109,7 @@
"sort-by": "1.2.0",
"ts-jest": "27.1.5",
"ts-patch": "2.0.1",
"typescript": "4.6.3",
"typescript": "4.9.5",
"typescript-transform-paths": "3.3.1",
"vite": "2.9.16",
"vite-tsconfig-paths": "3.4.1"
Expand Down
4 changes: 2 additions & 2 deletions src/organisms/Calendar/Dropdown/CalendarDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ICalendarDropdown } from './types'

export const CalendarDropdown = ({
redirectToCalendar,
t,
text,
courseColors,
now,
events,
Expand All @@ -19,7 +19,7 @@ export const CalendarDropdown = ({
now={isoDate}
courseColors={courseColors}
redirectToCalendar={redirectToCalendar}
t={t}
text={text}
/>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { ICalendarDropdown } from '../types'
export const CalendarDropdownContainer = ({
events,
loading,
t,
text,
now,
redirectToCalendar,
courseColors: colors,
Expand All @@ -22,20 +22,6 @@ export const CalendarDropdownContainer = ({
const [isTooltipDisabled, setTooltipDisabled] = useState(false)
const [isMenuOpen, setMenuOpen] = useState(false)

const text = {
buttonCalendar: t('CalendarGoto'),
course: t('CalendarCourse'),
empty: t('CalendarDontEvent'),
events: {
today: t('CalendarToday'),
tomorrow: t('CalendarTomorrow'),
next: t('CalendarNext'),
},
header: t('CalendarNextDates'),
loading: t('Cargando'),
tooltip: t('Calendar'),
}

// Resuelve tooltip que se mantiene visible al cerrar el menu
useEffect(() => {
if (isMenuOpen) {
Expand All @@ -59,18 +45,23 @@ export const CalendarDropdownContainer = ({
position="relative"
sx={{
'>div': {
transform: 'translate3d(-409px, 38px, 0px) !important',
position: isMobile ? 'fixed !important' : 'absolute',
left: isMobile ? '0 !important' : 'auto',
top: isMobile ? '62px !important' : 'auto',
transform: isMobile ? 'none !important' : 'translate3d(-409px, 38px, 0px) !important',
},

'.chakra-menu__menu-list': {
position: 'absolute',
width: isMobile ? '100vw' : '500px',
maxHeight: isMobile ? 'calc(100vh - 62px)' : 'auto',
overflowY: isMobile ? 'auto' : 'hidden',
borderRadius: isMobile ? '0' : '10px',
boxShadow: isMobile ? 'none' : 'rgba(47, 47, 47, 0.2) -1px 6px 40px 0px',
width: isMobile ? '100vw' : '500px',
height: isMobile || empty ? 'auto' : '560px',
animation: 'none !important',
transition: 'none !important',
transform: 'none !important',
opacity: '1 !important',
position: 'absolute',
},
'.chakra-menu__group__title': {
fontSize: '18px',
Expand All @@ -87,15 +78,18 @@ export const CalendarDropdownContainer = ({
<>
<GoToCalendar
hasNew={hasNew ?? false}
text={text.tooltip}
text={text?.tooltip || 'Ir a Mi Calendario'}
tooltipDisabled={isTooltipDisabled}
/>
<MenuList>
<Header text={text.header} isMobile={isMobile} />
<Header
text={text?.header || 'Próximas fechas importantes de tus cursos'}
isMobile={isMobile}
/>
{loading ? (
<Loading text={text.loading} />
<Loading text={text?.loading || 'Cargando'} />
) : events.length === 0 || empty ? (
<Empty text={text.empty} />
<Empty text={text?.empty || 'Aún no tienes eventos en tu calendario'} />
) : (
<Events
colors={colors}
Expand Down
Loading