Skip to content

Add attendance email update flow - #91

Merged
Tamir198 merged 3 commits into
mainfrom
86extdj3f-chekIn
Jun 22, 2026
Merged

Add attendance email update flow#91
Tamir198 merged 3 commits into
mainfrom
86extdj3f-chekIn

Conversation

@Elad-Abutbul

@Elad-Abutbul Elad-Abutbul commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Description

Please include a summary of the changes and the related issue.

Related Issue(s)

Fixes # (issue number)

Checklist:

  • I have performed a self-review of my own code
  • My changes generate no new warnings

Screenshots (if appropriate):

Summary by CodeRabbit

Release Notes

  • New Features

    • Attendance status updates during check-in now send an email notification.
  • Bug Fixes

    • Check-in now displays the correct appointment time from the appointment details.
  • Enhancements

    • Added cancel support in the check-in flow.
    • Check-in options are disabled while the email is being sent.
    • Shows an “update failed” message if the attendance email can’t be sent.
  • Documentation

    • Updated environment variable documentation to include VITE_ATTENDANCE_EMAIL.

@Elad-Abutbul
Elad-Abutbul requested a review from Tamir198 June 17, 2026 10:37
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds attendance email notification to the check-in flow. New types and constants define attendance statuses, appointment details, and email routing. An environment variable configures the attendance email recipient. A typed email service and useSendEmail React mutation hook are introduced. The CheckIn, CheckInActions, and CheckInOptions components are updated to trigger the email mutation, propagate pending state, disable buttons during submission, and display error messages. Translation strings are added for multiple languages.

Changes

Attendance Check-In Email Integration

Layer / File(s) Summary
Types, constants, API endpoint, and environment setup
src/types/attendance.types.ts, src/types/email.types.ts, src/constants/attendance.constants.ts, src/constants/email.constants.ts, src/constants/api.constants.ts, .env.example, README.md
Defines AttendanceStatus, AttendanceAppointmentDetails, and AttendanceUpdatePayload types. Defines EmailType, SendEmailRequest, and SendEmailResponse types. Exports ATTENDANCE_STATUS and EMAIL_TYPES constants. Adds EMAIL_RECIPIENTS_BY_TYPE mapping from the VITE_ATTENDANCE_EMAIL environment variable. Adds /api/email endpoint constant. Documents VITE_ATTENDANCE_EMAIL in configuration and README.
Email service implementation
src/services/email/email.service.ts
Implements sendEmail function that posts a typed SendEmailRequest to the /api/email endpoint and returns a SendEmailResponse.
useSendEmail mutation hook
src/hooks/useSendEmail.ts
Exports useSendEmail React hook wrapping useMutation to call sendEmail, automatically selecting the email recipient from EMAIL_RECIPIENTS_BY_TYPE based on the provided emailType, and supporting generic TPayload types.
Check-in UI components and mutation wiring
src/pages/home/checkIn/CheckIn.tsx, src/pages/home/checkIn/CheckInActions.tsx, src/pages/home/checkIn/CheckInOptions.tsx, src/pages/home/checkIn/checkIn.mock.ts
CheckIn drives check-in through sendAttendanceUpdate email mutation, sets isCheckedIn only on success for COMING status, and displays error state on failure. Mock appointment data is exported. isPending and onCancel props are propagated through CheckInActions and CheckInOptions to disable action buttons while the mutation is in flight and wire the cancel handler.
Localization strings for check-in UI and errors
src/locales/ar/translation.json, src/locales/en/translation.json, src/locales/he/translation.json, src/locales/ru/translation.json
Adds checkIn.updateFailed error message to English, Hebrew, and Russian. Adds comprehensive Arabic check-in UI translations including appointment details labels, action buttons, and completion/error messages.

Sequence Diagram

sequenceDiagram
  participant User
  participant CheckInOptions
  participant CheckIn
  participant useSendEmail
  participant EmailAPI

  User->>CheckInOptions: clicks check-in or not-coming
  CheckInOptions->>CheckIn: onCheckIn(attendanceStatus)
  CheckIn->>useSendEmail: mutate(AttendanceUpdatePayload)
  useSendEmail->>EmailAPI: POST /api/email with recipient from EMAIL_RECIPIENTS_BY_TYPE
  EmailAPI-->>useSendEmail: SendEmailResponse
  useSendEmail-->>CheckIn: onSuccess / onError
  Note over CheckIn: onSuccess: setIsCheckedIn(true) if status === COMING<br/>onError: setHasEmailError(true)
  Note over CheckInOptions: isPending disables buttons during flight
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • ColmanDevClubORG/Sagol360Management#42: Introduced the initial CheckIn, CheckInActions, and CheckInOptions component structure that this PR directly extends with email-mutation wiring and pending-state management.

