Skip to content

Add not relevant flag#82

Merged
Marfuen merged 2 commits intomainfrom
mariano/stuff
Feb 26, 2025
Merged

Add not relevant flag#82
Marfuen merged 2 commits intomainfrom
mariano/stuff

Conversation

@Marfuen
Copy link
Copy Markdown
Contributor

@Marfuen Marfuen commented Feb 26, 2025

Summary by CodeRabbit

  • New Features

    • Introduced relevance-based filtering for evidence tasks with options for "Relevant" and "Not Relevant."
    • Enabled a new toggle control for updating evidence relevance, with immediate visual feedback and warning messages when applicable.
  • UI Enhancements

    • Redesigned the filter dropdown into a two-column grid for clearer organization.
    • Upgraded the file upload experience to a sleek card-style interface.
    • Streamlined loading and error displays for a cleaner user interaction.

- Implement new `relevance` filter in evidence tasks list
- Add `isNotRelevant` field to OrganizationEvidence model
- Create server action `toggleRelevance` to mark evidence as relevant/not relevant
- Update evidence details, filters, and data table to support relevance status
- Enhance EvidenceTableProvider with relevance state management
- Add relevance column and filter dropdown in evidence tasks view
- Improve UI with visual indicators for evidence relevance
@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 26, 2025

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

Name Status Preview Comments Updated (UTC)
app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 26, 2025 8:03pm
comp-portal ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 26, 2025 8:03pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
web ⬜️ Skipped (Inspect) Feb 26, 2025 8:03pm

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 26, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request implements several changes focused on evidence task relevance. The logic for counting and filtering evidence tasks has been refined, introducing a new "relevance" parameter throughout the codebase. UI components such as filter badges, dropdowns, and data table columns have been updated to display relevance status. A new action for toggling relevance has been added with corresponding UI updates in evidence details and review sections. Additionally, state management hooks and context have been extended to support the new relevance filtering, and the database schema has been modified to include a new boolean column with restructured enums for clarity.

Changes

File(s) Change Summary
apps/app/src/app/[locale]/(app)/(dashboard)/evidence/Actions/getEvidenceTasksStats.ts
apps/app/src/app/[locale]/(app)/(dashboard)/evidence/Actions/getOrganizationEvidenceTasks.ts
apps/app/src/app/[locale]/(app)/(dashboard)/evidence/[id]/Actions/toggleRelevance.ts
- Updated evidence task counting logic based on publication status and content.
- Introduced an optional relevance parameter for filtering evidence tasks.
- Added a new action to toggle evidence relevance with proper auth and DB update logic.
apps/app/src/app/[locale]/(app)/(dashboard)/evidence/Components/EvidenceFilters/ActiveFilterBadges.tsx
apps/app/src/app/[locale]/(app)/(dashboard)/evidence/Components/EvidenceFilters/FilterDropdown.tsx
apps/app/src/app/[locale]/(app)/(dashboard)/evidence/Components/data-table/columns.tsx
apps/app/src/app/[locale]/(app)/(dashboard)/evidence/Components/data-table/index.ts
apps/app/src/app/[locale]/(app)/(dashboard)/evidence/Components/EvidenceList.tsx
- Integrated relevance filter into active filter badges and dropdown menus.
- Updated DataTable import and added a new "Relevance" column with icon-based rendering.
apps/app/src/app/[locale]/(app)/(dashboard)/evidence/[id]/Components/EvidenceDetails.tsx
apps/app/src/app/[locale]/(app)/(dashboard)/evidence/[id]/Components/ReviewSection.tsx
apps/app/src/app/[locale]/(app)/(dashboard)/evidence/[id]/Components/AssigneeSection.tsx
- Updated UI to display a warning message when evidence is marked as not relevant.
- Added a toggle relevance button in the review section and streamlined loading/error states.
apps/app/src/app/[locale]/(app)/(dashboard)/evidence/[id]/Components/FileSection.tsx
apps/app/src/app/[locale]/(app)/(dashboard)/evidence/[id]/Components/FileUpload.tsx
- Removed conditional dropzone logic in favor of always rendering a FileUpload component.
- Introduced a new variant system ("default" or "card") in the FileUpload component.
apps/app/src/app/[locale]/(app)/(dashboard)/evidence/hooks/useEvidenceTableContext.tsx
apps/app/src/app/[locale]/(app)/(dashboard)/evidence/hooks/useEvidenceTasks.ts
- Extended context and hook interfaces to include a new state (relevance) and its setter.
- Modified the data fetching process to consider the relevance filter for evidence tasks.
packages/db/prisma/migrations/20250226183500_add_is_relevant_to_evidence/migration.sql
packages/db/prisma/schema.prisma
- Added a new boolean column (isNotRelevant) to the OrganizationEvidence table with a default value of false.
- Reorganized enums and model attributes in the Prisma schema for improved consistency.

Sequence Diagram(s)

sequenceDiagram
  participant U as User
  participant ED as EvidenceDetails Component
  participant API as toggleRelevance Action
  participant DB as Database

  U->>ED: Click toggle relevance button
  ED->>API: Call toggleRelevance (evidence ID, new flag)
  API->>DB: Retrieve evidence record by ID & organization
  DB-->>API: Return evidence record
  API->>DB: Update evidence (relevance, published status, timestamp)
  DB-->>API: Return updated evidence
  API-->>ED: Respond with success and updated data
  ED->>U: UI reflects new relevance status
Loading
sequenceDiagram
  participant U as User
  participant FD as FilterDropdown Component
  participant CT as EvidenceTable Context
  participant API as getOrganizationEvidenceTasks
  participant DB as Database

  U->>FD: Select relevance filter option
  FD->>CT: Update relevance state
  CT->>API: Fetch evidence tasks with relevance filter
  API->>DB: Query tasks using relevance condition
  DB-->>API: Return filtered tasks
  API-->>CT: Provide updated task list
  CT->>FD: UI updates with filtered results
Loading

Possibly related PRs

  • add baseline migrations #48: Modifications involving database schema changes, including the addition of new enumerated types and table structures, are strongly connected to the relevance column addition in this PR.

Poem

I'm a hopping rabbit with a code delight,
Skipping through filters and toggling what’s right,
Relevance now shines in every task and row,
With UI badges and tables giving it a glow,
I nibble on bugs and munch on new features,
In this digital garden, every change is a treasure!
🐰💻 Hop on to the next commit dance!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1794850 and 58890f1.

📒 Files selected for processing (17)
  • apps/app/src/app/[locale]/(app)/(dashboard)/evidence/Actions/getEvidenceTasksStats.ts (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/evidence/Actions/getOrganizationEvidenceTasks.ts (3 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/evidence/Components/EvidenceFilters/ActiveFilterBadges.tsx (3 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/evidence/Components/EvidenceFilters/FilterDropdown.tsx (3 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/evidence/Components/EvidenceList.tsx (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/evidence/Components/data-table/columns.tsx (2 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/evidence/Components/data-table/index.ts (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/evidence/[id]/Actions/toggleRelevance.ts (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/evidence/[id]/Components/AssigneeSection.tsx (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/evidence/[id]/Components/EvidenceDetails.tsx (3 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/evidence/[id]/Components/FileSection.tsx (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/evidence/[id]/Components/FileUpload.tsx (3 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/evidence/[id]/Components/ReviewSection.tsx (3 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/evidence/hooks/useEvidenceTableContext.tsx (7 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/evidence/hooks/useEvidenceTasks.ts (4 hunks)
  • packages/db/prisma/migrations/20250226183500_add_is_relevant_to_evidence/migration.sql (1 hunks)
  • packages/db/prisma/schema.prisma (13 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

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.
  • @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.

@Marfuen Marfuen merged commit 6e2b94f into main Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant