Skip to content

Minor fixes 0804#1290

Merged
duckduckhero merged 5 commits intomainfrom
minor-fixes-0804
Aug 5, 2025
Merged

Minor fixes 0804#1290
duckduckhero merged 5 commits intomainfrom
minor-fixes-0804

Conversation

@duckduckhero
Copy link
Contributor

@duckduckhero duckduckhero commented Aug 4, 2025

Summary by cubic

Improved the people list in the contact view by adding sorting options and fixed the export date in the share button to use the session's creation date if available.

  • UI Improvements

    • Added a dropdown to sort people alphabetically, by oldest, or by newest in the contact view.
  • Bug Fixes

    • Fixed export date frontmatter to use the session's creation date when exporting.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 4, 2025

📝 Walkthrough

Walkthrough

The ContactView component's sorting feature was enhanced by replacing a boolean toggle with a dropdown offering "alphabetical," "oldest," and "newest" options, updating both state management and UI controls. Separately, the share-button export logic now prefers a session's creation date for Obsidian exports, defaulting to the current date if unavailable.

Changes

Cohort / File(s) Change Summary
ContactView Sorting Enhancement
apps/desktop/src/components/finder/views/contact-view.tsx
Replaced the alphabetical sort toggle with a select dropdown supporting "alphabetical," "oldest," and "newest" options; updated state management, sorting logic, and UI controls accordingly. Removed unused icon import and updated memoization dependencies.
Obsidian Export Date Logic
apps/desktop/src/components/toolbar/buttons/share-button.tsx
Changed the export handler to use the session's created_at timestamp for the "date" field in frontmatter, falling back to the current timestamp if unavailable. No changes to public interfaces or function signatures.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ContactView
    participant UI_Select

    User->>UI_Select: Selects sort option ("alphabetical", "oldest", "newest")
    UI_Select->>ContactView: Updates sortOption state
    ContactView->>ContactView: Recomputes people list order based on sortOption
    ContactView-->>User: Displays sorted people list
Loading
sequenceDiagram
    participant User
    participant ShareButton
    participant Session

    User->>ShareButton: Initiates Obsidian export
    ShareButton->>Session: Retrieves session.created_at
    alt session.created_at exists
        ShareButton->>ShareButton: Use session.created_at for frontmatter date
    else
        ShareButton->>ShareButton: Use current date for frontmatter date
    end
    ShareButton-->>User: Exports markdown with correct date
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 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 0f14eaa and 4fc16b1.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • apps/desktop/src/components/finder/views/contact-view.tsx (5 hunks)
  • apps/desktop/src/components/toolbar/buttons/share-button.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,ts,tsx,rs}

⚙️ CodeRabbit Configuration File

**/*.{js,ts,tsx,rs}: 1. No error handling.
2. No unused imports, variables, or functions.
3. For comments, keep it minimal. It should be about "Why", not "What".

Files:

  • apps/desktop/src/components/toolbar/buttons/share-button.tsx
  • apps/desktop/src/components/finder/views/contact-view.tsx
🔇 Additional comments (5)
apps/desktop/src/components/toolbar/buttons/share-button.tsx (1)

468-468: LGTM! Improved date handling for Obsidian exports.

Using the session's creation date (created_at) for the frontmatter is semantically more accurate than always using the current export time. The fallback to current timestamp ensures the field is never undefined.

apps/desktop/src/components/finder/views/contact-view.tsx (4)

3-3: LGTM! Clean import updates.

Correctly removed the unused ArrowUpAZ icon and added the necessary Select component imports for the new dropdown functionality.

Also applies to: 12-12


31-31: LGTM! Improved state management.

The change from a boolean sortAlphabetically to a union type sortOption is more extensible and clearly represents the three sorting options available.


260-278: LGTM! Excellent UX improvement.

The Select dropdown is a significant improvement over the previous toggle button, providing clear options and better usability. The implementation correctly handles the three sorting states with appropriate styling.


127-138: Confirm chronological ordering for “newest” sort

The reverse-based logic here assumes that the source array is already ordered oldest→newest:

} else if (sortOption === "newest") {
  filtered = [...filtered].reverse();
}

Please verify that dbCommands.listHumans(null) indeed returns results in ascending creation order. If it does not, consider replacing the reverse with an explicit timestamp sort, for example:

filtered = [...filtered].sort(
  (a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime()
);

• File: apps/desktop/src/components/finder/views/contact-view.tsx
• Lines: 132–138

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch minor-fixes-0804

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • 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 explain this code block.
  • 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 explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests 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.

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

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

cubic analysis

1 issue found across 2 files • Review in cubic

React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai to give feedback, ask questions, or re-run the review.

const nameB = (b.full_name || b.email || "").toLowerCase();
return nameA.localeCompare(nameB);
});
} else if (sortOption === "newest") {
Copy link

Choose a reason for hiding this comment

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

The "oldest" option is presented to users and included in sortOption’s union type but the displayPeople memo never handles sortOption === "oldest", so choosing "Oldest" will not change the ordering, creating a mismatch between UI and behaviour. (Based on your team’s feedback about ensuring new enum values are always fully implemented)

Prompt for AI agents
Address the following comment on apps/desktop/src/components/finder/views/contact-view.tsx at line 133:

<comment>The &quot;oldest&quot; option is presented to users and included in sortOption’s union type but the displayPeople memo never handles sortOption === &quot;oldest&quot;, so choosing &quot;Oldest&quot; will not change the ordering, creating a mismatch between UI and behaviour. (Based on your team’s feedback about ensuring new enum values are always fully implemented)</comment>

<file context>
@@ -123,16 +124,18 @@ export function ContactView({ userId, initialPersonId, initialOrgId }: ContactVi
       ? allPeopleWithUser.filter(person =&gt; person.organization_id === selectedOrganization)
       : allPeopleWithUser).filter(person =&gt; person.id === userId || isValidName(person.full_name));
 
-    if (sortAlphabetically) {
+    if (sortOption === &quot;alphabetical&quot;) {
       filtered = [...filtered].sort((a, b) =&gt; {
         const nameA = (a.full_name || a.email || &quot;&quot;).toLowerCase();
         const nameB = (b.full_name || b.email || &quot;&quot;).toLowerCase();
         return nameA.localeCompare(nameB);
</file context>

@duckduckhero duckduckhero merged commit 4b179e8 into main Aug 5, 2025
7 checks passed
@ComputelessComputer ComputelessComputer deleted the minor-fixes-0804 branch December 14, 2025 15:21
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

Comments