Suggested reviewers

  • Tamir198

🐇 A hop through the code, an email takes flight,
With types and constants all neatly set right,
The check-in now sends a note down the wire,
While pending keeps buttons from lighting afire,
📬 Attendance confirmed — the rabbits delight!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description follows the template structure but lacks substantive details about the changes and does not reference a specific issue number. Provide a detailed summary of changes (e.g., new email service, updated check-in flow, constants and types added) and reference the related issue number.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding an attendance email update flow, which is the primary feature across all modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 86extdj3f-chekIn

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Elad-Abutbul
Elad-Abutbul requested review from GilHeller and removed request for Tamir198 June 17, 2026 10:37

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🧹 Nitpick comments (1)
src/hooks/useSendEmail.ts (1)

5-14: ⚡ Quick win

Consider adding a mutationKey for better debugging.

The useMutation call omits a mutationKey. While optional, including one improves the developer experience by making mutations identifiable in React Query DevTools and allows for potential future enhancements like mutation deduplication or status tracking.

♻️ Suggested enhancement
 export const useSendEmail = <TPayload = Record<string, unknown>>(emailType: EmailType) => {
   return useMutation<SendEmailResponse, Error, TPayload>({
+    mutationKey: ['sendEmail', emailType],
     mutationFn: (payload) =>
       sendEmail<TPayload>({
         emailType,
         email: EMAIL_RECIPIENTS_BY_TYPE[emailType],
         payload,
       }),
   })
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/hooks/useSendEmail.ts` around lines 5 - 14, The useSendEmail hook's
useMutation call is missing a mutationKey property. Add a mutationKey
configuration to the useMutation options object that uniquely identifies this
mutation. The key should incorporate the emailType parameter to ensure each
email type mutation is distinctly tracked in React Query DevTools. Include the
mutationKey as an array property alongside the existing mutationFn property in
the options object passed to useMutation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/constants/attendance.constants.ts`:
- Around line 8-14: The ATTENDANCE_APPOINTMENT_DETAILS constant in
attendance.constants.ts contains hardcoded mock patient data that will be sent
in every attendance email regardless of actual patient information. Remove this
constant entirely and instead refactor CheckIn.tsx to fetch real appointment
details from a backend API call based on the authenticated user/session, then
pass the actual appointment data as props to the CheckIn component or through
context. This ensures each attendance update contains the correct patient and
appointment information.

In `@src/constants/email.constants.ts`:
- Around line 7-9: The EMAIL_RECIPIENTS_BY_TYPE object currently allows
VITE_ATTENDANCE_EMAIL to default to an empty string, which will cause silent
failures when emails are sent. Instead of using the fallback empty string
operator, validate that the VITE_ATTENDANCE_EMAIL environment variable is
defined at module load time and throw an error immediately if it is missing or
empty. This ensures the misconfiguration is caught early rather than causing
runtime failures when attempting to send emails to the
EMAIL_TYPES.ATTENDANCE_UPDATE recipient.

In `@src/locales/ar/translation.json`:
- Line 81: The translation key "chckIn.orangeCell" contains a typo where
"chckIn" is missing the letter 'e' and should be "checkIn" to match the
consistent namespace pattern used throughout the codebase. Change the key name
from "chckIn.orangeCell" to "checkIn.orangeCell" in the Arabic translation file
to ensure proper key lookup and consistency with other checkIn-related
translations.

In `@src/pages/home/checkIn/CheckIn.tsx`:
- Around line 42-54: The sendAttendanceEmail call in the sendAttendanceUpdate
function currently only handles the success case with an onSuccess callback but
lacks error handling. Add an onError callback to the mutation options object
alongside the existing onSuccess callback to handle failures. The onError
callback should provide user feedback (such as displaying an error message or
toast notification) when the email send operation fails, ensuring users are
aware of any network or API errors and the UI state reflects the failure
appropriately.
- Line 98: The onCancel callback passed to CheckInOptions is currently an empty
function, which means the "notComing" button has no functionality when clicked.
You need to either implement the cancel behavior by adding the appropriate logic
inside the onCancel callback (such as updating state, closing modals, or
navigating away), or if this is intentionally a placeholder, add a TODO comment
above the onCancel prop explaining what functionality needs to be implemented
and why it's currently empty. Reference the CheckInActionsProps interface and
CheckInOptions component to understand what the expected behavior should be.

In `@src/services/email/email.service.ts`:
- Around line 4-8: The SendEmailRequest interface has the emailType property
typed as a string, which allows any string value and bypasses type safety.
Update the emailType property in the SendEmailRequest interface to use the
EmailType union from email.constants.ts instead of string. This will ensure only
valid email types are accepted and provide compile-time type checking.

---

Nitpick comments:
In `@src/hooks/useSendEmail.ts`:
- Around line 5-14: The useSendEmail hook's useMutation call is missing a
mutationKey property. Add a mutationKey configuration to the useMutation options
object that uniquely identifies this mutation. The key should incorporate the
emailType parameter to ensure each email type mutation is distinctly tracked in
React Query DevTools. Include the mutationKey as an array property alongside the
existing mutationFn property in the options object passed to useMutation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1e25c8ac-84cc-40bf-b10f-fe4e50e10048

📥 Commits

Reviewing files that changed from the base of the PR and between 74d158a and 23a63c4.

📒 Files selected for processing (11)
  • .env.example
  • README.md
  • src/constants/api.constants.ts
  • src/constants/attendance.constants.ts
  • src/constants/email.constants.ts
  • src/hooks/useSendEmail.ts
  • src/locales/ar/translation.json
  • src/pages/home/checkIn/CheckIn.tsx
  • src/pages/home/checkIn/CheckInActions.tsx
  • src/pages/home/checkIn/CheckInOptions.tsx
  • src/services/email/email.service.ts

Comment thread src/constants/attendance.constants.ts Outdated
Comment thread src/constants/email.constants.ts Outdated
Comment on lines +7 to +9
export const EMAIL_RECIPIENTS_BY_TYPE = {
[EMAIL_TYPES.ATTENDANCE_UPDATE]: import.meta.env.VITE_ATTENDANCE_EMAIL || '',
} satisfies Record<EmailType, string>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Validate that email recipient is configured at module load.

Line 8 falls back to an empty string when VITE_ATTENDANCE_EMAIL is missing. Emails sent to an empty recipient will fail at runtime (either silently or with an error), and users won't receive feedback that their attendance update wasn't delivered.

Instead of a silent fallback, fail early if the required environment variable is not set:

🛡️ Proposed validation to prevent empty recipients
+const getAttendanceEmail = () => {
+  const email = import.meta.env.VITE_ATTENDANCE_EMAIL
+  if (!email) {
+    throw new Error('VITE_ATTENDANCE_EMAIL environment variable is required')
+  }
+  return email
+}
+
 export const EMAIL_RECIPIENTS_BY_TYPE = {
-  [EMAIL_TYPES.ATTENDANCE_UPDATE]: import.meta.env.VITE_ATTENDANCE_EMAIL || '',
+  [EMAIL_TYPES.ATTENDANCE_UPDATE]: getAttendanceEmail(),
 } satisfies Record<EmailType, string>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/constants/email.constants.ts` around lines 7 - 9, The
EMAIL_RECIPIENTS_BY_TYPE object currently allows VITE_ATTENDANCE_EMAIL to
default to an empty string, which will cause silent failures when emails are
sent. Instead of using the fallback empty string operator, validate that the
VITE_ATTENDANCE_EMAIL environment variable is defined at module load time and
throw an error immediately if it is missing or empty. This ensures the
misconfiguration is caught early rather than causing runtime failures when
attempting to send emails to the EMAIL_TYPES.ATTENDANCE_UPDATE recipient.

"checkIn.nextAppointment": "الموعد التالي",
"checkIn.today": "اليوم",
"checkIn.hyperbaricTreatment": "العلاج في غرفة الضغط",
"chckIn.orangeCell": "الخلية البرتقالية",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix the translation key typo on Line 81.

"chckIn.orangeCell" is inconsistent with the rest of the checkIn.* namespace and will likely miss at lookup time.

Suggested patch
-  "chckIn.orangeCell": "الخلية البرتقالية",
+  "checkIn.orangeCell": "الخلية البرتقالية",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"chckIn.orangeCell": "الخلية البرتقالية",
"checkIn.orangeCell": "الخلية البرتقالية",
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/locales/ar/translation.json` at line 81, The translation key
"chckIn.orangeCell" contains a typo where "chckIn" is missing the letter 'e' and
should be "checkIn" to match the consistent namespace pattern used throughout
the codebase. Change the key name from "chckIn.orangeCell" to
"checkIn.orangeCell" in the Arabic translation file to ensure proper key lookup
and consistency with other checkIn-related translations.

Comment thread src/pages/home/checkIn/CheckIn.tsx
<CheckInActions
onDone={onDone}
onCheckIn={handleCheckIn}
onCancel={() => {}}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

cd /repo && cat -n src/pages/home/checkIn/CheckIn.tsx | sed -n '90,110p'

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 135


🏁 Script executed:

cd /repo && rg "CheckInActions" --type tsx -A 5 -B 5

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 135


🏁 Script executed:

cd /repo && fd "CheckInActions" --type ts --type tsx

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 135


🏁 Script executed:

cat -n src/pages/home/checkIn/CheckIn.tsx | sed -n '90,110p'

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 544


🏁 Script executed:

rg "CheckInActions" --type tsx -A 5 -B 5

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 107


🏁 Script executed:

fd "CheckInActions" --type ts --type tsx

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 249


🏁 Script executed:

rg "CheckInActions" -A 5 -B 5

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 3105


🏁 Script executed:

fd "CheckInActions"

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 121


🏁 Script executed:

rg "interface.*CheckInActions|type.*CheckInActions|export.*CheckInActions" -A 10

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 1265


🏁 Script executed:

cat -n src/pages/home/checkIn/CheckInActions.tsx | head -50

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 946


🏁 Script executed:

rg "onCancel" src/pages/home/checkIn/CheckInActions.tsx -A 2 -B 2

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 425


🏁 Script executed:

cat -n src/pages/home/checkIn/CheckInOptions.tsx

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 1515


Empty onCancel callback needs implementation or explanation

The onCancel callback on line 98 is required by the CheckInActionsProps interface and is actively used by CheckInOptions as the onClick handler for the "notComing" button. Passing an empty function onCancel={() => {}} means the cancel button won't perform any action. Either implement the cancel functionality or add a TODO comment explaining the intentional placeholder.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/pages/home/checkIn/CheckIn.tsx` at line 98, The onCancel callback passed
to CheckInOptions is currently an empty function, which means the "notComing"
button has no functionality when clicked. You need to either implement the
cancel behavior by adding the appropriate logic inside the onCancel callback
(such as updating state, closing modals, or navigating away), or if this is
intentionally a placeholder, add a TODO comment above the onCancel prop
explaining what functionality needs to be implemented and why it's currently
empty. Reference the CheckInActionsProps interface and CheckInOptions component
to understand what the expected behavior should be.

Comment thread src/services/email/email.service.ts Outdated
Comment thread src/constants/attendance.constants.ts Outdated
NOT_COMING: 'NOT_COMING',
} as const

export type AttendanceStatus = (typeof ATTENDANCE_STATUS)[keyof typeof ATTENDANCE_STATUS]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

types should sit inside types folder

Comment thread src/constants/attendance.constants.ts Outdated

export type AttendanceStatus = (typeof ATTENDANCE_STATUS)[keyof typeof ATTENDANCE_STATUS]

export const ATTENDANCE_APPOINTMENT_DETAILS = {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is a mock object it should not sit inside the constants folder

Comment thread src/hooks/useSendEmail.ts
import { EMAIL_RECIPIENTS_BY_TYPE, type EmailType } from '@/constants/email.constants'
import { sendEmail, type SendEmailResponse } from '@/services/email/email.service'

export const useSendEmail = <TPayload = Record<string, unknown>>(emailType: EmailType) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to have TPayload in here? isnt the type the same for every call?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TPayload is intentionally generic because this is a shared email service that can support multiple email types, each with a different payload shape. Attendance is currently only the first use case.

Comment thread src/pages/home/checkIn/CheckIn.tsx
Comment thread src/services/email/email.service.ts Outdated

export interface SendEmailRequest<TPayload = Record<string, unknown>> {
emailType: string
email: string

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have type for email and not string only?

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
src/constants/email.constants.ts (1)

5-7: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fail fast when VITE_ATTENDANCE_EMAIL is missing.

Using || '' silently permits an invalid recipient; useSendEmail then forwards that empty address to the API, causing runtime delivery failures instead of early config failure.

Proposed fix
 export const EMAIL_TYPES = {
   ATTENDANCE_UPDATE: 'ATTENDANCE_UPDATE',
 } as const
 
+const getRequiredAttendanceEmail = () => {
+  const email = import.meta.env.VITE_ATTENDANCE_EMAIL
+  if (!email?.trim()) {
+    throw new Error('Missing required environment variable: VITE_ATTENDANCE_EMAIL')
+  }
+  return email
+}
+
 export const EMAIL_RECIPIENTS_BY_TYPE = {
-  [EMAIL_TYPES.ATTENDANCE_UPDATE]: import.meta.env.VITE_ATTENDANCE_EMAIL || '',
+  [EMAIL_TYPES.ATTENDANCE_UPDATE]: getRequiredAttendanceEmail(),
 } satisfies Record<(typeof EMAIL_TYPES)[keyof typeof EMAIL_TYPES], string>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/constants/email.constants.ts` around lines 5 - 7, The
EMAIL_RECIPIENTS_BY_TYPE constant uses a fallback empty string when
VITE_ATTENDANCE_EMAIL is missing, allowing invalid configuration to silently
pass and cause runtime failures downstream. Remove the `|| ''` fallback from the
VITE_ATTENDANCE_EMAIL assignment so that the application fails explicitly and
immediately at startup if this required environment variable is not configured,
preventing empty email addresses from being forwarded to the API.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@src/constants/email.constants.ts`:
- Around line 5-7: The EMAIL_RECIPIENTS_BY_TYPE constant uses a fallback empty
string when VITE_ATTENDANCE_EMAIL is missing, allowing invalid configuration to
silently pass and cause runtime failures downstream. Remove the `|| ''` fallback
from the VITE_ATTENDANCE_EMAIL assignment so that the application fails
explicitly and immediately at startup if this required environment variable is
not configured, preventing empty email addresses from being forwarded to the
API.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7d898ff8-6902-4268-9c8b-ce2cf52d087d

📥 Commits

Reviewing files that changed from the base of the PR and between 23a63c4 and 79873f3.

📒 Files selected for processing (12)
  • src/constants/attendance.constants.ts
  • src/constants/email.constants.ts
  • src/hooks/useSendEmail.ts
  • src/locales/ar/translation.json
  • src/locales/en/translation.json
  • src/locales/he/translation.json
  • src/locales/ru/translation.json
  • src/pages/home/checkIn/CheckIn.tsx
  • src/pages/home/checkIn/checkIn.mock.ts
  • src/services/email/email.service.ts
  • src/types/attendance.types.ts
  • src/types/email.types.ts
💤 Files with no reviewable changes (1)
  • src/constants/attendance.constants.ts
✅ Files skipped from review due to trivial changes (6)
  • src/types/email.types.ts
  • src/pages/home/checkIn/checkIn.mock.ts
  • src/locales/en/translation.json
  • src/locales/he/translation.json
  • src/locales/ru/translation.json
  • src/locales/ar/translation.json
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/hooks/useSendEmail.ts
  • src/pages/home/checkIn/CheckIn.tsx

@Elad-Abutbul
Elad-Abutbul requested a review from Tamir198 June 22, 2026 11:23

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/pages/home/checkIn/CheckIn.tsx (1)

23-23: ⚠️ Potential issue | 🔴 Critical | 🏗️ Heavy lift

Replace mock data with real appointment details.

The component imports and uses mockAttendanceAppointmentDetails to construct the email payload. Mock data should not be used in production components—it will send incorrect appointment information and break the attendance tracking flow.

Pass actual appointment details as props to CheckIn or fetch them from a data source.

📋 Recommended approach
 import { mockAttendanceAppointmentDetails } from './checkIn.mock'

 interface CheckInProps {
   onDone: () => void
+  appointmentDetails: Omit<AttendanceUpdatePayload, 'attendanceStatus'>
 }

-export const CheckIn = ({ onDone }: CheckInProps) => {
+export const CheckIn = ({ onDone, appointmentDetails }: CheckInProps) => {
   const { t } = useTranslation()
   // ...
   const sendAttendanceUpdate = (attendanceStatus: AttendanceStatus) => {
     sendAttendanceEmail(
       {
-        ...mockAttendanceAppointmentDetails,
+        ...appointmentDetails,
         attendanceStatus,
       },

Also applies to: 40-42

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/pages/home/checkIn/CheckIn.tsx` at line 23, Remove the import of
mockAttendanceAppointmentDetails from the checkIn.mock file in the CheckIn
component. Instead, modify the CheckIn component to accept actual appointment
details as a prop or fetch them from a real data source (such as an API or state
management). Update the email payload construction to use the real appointment
data from the prop or fetched source instead of the mock data, ensuring that the
component receives and uses authentic appointment information for the attendance
tracking flow.
♻️ Duplicate comments (1)
src/pages/home/checkIn/CheckIn.tsx (1)

101-101: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Empty onCancel callback needs implementation or explanation.

The onCancel callback is required by CheckInActionsProps and wired to the "notComing" button in CheckInOptions. An empty function means that button has no effect when clicked. Either implement the cancel behavior (e.g., sendAttendanceUpdate(ATTENDANCE_STATUS.NOT_COMING)) or add a TODO explaining the placeholder.

🔧 Possible implementation
-        onCancel={() => {}}
+        onCancel={() => sendAttendanceUpdate(ATTENDANCE_STATUS.NOT_COMING)}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/pages/home/checkIn/CheckIn.tsx` at line 101, The onCancel callback in the
CheckInActionsProps is currently empty, making the "notComing" button in
CheckInOptions non-functional. Implement the onCancel callback to call
sendAttendanceUpdate with ATTENDANCE_STATUS.NOT_COMING to properly handle the
cancel/not coming action, or add a TODO comment explaining why it remains a
placeholder if implementation is intentionally deferred.
🧹 Nitpick comments (1)
src/pages/home/checkIn/CheckIn.tsx (1)

91-97: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Consider enhancing error feedback.

The error alert displays a generic message without details about what failed or how to recover. Users cannot retry after an error, and developers have no context for debugging.

💡 Suggested improvements
+  const {
+    mutate: sendAttendanceEmail,
+    isPending,
+    isError,
+    error,
+    reset,
+  } = useSendEmail<AttendanceUpdatePayload>(EMAIL_TYPES.ATTENDANCE_UPDATE)

   // ...
   
   {isError ? (
     <div role="alert">
       <SGLTypography variant="mediumText" color="white">
-        {t('checkIn.updateFailed')}
+        {t('checkIn.updateFailed')}: {error?.message}
       </SGLTypography>
+      <button onClick={() => reset()}>
+        {t('common.dismiss')}
+      </button>
     </div>
   ) : null}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/pages/home/checkIn/CheckIn.tsx` around lines 91 - 97, The error alert in
the CheckIn component displays only a generic message when isError is true,
lacking actionable feedback for users and debugging context for developers.
Enhance the error handling by: storing and displaying the actual error details
alongside the generic message in the SGLTypography component, adding a retry
button or mechanism within the alert container to allow users to reattempt the
check-in operation, and logging the complete error information (not just the
isError flag) so developers can understand what specifically failed during the
update operation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/pages/home/checkIn/CheckIn.tsx`:
- Line 23: Remove the import of mockAttendanceAppointmentDetails from the
checkIn.mock file in the CheckIn component. Instead, modify the CheckIn
component to accept actual appointment details as a prop or fetch them from a
real data source (such as an API or state management). Update the email payload
construction to use the real appointment data from the prop or fetched source
instead of the mock data, ensuring that the component receives and uses
authentic appointment information for the attendance tracking flow.

---

Duplicate comments:
In `@src/pages/home/checkIn/CheckIn.tsx`:
- Line 101: The onCancel callback in the CheckInActionsProps is currently empty,
making the "notComing" button in CheckInOptions non-functional. Implement the
onCancel callback to call sendAttendanceUpdate with ATTENDANCE_STATUS.NOT_COMING
to properly handle the cancel/not coming action, or add a TODO comment
explaining why it remains a placeholder if implementation is intentionally
deferred.

---

Nitpick comments:
In `@src/pages/home/checkIn/CheckIn.tsx`:
- Around line 91-97: The error alert in the CheckIn component displays only a
generic message when isError is true, lacking actionable feedback for users and
debugging context for developers. Enhance the error handling by: storing and
displaying the actual error details alongside the generic message in the
SGLTypography component, adding a retry button or mechanism within the alert
container to allow users to reattempt the check-in operation, and logging the
complete error information (not just the isError flag) so developers can
understand what specifically failed during the update operation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 051061e9-c3db-471f-914c-9057308ae68b

📥 Commits

Reviewing files that changed from the base of the PR and between 79873f3 and 4d2e18d.

📒 Files selected for processing (1)
  • src/pages/home/checkIn/CheckIn.tsx

@Tamir198
Tamir198 merged commit 7f97283 into main Jun 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants