-
Notifications
You must be signed in to change notification settings - Fork 49
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]: handle February (28/29 days) in calendar and integrate task label translations, update button logic #3397
Conversation
…dle February (28/29 days) in calendar
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 eslint
apps/web/app/[locale]/timesheet/[memberId]/components/CalendarView.tsxOops! Something went wrong! :( ESLint: 8.46.0 ESLint couldn't find the config "next/core-web-vitals" to extend from. Please check that the name of the config is correct. The config "next/core-web-vitals" was referenced from the config file in "/apps/web/.eslintrc.json". If you still have problems, please stop by https://eslint.org/chat/help to chat with the team. WalkthroughThe changes in this pull request primarily enhance the localization capabilities of the timesheet-related components within the application. Key modifications include the addition of a translation property Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Outside diff range and nitpick comments (4)
apps/web/app/[locale]/timesheet/[memberId]/components/TimesheetCard.tsx (3)
Line range hint
45-54
: Remove duplicatetext-sm
classThe button's className contains a duplicate
text-sm
class which should be removed for cleaner code.className={cn( 'h-9 px-3 py-2', 'border border-gray-200 ', - 'text-[#282048] text-sm', + 'text-[#282048]', 'flex items-center', 'hover:bg-gray-50 hover:dark:bg-primary-light/40 focus:ring-2 focus:ring-offset-2 focus:ring-gray-200 dark:border-gray-600' )}
156-157
: Fix duplicate text-sm class in TaskNameInfoDisplayThe
taskTitleClassName
contains a duplicatetext-sm
class.taskTitleClassName={cn( - 'text-sm !text-ellipsis !overflow-hidden text-sm' + 'text-sm !text-ellipsis !overflow-hidden' )}
Line range hint
82-182
: Consider adding error handling and performance optimizationsA few suggestions to improve the component:
- Add error handling for cases where
data
is undefined or network requests fail- Consider memoizing the filtered and transformed data using
useMemo
to optimize performance, especially for large datasets- Consider memoizing the callback functions using
useCallback
to prevent unnecessary re-rendersExample implementation:
const TimesheetCardDetail = ({ data }: { data?: Record<TimesheetStatus, TimesheetLog[]> }) => { const { getStatusTimesheet, groupByDate } = useTimesheet({}); const { timesheetGroupByDays } = useTimelogFilterOptions(); const t = useTranslations(); // Memoize transformed data const timesheetGroupByDate = useMemo(() => groupByDate(data?.PENDING || []), [data?.PENDING, groupByDate] ); // Add error handling if (!data) { return <div className="text-red-500">{t('common.ERROR_LOADING_DATA')}</div>; } // Rest of the component... };apps/web/app/[locale]/timesheet/[memberId]/components/CalendarView.tsx (1)
190-200
: Consider removing CSS important flagsWhile the height and text size adjustments are valid, the use of
!important
flags (!h-[16px]
,!text-[13px]
) suggests potential CSS specificity issues. Consider restructuring the CSS to avoid specificity conflicts.Consider using more specific selectors or adjusting the CSS hierarchy instead:
-'flex flex-row-reverse justify-end items-center w-full !h-[16px] rounded-sm gap-x-2 hover:no-underline' +'flex flex-row-reverse justify-end items-center w-full h-[16px] rounded-sm gap-x-2 hover:no-underline' -'text-base font-normal text-gray-400 uppercase !text-[13px]' +'text-base font-normal text-gray-400 uppercase text-[13px]'
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (19)
apps/web/app/[locale]/timesheet/[memberId]/components/CalendarView.tsx
(6 hunks)apps/web/app/[locale]/timesheet/[memberId]/components/FilterWithStatus.tsx
(3 hunks)apps/web/app/[locale]/timesheet/[memberId]/components/MonthlyTimesheetCalendar.tsx
(5 hunks)apps/web/app/[locale]/timesheet/[memberId]/components/TimeSheetFilterPopover.tsx
(5 hunks)apps/web/app/[locale]/timesheet/[memberId]/components/TimesheetCard.tsx
(6 hunks)apps/web/app/[locale]/timesheet/[memberId]/components/WeeklyTimesheetCalendar.tsx
(4 hunks)apps/web/locales/ar.json
(1 hunks)apps/web/locales/bg.json
(1 hunks)apps/web/locales/de.json
(1 hunks)apps/web/locales/en.json
(1 hunks)apps/web/locales/es.json
(1 hunks)apps/web/locales/fr.json
(1 hunks)apps/web/locales/he.json
(1 hunks)apps/web/locales/it.json
(1 hunks)apps/web/locales/nl.json
(1 hunks)apps/web/locales/pl.json
(1 hunks)apps/web/locales/pt.json
(1 hunks)apps/web/locales/ru.json
(1 hunks)apps/web/locales/zh.json
(1 hunks)
👮 Files not reviewed due to content moderation or server errors (1)
- apps/web/locales/ru.json
🧰 Additional context used
📓 Learnings (1)
apps/web/locales/es.json (1)
Learnt from: CREDO23
PR: ever-co/ever-teams#3309
File: apps/web/locales/es.json:335-337
Timestamp: 2024-11-12T14:06:02.202Z
Learning: When reviewing additions of new translation keys in `apps/web/locales/`, ensure to verify whether the keys have been added to all relevant locale files before suggesting they are missing.
🔇 Additional comments (18)
apps/web/app/[locale]/timesheet/[memberId]/components/TimesheetCard.tsx (2)
14-14
: LGTM: Import of cn
utility
The addition of the cn
utility import aligns with the codebase's standardization of class name management.
Line range hint 62-68
: LGTM: Icon container styling
The class names are well-structured and the accessibility attribute is properly implemented.
apps/web/app/[locale]/timesheet/[memberId]/components/TimeSheetFilterPopover.tsx (1)
Line range hint 1-168
: File changes don't align with PR objectives.
This file contains styling and translation-related changes but lacks any implementation for handling February's 28/29 days in the calendar. Consider:
- Are there other files that implement the calendar-related changes?
- Was this file included in the PR accidentally?
- Should the PR description be updated to reflect these additional changes?
Let's check for calendar-related files that might contain the actual February handling changes:
apps/web/app/[locale]/timesheet/[memberId]/components/FilterWithStatus.tsx (1)
6-6
: LGTM: Translation integration looks good
The useTranslations hook is properly imported and initialized.
Also applies to: 21-21
apps/web/app/[locale]/timesheet/[memberId]/components/WeeklyTimesheetCalendar.tsx (1)
8-8
: LGTM: Translation integration is properly implemented
The translation hook is correctly typed and navigation buttons are properly localized.
Also applies to: 11-11, 67-67, 80-80
apps/web/app/[locale]/timesheet/[memberId]/components/MonthlyTimesheetCalendar.tsx (2)
31-38
: LGTM: February handling logic is robust
The implementation correctly:
- Handles February's varying days (28/29)
- Uses isLeapYear for accurate leap year detection
- Falls back to standard endOfMonth for other months
8-8
: LGTM: Translation integration matches weekly view
The translation implementation is consistent with WeeklyTimesheetCalendar.
Also applies to: 11-11, 73-73, 82-82
apps/web/app/[locale]/timesheet/[memberId]/components/CalendarView.tsx (2)
15-15
: LGTM: Translation hook properly typed
The addition of the translation hook to the interface is well-structured and follows TypeScript best practices.
39-43
: LGTM: Consistent translation prop passing
The translation hook is properly obtained and passed down to child components, ensuring consistent internationalization throughout the calendar views.
apps/web/locales/zh.json (1)
636-642
: LGTM: Comprehensive status translations added
The new translation keys for timesheet statuses are well-structured and provide complete coverage for all task states.
apps/web/locales/he.json (1)
636-642
: LGTM: Consistent translations across languages
The Hebrew translations for timesheet statuses maintain consistency with other language files while providing proper localization.
apps/web/locales/en.json (1)
636-642
: LGTM: Consistent with Arabic translations
The English translations are properly aligned with the Arabic translations.
apps/web/locales/nl.json (2)
636-642
: LGTM: Consistent with other language translations
The Dutch translations are properly aligned with other language translations.
Line range hint 1-1
: Verify missing calendar-related changes
Let's search for calendar-related files that might need updates for handling February days.
apps/web/locales/pl.json (1)
636-642
: Same inconsistency as in bg.json
These changes mirror those in bg.json and are similarly unrelated to the PR's objective.
apps/web/locales/it.json (1)
636-642
: Same inconsistency as in bg.json and pl.json
These changes mirror those in bg.json and pl.json and are similarly unrelated to the PR's objective.
apps/web/locales/pt.json (1)
637-643
: LGTM! Translations are consistent
The Portuguese translations for timesheet statuses have been properly added and are consistent with other locale files.
apps/web/locales/es.json (1)
636-642
: LGTM! Translations are consistent
The Spanish translations for timesheet statuses have been properly added and are consistent with other locale files.
Description
Please include a summary of the changes and the related issue.
Type of Change
Checklist
Previous screenshots
Please add here videos or images of previous status
Current screenshots
Please add here videos or images of previous status
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Documentation