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(Meetings): add quick settings for midweek and weekend meetings #2403

Merged
merged 7 commits into from
Aug 26, 2024

Conversation

rhahao
Copy link
Member

@rhahao rhahao commented Aug 26, 2024

No description provided.

Copy link

vercel bot commented Aug 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
organized-app ✅ Ready (Inspect) Visit Preview Aug 26, 2024 1:52pm

Copy link
Contributor

coderabbitai bot commented Aug 26, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The pull request introduces significant updates across multiple components and hooks within the application. Key changes include the enhancement of the About component to accept new props, the introduction of new components for managing meeting settings, and the restructuring of existing components for improved modularity. New hooks have been created to manage state related to meeting preferences, while some existing hooks have been simplified or removed. Additionally, new quick settings components have been added for both midweek and weekend meetings, enhancing user interaction with meeting configurations.

Changes

File Path Change Summary
src/features/about/index.tsx Updated About component to accept props: AboutProps, reorganized imports, added handleForceReload function, and modified JSX layout with new IconButton for reload action.
src/features/about/index.types.ts Introduced new type AboutProps with property updatePwa: VoidFunction.
src/features/about/useAbout.tsx Modified useAbout hook to accept AboutProps, added handleForceReload function for invoking updatePwa and page reload.
src/features/congregation/settings/congregation_privacy/index.tsx Added OutgoingTalkAccess component to manage outgoing talks privacy settings, removing previous toggle logic from CongregationPrivacy.
src/features/congregation/settings/congregation_privacy/outgoing_talk_access/index.tsx Introduced OutgoingTalkAccess component with toggle functionality for outgoing talks visibility.
src/features/congregation/settings/congregation_privacy/outgoing_talk_access/useOutgoingTalkAccess.tsx Created custom hook to manage outgoing talks visibility with Recoil state management.
src/features/congregation/settings/congregation_privacy/useCongregationPrivacy.tsx Simplified hook by removing outgoing talks visibility logic and associated state.
src/features/congregation/settings/meeting_forms/display_name/index.tsx Added DisplayName component to manage display name settings for meetings.
src/features/congregation/settings/meeting_forms/display_name/useDisplayName.tsx Created custom hook to manage display name feature state.
src/features/congregation/settings/meeting_forms/index.tsx Restructured MeetingForms component, removed CardSectionContent, and added new components like MidweekExactDate and DisplayName.
src/features/congregation/settings/meeting_forms/midweek_exact_date/index.tsx Introduced MidweekExactDate component for managing exact date display settings.
src/features/congregation/settings/meeting_forms/midweek_exact_date/useMidweekExactDate.tsx Created hook to manage exact date display state.
src/features/congregation/settings/meeting_forms/useMeetingForms.tsx Removed state variables and handlers related to display settings, focusing on source auto-update settings.
src/features/congregation/settings/meeting_settings/midweek/assignment_preferences/index.tsx Added AssignmentPreferences component for managing prayer assignment settings.
src/features/congregation/settings/meeting_settings/midweek/assignment_preferences/useAssignmentPreferences.tsx Created hook to manage prayer assignment preferences.
src/features/congregation/settings/meeting_settings/midweek/auxiliary_classroom/index.tsx Introduced AuxiliaryClassroom component for managing auxiliary classroom settings.
src/features/congregation/settings/meeting_settings/midweek/auxiliary_classroom/useAuxiliaryClassroom.tsx Updated hook to focus on auxiliary classroom settings, removing unrelated state variables.
src/features/congregation/settings/meeting_settings/midweek/day_time/index.tsx Added DayTime component for selecting meeting day and time.
src/features/congregation/settings/meeting_settings/midweek/day_time/useDayTime.tsx Created hook for managing meeting day and time settings.
src/features/congregation/settings/meeting_settings/weekend/assignment_preferences/index.tsx Introduced AssignmentPreferences component for weekend meetings.
src/features/congregation/settings/meeting_settings/weekend/assignment_preferences/useAssignmentPreferences.tsx Created hook to manage assignment preferences for weekend meetings.
src/features/congregation/settings/meeting_settings/weekend/day_time/index.tsx Added DayTime component for managing weekend meeting day and time settings.
src/features/congregation/settings/meeting_settings/weekend/day_time/useDayTime.tsx Created hook to manage weekend meeting day and time settings.
src/features/congregation/settings/meeting_settings/weekend/index.tsx Restructured WeekendSettings component to utilize new components for managing settings.
src/features/meetings/midweek_editor/quick_settings/index.tsx Introduced QuickSettingsMidweekMeeting component for managing midweek meeting settings.
src/features/meetings/midweek_editor/quick_settings/index.types.ts Added QuickSettingsMidweekMeetingProps type definition for props management.
src/features/meetings/weekend_editor/quick_settings/index.tsx Introduced QuickSettingsWeekendMeeting component for managing weekend meeting settings.
src/features/meetings/weekend_editor/quick_settings/index.types.ts Added QuickSettingsWeekendMeetingProps type definition for props management.
src/layouts/root_layout/index.tsx Modified RootLayout to pass updatePwa prop to About component.
src/pages/meetings/midweek/index.tsx Integrated QuickSettingsMidweekMeeting into MidweekMeeting component with state management for quick settings.
src/pages/meetings/midweek/useMidweek.tsx Updated useMidweek hook to manage state for quick settings visibility.
src/pages/meetings/weekend/index.tsx Integrated QuickSettingsWeekendMeeting into WeekendMeeting component with state management for quick settings.
src/pages/meetings/weekend/useWeekend.tsx Updated useWeekend hook to manage state for quick settings visibility.

Possibly related PRs

Warning

Rate limit exceeded

@rhahao has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 11 minutes and 59 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 2bb4c4d and b365351.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 2bb4c4d and b365351.

