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

fix: ensure that lost modal styles are applied throughout application #4291

Merged
merged 2 commits into from
Oct 4, 2024

Conversation

sjschlapbach
Copy link
Member

@sjschlapbach sjschlapbach commented Oct 4, 2024

Summary by CodeRabbit

  • New Features
    • None
  • Improvements
    • Updated the version of @uzh-bf/design-system across multiple components for enhanced functionality and consistency.
    • Enhanced modal behavior and appearance in the Question component during question deletion.
    • Improved layout and styling of links in the EmbeddingModal.
    • Updated width behavior of the SessionQRModal.
    • Enhanced responsiveness and layout of the AdvancedLiveQuizSettings modal.
    • Adjusted padding and height properties in the LeaveLeaderboardModal.

Copy link

aviator-app bot commented Oct 4, 2024

Current Aviator status

Aviator will automatically update this comment as the status of the PR changes.
Comment /aviator refresh to force Aviator to re-examine your PR (or learn about other /aviator commands).

This PR was merged manually (without Aviator). Merging manually can negatively impact the performance of the queue. Consider using Aviator next time.


See the real-time status of this PR on the Aviator webapp.
Use the Aviator Chrome Extension to see the status of your PR within GitHub.

Copy link

coderabbitai bot commented Oct 4, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

This pull request updates multiple package.json files across various applications and packages to increment the version of the @uzh-bf/design-system dependency from 3.0.0-alpha.29 to 3.0.0-alpha.30. Additionally, several components have undergone styling modifications, particularly in their modal implementations, focusing on adjusting height constraints and layout properties to enhance responsiveness and visual presentation.

Changes

File Path Change Summary
apps/auth/package.json Dependency version updated: @uzh-bf/design-system from 3.0.0-alpha.29 to 3.0.0-alpha.30.
apps/backend-docker/package.json Dependency version updated: @uzh-bf/design-system from 3.0.0-alpha.29 to 3.0.0-alpha.30.
apps/docs/package.json Dependency version updated: @uzh-bf/design-system from 3.0.0-alpha.29 to 3.0.0-alpha.30.
apps/frontend-control/package.json Dependency version updated: @uzh-bf/design-system from 3.0.0-alpha.29 to 3.0.0-alpha.30.
apps/frontend-manage/package.json Dependency version updated: @uzh-bf/design-system from 3.0.0-alpha.29 to 3.0.0-alpha.30.
apps/frontend-pwa/package.json Dependency version updated: @uzh-bf/design-system from 3.0.0-alpha.29 to 3.0.0-alpha.30.
apps/func-incoming-responses/package.json Dependency version updated: @uzh-bf/design-system from 3.0.0-alpha.29 to 3.0.0-alpha.30.
apps/func-response-processor/package.json Dependency version updated: @uzh-bf/design-system from 3.0.0-alpha.29 to 3.0.0-alpha.30.
apps/office-addin/package.json Dependency version updated: @uzh-bf/design-system from 3.0.0-alpha.29 to 3.0.0-alpha.30.
packages/markdown/package.json Peer dependency updated: @uzh-bf/design-system from 3.0.0-alpha.29 to 3.0.0-alpha.30.
packages/shared-components/package.json Peer dependency updated: @uzh-bf/design-system from 3.0.0-alpha.29 to 3.0.0-alpha.30.
packages/transactional/package.json Dependency version updated: @uzh-bf/design-system from 3.0.0-alpha.29 to 3.0.0-alpha.30.
apps/frontend-manage/src/components/courses/modals/SupportModal.tsx Class name updated in SupportModal to enhance modal height properties.
apps/frontend-manage/src/components/courses/modals/CourseArchiveModal.tsx Class name simplified in CourseArchiveModal to streamline styling.
apps/frontend-manage/src/components/courses/modals/CourseDeletionItem.tsx Fixed height removed from CourseDeletionItem, allowing content-based height determination.
apps/frontend-manage/src/components/courses/modals/CourseDeletionModal.tsx Class name updated for responsive design in CourseDeletionModal.
apps/frontend-manage/src/components/courses/modals/CourseManipulationModal.tsx Class properties adjusted in CourseManipulationModal for layout improvement.
apps/frontend-manage/src/components/courses/modals/ExtensionModal.tsx Class name modified for simplified height constraints in ExtensionModal.
apps/frontend-manage/src/components/courses/modals/PublishConfirmationModal.tsx Class name updated in PublishConfirmationModal to affect height and positioning.
apps/frontend-manage/src/components/questions/QuestionEditModal.tsx Modal height constraint adjusted and validation schema enhanced in QuestionEditModal.
apps/frontend-manage/src/components/sessions/LiveQuizNameChangeModal.tsx Class name modified in LiveQuizNameChangeModal to streamline layout.
apps/frontend-manage/src/components/sessions/cockpit/CourseQRModal.tsx Class name updated in CourseQRModal to remove fixed height.
apps/frontend-manage/src/components/sessions/creation/StackDescriptionModal.tsx Class name simplified in StackDescriptionModal for height constraints.
apps/frontend-manage/src/components/sessions/creation/groupActivity/GroupActivityClueModal.tsx Class name modified in GroupActivityClueModal to remove fixed height.
apps/frontend-manage/src/components/sessions/creation/liveQuiz/AdvancedLiveQuizSettings.tsx Modal layout and styling adjusted for responsiveness in AdvancedLiveQuizSettings.
apps/frontend-manage/src/components/sessions/creation/liveQuiz/LiveQuizCreationBlock.tsx Class name updated in LiveQuizCreationBlock to affect height and padding.
apps/frontend-manage/src/components/user/SuspendedFirstLoginModal.tsx Class name modified in SuspendedFirstLoginModal to enhance height adaptability.
apps/frontend-pwa/src/components/flags/FlagElementModal.tsx Class name updated in FlagElementModal to remove fixed height and improve form handling.
apps/frontend-pwa/src/components/participant/LeaveLeaderboardModal.tsx New property added and class name modified in LeaveLeaderboardModal.
apps/frontend-pwa/src/components/participant/ParticipantProfileModal.tsx Class name simplified in ParticipantProfileModal to alter height and overflow behavior.

Possibly related PRs

Suggested reviewers

  • rschlaefli

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

@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: 0

🧹 Outside diff range and nitpick comments (7)
apps/frontend-pwa/src/components/participant/LeaveLeaderboardModal.tsx (1)

39-39: Approved: Modal style improvements

The changes to the Modal component's className prop improve the layout consistency:

  1. Adding min-h-max ensures the modal always accommodates its content height.
  2. Changing pt-0 to !pt-0 guarantees zero top padding, overriding any conflicting styles.

These adjustments should resolve any layout issues related to the modal's height and padding.

For better readability and maintainability, consider splitting the className object into multiple lines:

className={{
  content: 'h-max min-h-max w-[40rem] self-center !pt-0',
}}

This format makes it easier to add or modify classes in the future.

apps/frontend-manage/src/components/sessions/cockpit/SessionQRModal.tsx (2)

46-46: LGTM! Consider adding a comment for clarity.

The addition of !w-max to the Modal's content className is appropriate. It ensures the modal takes up the maximum width needed for its content, which aligns with the PR objective of applying lost modal styles.

For improved clarity, consider adding a brief comment explaining the purpose of !w-max. For example:

 content: 'h-max max-h-full !w-max max-w-6xl overflow-y-auto',
+// !w-max ensures the modal takes up the maximum width needed for its content

This comment would help future developers understand the intent behind this specific style.


Line range hint 1-95: Consider extracting QR code rendering logic

The component is well-structured and follows React best practices. To further improve code organization and reusability, consider extracting the QR code rendering logic into a separate component.

You could create a new component, for example, QRCodeWithLink, that encapsulates the QR code, title, description, and "Present QR Code" button. This would reduce duplication and make the SessionQRModal component more concise. Here's a sketch of how it could look:

interface QRCodeWithLinkProps {
  title: string;
  description: string;
  path: string;
  buttonCy: string;
}

function QRCodeWithLink({ title, description, path, buttonCy }: QRCodeWithLinkProps) {
  const t = useTranslations()

  return (
    <div className="flex-1">
      <H3>{title}</H3>
      <Prose>{description}</Prose>
      <QR
        className={{ title: 'text-base', canvas: 'flex justify-center' }}
        path={path}
        width={100}
      />
      <Link passHref href={`/qr${path}`} target="_blank">
        <Button
          fluid
          className={{
            root: twMerge(
              'bg-primary-80 mt-2 h-9 text-lg font-bold text-white'
            ),
          }}
          data={{ cy: buttonCy }}
        >
          <Button.Label>{t('manage.general.presentQrCode')}</Button.Label>
        </Button>
      </Link>
    </div>
  )
}

Then, in the SessionQRModal, you could use it like this:

<div className="flex flex-col gap-8 md:flex-row">
  <QRCodeWithLink
    title="Account Link"
    description={t('manage.cockpit.qrCodeAccountLinkDescription')}
    path={accountRelativeLink}
    buttonCy={`qr-link-${shortname}`}
  />
  <QRCodeWithLink
    title={t('manage.cockpit.qrCodeDirectLinkTitle')}
    description={t('manage.cockpit.qrCodeDirectLinkDescription')}
    path={sessionRelativeLink}
    buttonCy={`qr-direct-link-${sessionId}`}
  />
</div>

This refactoring would make the code more maintainable and easier to update in the future.

apps/frontend-manage/src/components/sessions/EmbeddingModal.tsx (3)

37-50: Improved link styling and layout

The changes to the LazyHMACLink component enhance the layout and styling of the link display. The max-w-full class on the outer <div> prevents overflow, while the new className on the <a> tag improves text wrapping and width constraints. These modifications align well with the PR objective of ensuring consistent modal styles throughout the application.

Consider adding a title attribute to the <a> tag with the full link URL. This would provide a tooltip with the complete link when users hover over it, which can be helpful when the link is truncated due to the max-w-[calc(100%-3.5rem)] constraint.

 <a
   data-cy={`open-embedding-link-session-${sessionId}`}
   className="max-w-[calc(100%-3.5rem)] break-words text-sm"
+  title={link}
 >
   {link}
 </a>

Line range hint 107-109: Enhanced link parameters for better context and control

The updates to the LazyHMACLink component call within the questions mapping improve the functionality and flexibility of the embedded links. The addition of questionIx and showSolution parameters provides more context and control over the embedded view, while hideControls=true ensures a cleaner presentation.

For consistency, consider applying the hideControls=true parameter to the evaluation link as well (line 95). This would ensure a uniform appearance across all embedded views.

 <LazyHMACLink sessionId={sessionId} params={``} />

to

 <LazyHMACLink sessionId={sessionId} params={`hideControls=true`} />

Line range hint 114-117: Added leaderboard link with consistent styling

The addition of a LazyHMACLink component for the leaderboard enhances the functionality of the modal. The use of leaderboard=true and hideControls=true parameters maintains consistency with the other embedded links.

To improve clarity, consider adding a comment explaining the purpose of the leaderboard link, especially if it's a new feature. This would help other developers understand its significance quickly.

 <div>
+  {/* Leaderboard link for displaying user rankings */}
   <div className="w-30 font-bold">
     {t('shared.generic.leaderboard')}:
   </div>
   <LazyHMACLink
     sessionId={sessionId}
     params={`leaderboard=true&hideControls=true`}
   />
 </div>
apps/frontend-manage/src/components/questions/Question.tsx (1)

Line range hint 243-288: LGTM! Consider adding error handling.

The changes to the Modal component for question deletion look good. The async function in onPrimaryAction correctly handles the deletion process, including updating the Apollo cache and the UI.

Consider adding error handling to the delete operation. For example:

try {
  await deleteQuestion({
    // ... existing code ...
  });
  unsetDeletedQuestion(id);
  setIsDeletionModalOpen(false);
} catch (error) {
  console.error('Error deleting question:', error);
  // Optionally, show an error message to the user
}

This will ensure that any errors during the deletion process are caught and logged, improving the robustness of the application.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between c368dc9 and 697f76e.

📒 Files selected for processing (6)
  • apps/frontend-manage/src/components/courses/modals/EnableGamificationModal.tsx (0 hunks)
  • apps/frontend-manage/src/components/questions/Question.tsx (2 hunks)
  • apps/frontend-manage/src/components/sessions/EmbeddingModal.tsx (1 hunks)
  • apps/frontend-manage/src/components/sessions/cockpit/SessionQRModal.tsx (1 hunks)
  • apps/frontend-manage/src/components/sessions/creation/liveQuiz/AdvancedLiveQuizSettings.tsx (2 hunks)
  • apps/frontend-pwa/src/components/participant/LeaveLeaderboardModal.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • apps/frontend-manage/src/components/courses/modals/EnableGamificationModal.tsx
🔇 Additional comments (5)
apps/frontend-manage/src/components/sessions/EmbeddingModal.tsx (1)

Line range hint 1-124: Overall assessment: Improved modal functionality and consistency

The changes in this file successfully address the PR objective of ensuring that modal styles are applied throughout the application. The modifications to the LazyHMACLink component and its usage within EmbeddingModal enhance the layout, styling, and functionality of the embedded links. The addition of the leaderboard link further improves the modal's features.

Key improvements:

  1. Better link styling and layout in LazyHMACLink
  2. Enhanced link parameters for questions, providing more context and control
  3. Addition of a leaderboard link with consistent styling

The suggested minor improvements (adding a title attribute, ensuring consistency with hideControls, and adding a comment for the leaderboard link) would further enhance the code's clarity and consistency.

apps/frontend-manage/src/components/sessions/creation/liveQuiz/AdvancedLiveQuizSettings.tsx (4)

49-49: Improved modal responsiveness and layout

The updated className prop enhances the modal's responsiveness and layout:

  • !w-full ensures the modal takes full width on smaller screens.
  • max-w-[60rem] prevents the modal from becoming too wide on larger screens.
  • !pb-0 removes bottom padding, allowing for custom padding within the modal content.

These changes provide better control over the modal's appearance across different screen sizes.


52-52: Enhanced responsive layout

The updated outer div's className improves the component's responsiveness:

  • Vertical layout on smaller screens with flex flex-col.
  • Horizontal layout on medium and larger screens with md:flex-row.
  • Appropriate spacing with gap-6 for vertical layout and md:gap-0 for horizontal layout.

This change ensures better content organization and readability across different device sizes.


53-53: Improved inner layout responsiveness

The updated inner divs' className properties enhance the layout's flexibility:

  • Both divs use w-full for full width on smaller screens.
  • They switch to md:w-1/2 on medium screens and above, creating a two-column layout.
  • The first div adds md:mr-8 for right margin on larger screens, ensuring proper spacing.

These changes create a more adaptable and visually balanced layout across various screen sizes.

Also applies to: 79-79


Line range hint 49-79: Summary: Effective implementation of responsive design

The changes in this PR successfully address the objective of ensuring modal styles are applied throughout the application. The modifications to the AdvancedLiveQuizSettings component significantly improve its responsiveness and layout:

  1. The modal now has a more controlled width and padding.
  2. The outer layout adapts between vertical and horizontal arrangements based on screen size.
  3. Inner elements adjust their width and spacing to maintain visual balance across devices.

These improvements enhance the overall user experience without altering the component's core functionality. The implementation follows responsive design best practices and should integrate well with the rest of the application.

Copy link

cypress bot commented Oct 4, 2024

klicker-uzh    Run #3132

Run Properties:  status check passed Passed #3132  •  git commit a5d8c97963 ℹ️: Merge 47d032a93d5020084cd4f4af47820c99872b934e into c368dc99bcbd035b2a34b4ceb5c4...
Project klicker-uzh
Branch Review modal-styles
Run status status check passed Passed #3132
Run duration 09m 43s
Commit git commit a5d8c97963 ℹ️: Merge 47d032a93d5020084cd4f4af47820c99872b934e into c368dc99bcbd035b2a34b4ceb5c4...
Committer Julius Schlapbach
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 1
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 47
View all changes introduced in this branch ↗︎

Copy link

sonarcloud bot commented Oct 4, 2024

@sjschlapbach sjschlapbach merged commit 0774ff8 into v3 Oct 4, 2024
13 of 16 checks passed
@sjschlapbach sjschlapbach deleted the modal-styles branch October 4, 2024 13:49
Copy link

cypress bot commented Oct 4, 2024

klicker-uzh    Run #3134

Run Properties:  status check passed Passed #3134  •  git commit 0774ff8cf3: fix: ensure that lost modal styles are applied throughout application (#4291)
Project klicker-uzh
Branch Review v3
Run status status check passed Passed #3134
Run duration 09m 33s
Commit git commit 0774ff8cf3: fix: ensure that lost modal styles are applied throughout application (#4291)
Committer Julius Schlapbach
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 47
View all changes introduced in this branch ↗︎

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

Successfully merging this pull request may close these issues.

1 participant