Skip to content

style(web): simplify z-index styling#1475

Merged
tyler-dane merged 35 commits intomainfrom
refactor/zindex-tailwind
Feb 27, 2026
Merged

style(web): simplify z-index styling#1475
tyler-dane merged 35 commits intomainfrom
refactor/zindex-tailwind

Conversation

@tyler-dane
Copy link
Contributor

@tyler-dane tyler-dane commented Feb 26, 2026

This pull request adds comprehensive documentation and skill files for code simplification across multiple directories, establishing clear guidelines, heuristics, and examples for minimizing complexity, avoiding duplication, and improving code legibility. The changes unify and expand the simplify-code skill for use in .cursor, .claude, and .codex environments, providing both high-level principles and practical before/after examples.

Skill documentation and principles:

  • Added detailed SKILL.md files in .cursor/skills/simplify-code/, .claude/skills/simplify-code/, and .codex/skills/simplify-code/ describing when and how to simplify code, including DRY, legibility, durability, and anti-patterns to avoid. [1] [2] [3]

Heuristics and complexity thresholds:

  • Added heuristics.md in .cursor/skills/simplify-code/ and .codex/skills/simplify-code/ outlining complexity thresholds, DRY detection rules, nesting reduction strategies, config-driven simplification, and durability checklists to guide refactoring decisions.

Practical examples:

  • Added examples.md in .cursor/skills/simplify-code/ and .codex/skills/simplify-code/ with before/after code samples demonstrating guard clauses, single-pass iteration, config-driven handlers, shared helpers, and composing hooks instead of duplication.

Rules configuration:

… forgot password functionality

- Added `AuthModal` component to manage user authentication flows, including sign in, sign up, and password recovery.
- Introduced `AccountIcon` for triggering the authentication modal.
- Created forms for sign in, sign up, and forgot password, utilizing Zod for validation.
- Implemented tab navigation between sign in and sign up views.
- Integrated Google OAuth sign-in functionality.
- Established context and hooks for managing modal state and feature flags.
- Added comprehensive tests for modal behavior and form validation.
…st coverage

- Renamed `User` icon to `UserIcon` for clarity in `AccountIcon`.
- Enhanced `AuthModal` and its forms with consistent button labels and improved comments for future implementation.
- Updated test cases to use semantic queries and ensure consistent button labels across tabs.
- Refactored `AuthInput` error handling styles for better clarity.
- Removed unused `index.ts` file from `AuthModal` directory to streamline imports.
- Adjusted import paths in various components to reflect the new structure.
…tionality

- Replaced `UserIcon` with `UserCircleDashedIcon` and `UserCircleIcon` for better visual representation based on authentication state.
- Enhanced tooltip descriptions to reflect user login status dynamically.
- Updated tests to verify correct rendering of icons and tooltip descriptions based on authentication state.
- Adjusted test cases to ensure consistent labeling and improved clarity in user interactions.
…ility

- Updated test cases in `AuthModal.test.tsx` to utilize semantic queries for button interactions, replacing `data-testid` with `role` and `name` attributes for better accessibility.
- Refactored mock components for `GoogleButton` and `TooltipWrapper` to align with semantic best practices, improving test clarity and maintainability.
- Adjusted `AuthModal.tsx` to include a `DotIcon` for improved visual separation in the privacy and terms section, enhancing user experience.
…d styling

- Replaced the existing GoogleButtonBase with a custom button component that includes a monochrome Google "G" logo.
- Added styling to align with Google design guidelines, including padding, border radius, and hover effects.
- Improved accessibility by ensuring proper aria-label usage and button interaction handling.
- Enhanced the button's visual appearance and user experience through refined layout and interaction feedback.
- Moved the Google Sign In button to a more visually distinct position within the AuthModal component for improved user experience.
- Updated button styling to maintain consistency with the overall design.
- Cleaned up the code by removing redundant elements and ensuring better readability.
…experience

- Modified the AuthModal component to display personalized greetings based on the user's sign-up name, enhancing user engagement.
- Updated test cases in AuthModal.test.tsx to reflect changes in greeting messages, ensuring accurate verification of modal behavior.
- Adjusted styling in AuthTabs to improve visual consistency and accessibility.
- Enhanced SignUpForm to include a callback for name changes, facilitating dynamic updates in the greeting.
…ved test coverage

- Added a new test case to verify that the greeting updates correctly when the user types their name in the AuthModal.
- Modified the greeting message format in AuthModal.tsx for better clarity and user engagement.
- Updated styling in OverlayPanel for improved layout and responsiveness.
…ty in AuthModal tests

- Updated the mock implementation of TooltipWrapper in AuthModal.test.tsx to support keyboard interactions, allowing users to trigger actions via the Enter and Space keys.
- Improved accessibility by adding role and tabIndex attributes to the mock component, ensuring it behaves like a button when onClick is defined.
…nsistency

- Replaced hardcoded z-index values with constants from ZIndex in StyledHeaderRow, StyledReminderContainer, AgendaEventPreview, BaseContextMenu, StorageInfoModal, and StyledMenu.
- Renamed Shortcut component to ShortcutTip for clarity and improved code organization.
- Adjusted related imports and component usage to reflect the changes in naming and z-index management.
…kdrop prop

- Removed the backdrop prop from OverlayPanel, streamlining its interface and usage.
- Updated AuthModal to reflect the removal of the backdrop prop, enhancing code clarity.
- Cleaned up SyncEventsOverlay by removing the backdrop prop, ensuring consistency across components.
…label support

- Updated AuthInput to make the label prop optional, allowing for placeholder-only styles.
- Introduced ariaLabel prop for accessibility when the label is omitted.
- Adjusted usage in SignInForm, SignUpForm, and ForgotPasswordForm to utilize the new ariaLabel prop for improved accessibility.
- Enhanced ShortcutTip component to support hover interactions for displaying keyboard shortcuts.
…s and optional children prop

- Introduced a new ShortcutBadge component for displaying keyboard shortcuts.
- Updated ShortcutTip to support hover interactions, showing the shortcut when the component is hovered over.
- Added an optional children prop to allow for more flexible usage of the ShortcutTip component.
… view switching

- Removed the AuthTabs component to streamline the AuthModal interface, replacing tab navigation with a button for switching between Sign In and Sign Up views.
- Updated the AuthModal to include a dynamic title action for switching views, improving user experience.
- Adjusted tests in AuthModal.test.tsx to reflect changes in view switching and button interactions, ensuring accurate verification of modal behavior.
- Enhanced the OverlayPanel component to support optional title actions, improving layout flexibility.
…experience

- Updated ForgotPasswordForm, SignInForm, and SignUpForm to clear validation errors when the user types, enhancing real-time feedback.
- Modified error display logic to only show validation errors on blur for fields with input, preventing unnecessary error messages for empty required fields.
- Streamlined dependencies in useCallback hooks for better performance and clarity.
… in Auth components

- Introduced the useZodForm hook to manage form state and validation using Zod, enhancing the handling of form inputs in ForgotPasswordForm, SignInForm, and SignUpForm.
- Updated forms to utilize the new hook, simplifying validation logic and improving user experience by showing errors only on blur and clearing them during input.
- Added comprehensive tests for useZodForm to ensure correct validation behavior and form state management.
- Changed button labels in SignInForm and SignUpForm from "Enter" and "Create account" to "Log in" and "Sign up" respectively for better clarity.
- Updated Google sign-in button label in AuthModal from "Sign in with Google" to "Continue with Google" to align with user expectations.
- Introduced AuthButton component to standardize button styles and improve code organization within AuthModal.
- Adjusted tests in AuthModal.test.tsx, SignInForm.test.tsx, and SignUpForm.test.tsx to reflect the updated button labels, ensuring accurate test coverage.
- Updated button transition effects in AuthButton to use 'transition-all duration-150' for smoother animations.
- Modified hover styles for the outline variant to improve visual feedback, changing from 'hover:bg-[#f8f8f8]' to 'hover:bg-[#f0f0f0] hover:border-[#151515]'.
… yarn.lock

- Deleted react-google-button dependency from package.json to streamline project dependencies.
- Updated yarn.lock to reflect the removal of react-google-button, ensuring consistency in the dependency tree.
- Renamed schema variables in auth.schemas.ts from camelCase to PascalCase for consistency and clarity.
- Updated AuthModal and its related components to use the new schema names, including LogInSchema and SignUpSchema.
- Refactored AuthModal to handle URL parameters for opening specific authentication views, enhancing user experience.
- Added tests for URL parameter handling to ensure correct modal behavior based on query strings.
- Introduced LogInForm component to replace SignInForm, aligning with the new naming conventions.
… UI components

- Added detailed zIndex layers in tailwind.config.ts to manage stacking order for calendar events, overlays, and interactive elements.
- Updated OverlayPanel, BaseContextMenu, and StorageInfoModal components to utilize the new zIndex values for consistent layering across the application.
- Removed direct references to ZIndex constants in components to streamline styling and improve maintainability.
- Deleted the StorageInfoModal component from the project to streamline the codebase and improve maintainability.
- This change follows recent updates to zIndex configurations and component layering, ensuring a cleaner architecture.
@tyler-dane tyler-dane changed the title Refactor/zindex-tailwind style(web): centralize z-index tailwind values Feb 26, 2026
Base automatically changed from feat/1452-form to main February 26, 2026 21:40
… weight

- Updated the AuthButton component to remove the font weight class for a cleaner style definition.
- This change enhances the button's appearance while maintaining its functionality and responsiveness.
Copilot AI review requested due to automatic review settings February 26, 2026 21:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds centralized Tailwind z-index tokens and begins migrating a few web UI components away from hard-coded / constant z-index values to the new z-layer-* classes.

Changes:

  • Added a custom theme.extend.zIndex scale to packages/web/tailwind.config.ts with documented layering tokens (layer-1layer-30, max).
  • Updated Day view context menu base component to use z-layer-30 instead of ZIndex constants.
  • Updated OverlayPanel to use the new z-index token (z-layer-20) instead of an arbitrary z-[1000] class.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
packages/web/tailwind.config.ts Introduces centralized Tailwind z-index tokens for layering.
packages/web/src/views/Day/components/ContextMenu/BaseContextMenu.tsx Switches context menu z-index to new Tailwind token.
packages/web/src/views/Day/components/Agenda/Events/AgendaEventPreview/AgendaEventPreview.tsx Removes redundant z-index class (z-index is controlled via inline style).
packages/web/src/components/OverlayPanel/OverlayPanel.tsx Migrates overlay z-index from arbitrary value to tokenized layer.
packages/web/src/components/AuthModal/components/AuthButton.tsx Removes font-medium from base AuthButton classes (unrelated to z-index).

…asses

- Removed the use of custom z-index from the NowLine component and replaced it with Tailwind's z-layer-5 class for improved styling consistency.
- Cleaned up the code by eliminating the unused useGridMaxZIndex hook, streamlining the component's functionality.
- Adjusted the placement of the SelectView component within the Header to maintain consistent rendering alongside the AccountIcon.
- This change improves the layout and visual consistency of the Header component.
- Replaced hardcoded z-index value in ContextMenu component with ZIndex.LAYER_2 constant for improved consistency and maintainability.
- This change aligns with recent updates to z-index management across the codebase.
- Removed custom z-index values from Tailwind configuration and components, replacing them with Tailwind's built-in z-index classes for consistency.
- Updated OverlayPanel, NowLine, and BaseContextMenu components to utilize the new z-index classes, enhancing maintainability and styling uniformity.
- Cleaned up related tests to reflect the changes in z-index management.
- Deleted the StorageInfoModal component to streamline the codebase and enhance maintainability, following recent updates to z-index configurations.
Copilot AI review requested due to automatic review settings February 26, 2026 22:27
@tyler-dane tyler-dane changed the title style(web): centralize z-index tailwind values style(web): simplify z-index styling Feb 26, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (2)

packages/web/src/views/Day/components/Agenda/NowLine/NowLine.test.tsx:52

  • Removing the z-index test may mask future regressions. The test validated that the NowLine component had proper z-index layering. While the implementation has changed to use Tailwind classes instead of dynamic z-index, the layering behavior is still critical for the NowLine to be visible above other elements. Consider updating the test to verify the z-5 class is present instead of completely removing it.
  it("updates time on minute sync", () => {
    let syncCallback: () => void;
    (setupMinuteSync as jest.Mock).mockImplementation((cb) => {
      syncCallback = cb;
      return jest.fn();
    });

packages/web/src/views/Day/components/StorageInfoModal/StorageInfoModal.tsx:1

  • The PR description states this change is "related to #1265" which is about replacing raw Tailwind colors with semantic names. However, this PR focuses on centralizing z-index values and does not address color naming. The PR makes changes to z-index management but doesn't replace any raw color references with semantic variables. Consider updating the PR description to accurately reflect the z-index centralization work, or ensure color-related changes from issue #1265 are included if that was the intent.

- Introduced the useAuthCmdItems hook to provide command palette items for authentication actions when the user is not authenticated.
- Integrated useAuthCmdItems into CmdPalette, DayCmdPalette, and NowCmdPalette components to enhance user experience with sign-up and log-in options.
- Introduced a new skill for simplifying code, focusing on minimizing complexity, eliminating duplication, and enhancing legibility.
- Added heuristics and examples to guide developers in applying simplification principles effectively.
- Updated .gitignore to remove unnecessary entries and streamline the project structure.
…it for form closure

- Added a wait condition to ensure the title input is hidden after saving, confirming the form closure and completion of the save action.
- This improvement enhances the reliability of the event form submission process in end-to-end tests.
Copilot AI review requested due to automatic review settings February 26, 2026 23:35
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 23 out of 24 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (3)

packages/web/src/views/CmdPalette/CmdPalette.tsx:157

  • authCmdItems are spread into the Settings section, but the existing "Log Out" command is still always present. When unauthenticated, this results in showing Sign Up / Log In alongside Log Out, which is confusing and likely incorrect. Consider conditionally rendering the Log Out item only when authenticated (or have useAuthCmdItems return the appropriate auth-related items for both states).
              : "CloudArrowUpIcon",
            onClick: isGoogleCalendarConnected
              ? undefined
              : onConnectGoogleCalendar,
          },
          ...authCmdItems,
          {
            id: "log-out",
            children: "Log Out [z]",
            icon: "ArrowRightOnRectangleIcon",
            onClick: () => pressKey("z"),
          },

packages/web/src/views/Day/components/DayCmdPalette.tsx:94

  • authCmdItems are spread into the Settings section, but "Log Out" is still always present. When the user is unauthenticated, this will show Log In / Sign Up items alongside Log Out. Consider guarding the Log Out command behind session.authenticated (or moving both authenticated/unauthenticated auth items into a single hook so only the correct set is rendered).
              ? "CheckCircleIcon"
              : "CloudArrowUpIcon",
            onClick: isGoogleCalendarConnected
              ? undefined
              : onConnectGoogleCalendar,
          },
          ...authCmdItems,
          {
            id: "log-out",
            children: "Log Out [z]",
            icon: "ArrowRightOnRectangleIcon",
            onClick: () => pressKey("z"),
          },

packages/web/src/views/Now/components/NowCmdPalette.tsx:71

  • authCmdItems are spread into the Settings section, but "Log Out" is still always present. For unauthenticated users this will show Log In / Sign Up together with Log Out. Consider making Log Out conditional on session.authenticated (or have the auth-items hook return the correct item set for each auth state).
              : "CloudArrowUpIcon",
            onClick: isGoogleCalendarConnected
              ? undefined
              : onConnectGoogleCalendar,
          },
          ...authCmdItems,
          {
            id: "log-out",
            children: "Log Out [z]",
            icon: "ArrowRightOnRectangleIcon",
            onClick: () => pressKey("z"),
          },

…havior

- Integrated useGridMaxZIndex hook to dynamically set the z-index of the NowLine component, ensuring it appears above other elements.
- Updated the NowLine test suite to include a new test case verifying that the z-index is set correctly.
- Refactored the NowLine component to remove hardcoded z-index values, improving maintainability and consistency with recent z-index updates.
- Introduced a new test suite for the useAuthCmdItems hook to validate its behavior under various authentication states.
- Added tests to ensure correct command palette items are returned based on authentication status and feature flag settings.
- Verified that clicking on authentication items opens the appropriate modal views, enhancing the reliability of the authentication command palette functionality.
@tyler-dane tyler-dane merged commit 833b5c1 into main Feb 27, 2026
5 checks passed
@tyler-dane tyler-dane deleted the refactor/zindex-tailwind branch February 27, 2026 00:36
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.

2 participants