⛔ Files ignored due to path filters (1)
  • src/locales/en/meetings.json is excluded by !**/*.json
📒 Files selected for processing (39)
  • src/features/about/index.tsx (2 hunks)
  • src/features/about/index.types.ts (1 hunks)
  • src/features/about/useAbout.tsx (2 hunks)
  • src/features/congregation/settings/congregation_privacy/index.tsx (2 hunks)
  • src/features/congregation/settings/congregation_privacy/outgoing_talk_access/index.tsx (1 hunks)
  • src/features/congregation/settings/congregation_privacy/outgoing_talk_access/useOutgoingTalkAccess.tsx (1 hunks)
  • src/features/congregation/settings/congregation_privacy/useCongregationPrivacy.tsx (2 hunks)
  • src/features/congregation/settings/meeting_forms/display_name/index.tsx (1 hunks)
  • src/features/congregation/settings/meeting_forms/display_name/useDisplayName.tsx (1 hunks)
  • src/features/congregation/settings/meeting_forms/index.tsx (2 hunks)
  • src/features/congregation/settings/meeting_forms/midweek_exact_date/index.tsx (1 hunks)
  • src/features/congregation/settings/meeting_forms/midweek_exact_date/useMidweekExactDate.tsx (1 hunks)
  • src/features/congregation/settings/meeting_forms/useMeetingForms.tsx (0 hunks)
  • src/features/congregation/settings/meeting_settings/midweek/assignment_preferences/index.tsx (1 hunks)
  • src/features/congregation/settings/meeting_settings/midweek/assignment_preferences/useAssignmentPreferences.tsx (1 hunks)
  • src/features/congregation/settings/meeting_settings/midweek/auxiliary_classroom/index.tsx (1 hunks)
  • src/features/congregation/settings/meeting_settings/midweek/auxiliary_classroom/useAuxiliaryClassroom.tsx (0 hunks)
  • src/features/congregation/settings/meeting_settings/midweek/day_time/index.tsx (1 hunks)
  • src/features/congregation/settings/meeting_settings/midweek/day_time/useDayTime.tsx (1 hunks)
  • src/features/congregation/settings/meeting_settings/midweek/index.tsx (2 hunks)
  • src/features/congregation/settings/meeting_settings/weekend/assignment_preferences/index.tsx (1 hunks)
  • src/features/congregation/settings/meeting_settings/weekend/assignment_preferences/useAssignmentPreferences.tsx (1 hunks)
  • src/features/congregation/settings/meeting_settings/weekend/day_time/index.tsx (1 hunks)
  • src/features/congregation/settings/meeting_settings/weekend/day_time/useDayTime.tsx (1 hunks)
  • src/features/congregation/settings/meeting_settings/weekend/index.tsx (2 hunks)
  • src/features/congregation/settings/meeting_settings/weekend/monthly_warning/index.tsx (1 hunks)
  • src/features/congregation/settings/meeting_settings/weekend/monthly_warning/useMonthlyWarning.tsx (1 hunks)
  • src/features/congregation/settings/meeting_settings/weekend/study_conductor/index.tsx (1 hunks)
  • src/features/congregation/settings/meeting_settings/weekend/study_conductor/useStudyConductor.tsx (1 hunks)
  • src/features/congregation/settings/meeting_settings/weekend/useWeekend.tsx (0 hunks)
  • src/features/meetings/midweek_editor/quick_settings/index.tsx (1 hunks)
  • src/features/meetings/midweek_editor/quick_settings/index.types.ts (1 hunks)
  • src/features/meetings/weekend_editor/quick_settings/index.tsx (1 hunks)
  • src/features/meetings/weekend_editor/quick_settings/index.types.ts (1 hunks)
  • src/layouts/root_layout/index.tsx (1 hunks)
  • src/pages/meetings/midweek/index.tsx (4 hunks)
  • src/pages/meetings/midweek/useMidweek.tsx (2 hunks)
  • src/pages/meetings/weekend/index.tsx (4 hunks)
  • src/pages/meetings/weekend/useWeekend.tsx (2 hunks)

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@rhahao rhahao merged commit 9ebc1b9 into sws2apps:main Aug 26, 2024
12 checks passed
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 19

Outside diff range, codebase verification and nitpick comments (11)
src/features/congregation/settings/meeting_forms/display_name/index.tsx (1)

5-18: LGTM!

The component is correctly implemented. However, consider adding prop types for better type safety.

The code changes are approved.

Consider adding prop types to the component:

+import PropTypes from 'prop-types';

const DisplayName = () => {
  const { t } = useAppTranslation();

  const { displayNameMeeting, handleDisplayNameMeetingToggle } =
    useDisplayName();

  return (
    <SwitchWithLabel
      label={t('tr_useDisplayNameMeeting')}
      checked={displayNameMeeting}
      onChange={handleDisplayNameMeetingToggle}
    />
  );
};

+DisplayName.propTypes = {
+  displayNameMeeting: PropTypes.bool.isRequired,
+  handleDisplayNameMeetingToggle: PropTypes.func.isRequired,
+};

export default DisplayName;
src/features/congregation/settings/meeting_settings/midweek/index.tsx (1)

Line range hint 9-20: LGTM!

The component is correctly implemented. However, consider adding prop types for better type safety.

The code changes are approved.

Consider adding prop types to the component:

+import PropTypes from 'prop-types';

const MidweekSettings = () => {
  return (
    <Box sx={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>
      <DayTime />

      <Box
        sx={{
          display: 'flex',
          flexDirection: 'column',
          gap: '16px',
        }}
      >
        <AssignmentPreferences />
        <AuxiliaryClassroom />
      </Box>
    </Box>
  );
};

+MidweekSettings.propTypes = {
+  DayTime: PropTypes.element.isRequired,
+  AssignmentPreferences: PropTypes.element.isRequired,
+  AuxiliaryClassroom: PropTypes.element.isRequired,
+};

export default MidweekSettings;
src/features/congregation/settings/meeting_settings/weekend/monthly_warning/index.tsx (1)

5-18: LGTM!

The component is correctly implemented. However, consider adding prop types for better type safety.

The code changes are approved.

Consider adding prop types to the component:

+import PropTypes from 'prop-types';

const MonthlyWarning = () => {
  const { t } = useAppTranslation();

  const { handleMonthlyOverlapToggle, monthlyOverlapShown } =
    useWeekendSettings();

  return (
    <SwitchWithLabel
      label={t('tr_repeatedMonthlyWarning')}
      helper={t('tr_repeatedMonthlyWarningDesc')}
      checked={monthlyOverlapShown}
      onChange={handleMonthlyOverlapToggle}
    />
  );
};

+MonthlyWarning.propTypes = {
+  handleMonthlyOverlapToggle: PropTypes.func.isRequired,
+  monthlyOverlapShown: PropTypes.bool.isRequired,
+};

export default MonthlyWarning;
src/features/congregation/settings/meeting_settings/weekend/day_time/index.tsx (1)

7-34: Minor improvement: Pass handleMeetingTimeChange directly to onChange.

Instead of wrapping handleMeetingTimeChange in an arrow function, you can pass it directly to onChange.

- onChange={(time) => handleMeetingTimeChange(time)}
+ onChange={handleMeetingTimeChange}
src/features/about/useAbout.tsx (1)

Line range hint 8-43: Minor improvement: Include more context in the error message.

In handleForceReload, include more context in the error message to make it easier to debug.

- console.error(error.message);
+ console.error('Error in handleForceReload:', error.message);
src/features/congregation/settings/meeting_forms/midweek_exact_date/useMidweekExactDate.tsx (1)

6-37: Minor improvement: Include error handling in handleDisplayExactDateToggle.

In handleDisplayExactDateToggle, include error handling to manage potential issues during the update.

 const handleDisplayExactDateToggle = async () => {
+  try {
     const exactDate = structuredClone(
       settings.cong_settings.schedule_exact_date_enabled
     );

     exactDate.value = !displayExactDate;
     exactDate.updatedAt = new Date().toISOString();

     await dbAppSettingsUpdate({
       'cong_settings.schedule_exact_date_enabled': exactDate,
     });
+  } catch (error) {
+    console.error('Error updating exact date setting:', error.message);
+  }
 };
src/features/congregation/settings/congregation_privacy/index.tsx (1)

10-10: outgoingTalksPublic state and toggle functionality still present

The outgoingTalksPublic state and its associated toggle functionality have not been removed from the codebase. They are still present in the following files:

  • src/features/congregation/settings/congregation_privacy/outgoing_talk_access/useOutgoingTalkAccess.tsx
  • src/features/congregation/settings/congregation_privacy/outgoing_talk_access/index.tsx

Please ensure these are removed if they are no longer needed.

Analysis chain

Verify the removal of the outgoingTalksPublic state and its associated toggle functionality.

Ensure that the outgoingTalksPublic state and its associated toggle functionality have been correctly removed from the useCongregationPrivacy hook.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the removal of the `outgoingTalksPublic` state and its associated toggle functionality.

# Test: Search for the `outgoingTalksPublic` state and its associated toggle functionality. Expect: No occurrences of `outgoingTalksPublic`.
rg --type js --type ts --type tsx 'outgoingTalksPublic'

Length of output: 83


Script:

#!/bin/bash
# Description: Verify the removal of the `outgoingTalksPublic` state and its associated toggle functionality.

# Test: Search for the `outgoingTalksPublic` state and its associated toggle functionality. Expect: No occurrences of `outgoingTalksPublic`.
rg --glob '*.js' --glob '*.ts' --glob '*.tsx' 'outgoingTalksPublic'

Length of output: 824

src/features/congregation/settings/meeting_settings/midweek/day_time/useDayTime.tsx (1)

8-21: Optimize useMemo dependency array.

The useMemo dependency array should include only the necessary dependencies. In this case, settings.cong_settings.format_24h_enabled and dataView are sufficient.

Apply this diff to optimize the dependency array:

 }, [settings.cong_settings.format_24h_enabled, dataView]);
src/features/congregation/settings/meeting_settings/weekend/day_time/useDayTime.tsx (1)

8-21: Optimize useMemo dependency array.

The useMemo dependency array should include only the necessary dependencies. In this case, settings.cong_settings.format_24h_enabled and dataView are sufficient.

Apply this diff to optimize the dependency array:

 }, [settings.cong_settings.format_24h_enabled, dataView]);
src/features/congregation/settings/meeting_settings/midweek/auxiliary_classroom/useAuxiliaryClassroom.tsx (2)

Line range hint 1-3: Fix typographical errors.

There is a typographical error in the variable name elligiblePersons.

Apply this diff to fix the typographical error:

    const elligiblePersons = persons.filter((record) =>
-      record.person_data.assignments.find(
+      record.person_data.assignments.some(

Also applies to: 14-42


Line range hint 44-74: Improve error handling and state updates.

The hook can be improved by adding error handling for the async functions and ensuring state updates are reflected immediately.

Apply this diff to improve error handling and state updates:

  const handleAuxClassToggle = async () => {
    const midweekSettings = structuredClone(
      settings.cong_settings.midweek_meeting
    );

    const current = midweekSettings.find((record) => record.type === dataView);

    current.class_count.value = auxClassEnabled ? 1 : 2;
    current.class_count.updatedAt = new Date().toISOString();

    try {
      await dbAppSettingsUpdate({
        'cong_settings.midweek_meeting': midweekSettings,
      });
      setAuxClassEnabled(!auxClassEnabled);
    } catch (error) {
      console.error('Failed to update auxiliary class toggle:', error);
    }
  };

  const handleAuxCounselorMainToggle = async () => {
    const midweekSettings = structuredClone(
      settings.cong_settings.midweek_meeting
    );

    const current = midweekSettings.find((record) => record.type === dataView);

    current.aux_class_counselor_default.enabled.value =
      !auxCounselorMainEnabled;
    current.aux_class_counselor_default.enabled.updatedAt =
      new Date().toISOString();

    try {
      await dbAppSettingsUpdate({
        'cong_settings.midweek_meeting': midweekSettings,
      });
      setAuxCounselorMainEnabled(!auxCounselorMainEnabled);
    } catch (error) {
      console.error('Failed to update auxiliary counselor main toggle:', error);
    }
  };

  const handleAuxCounselorMainPersonChange = async (value: string) => {
    const midweekSettings = structuredClone(
      settings.cong_settings.midweek_meeting
    );

    const current = midweekSettings.find((record) => record.type === dataView);

    current.aux_class_counselor_default.person.value = value;
    current.aux_class_counselor_default.person.updatedAt =
      new Date().toISOString();

    try {
      await dbAppSettingsUpdate({
        'cong_settings.midweek_meeting': midweekSettings,
      });
      setAuxCounselorMainPerson(value);
    } catch (error) {
      console.error('Failed to update auxiliary counselor main person:', error);
    }
  };
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2bb4c4d and b365351.

Files ignored due to path filters (1)
  • src/locales/en/meetings.json is excluded by !**/*.json
Files selected for processing (38)
  • src/features/about/index.tsx (2 hunks)
  • src/features/about/index.types.ts (1 hunks)
  • src/features/about/useAbout.tsx (2 hunks)
  • src/features/congregation/settings/congregation_privacy/index.tsx (3 hunks)
  • src/features/congregation/settings/congregation_privacy/outgoing_talk_access/index.tsx (1 hunks)
  • src/features/congregation/settings/congregation_privacy/outgoing_talk_access/useOutgoingTalkAccess.tsx (1 hunks)
  • src/features/congregation/settings/congregation_privacy/useCongregationPrivacy.tsx (2 hunks)
  • src/features/congregation/settings/meeting_forms/display_name/index.tsx (1 hunks)
  • src/features/congregation/settings/meeting_forms/display_name/useDisplayName.tsx (1 hunks)
  • src/features/congregation/settings/meeting_forms/index.tsx (3 hunks)
  • src/features/congregation/settings/meeting_forms/midweek_exact_date/index.tsx (1 hunks)
  • src/features/congregation/settings/meeting_forms/midweek_exact_date/useMidweekExactDate.tsx (1 hunks)
  • src/features/congregation/settings/meeting_forms/useMeetingForms.tsx (4 hunks)
  • src/features/congregation/settings/meeting_settings/midweek/assignment_preferences/index.tsx (1 hunks)
  • src/features/congregation/settings/meeting_settings/midweek/assignment_preferences/useAssignmentPreferences.tsx (1 hunks)
  • src/features/congregation/settings/meeting_settings/midweek/auxiliary_classroom/index.tsx (1 hunks)
  • src/features/congregation/settings/meeting_settings/midweek/auxiliary_classroom/useAuxiliaryClassroom.tsx (5 hunks)
  • src/features/congregation/settings/meeting_settings/midweek/day_time/index.tsx (1 hunks)
  • src/features/congregation/settings/meeting_settings/midweek/day_time/useDayTime.tsx (1 hunks)
  • src/features/congregation/settings/meeting_settings/midweek/index.tsx (2 hunks)
  • src/features/congregation/settings/meeting_settings/weekend/assignment_preferences/index.tsx (1 hunks)
  • src/features/congregation/settings/meeting_settings/weekend/assignment_preferences/useAssignmentPreferences.tsx (1 hunks)
  • src/features/congregation/settings/meeting_settings/weekend/day_time/index.tsx (1 hunks)
  • src/features/congregation/settings/meeting_settings/weekend/day_time/useDayTime.tsx (1 hunks)
  • src/features/congregation/settings/meeting_settings/weekend/index.tsx (2 hunks)
  • src/features/congregation/settings/meeting_settings/weekend/monthly_warning/index.tsx (1 hunks)
  • src/features/congregation/settings/meeting_settings/weekend/monthly_warning/useMonthlyWarning.tsx (1 hunks)
  • src/features/congregation/settings/meeting_settings/weekend/study_conductor/index.tsx (1 hunks)
  • src/features/congregation/settings/meeting_settings/weekend/study_conductor/useStudyConductor.tsx (1 hunks)
  • src/features/meetings/midweek_editor/quick_settings/index.tsx (1 hunks)
  • src/features/meetings/midweek_editor/quick_settings/index.types.ts (1 hunks)
  • src/features/meetings/weekend_editor/quick_settings/index.tsx (1 hunks)
  • src/features/meetings/weekend_editor/quick_settings/index.types.ts (1 hunks)
  • src/layouts/root_layout/index.tsx (1 hunks)
  • src/pages/meetings/midweek/index.tsx (4 hunks)
  • src/pages/meetings/midweek/useMidweek.tsx (2 hunks)
  • src/pages/meetings/weekend/index.tsx (4 hunks)
  • src/pages/meetings/weekend/useWeekend.tsx (2 hunks)
Files skipped from review due to trivial changes (5)
  • src/features/about/index.types.ts
  • src/features/congregation/settings/congregation_privacy/useCongregationPrivacy.tsx
  • src/features/congregation/settings/meeting_forms/useMeetingForms.tsx
  • src/features/meetings/midweek_editor/quick_settings/index.types.ts
  • src/features/meetings/weekend_editor/quick_settings/index.types.ts
Additional comments not posted (97)
src/features/congregation/settings/meeting_forms/display_name/index.tsx (2)

3-3: Verify the translation keys.

Ensure that the translation keys tr_useDisplayNameMeeting are correctly defined in the translation files.

Run the following script to verify the translation keys:

Verification successful

Translation Keys Verified Successfully

The translation key tr_useDisplayNameMeeting is correctly defined in multiple translation files across different locales. No issues were found.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the translation keys.

# Test: Search for the translation keys. Expect: Correctly defined keys.
rg --type json $'tr_useDisplayNameMeeting'

Length of output: 3239


1-2: Verify the useDisplayName hook.

Ensure that the useDisplayName hook is correctly implemented and handles state management as expected.

Run the following script to verify the implementation of useDisplayName:

src/features/congregation/settings/meeting_settings/midweek/index.tsx (1)

2-4: Verify the new components.

Ensure that the new components DayTime, AssignmentPreferences, and AuxiliaryClassroom are correctly implemented and handle their respective functionalities as expected.

Run the following script to verify the implementation of the new components:

Verification successful

Components Verified Successfully

The components DayTime, AssignmentPreferences, and AuxiliaryClassroom are correctly implemented and integrated into the codebase. Their presence and structure have been confirmed. No further issues were found regarding these components.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of the new components.

# Test: Search for the new components implementation. Expect: Correct implementation.
rg --type tsx $'DayTime'
rg --type tsx $'AssignmentPreferences'
rg --type tsx $'AuxiliaryClassroom'

Length of output: 180


Script:

#!/bin/bash
# Description: Locate and verify the implementation of the new components.

# Locate files that might contain the components.
fd 'DayTime' --extension tsx --exec rg 'function DayTime' {}
fd 'AssignmentPreferences' --extension tsx --exec rg 'function AssignmentPreferences' {}
fd 'AuxiliaryClassroom' --extension tsx --exec rg 'function AuxiliaryClassroom' {}

Length of output: 238


Script:

#!/bin/bash
# Description: Search for the components by name across all files.

# Search for the component names to locate their implementations.
rg 'DayTime' 
rg 'AssignmentPreferences' 
rg 'AuxiliaryClassroom' 

Length of output: 5969

src/features/congregation/settings/meeting_settings/weekend/monthly_warning/index.tsx (2)

3-3: Verify the translation keys.

Ensure that the translation keys tr_repeatedMonthlyWarning and tr_repeatedMonthlyWarningDesc are correctly defined in the translation files.

Run the following script to verify the translation keys:

Verification successful

Translation keys are correctly defined.

The translation keys tr_repeatedMonthlyWarning and tr_repeatedMonthlyWarningDesc are present and correctly defined across multiple locale files. No issues were found.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the translation keys.

# Test: Search for the translation keys. Expect: Correctly defined keys.
rg --type json $'tr_repeatedMonthlyWarning'
rg --type json $'tr_repeatedMonthlyWarningDesc'

Length of output: 10628


1-2: Verify the useWeekendSettings hook.

Ensure that the useWeekendSettings hook is correctly implemented and handles state management as expected.

Run the following script to verify the implementation of useWeekendSettings:

Verification successful

The useWeekendSettings hook is correctly implemented.

The hook, implemented as useMonthlyWarning, effectively manages state using Recoil and updates settings in the database. It provides the necessary functionality for handling monthly overlap warnings without any apparent issues.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of `useWeekendSettings`.

# Test: Search for the `useWeekendSettings` hook implementation. Expect: Correct implementation.
rg --type tsx $'useWeekendSettings'

Length of output: 62


Script:

#!/bin/bash
# Description: Verify the implementation of `useWeekendSettings`.

# Find all .tsx files and search for the `useWeekendSettings` hook implementation.
fd --extension tsx --exec rg 'useWeekendSettings' {}

Length of output: 134


Script:

#!/bin/bash
# Description: Locate and inspect the `useMonthlyWarning` file for `useWeekendSettings` implementation.

# Find the `useMonthlyWarning` file and display its contents.
fd 'useMonthlyWarning' --exec cat {}

Length of output: 1365

src/features/congregation/settings/meeting_forms/midweek_exact_date/index.tsx (2)

1-3: LGTM!

The import statements are appropriate and necessary for the component's functionality.

The code changes are approved.


5-19: LGTM!

The MidweekExactDate component is well-structured and follows best practices for using hooks and rendering components.

The code changes are approved.

src/features/congregation/settings/congregation_privacy/outgoing_talk_access/index.tsx (2)

1-3: LGTM!

The import statements are appropriate and necessary for the component's functionality.

The code changes are approved.


5-19: LGTM!

The OutgoingTalkAccess component is well-structured and follows best practices for using hooks and rendering components.

The code changes are approved.

src/features/congregation/settings/meeting_settings/weekend/index.tsx (2)

1-5: LGTM!

The import statements are appropriate and necessary for the component's functionality.

The code changes are approved.


Line range hint 7-24: LGTM!

The WeekendSettings component is well-structured and follows best practices for using layout components and rendering child components.

The code changes are approved.

src/features/congregation/settings/meeting_settings/midweek/assignment_preferences/index.tsx (5)

1-3: LGTM!

The import statements are correct and necessary for the component's functionality.

The code changes are approved.


5-6: LGTM!

The component definition and translation hook usage are correct.

The code changes are approved.


8-13: LGTM!

The useAssignmentPreferences hook usage is correct and necessary for managing assignment preferences state.

The code changes are approved.


15-29: LGTM!

The JSX structure and SwitchWithLabel components are correctly implemented.

The code changes are approved.


32-32: LGTM!

The export statement is correct.

The code changes are approved.

src/features/congregation/settings/meeting_settings/weekend/assignment_preferences/index.tsx (5)

1-3: LGTM!

The import statements are correct and necessary for the component's functionality.

The code changes are approved.


5-6: LGTM!

The component definition and translation hook usage are correct.

The code changes are approved.


8-13: LGTM!

The useAssignmentPreferences hook usage is correct and necessary for managing assignment preferences state.

The code changes are approved.


15-29: LGTM!

The JSX structure and SwitchWithLabel components are correctly implemented.

The code changes are approved.


32-32: LGTM!

The export statement is correct.

The code changes are approved.

src/features/congregation/settings/meeting_settings/midweek/day_time/index.tsx (5)

1-5: LGTM!

The import statements are correct and necessary for the component's functionality.

The code changes are approved.


7-8: LGTM!

The component definition and translation hook usage are correct.

The code changes are approved.


10-16: LGTM!

The useDayTime hook usage is correct and necessary for managing day and time state.

The code changes are approved.


18-32: LGTM!

The JSX structure and DaySelector and TimePicker components are correctly implemented.

The code changes are approved.


36-36: LGTM!

The export statement is correct.

The code changes are approved.

src/features/congregation/settings/meeting_settings/weekend/day_time/index.tsx (1)

1-5: LGTM!

The imports are appropriate for the functionality provided in the file.

The code changes are approved.

src/features/about/useAbout.tsx (1)

1-4: LGTM!

The imports are appropriate for the functionality provided in the file.

The code changes are approved.

src/features/congregation/settings/meeting_forms/midweek_exact_date/useMidweekExactDate.tsx (1)

1-4: LGTM!

The imports are appropriate for the functionality provided in the file.

The code changes are approved.

src/features/congregation/settings/meeting_forms/display_name/useDisplayName.tsx (1)

7-8: Verify Recoil state keys.

Ensure that the Recoil state keys settingsState and userDataViewState are correct and exist in the Recoil state management.

Verification successful

Recoil State Keys Verified

The Recoil state keys settingsState and userDataViewState are correctly defined in the codebase:

  • settingsState is defined as an atom in src/states/settings.ts.
  • userDataViewState is defined as a selector in src/states/settings.ts.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of Recoil state keys `settingsState` and `userDataViewState`.

# Test: Search for the Recoil state keys. Expect: Definitions of `settingsState` and `userDataViewState`.
rg --type js --type ts --type tsx 'const settingsState|const userDataViewState'

Length of output: 109


Script:

#!/bin/bash
# Description: Verify the existence of Recoil state keys `settingsState` and `userDataViewState`.

# Test: Search for the Recoil state keys. Expect: Definitions of `settingsState` and `userDataViewState`.
rg --type-add 'tsx:*.tsx' --type js --type ts --type tsx 'const settingsState|const userDataViewState'

Length of output: 230

src/features/congregation/settings/congregation_privacy/index.tsx (1)

10-10: Verify the OutgoingTalkAccess component.

Ensure that the OutgoingTalkAccess component is correctly implemented and imported from the correct path.

Verification successful

Verified: The OutgoingTalkAccess component is correctly implemented and imported.

The OutgoingTalkAccess component is defined in src/features/congregation/settings/congregation_privacy/outgoing_talk_access/index.tsx, confirming that the import path is correct and the component is implemented as expected. No further action is required.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of the `OutgoingTalkAccess` component.

# Test: Search for the `OutgoingTalkAccess` component. Expect: Definition of the `OutgoingTalkAccess` component.
rg --type js --type ts --type tsx 'const OutgoingTalkAccess|function OutgoingTalkAccess'

Length of output: 118


Script:

#!/bin/bash
# Description: Verify the implementation of the `OutgoingTalkAccess` component.

# Test: Search for the `OutgoingTalkAccess` component definition in .js, .ts, and .tsx files.
rg 'const OutgoingTalkAccess|function OutgoingTalkAccess' --glob '*.js' --glob '*.ts' --glob '*.tsx'

Length of output: 224

src/features/congregation/settings/congregation_privacy/outgoing_talk_access/useOutgoingTalkAccess.tsx (1)

7-8: Verify Recoil state keys.

Ensure that the Recoil state keys settingsState and userDataViewState are correct and exist in the Recoil state management.

Verification successful

Recoil State Keys Verified

The Recoil state keys settingsState and userDataViewState are correctly defined in the codebase:

  • settingsState is defined in src/states/settings.ts.
  • userDataViewState is also defined in src/states/settings.ts.

These definitions confirm that the state keys are valid and exist as expected.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of Recoil state keys `settingsState` and `userDataViewState`.

# Test: Search for the Recoil state keys. Expect: Definitions of `settingsState` and `userDataViewState`.
rg --type js --type ts --type tsx 'const settingsState|const userDataViewState'

Length of output: 109


Script:

#!/bin/bash
# Description: Verify the existence of Recoil state keys `settingsState` and `userDataViewState`.

# Test: Search for the Recoil state keys. Expect: Definitions of `settingsState` and `userDataViewState`.
rg --type js --type ts --type jsx 'const settingsState|const userDataViewState'

Length of output: 109


Script:

#!/bin/bash
# Description: Verify the existence of Recoil state keys `settingsState` and `userDataViewState`.

# Test: Search for the Recoil state keys. Expect: Definitions of `settingsState` and `userDataViewState`.
rg --type js --type ts 'const settingsState|const userDataViewState'

Length of output: 196

src/pages/meetings/midweek/useMidweek.tsx (3)

13-13: LGTM!

The state variable quickSettingsOpen is correctly initialized to false.

The code changes are approved.


15-15: LGTM!

The handler function handleOpenQuickSettings correctly sets quickSettingsOpen to true.

The code changes are approved.


17-17: LGTM!

The handler function handleCloseQuickSettings correctly sets quickSettingsOpen to false.

The code changes are approved.

src/pages/meetings/weekend/useWeekend.tsx (3)

13-13: LGTM!

The state variable quickSettingsOpen is correctly initialized to false.

The code changes are approved.


17-17: LGTM!

The handler function handleOpenQuickSettings correctly sets quickSettingsOpen to true.

The code changes are approved.


19-19: LGTM!

The handler function handleCloseQuickSettings correctly sets quickSettingsOpen to false.

The code changes are approved.

src/features/congregation/settings/meeting_settings/weekend/monthly_warning/useMonthlyWarning.tsx (4)

1-4: LGTM!

The imports are correctly included and relevant to the functionality of the hook.

The code changes are approved.


6-11: LGTM!

The hook is correctly defined and the initial state is appropriately set.

The code changes are approved.


28-36: LGTM!

The useEffect hook is correctly implemented.

The code changes are approved.


38-41: LGTM!

The return object is correctly structured.

The code changes are approved.

src/features/congregation/settings/meeting_settings/weekend/study_conductor/index.tsx (7)

1-7: Verify the necessity of all imports.

Ensure that all imported modules are necessary and correctly used in the file.

Verify that each imported module is used in the code and remove any unused imports.


9-11: Ensure proper usage of useAppTranslation hook.

The useAppTranslation hook is used to get the translation function t.

Verify that the translations for tr_displayWSConductorSubstitutions, tr_displayWSConductorDesc, and tr_mainStudyConductor exist and are correctly defined.


12-13: Ensure proper usage of useBreakpoints hook.

The useBreakpoints hook is used to get the laptopUp breakpoint.

Verify that the laptopUp breakpoint is correctly defined and used in the application.


14-20: Ensure proper usage of useStudyConductor hook.

The useStudyConductor hook is used to get various handler functions and state variables.

Verify that the useStudyConductor hook is correctly implemented and returns the expected values.


22-28: Ensure correct rendering of TwoColumnsRow.

The TwoColumnsRow component is rendered with conditional styling based on the laptopUp breakpoint.

Verify that the TwoColumnsRow component is correctly implemented and the styling is applied as expected.


29-34: Ensure correct rendering of SwitchWithLabel.

The SwitchWithLabel component is rendered with the correct label, helper text, checked state, and onChange handler.

Verify that the SwitchWithLabel component is correctly implemented and the props are passed as expected.


36-46: Ensure correct rendering of Select component.

The Select component is rendered with the correct label, value, onChange handler, and menu items.

Verify that the Select component is correctly implemented and the props are passed as expected.

src/features/meetings/midweek_editor/quick_settings/index.tsx (6)

1-11: Verify the necessity of all imports.

Ensure that all imported modules are necessary and correctly used in the file.

Verify that each imported module is used in the code and remove any unused imports.


13-17: Ensure proper usage of useAppTranslation hook.

The useAppTranslation hook is used to get the translation function t.

Verify that the translations for tr_midweekMeeting, tr_assignmentPreferences exist and are correctly defined.


20-25: Ensure correct rendering of QuickSettings component.

The QuickSettings component is rendered with the correct title, open state, and onClose handler.

Verify that the QuickSettings component is correctly implemented and the props are passed as expected.


26-33: Ensure correct rendering of child components in the first Stack.

The first Stack component contains DayTime, MidweekExactDate, and DisplayName components.

Verify that the DayTime, MidweekExactDate, and DisplayName components are correctly implemented and the props are passed as expected.


34-36: Ensure correct rendering of child components in the second Stack.

The second Stack component contains the AuxiliaryClassroom component.

Verify that the AuxiliaryClassroom component is correctly implemented and the props are passed as expected.


38-43: Ensure correct rendering of child components in the third Stack.

The third Stack component contains a Typography component and the AssignmentPreferences component.

Verify that the Typography and AssignmentPreferences components are correctly implemented and the props are passed as expected.

src/features/meetings/weekend_editor/quick_settings/index.tsx (6)

1-12: Verify the necessity of all imports.

Ensure that all imported modules are necessary and correctly used in the file.

Verify that each imported module is used in the code and remove any unused imports.


14-18: Ensure proper usage of useAppTranslation hook.

The useAppTranslation hook is used to get the translation function t.

Verify that the translations for tr_weekendMeeting, tr_assignmentPreferences exist and are correctly defined.


21-26: Ensure correct rendering of QuickSettings component.

The QuickSettings component is rendered with the correct title, open state, and onClose handler.

Verify that the QuickSettings component is correctly implemented and the props are passed as expected.


27-33: Ensure correct rendering of child components in the first Stack.

The first Stack component contains DayTime, StudyConductor, and DisplayName components.

Verify that the DayTime, StudyConductor, and DisplayName components are correctly implemented and the props are passed as expected.


34-39: Ensure correct rendering of child components in the second Stack.

The second Stack component contains MonthlyWarning and OutgoingTalkAccess components.

Verify that the MonthlyWarning and OutgoingTalkAccess components are correctly implemented and the props are passed as expected.


41-45: Ensure correct rendering of child components in the third Stack.

The third Stack component contains a Typography component and the AssignmentPreferences component.

Verify that the Typography and AssignmentPreferences components are correctly implemented and the props are passed as expected.

src/features/congregation/settings/meeting_settings/midweek/auxiliary_classroom/index.tsx (5)

1-7: LGTM!

The import statements are relevant and correctly used.

The code changes are approved.


9-11: LGTM!

The component correctly uses the useAppTranslation hook.

The code changes are approved.


12-13: LGTM!

The component correctly uses the useBreakpoints hook.

The code changes are approved.


14-22: LGTM!

The component correctly uses the useAuxiliaryClassroom custom hook.

The code changes are approved.


24-60: LGTM!

The component correctly renders UI elements based on the state and handles user interactions.

The code changes are approved.

src/features/congregation/settings/meeting_settings/midweek/assignment_preferences/useAssignmentPreferences.tsx (5)

1-4: LGTM!

The import statements are relevant and correctly used.

The code changes are approved.


6-9: LGTM!

The hook correctly uses the useRecoilValue hook to get the state.

The code changes are approved.


10-12: LGTM!

The hook correctly initializes state variables.

The code changes are approved.


43-54: LGTM!

The hook correctly uses the useEffect hook to initialize state variables based on the settings.

The code changes are approved.


56-62: LGTM!

The hook correctly returns the state variables and functions.

The code changes are approved.

src/features/congregation/settings/meeting_settings/weekend/assignment_preferences/useAssignmentPreferences.tsx (5)

1-4: LGTM!

The import statements are relevant and correctly used.

The code changes are approved.


6-9: LGTM!

The hook correctly uses the useRecoilValue hook to get the state.

The code changes are approved.


10-12: LGTM!

The hook correctly initializes state variables.

The code changes are approved.


44-55: LGTM!

The hook correctly uses the useEffect hook to initialize state variables based on the settings.

The code changes are approved.


57-62: LGTM!

The hook correctly returns the state variables and functions.

The code changes are approved.

src/features/congregation/settings/meeting_settings/midweek/day_time/useDayTime.tsx (1)

64-70: LGTM!

The hook is correctly implemented and returns the expected state and handler functions.

The code changes are approved.

src/features/congregation/settings/meeting_settings/weekend/day_time/useDayTime.tsx (1)

64-70: LGTM!

The hook is correctly implemented and returns the expected state and handler functions.

The code changes are approved.

src/layouts/root_layout/index.tsx (2)

75-75: LGTM!

The RootLayout component is correctly implemented and the changes are properly integrated.

The code changes are approved.


Line range hint 1-75: Ensure proper prop validation.

Ensure that the About component properly validates and utilizes the updatePwa prop.

Run the following script to verify the About component's prop validation:

src/pages/meetings/midweek/index.tsx (4)

13-13: New import added.

The import statement for QuickSettingsMidweekMeeting is correctly added.

The code changes are approved.


33-35: New state variable and handlers added.

The state variable quickSettingsOpen and handlers handleCloseQuickSettings and handleOpenQuickSettings are correctly added to manage the quick settings functionality.

The code changes are approved.


46-51: Conditional rendering of QuickSettingsMidweekMeeting.

The QuickSettingsMidweekMeeting component is correctly rendered based on the quickSettingsOpen state. The onClose prop is correctly set to handleCloseQuickSettings.

The code changes are approved.


75-75: New quickAction prop added to PageTitle.

The quickAction prop is correctly added to the PageTitle component and is linked to the handleOpenQuickSettings function.

The code changes are approved.

src/features/about/index.tsx (6)

1-1: New import added.

The import statement for IconButton is correctly added.

The code changes are approved.


4-4: New prop type AboutProps added.

The AboutProps type is correctly imported to define the props for the About component.

The code changes are approved.


8-8: New import added.

The import statement for IconButton is correctly added.

The code changes are approved.


12-20: New prop type and method added.

The About component now accepts props of type AboutProps, and the handleForceReload method is correctly destructured from the useAbout hook.

The code changes are approved.


59-60: Layout adjustments in Box component.

The justifyContent property is correctly set to space-between to improve the alignment and spacing of the child elements.

The code changes are approved.


63-77: Layout adjustments and new IconButton for reload action.

The layout adjustments in the Box component improve the alignment and spacing of the child elements. The new IconButton is correctly added to trigger the handleForceReload function.

The code changes are approved.

src/pages/meetings/weekend/index.tsx (4)

8-9: New import added.

The import statement for QuickSettingsWeekendMeeting is correctly added.

The code changes are approved.


31-33: New state variable and handlers added.

The state variable quickSettingsOpen and handlers handleCloseQuickSettings and handleOpenQuickSettings are correctly added to manage the quick settings functionality.

The code changes are approved.


44-49: Conditional rendering of QuickSettingsWeekendMeeting.

The QuickSettingsWeekendMeeting component is correctly rendered based on the quickSettingsOpen state. The onClose prop is correctly set to handleCloseQuickSettings.

The code changes are approved.


73-73: New quickAction prop added to PageTitle.

The quickAction prop is correctly added to the PageTitle component and is linked to the handleOpenQuickSettings function.

The code changes are approved.

src/features/congregation/settings/meeting_forms/index.tsx (2)

1-10: LGTM!

The imports are appropriate for the changes made in the component.

The code changes are approved.


31-94: LGTM!

The restructuring using Stack from Material-UI improves the visual hierarchy and spacing between elements. The introduction of MidweekExactDate and DisplayName components enhances modularity.

The code changes are approved.

src/features/congregation/settings/meeting_settings/weekend/study_conductor/useStudyConductor.tsx (1)

1-13: LGTM!

The imports are appropriate for the functionality of the custom hook.

The code changes are approved.

Comment on lines +12 to +23
const handleDisplayNameMeetingToggle = async () => {
const displayNameEnabled = structuredClone(
settings.cong_settings.display_name_enabled.meetings
);

displayNameEnabled.value = !displayNameMeeting;
displayNameEnabled.updatedAt = new Date().toISOString();

await dbAppSettingsUpdate({
'cong_settings.display_name_enabled.meetings': displayNameEnabled,
});
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Add error handling for the async function.

The handleDisplayNameMeetingToggle function should handle potential errors from the async operation to ensure robustness.

 const handleDisplayNameMeetingToggle = async () => {
   try {
     const displayNameEnabled = structuredClone(
       settings.cong_settings.display_name_enabled.meetings
     );

     displayNameEnabled.value = !displayNameMeeting;
     displayNameEnabled.updatedAt = new Date().toISOString();

     await dbAppSettingsUpdate({
       'cong_settings.display_name_enabled.meetings': displayNameEnabled,
     });
   } catch (error) {
     console.error('Failed to update display name setting:', error);
   }
 };
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
const handleDisplayNameMeetingToggle = async () => {
const displayNameEnabled = structuredClone(
settings.cong_settings.display_name_enabled.meetings
);
displayNameEnabled.value = !displayNameMeeting;
displayNameEnabled.updatedAt = new Date().toISOString();
await dbAppSettingsUpdate({
'cong_settings.display_name_enabled.meetings': displayNameEnabled,
});
};
const handleDisplayNameMeetingToggle = async () => {
try {
const displayNameEnabled = structuredClone(
settings.cong_settings.display_name_enabled.meetings
);
displayNameEnabled.value = !displayNameMeeting;
displayNameEnabled.updatedAt = new Date().toISOString();
await dbAppSettingsUpdate({
'cong_settings.display_name_enabled.meetings': displayNameEnabled,
});
} catch (error) {
console.error('Failed to update display name setting:', error);
}
};

Consider adding a loading state.

Consider adding a loading state to provide feedback to the user during the async operation.

 const useMeetingForms = () => {
   const settings = useRecoilValue(settingsState);
   const dataView = useRecoilValue(userDataViewState);

   const [displayNameMeeting, setDisplayNameMeeting] = useState(false);
+  const [isLoading, setIsLoading] = useState(false);

   const handleDisplayNameMeetingToggle = async () => {
+    setIsLoading(true);
     try {
       const displayNameEnabled = structuredClone(
         settings.cong_settings.display_name_enabled.meetings
       );

       displayNameEnabled.value = !displayNameMeeting;
       displayNameEnabled.updatedAt = new Date().toISOString();

       await dbAppSettingsUpdate({
         'cong_settings.display_name_enabled.meetings': displayNameEnabled,
       });
     } catch (error) {
       console.error('Failed to update display name setting:', error);
     } finally {
+      setIsLoading(false);
     }
   };

   useEffect(() => {
     setDisplayNameMeeting(
       settings.cong_settings.display_name_enabled.meetings.value
     );
   }, [settings, dataView]);

   return {
     displayNameMeeting,
+    isLoading,
     handleDisplayNameMeetingToggle,
   };
 };
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
const handleDisplayNameMeetingToggle = async () => {
const displayNameEnabled = structuredClone(
settings.cong_settings.display_name_enabled.meetings
);
displayNameEnabled.value = !displayNameMeeting;
displayNameEnabled.updatedAt = new Date().toISOString();
await dbAppSettingsUpdate({
'cong_settings.display_name_enabled.meetings': displayNameEnabled,
});
};
const useMeetingForms = () => {
const settings = useRecoilValue(settingsState);
const dataView = useRecoilValue(userDataViewState);
const [displayNameMeeting, setDisplayNameMeeting] = useState(false);
const [isLoading, setIsLoading] = useState(false);
const handleDisplayNameMeetingToggle = async () => {
setIsLoading(true);
try {
const displayNameEnabled = structuredClone(
settings.cong_settings.display_name_enabled.meetings
);
displayNameEnabled.value = !displayNameMeeting;
displayNameEnabled.updatedAt = new Date().toISOString();
await dbAppSettingsUpdate({
'cong_settings.display_name_enabled.meetings': displayNameEnabled,
});
} catch (error) {
console.error('Failed to update display name setting:', error);
} finally {
setIsLoading(false);
}
};
useEffect(() => {
setDisplayNameMeeting(
settings.cong_settings.display_name_enabled.meetings.value
);
}, [settings, dataView]);
return {
displayNameMeeting,
isLoading,
handleDisplayNameMeetingToggle,
};
};

Comment on lines +12 to +25
const handleOutgoingTalksPublicToggle = async () => {
const weekendSettings = structuredClone(
settings.cong_settings.weekend_meeting
);

const current = weekendSettings.find((record) => record.type === dataView);

current.outgoing_talks_schedule_public.value = !outgoingTalksPublic;
current.outgoing_talks_schedule_public.updatedAt = new Date().toISOString();

await dbAppSettingsUpdate({
'cong_settings.weekend_meeting': weekendSettings,
});
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Add error handling for the async function.

The handleOutgoingTalksPublicToggle function should handle potential errors from the async operation to ensure robustness.

 const handleOutgoingTalksPublicToggle = async () => {
   try {
     const weekendSettings = structuredClone(
       settings.cong_settings.weekend_meeting
     );

     const current = weekendSettings.find((record) => record.type === dataView);

     current.outgoing_talks_schedule_public.value = !outgoingTalksPublic;
     current.outgoing_talks_schedule_public.updatedAt = new Date().toISOString();

     await dbAppSettingsUpdate({
       'cong_settings.weekend_meeting': weekendSettings,
     });
   } catch (error) {
     console.error('Failed to update outgoing talks public setting:', error);
   }
 };
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
const handleOutgoingTalksPublicToggle = async () => {
const weekendSettings = structuredClone(
settings.cong_settings.weekend_meeting
);
const current = weekendSettings.find((record) => record.type === dataView);
current.outgoing_talks_schedule_public.value = !outgoingTalksPublic;
current.outgoing_talks_schedule_public.updatedAt = new Date().toISOString();
await dbAppSettingsUpdate({
'cong_settings.weekend_meeting': weekendSettings,
});
};
const handleOutgoingTalksPublicToggle = async () => {
try {
const weekendSettings = structuredClone(
settings.cong_settings.weekend_meeting
);
const current = weekendSettings.find((record) => record.type === dataView);
current.outgoing_talks_schedule_public.value = !outgoingTalksPublic;
current.outgoing_talks_schedule_public.updatedAt = new Date().toISOString();
await dbAppSettingsUpdate({
'cong_settings.weekend_meeting': weekendSettings,
});
} catch (error) {
console.error('Failed to update outgoing talks public setting:', error);
}
};

Consider adding a loading state.

Consider adding a loading state to provide feedback to the user during the async operation.

 const useOutgoingTalkAccess = () => {
   const settings = useRecoilValue(settingsState);
   const dataView = useRecoilValue(userDataViewState);

   const [outgoingTalksPublic, setOutgoingTalksPublic] = useState(false);
+  const [isLoading, setIsLoading] = useState(false);

   const handleOutgoingTalksPublicToggle = async () => {
+    setIsLoading(true);
     try {
       const weekendSettings = structuredClone(
         settings.cong_settings.weekend_meeting
       );

       const current = weekendSettings.find((record) => record.type === dataView);

       current.outgoing_talks_schedule_public.value = !outgoingTalksPublic;
       current.outgoing_talks_schedule_public.updatedAt = new Date().toISOString();

       await dbAppSettingsUpdate({
         'cong_settings.weekend_meeting': weekendSettings,
       });
     } catch (error) {
       console.error('Failed to update outgoing talks public setting:', error);
     } finally {
+      setIsLoading(false);
     }
   };

   useEffect(() => {
     const weekendSettings = settings.cong_settings.weekend_meeting.find(
       (record) => record.type === dataView
     );

     setOutgoingTalksPublic(
       weekendSettings.outgoing_talks_schedule_public.value
     );
   }, [settings, dataView]);

   return {
     outgoingTalksPublic,
+    isLoading,
     handleOutgoingTalksPublicToggle,
   };
 };
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
const handleOutgoingTalksPublicToggle = async () => {
const weekendSettings = structuredClone(
settings.cong_settings.weekend_meeting
);
const current = weekendSettings.find((record) => record.type === dataView);
current.outgoing_talks_schedule_public.value = !outgoingTalksPublic;
current.outgoing_talks_schedule_public.updatedAt = new Date().toISOString();
await dbAppSettingsUpdate({
'cong_settings.weekend_meeting': weekendSettings,
});
};
const useOutgoingTalkAccess = () => {
const settings = useRecoilValue(settingsState);
const dataView = useRecoilValue(userDataViewState);
const [outgoingTalksPublic, setOutgoingTalksPublic] = useState(false);
const [isLoading, setIsLoading] = useState(false);
const handleOutgoingTalksPublicToggle = async () => {
setIsLoading(true);
try {
const weekendSettings = structuredClone(
settings.cong_settings.weekend_meeting
);
const current = weekendSettings.find((record) => record.type === dataView);
current.outgoing_talks_schedule_public.value = !outgoingTalksPublic;
current.outgoing_talks_schedule_public.updatedAt = new Date().toISOString();
await dbAppSettingsUpdate({
'cong_settings.weekend_meeting': weekendSettings,
});
} catch (error) {
console.error('Failed to update outgoing talks public setting:', error);
} finally {
setIsLoading(false);
}
};
useEffect(() => {
const weekendSettings = settings.cong_settings.weekend_meeting.find(
(record) => record.type === dataView
);
setOutgoingTalksPublic(
weekendSettings.outgoing_talks_schedule_public.value
);
}, [settings, dataView]);
return {
outgoingTalksPublic,
isLoading,
handleOutgoingTalksPublicToggle,
};
};

Comment on lines +12 to +25
const handleMonthlyOverlapToggle = async () => {
const weekendSettings = structuredClone(
settings.cong_settings.weekend_meeting
);

const current = weekendSettings.find((record) => record.type === dataView);

current.consecutive_monthly_parts_notice_shown.value = !monthlyOverlapShown;
current.consecutive_monthly_parts_notice_shown.updatedAt =
new Date().toISOString();

await dbAppSettingsUpdate({
'cong_settings.weekend_meeting': weekendSettings,
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding error handling for the database update.

The handler function is correctly implemented but could benefit from error handling for the database update to ensure robustness.

Apply this diff to add error handling:

 const handleMonthlyOverlapToggle = async () => {
   const weekendSettings = structuredClone(
     settings.cong_settings.weekend_meeting
   );

   const current = weekendSettings.find((record) => record.type === dataView);

   current.consecutive_monthly_parts_notice_shown.value = !monthlyOverlapShown;
   current.consecutive_monthly_parts_notice_shown.updatedAt =
     new Date().toISOString();

-  await dbAppSettingsUpdate({
-    'cong_settings.weekend_meeting': weekendSettings,
-  });
+  try {
+    await dbAppSettingsUpdate({
+      'cong_settings.weekend_meeting': weekendSettings,
+    });
+  } catch (error) {
+    console.error('Failed to update settings:', error);
+  }
 };
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
const handleMonthlyOverlapToggle = async () => {
const weekendSettings = structuredClone(
settings.cong_settings.weekend_meeting
);
const current = weekendSettings.find((record) => record.type === dataView);
current.consecutive_monthly_parts_notice_shown.value = !monthlyOverlapShown;
current.consecutive_monthly_parts_notice_shown.updatedAt =
new Date().toISOString();
await dbAppSettingsUpdate({
'cong_settings.weekend_meeting': weekendSettings,
});
const handleMonthlyOverlapToggle = async () => {
const weekendSettings = structuredClone(
settings.cong_settings.weekend_meeting
);
const current = weekendSettings.find((record) => record.type === dataView);
current.consecutive_monthly_parts_notice_shown.value = !monthlyOverlapShown;
current.consecutive_monthly_parts_notice_shown.updatedAt =
new Date().toISOString();
try {
await dbAppSettingsUpdate({
'cong_settings.weekend_meeting': weekendSettings,
});
} catch (error) {
console.error('Failed to update settings:', error);
}
};

Comment on lines +13 to +26
const handleAutoOpeningPrayerToggle = async () => {
const midweekSettings = structuredClone(
settings.cong_settings.midweek_meeting
);

const current = midweekSettings.find((record) => record.type === dataView);

current.opening_prayer_auto_assigned.value = !autoAssignOpeningPrayer;
current.opening_prayer_auto_assigned.updatedAt = new Date().toISOString();

await dbAppSettingsUpdate({
'cong_settings.midweek_meeting': midweekSettings,
});
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure proper error handling in async function.

The async function handleAutoOpeningPrayerToggle does not handle potential errors from the dbAppSettingsUpdate call.

Apply this diff to add error handling:

 const handleAutoOpeningPrayerToggle = async () => {
   const midweekSettings = structuredClone(
     settings.cong_settings.midweek_meeting
   );

   const current = midweekSettings.find((record) => record.type === dataView);

   current.opening_prayer_auto_assigned.value = !autoAssignOpeningPrayer;
   current.opening_prayer_auto_assigned.updatedAt = new Date().toISOString();

-  await dbAppSettingsUpdate({
-    'cong_settings.midweek_meeting': midweekSettings,
-  });
+  try {
+    await dbAppSettingsUpdate({
+      'cong_settings.midweek_meeting': midweekSettings,
+    });
+  } catch (error) {
+    console.error('Failed to update settings', error);
+  }
 };
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
const handleAutoOpeningPrayerToggle = async () => {
const midweekSettings = structuredClone(
settings.cong_settings.midweek_meeting
);
const current = midweekSettings.find((record) => record.type === dataView);
current.opening_prayer_auto_assigned.value = !autoAssignOpeningPrayer;
current.opening_prayer_auto_assigned.updatedAt = new Date().toISOString();
await dbAppSettingsUpdate({
'cong_settings.midweek_meeting': midweekSettings,
});
};
const handleAutoOpeningPrayerToggle = async () => {
const midweekSettings = structuredClone(
settings.cong_settings.midweek_meeting
);
const current = midweekSettings.find((record) => record.type === dataView);
current.opening_prayer_auto_assigned.value = !autoAssignOpeningPrayer;
current.opening_prayer_auto_assigned.updatedAt = new Date().toISOString();
try {
await dbAppSettingsUpdate({
'cong_settings.midweek_meeting': midweekSettings,
});
} catch (error) {
console.error('Failed to update settings', error);
}
};

Comment on lines +28 to +41
const handleAutoClosingPrayerToggle = async () => {
const midweekSettings = structuredClone(
settings.cong_settings.midweek_meeting
);

const current = midweekSettings.find((record) => record.type === dataView);

current.closing_prayer_auto_assigned.value = !autoAssignClosingPrayer;
current.closing_prayer_auto_assigned.updatedAt = new Date().toISOString();

await dbAppSettingsUpdate({
'cong_settings.midweek_meeting': midweekSettings,
});
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure proper error handling in async function.

The async function handleAutoClosingPrayerToggle does not handle potential errors from the dbAppSettingsUpdate call.

Apply this diff to add error handling:

 const handleAutoClosingPrayerToggle = async () => {
   const midweekSettings = structuredClone(
     settings.cong_settings.midweek_meeting
   );

   const current = midweekSettings.find((record) => record.type === dataView);

   current.closing_prayer_auto_assigned.value = !autoAssignClosingPrayer;
   current.closing_prayer_auto_assigned.updatedAt = new Date().toISOString();

-  await dbAppSettingsUpdate({
-    'cong_settings.midweek_meeting': midweekSettings,
-  });
+  try {
+    await dbAppSettingsUpdate({
+      'cong_settings.midweek_meeting': midweekSettings,
+    });
+  } catch (error) {
+    console.error('Failed to update settings', error);
+  }
 };
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
const handleAutoClosingPrayerToggle = async () => {
const midweekSettings = structuredClone(
settings.cong_settings.midweek_meeting
);
const current = midweekSettings.find((record) => record.type === dataView);
current.closing_prayer_auto_assigned.value = !autoAssignClosingPrayer;
current.closing_prayer_auto_assigned.updatedAt = new Date().toISOString();
await dbAppSettingsUpdate({
'cong_settings.midweek_meeting': midweekSettings,
});
};
const handleAutoClosingPrayerToggle = async () => {
const midweekSettings = structuredClone(
settings.cong_settings.midweek_meeting
);
const current = midweekSettings.find((record) => record.type === dataView);
current.closing_prayer_auto_assigned.value = !autoAssignClosingPrayer;
current.closing_prayer_auto_assigned.updatedAt = new Date().toISOString();
try {
await dbAppSettingsUpdate({
'cong_settings.midweek_meeting': midweekSettings,
});
} catch (error) {
console.error('Failed to update settings', error);
}
};

Comment on lines +23 to +36
const handleMeetingDayChange = async (value: number) => {
const weekendSettings = structuredClone(
settings.cong_settings.weekend_meeting
);

const current = weekendSettings.find((record) => record.type === dataView);

current.weekday.value = value;
current.weekday.updatedAt = new Date().toISOString();

await dbAppSettingsUpdate({
'cong_settings.weekend_meeting': weekendSettings,
});
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure proper error handling for external calls.

Consider adding error handling for dbAppSettingsUpdate to manage potential failures gracefully.

Apply this diff to add error handling:

 const handleMeetingDayChange = async (value: number) => {
-  await dbAppSettingsUpdate({
-    'cong_settings.weekend_meeting': weekendSettings,
-  });
+  try {
+    await dbAppSettingsUpdate({
+      'cong_settings.weekend_meeting': weekendSettings,
+    });
+  } catch (error) {
+    console.error('Failed to update meeting day:', error);
+  }
 };
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
const handleMeetingDayChange = async (value: number) => {
const weekendSettings = structuredClone(
settings.cong_settings.weekend_meeting
);
const current = weekendSettings.find((record) => record.type === dataView);
current.weekday.value = value;
current.weekday.updatedAt = new Date().toISOString();
await dbAppSettingsUpdate({
'cong_settings.weekend_meeting': weekendSettings,
});
};
const handleMeetingDayChange = async (value: number) => {
const weekendSettings = structuredClone(
settings.cong_settings.weekend_meeting
);
const current = weekendSettings.find((record) => record.type === dataView);
current.weekday.value = value;
current.weekday.updatedAt = new Date().toISOString();
try {
await dbAppSettingsUpdate({
'cong_settings.weekend_meeting': weekendSettings,
});
} catch (error) {
console.error('Failed to update meeting day:', error);
}
};

Comment on lines +55 to +62
useEffect(() => {
const weekendSettings = settings.cong_settings.weekend_meeting.find(
(record) => record.type === dataView
);

setMeetingDay(weekendSettings.weekday.value);
setMeetingTime(generateDateFromTime(weekendSettings.time.value));
}, [settings, dataView]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure proper error handling for external calls.

Consider adding error handling for the generateDateFromTime function to manage potential failures gracefully.

Apply this diff to add error handling:

 useEffect(() => {
-  setMeetingDay(weekendSettings.weekday.value);
-  setMeetingTime(generateDateFromTime(weekendSettings.time.value));
+  try {
+    setMeetingDay(weekendSettings.weekday.value);
+    setMeetingTime(generateDateFromTime(weekendSettings.time.value));
+  } catch (error) {
+    console.error('Failed to initialize meeting settings:', error);
+  }
 }, [settings, dataView]);
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
useEffect(() => {
const weekendSettings = settings.cong_settings.weekend_meeting.find(
(record) => record.type === dataView
);
setMeetingDay(weekendSettings.weekday.value);
setMeetingTime(generateDateFromTime(weekendSettings.time.value));
}, [settings, dataView]);
useEffect(() => {
const weekendSettings = settings.cong_settings.weekend_meeting.find(
(record) => record.type === dataView
);
try {
setMeetingDay(weekendSettings.weekday.value);
setMeetingTime(generateDateFromTime(weekendSettings.time.value));
} catch (error) {
console.error('Failed to initialize meeting settings:', error);
}
}, [settings, dataView]);

Comment on lines +38 to +53
const handleMeetingTimeChange = async (value: Date) => {
const time = value ? formatDate(value, 'HH:mm') : '00:00';

const weekendSettings = structuredClone(
settings.cong_settings.weekend_meeting
);

const current = weekendSettings.find((record) => record.type === dataView);

current.time.value = time;
current.time.updatedAt = new Date().toISOString();

await dbAppSettingsUpdate({
'cong_settings.weekend_meeting': weekendSettings,
});
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure proper error handling for external calls.

Consider adding error handling for dbAppSettingsUpdate to manage potential failures gracefully.

Apply this diff to add error handling:

 const handleMeetingTimeChange = async (value: Date) => {
-  await dbAppSettingsUpdate({
-    'cong_settings.weekend_meeting': weekendSettings,
-  });
+  try {
+    await dbAppSettingsUpdate({
+      'cong_settings.weekend_meeting': weekendSettings,
+    });
+  } catch (error) {
+    console.error('Failed to update meeting time:', error);
+  }
 };
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
const handleMeetingTimeChange = async (value: Date) => {
const time = value ? formatDate(value, 'HH:mm') : '00:00';
const weekendSettings = structuredClone(
settings.cong_settings.weekend_meeting
);
const current = weekendSettings.find((record) => record.type === dataView);
current.time.value = time;
current.time.updatedAt = new Date().toISOString();
await dbAppSettingsUpdate({
'cong_settings.weekend_meeting': weekendSettings,
});
};
const handleMeetingTimeChange = async (value: Date) => {
const time = value ? formatDate(value, 'HH:mm') : '00:00';
const weekendSettings = structuredClone(
settings.cong_settings.weekend_meeting
);
const current = weekendSettings.find((record) => record.type === dataView);
current.time.value = time;
current.time.updatedAt = new Date().toISOString();
try {
await dbAppSettingsUpdate({
'cong_settings.weekend_meeting': weekendSettings,
});
} catch (error) {
console.error('Failed to update meeting time:', error);
}
};

Comment on lines +21 to +22
const [subtituteWTConductorDisplayed, setSubtituteWTConductorDisplayed] =
useState(true);
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix typographical errors.

There are typographical errors in the variable names subtituteWTConductorDisplayed and personsWTCondcutorList.

Apply this diff to fix the typographical errors:

-  const [subtituteWTConductorDisplayed, setSubtituteWTConductorDisplayed] =
+  const [substituteWTConductorDisplayed, setSubstituteWTConductorDisplayed] =
    useState(true);

-  const personsWTCondcutorList = useMemo(() => {
+  const personsWTConductorList = useMemo(() => {

Also applies to: 25-42, 61-74, 76-85

Comment on lines +44 to +59
const handleWTConductorToggle = async () => {
const weekendSettings = structuredClone(
settings.cong_settings.weekend_meeting
);

const current = weekendSettings.find((record) => record.type === dataView);

current.substitute_w_study_conductor_displayed.value =
!subtituteWTConductorDisplayed;
current.substitute_w_study_conductor_displayed.updatedAt =
new Date().toISOString();

await dbAppSettingsUpdate({
'cong_settings.weekend_meeting': weekendSettings,
});
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Improve error handling and state updates.

The hook can be improved by adding error handling for the async functions and ensuring state updates are reflected immediately.

Apply this diff to improve error handling and state updates:

  const handleWTConductorToggle = async () => {
    const weekendSettings = structuredClone(
      settings.cong_settings.weekend_meeting
    );

    const current = weekendSettings.find((record) => record.type === dataView);

    current.substitute_w_study_conductor_displayed.value =
      !substituteWTConductorDisplayed;
    current.substitute_w_study_conductor_displayed.updatedAt =
      new Date().toISOString();

    try {
      await dbAppSettingsUpdate({
        'cong_settings.weekend_meeting': weekendSettings,
      });
      setSubstituteWTConductorDisplayed(!substituteWTConductorDisplayed);
    } catch (error) {
      console.error('Failed to update WT conductor toggle:', error);
    }
  };

  const handleWTConductorMainPersonChange = async (value: string) => {
    const weekendSettings = structuredClone(
      settings.cong_settings.weekend_meeting
    );

    const current = weekendSettings.find((record) => record.type === dataView);

    current.w_study_conductor_default.value = value;
    current.w_study_conductor_default.updatedAt = new Date().toISOString();

    try {
      await dbAppSettingsUpdate({
        'cong_settings.weekend_meeting': weekendSettings,
      });
      setWTConductorMainPerson(value);
    } catch (error) {
      console.error('Failed to update WT conductor main person:', error);
    }
  };

Also applies to: 61-74

Copy link

cypress bot commented Aug 26, 2024

organized-app    Run #1196

Run Properties:  status check passed Passed #1196  •  git commit 9ebc1b9a97: feat(Meetings): add quick settings for midweek and weekend meetings (#2403)
Project organized-app
Branch Review main
Run status status check passed Passed #1196
Run duration 00m 06s
Commit git commit 9ebc1b9a97: feat(Meetings): add quick settings for midweek and weekend meetings (#2403)
Committer Rasamoelina, Haja Onjatiana
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 1
View all changes introduced in this branch ↗︎

@rhahao
Copy link
Member Author

rhahao commented Nov 30, 2024

🎉 This PR is included in version 2.130.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant