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(web): deadline detail #17427

Merged
merged 6 commits into from
Jan 8, 2025
Merged

fix(web): deadline detail #17427

merged 6 commits into from
Jan 8, 2025

Conversation

disaerna
Copy link
Member

@disaerna disaerna commented Jan 7, 2025

Grant

What

Detail panel
Display date period
Combine status texts

Remove extra spacing

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced grant deadline information display with updated terminology.
    • Improved conditional rendering of the ExtraPanel based on relevant grant files or support links.
    • Added localization for deadline period text to support multiple languages.
  • Improvements

    • Refined layout of grant sidebar components by adjusting spacing.
    • Enhanced visual styling of grant cards with updated border color.
  • Bug Fixes

    • Prevented rendering of empty ExtraPanels, improving user interface clarity.
    • Improved display of grant application information by combining status and deadline displays.

These updates provide a more informative and streamlined user experience when viewing grant details.

@disaerna disaerna added the automerge Merge this PR as soon as all checks pass label Jan 7, 2025
@disaerna disaerna requested a review from a team as a code owner January 7, 2025 15:05
Copy link
Contributor

coderabbitai bot commented Jan 7, 2025

Walkthrough

The pull request introduces several modifications to the Grants section of the web application, focusing on improving the rendering and display of grant-related information. Changes include conditional rendering of the ExtraPanel, updates to the DetailPanel for displaying grant status and deadline information, removal of a <Stack> component in the GrantSidebar, addition of a new localization message for the deadline period, and enhancement of the Status interface with a deadlinePeriod property.

Changes

File Change Summary
apps/web/screens/Grants/Grant/Grant.tsx Conditionally render ExtraPanel based on presence of files or support links
apps/web/screens/Grants/Grant/GrantSidebar/DetailPanel.tsx Updated rendering of status and deadline, added margin, changed deadline label
apps/web/screens/Grants/Grant/GrantSidebar/ExtraPanel.tsx Added marginBottom={3} to Box component
apps/web/screens/Grants/Grant/GrantSidebar/GrantSidebar.tsx Removed <Stack> component, directly placed panels in fragment
apps/web/screens/Grants/messages.ts Added new deadlinePeriod message for localization
apps/web/screens/Grants/utils.ts Updated Status interface, added deadlinePeriod to parseStatus function

Possibly related PRs

Suggested labels

automerge

Suggested reviewers

  • thorkellmani
  • RunarVestmann

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4f63b0d and 1db6301.

📒 Files selected for processing (1)
  • apps/web/components/GrantCardsList/GrantCardsList.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • apps/web/components/GrantCardsList/GrantCardsList.tsx

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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.

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
Member

@thorkellmani thorkellmani left a comment

Choose a reason for hiding this comment

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

LGTM 🐝

@datadog-island-is
Copy link

datadog-island-is bot commented Jan 7, 2025

Datadog Report

All test runs 83f16f4 🔗

10 Total Test Services: 0 Failed, 10 Passed
🔻 Test Sessions change in coverage: 2 decreased, 1 increased (+0.04%), 197 no change

Test Services
This report shows up to 10 services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
air-discount-scheme-backend 0 0 0 63 0 22.56s N/A Link
air-discount-scheme-web 0 0 0 2 0 6.57s N/A Link
api 0 0 0 4 0 2.48s N/A Link
api-catalogue-services 0 0 0 23 0 9.08s N/A Link
api-domains-air-discount-scheme 0 0 0 6 0 16.63s N/A Link
api-domains-assets 0 0 0 3 0 9.55s N/A Link
api-domains-auth-admin 0 0 0 18 0 10.1s 1 no change Link
api-domains-communications 0 0 0 5 0 30.28s N/A Link
api-domains-criminal-record 0 0 0 5 0 8.42s N/A Link
api-domains-driving-license 0 0 0 23 0 27.26s N/A Link

🔻 Code Coverage Decreases vs Default Branch (2)

  • license-api - jest 34.12% (-0.01%) - Details
  • services-user-notification - jest 68.85% (-0.01%) - Details

Copy link

codecov bot commented Jan 7, 2025

Codecov Report

Attention: Patch coverage is 0% with 23 lines in your changes missing coverage. Please review.

Project coverage is 35.67%. Comparing base (53e35da) to head (3d6579a).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
apps/web/screens/Grants/utils.ts 0.00% 15 Missing ⚠️
apps/web/screens/Grants/Grant/Grant.tsx 0.00% 2 Missing ⚠️
.../screens/Grants/Grant/GrantSidebar/DetailPanel.tsx 0.00% 2 Missing ⚠️
...screens/Grants/Grant/GrantSidebar/GrantSidebar.tsx 0.00% 2 Missing ⚠️
...s/web/components/GrantCardsList/GrantCardsList.tsx 0.00% 1 Missing ⚠️
...b/screens/Grants/Grant/GrantSidebar/ExtraPanel.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #17427   +/-   ##
=======================================
  Coverage   35.67%   35.67%           
=======================================
  Files        6941     6941           
  Lines      149131   149178   +47     
  Branches    42640    42658   +18     
=======================================
+ Hits        53196    53217   +21     
- Misses      95935    95961   +26     
Flag Coverage Δ
judicial-system-backend 55.88% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
apps/web/screens/Grants/messages.ts 0.00% <ø> (ø)
...s/web/components/GrantCardsList/GrantCardsList.tsx 0.00% <0.00%> (ø)
...b/screens/Grants/Grant/GrantSidebar/ExtraPanel.tsx 0.00% <0.00%> (ø)
apps/web/screens/Grants/Grant/Grant.tsx 0.00% <0.00%> (ø)
.../screens/Grants/Grant/GrantSidebar/DetailPanel.tsx 0.00% <0.00%> (ø)
...screens/Grants/Grant/GrantSidebar/GrantSidebar.tsx 0.00% <0.00%> (ø)
apps/web/screens/Grants/utils.ts 0.00% <0.00%> (ø)

... and 13 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 53e35da...3d6579a. Read the comment docs.

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: 1

🧹 Nitpick comments (1)
apps/web/screens/Grants/Grant/GrantSidebar/DetailPanel.tsx (1)

71-73: Consider adding date format localization

The deadline period display could benefit from localized date formatting to match user preferences.

-          formatMessage(m.single.deadlinePeriod),
+          formatMessage(m.single.deadlinePeriod),
+          status.deadlinePeriod ? (
+            <Text variant="medium">
+              {formatDate(status.deadlinePeriod, locale)}
+            </Text>
+          ) : undefined,
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d7a639d and 9c28c1e.

📒 Files selected for processing (6)
  • apps/web/screens/Grants/Grant/Grant.tsx (1 hunks)
  • apps/web/screens/Grants/Grant/GrantSidebar/DetailPanel.tsx (2 hunks)
  • apps/web/screens/Grants/Grant/GrantSidebar/ExtraPanel.tsx (1 hunks)
  • apps/web/screens/Grants/Grant/GrantSidebar/GrantSidebar.tsx (1 hunks)
  • apps/web/screens/Grants/messages.ts (1 hunks)
  • apps/web/screens/Grants/utils.ts (4 hunks)
✅ Files skipped from review due to trivial changes (1)
  • apps/web/screens/Grants/Grant/GrantSidebar/ExtraPanel.tsx
🧰 Additional context used
📓 Path-based instructions (5)
apps/web/screens/Grants/Grant/Grant.tsx (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/web/screens/Grants/Grant/GrantSidebar/GrantSidebar.tsx (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/web/screens/Grants/messages.ts (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/web/screens/Grants/Grant/GrantSidebar/DetailPanel.tsx (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/web/screens/Grants/utils.ts (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
🔇 Additional comments (5)
apps/web/screens/Grants/Grant/GrantSidebar/GrantSidebar.tsx (1)

58-69: Verify spacing consistency between panels

The removal of the Stack component affects the vertical spacing between panels. Ensure that each panel has consistent spacing through individual margin controls.

✅ Verification successful

Spacing consistency is maintained ✓

The removal of the outer Stack component is safe as each panel (DetailPanel, ExtraPanel) maintains consistent internal spacing with space={2}, while the containing Box provides adequate padding with padding={3}.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if other sidebar components use Stack for spacing
rg -l "Stack.*space.*[23]" apps/web/screens/Grants

Length of output: 229


Script:

#!/bin/bash
# Check Stack implementations in sidebar components
echo "=== GrantSidebar.tsx ==="
rg "Stack.*space" apps/web/screens/Grants/Grant/GrantSidebar/GrantSidebar.tsx -B 1 -A 1

echo -e "\n=== ExtraPanel.tsx ==="
rg "Stack.*space" apps/web/screens/Grants/Grant/GrantSidebar/ExtraPanel.tsx -B 1 -A 1

echo -e "\n=== DetailPanel.tsx ==="
rg "Stack.*space" apps/web/screens/Grants/Grant/GrantSidebar/DetailPanel.tsx -B 1 -A 1

Length of output: 704

apps/web/screens/Grants/Grant/GrantSidebar/DetailPanel.tsx (1)

59-67: LGTM! Improved status display clarity

The status display now properly combines application status with deadline status using consistent Text components.

apps/web/screens/Grants/Grant/Grant.tsx (1)

193-197: LGTM! Improved conditional rendering

The ExtraPanel is now only rendered when there's actual content (files or support links) to display, which is more efficient and provides better UX.

apps/web/screens/Grants/messages.ts (2)

149-152: LGTM: New deadline period message added correctly.

The new deadlinePeriod message follows the established pattern and naming conventions.


146-148: Verify the deadline message's default text.

The deadline message uses the same default text ('Umsóknir') as the applications message. This could cause confusion as they appear to serve different purposes. Consider using a more specific text for the deadline message.

apps/web/screens/Grants/utils.ts Outdated Show resolved Hide resolved
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: 0

🧹 Nitpick comments (1)
apps/web/screens/Grants/utils.ts (1)

58-64: Consider extracting date formatting logic

The date formatting logic is repeated across multiple status cases. Consider extracting it into a helper function for better maintainability.

+const formatDeadlinePeriod = (dateFrom: string, dateTo: string): string => {
+  return `${format(new Date(dateFrom), 'dd.MM.yyyy')} - ${format(
+    new Date(dateTo),
+    'dd.MM.yyyy',
+  )}`;
+};

 case GrantStatus.Closed: {
   // ...
   return {
     // ...
-    deadlinePeriod:
-      grant.dateFrom && grant.dateTo
-        ? `${format(new Date(grant.dateFrom), 'dd.MM.yyyy')} - ${format(
-            new Date(grant.dateTo),
-            'dd.MM.yyyy',
-          )}`
-        : undefined,
+    deadlinePeriod: grant.dateFrom && grant.dateTo
+      ? formatDeadlinePeriod(grant.dateFrom, grant.dateTo)
+      : undefined,
   };
 }

Also applies to: 79-85, 133-139

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d7a639d and 9c28c1e.

📒 Files selected for processing (6)
  • apps/web/screens/Grants/Grant/Grant.tsx (1 hunks)
  • apps/web/screens/Grants/Grant/GrantSidebar/DetailPanel.tsx (2 hunks)
  • apps/web/screens/Grants/Grant/GrantSidebar/ExtraPanel.tsx (1 hunks)
  • apps/web/screens/Grants/Grant/GrantSidebar/GrantSidebar.tsx (1 hunks)
  • apps/web/screens/Grants/messages.ts (1 hunks)
  • apps/web/screens/Grants/utils.ts (4 hunks)
✅ Files skipped from review due to trivial changes (1)
  • apps/web/screens/Grants/Grant/GrantSidebar/ExtraPanel.tsx
🧰 Additional context used
📓 Path-based instructions (5)
apps/web/screens/Grants/messages.ts (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/web/screens/Grants/utils.ts (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/web/screens/Grants/Grant/Grant.tsx (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/web/screens/Grants/Grant/GrantSidebar/DetailPanel.tsx (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
apps/web/screens/Grants/Grant/GrantSidebar/GrantSidebar.tsx (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
🔇 Additional comments (7)
apps/web/screens/Grants/Grant/GrantSidebar/GrantSidebar.tsx (1)

58-69: Verify spacing between panels

The removal of the Stack component affects the spacing between panels. Ensure that each panel component (DetailPanel, ExtraPanel, InstitutionPanel) handles its own margin/spacing to maintain consistent layout.

✅ Verification successful

Spacing is properly handled by individual components

Each panel component already implements its own spacing:

  • DetailPanel: marginBottom={3}
  • ExtraPanel: marginBottom={3}
  • InstitutionPanel: No bottom margin (appropriate as last component)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for margin or spacing properties in panel components
ast-grep --pattern 'marginBottom={$_}'

Length of output: 40


Script:

#!/bin/bash
# Search for panel component implementations and their styles
echo "=== Panel Component Implementations ==="
fd "DetailPanel|ExtraPanel|InstitutionPanel" --type f

echo -e "\n=== Styled Components Usage ==="
rg -l "styled\." --type ts --type tsx

echo -e "\n=== CSS Properties in Components ==="
rg "margin|padding" --type ts --type tsx -g "*Panel*"

Length of output: 892


Script:

#!/bin/bash
# Check content of panel components
echo "=== DetailPanel Content ==="
cat "apps/web/screens/Grants/Grant/GrantSidebar/DetailPanel.tsx"

echo -e "\n=== ExtraPanel Content ==="
cat "apps/web/screens/Grants/Grant/GrantSidebar/ExtraPanel.tsx"

echo -e "\n=== InstitutionPanel Content ==="
cat "apps/web/components/InstitutionPanel/InstitutionPanel.tsx"

echo -e "\n=== Styled Components and CSS Properties ==="
rg "styled\.|margin|padding" -t tsx -t ts -g "*Panel.tsx"

Length of output: 7594

apps/web/screens/Grants/Grant/GrantSidebar/DetailPanel.tsx (3)

59-67: LGTM! Status text combination improves readability

The fragment combining application status and deadline status enhances information density while maintaining clarity.


71-73: LGTM! Deadline period display enhancement

The addition of a dedicated deadline period display improves the clarity of grant timing information.


97-102: LGTM! Proper spacing maintained

The addition of marginBottom={3} ensures consistent spacing after removing the Stack component from the parent.

apps/web/screens/Grants/utils.ts (1)

14-14: LGTM! Type definition enhancement

The addition of deadlinePeriod to the Status interface properly types the new feature.

apps/web/screens/Grants/Grant/Grant.tsx (1)

193-197: LGTM! Improved conditional rendering

The addition of the condition (grant.files || grant.supportLinks) prevents rendering empty ExtraPanel components, improving the UI.

apps/web/screens/Grants/messages.ts (1)

149-152: Clarify the distinction between 'deadline' and 'deadlinePeriod' messages.

The addition follows the established naming conventions and integrates well with the PR objectives. However, there's an existing deadline message (line 124) with a similar defaultMessage. Could you clarify the intended difference between these two messages to ensure we're not introducing redundancy?

@disaerna disaerna removed the automerge Merge this PR as soon as all checks pass label Jan 8, 2025
@disaerna disaerna added the automerge Merge this PR as soon as all checks pass label Jan 8, 2025
@kodiakhq kodiakhq bot merged commit 28af6af into main Jan 8, 2025
258 checks passed
@kodiakhq kodiakhq bot deleted the feat/grants/deadlinefixes branch January 8, 2025 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants