digdir / dialogporten-frontend

Brukergrensesnitt for Dialogporten
https://digdir.github.io/dialogporten-frontend/
MIT License
4 stars 2 forks source link

fix: Add search parameters to inbox message link #1366

Closed mbacherycz closed 1 week ago

mbacherycz commented 1 week ago

Hva er endret?

Dokumentasjon / Storybook / testdekning

Skjermbilder eller GIFs (valgfritt)

Summary by CodeRabbit

coderabbitai[bot] commented 1 week ago
📝 Walkthrough
📝 Walkthrough ## Walkthrough The pull request introduces changes to the `InboxItem` component in `InboxItem.tsx`, primarily by reorganizing import statements and refining how the `linkTo` prop is handled based on the `inSelectionMode` state. The `useDialogs.tsx` file is updated to include a new `linkTo` property in the `mapDialogDtoToInboxItem` function, enhancing dialog representation. Additionally, the `SearchDropdown.tsx` component now utilizes the `useLocation` hook to dynamically construct links with search parameters. The `Inbox.tsx` component also reflects these changes by updating the `linkTo` property to include relevant query parameters. ## Changes | File Path | Change Summary | |---------------------------------------------|---------------------------------------------------------------------------------------------------| | `packages/frontend/src/components/InboxItem/InboxItem.tsx` | - Reorganized import statements.
- Updated `linkTo` prop to conditionally pass based on `inSelectionMode`.
- Modified `onClick` handler for `isMinimalistic` check. | | `packages/frontend/src/api/useDialogs.tsx` | - Updated `mapDialogDtoToInboxItem` to include `linkTo` property.
- Adjusted `useDialogs` hook for dialog retrieval. | | `packages/frontend/src/components/Header/SearchDropdown.tsx` | - Added `useLocation` hook.
- Updated `linkTo` property to include current search parameters. | | `packages/frontend/src/pages/Inbox/Inbox.tsx` | - Altered `linkTo` property in `InboxItemInput` to include dynamic URL with search parameters.
- Improved error handling in `handleSaveSearch` function. | ## Possibly related PRs - **#1125**: Changes in `SearchDropdown.tsx` regarding the `linkTo` property are related to the main PR's updates to the `InboxItem` component, as both involve modifications to how links are constructed and displayed based on context. - **#1130**: The modifications to the `mapDialogDtoToInboxItem` function in `useDialogs.tsx` include updates to the `linkTo` property, which directly connects to the changes made in the `InboxItem` component regarding link handling. - **#1140**: The addition of the `isUnread` property in the `Inbox` component relates to the main PR's focus on enhancing the functionality of the `InboxItem` component, as both involve managing the state of items displayed in the inbox. - **#1146**: Similar to #1140, the `isUnread` property added to the `SearchDropdown` component connects to the main PR's updates in managing the visibility and state of inbox items. - **#1167**: The changes in `useDialogs.tsx` regarding the handling of timestamps and the introduction of the `updatedAt` property relate to the main PR's focus on improving the logic and visibility of dialog items in the inbox. - **#1278**: The modifications to the inbox counter to reflect unread items are directly related to the main PR's enhancements in the `InboxItem` component, as both aim to improve user experience regarding item visibility. - **#1337**: The updates to the `Inbox` component's header to reflect the context of empty states are related to the main PR's focus on enhancing the `InboxItem` component's functionality and user feedback. - **#1351**: The changes in the `SearchBar` component regarding URL parameter management connect to the main PR's updates in the `InboxItem` component, as both involve improving user navigation and search functionality. - **#1354**: The improvements to the logic for saved searches in the `SaveSearchButton` component relate to the main PR's focus on enhancing the overall functionality and clarity of the inbox and its components. - **#1360**: The adjustments to the saved search link to include the party parameter are relevant to the main PR's focus on improving the functionality of the inbox and its associated components. ## Suggested reviewers - seanes

[!WARNING]

Rate limit exceeded

@mbacherycz has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 0 minutes and 3 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](https://docs.coderabbit.ai/faq) for further information.
📥 Commits Reviewing files that changed from the base of the PR and between ecdd08ce5b463504796101f11ad3cb8e0231f9d9 and 698572bf5ff3f2dbc087ae70abfde57ffc38f545.

📜 Recent review details **Configuration used: .coderabbit.yaml** **Review profile: CHILL**
📥 Commits Reviewing files that changed from the base of the PR and between ecdd08ce5b463504796101f11ad3cb8e0231f9d9 and 698572bf5ff3f2dbc087ae70abfde57ffc38f545.
📒 Files selected for processing (4) * `packages/frontend/src/api/useDialogs.tsx` (0 hunks) * `packages/frontend/src/components/Header/SearchDropdown.tsx` (3 hunks) * `packages/frontend/src/components/InboxItem/InboxItem.tsx` (1 hunks) * `packages/frontend/src/pages/Inbox/Inbox.tsx` (1 hunks)
💤 Files with no reviewable changes (1) * packages/frontend/src/api/useDialogs.tsx
🚧 Files skipped from review as they are similar to previous changes (3) * packages/frontend/src/components/Header/SearchDropdown.tsx * packages/frontend/src/components/InboxItem/InboxItem.tsx * packages/frontend/src/pages/Inbox/Inbox.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 - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
🪧 Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit , 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. ### Documentation and Community - Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit. - Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.