Skip to content

Light sidebar#449

Merged
elie222 merged 3 commits intomainfrom
light-sidebar
May 25, 2025
Merged

Light sidebar#449
elie222 merged 3 commits intomainfrom
light-sidebar

Conversation

@elie222
Copy link
Owner

@elie222 elie222 commented May 25, 2025

Summary by CodeRabbit

  • New Features

    • Added a special "cold email blocker" rule to the automation rules list, with unique actions and navigation, visible when enabled in email account settings.
  • Style

    • Updated sidebar background color to pure white in light mode.
    • Adjusted sidebar text color for improved consistency.
    • Removed redundant dark mode CSS classes from sidebar components.

@vercel
Copy link

vercel bot commented May 25, 2025

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

Name Status Preview Updated (UTC)
inbox-zero ✅ Ready (Inspect) Visit Preview May 25, 2025 10:34am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 25, 2025

Walkthrough

The updates introduce a synthetic "cold email blocker" rule to the rules UI, conditionally displaying it based on account settings and handling it with special UI logic. Additional changes rename sidebar navigation labels, adjust sidebar logo text color class, remove explicit "dark" CSS classes from sidebar components, and update the sidebar background color variable in the global CSS, affecting the application's visual appearance.

Changes

File(s) Change Summary
apps/web/app/(app)/[emailAccountId]/automation/Rules.tsx Adds synthetic cold email blocker rule, updates rule rendering logic, integrates account data hook.
apps/web/components/SideNav.tsx Renames navigation labels; changes sidebar logo text color class from text-white to text-foreground.
apps/web/components/ui/sidebar.tsx Removes all explicit "dark" CSS class references from sidebar UI components.
apps/web/styles/globals.css Updates --sidebar-background CSS variable from 98% lightness to full white (100% lightness).

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant RulesComponent
    participant useEmailAccountFull
    participant UI

    User->>RulesComponent: Visit rules page
    RulesComponent->>useEmailAccountFull: Fetch email account data
    useEmailAccountFull-->>RulesComponent: Return account settings (incl. coldEmailBlocker)
    RulesComponent->>RulesComponent: Compute baseRules
    alt coldEmailBlocker enabled
        RulesComponent->>RulesComponent: Append synthetic cold email blocker rule
    end
    RulesComponent->>UI: Render rules list (with special handling for cold email blocker)
Loading

Possibly related PRs

  • Option to mark cold emails as read #318: Adds a new option in cold email settings to mark cold emails as read, updating related logic; both PRs enhance cold email handling, with this PR focusing on rule UI and the related PR on settings and processing.
  • Fix cold email blocker on previous messages from sender #328: Fixes cold email blocker logic by adding and using messageId in email processing functions; related to cold email blocker feature but focuses on backend logic, complementing this PR’s UI changes.

Poem

In the sidebar, colors shift to white,
While rules gain a blocker for cold email's blight.
No more toggling or delete for this special guest,
The UI now handles it with care and zest.
A rabbit hops, admiring the view—
Fresh rules and bright sidebars, all shiny and new!
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

apps/web/components/SideNav.tsx

Oops! Something went wrong! :(

ESLint: 9.24.0

ESLint couldn't find an eslint.config.(js|mjs|cjs) file.

From ESLint v9.0.0, the default configuration file is now eslint.config.js.
If you are using a .eslintrc.* file, please follow the migration guide
to update your configuration file to the new format:

https://eslint.org/docs/latest/use/configure/migration-guide

If you still have problems after following the migration guide, please stop by
https://eslint.org/chat/help to chat with the team.


📜 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 fd8a256 and 1a2410f.

📒 Files selected for processing (1)
  • apps/web/components/SideNav.tsx (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/web/components/SideNav.tsx
✨ Finishing Touches
  • 📝 Generate Docstrings

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:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 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.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

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 generate sequence diagram to generate a sequence diagram of the changes in 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.

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/app/(app)/[emailAccountId]/automation/Rules.tsx (1)

79-163: Consider extracting the cold email blocker rule creation logic.

The synthetic rule creation logic is quite extensive (lines 108-161). Consider extracting it into a separate function for better readability and testability.

+function createColdEmailBlockerRule(
+  emailAccountData: EmailAccountFullResponse | undefined,
+  emailAccountId: string,
+): RulesResponse[number] | null {
+  const enabled: ColdEmailSetting[] = [
+    ColdEmailSetting.LABEL,
+    ColdEmailSetting.ARCHIVE_AND_LABEL,
+    ColdEmailSetting.ARCHIVE_AND_READ_AND_LABEL,
+  ];
+
+  const shouldArchived: ColdEmailSetting[] = [
+    ColdEmailSetting.ARCHIVE_AND_LABEL,
+    ColdEmailSetting.ARCHIVE_AND_READ_AND_LABEL,
+  ];
+
+  const coldEmailBlockerEnabled =
+    emailAccountData?.coldEmailBlocker &&
+    enabled.includes(emailAccountData?.coldEmailBlocker);
+
+  if (!coldEmailBlockerEnabled) return null;
+
+  const showArchiveAction =
+    emailAccountData?.coldEmailBlocker &&
+    shouldArchived.includes(emailAccountData?.coldEmailBlocker);
+
+  return {
+    id: COLD_EMAIL_BLOCKER_RULE_ID,
+    name: "Block Cold Emails",
+    instructions: emailAccountData?.coldEmailPrompt || null,
+    automate: true,
+    enabled: true,
+    runOnThreads: false,
+    actions: [
+      {
+        id: "cold-email-blocker-label",
+        type: ActionType.LABEL,
+        label: inboxZeroLabels.cold_email.name.split("/")[1],
+        createdAt: new Date(),
+        updatedAt: new Date(),
+        ruleId: COLD_EMAIL_BLOCKER_RULE_ID,
+        to: null,
+        subject: null,
+        content: null,
+        cc: null,
+        bcc: null,
+        url: null,
+      },
+      showArchiveAction
+        ? {
+            id: "cold-email-blocker-archive",
+            type: ActionType.ARCHIVE,
+            label: null,
+            createdAt: new Date(),
+            updatedAt: new Date(),
+            ruleId: COLD_EMAIL_BLOCKER_RULE_ID,
+            to: null,
+            subject: null,
+            content: null,
+            cc: null,
+            bcc: null,
+            url: null,
+          }
+        : null,
+    ].filter(isDefined),
+    categoryFilters: [],
+    group: null,
+    emailAccountId: emailAccountId,
+    createdAt: new Date(),
+    updatedAt: new Date(),
+    categoryFilterType: null,
+    conditionalOperator: LogicalOperator.OR,
+    groupId: null,
+    systemType: null,
+    to: null,
+    from: null,
+    subject: null,
+    body: null,
+  };
+}

 const rules: RulesResponse = useMemo(() => {
-  const enabled: ColdEmailSetting[] = [
-    ColdEmailSetting.LABEL,
-    ColdEmailSetting.ARCHIVE_AND_LABEL,
-    ColdEmailSetting.ARCHIVE_AND_READ_AND_LABEL,
-  ];
-
-  const shouldArchived: ColdEmailSetting[] = [
-    ColdEmailSetting.ARCHIVE_AND_LABEL,
-    ColdEmailSetting.ARCHIVE_AND_READ_AND_LABEL,
-  ];
-
-  const coldEmailBlockerEnabled =
-    emailAccountData?.coldEmailBlocker &&
-    enabled.includes(emailAccountData?.coldEmailBlocker);
-
-  if (!coldEmailBlockerEnabled) return baseRules;
-
-  const showArchiveAction =
-    emailAccountData?.coldEmailBlocker &&
-    shouldArchived.includes(emailAccountData?.coldEmailBlocker);
-
-  // Works differently to rules, but we want to show it in the list for user simplicity
-  const coldEmailBlockerRule: RulesResponse[number] = {
-    // ... (lines 109-160)
-  };
-  return [...(baseRules || []), coldEmailBlockerRule];
+  const coldEmailBlockerRule = createColdEmailBlockerRule(
+    emailAccountData,
+    emailAccountId
+  );
+  
+  if (!coldEmailBlockerRule) return baseRules;
+  
+  return [...(baseRules || []), coldEmailBlockerRule];
 }, [baseRules, emailAccountData, emailAccountId]);
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 145497b and fd8a256.

📒 Files selected for processing (4)
  • apps/web/app/(app)/[emailAccountId]/automation/Rules.tsx (6 hunks)
  • apps/web/components/SideNav.tsx (1 hunks)
  • apps/web/components/ui/sidebar.tsx (2 hunks)
  • apps/web/styles/globals.css (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
apps/web/app/(app)/[emailAccountId]/automation/Rules.tsx (5)
apps/web/hooks/useEmailAccountFull.ts (1)
  • useEmailAccountFull (5-10)
apps/web/app/api/user/rules/route.ts (1)
  • RulesResponse (5-5)
apps/web/utils/label.ts (1)
  • inboxZeroLabels (28-64)
apps/web/utils/types.ts (1)
  • isDefined (8-10)
apps/web/utils/path.ts (1)
  • prefixPath (1-4)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Static Code Analysis Js
  • GitHub Check: Jit Security
🔇 Additional comments (6)
apps/web/styles/globals.css (1)

38-38: LGTM!

The change from 98% to 100% lightness creates a cleaner, pure white sidebar background that aligns with the PR's goal of refining the sidebar appearance.

apps/web/components/SideNav.tsx (1)

267-267: Good theming improvement!

Changing from text-white to text-foreground makes the logo text color adapt properly to the theme instead of being hardcoded to white. This ensures better contrast and consistency across light and dark themes.

apps/web/components/ui/sidebar.tsx (1)

210-210: Excellent theme flexibility improvement!

Removing the hardcoded "dark" classes allows these sidebar components to properly respond to the theme context instead of forcing dark mode styling. This change, combined with the CSS variable updates, creates a more cohesive theming system.

Also applies to: 227-227

apps/web/app/(app)/[emailAccountId]/automation/Rules.tsx (3)

16-16: Well-structured imports for the new cold email blocker feature.

The new imports are properly organized and all appear to be used in the implementation.

Also applies to: 51-61


62-62: Good use of a descriptive constant.

The constant name clearly indicates this is a special identifier for the synthetic cold email blocker rule.


191-201: Excellent implementation of special handling for the cold email blocker rule!

The UI correctly handles the synthetic cold email blocker rule by:

  • Using a different navigation path (/cold-email-blocker)
  • Preventing toggle of the runOnThreads setting
  • Hiding enable/disable and delete options
  • Opening edit/history links in new tabs

This ensures users understand this is a special system rule with different behavior.

Also applies to: 241-242, 274-298, 304-381

@elie222 elie222 merged commit 48180ef into main May 25, 2025
7 checks passed
@elie222 elie222 deleted the light-sidebar branch December 18, 2025 23:07
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