Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Improve tab locking functionality #9

Merged
merged 3 commits into from
Jan 4, 2025
Merged

Improve tab locking functionality #9

merged 3 commits into from
Jan 4, 2025

Conversation

canack
Copy link
Member

@canack canack commented Jan 4, 2025

Tab Management System Improvements

Changes

New Methods

  • Added switchPage() method to handle tab navigation with lock awareness
  • Added LockTab(key string) to lock individual tabs by their key
  • Added UnlockTab(key string) to unlock individual tabs by their key
  • Added IsTabLocked(key string) to check if a specific tab is locked
  • Added LockTabsToTheLeft() to lock all tabs to the left of current tab
  • Added LockTabsToTheRight() to lock all tabs to the right of current tab
  • Added UnlockTabs() to clear all tab locks (both general and individual)

Improvements

  • Implemented smart tab navigation that skips locked tabs
  • Added boundary checks to prevent unnecessary operations when at edge tabs
  • Improved tab lock state management in header component
  • Added support for both general tab locking and individual tab locking

Details

Tab Navigation

  • When navigating left/right, the system now automatically skips locked tabs
  • Navigation stops if all tabs in the direction are locked

Lock Management

  • LockTab(key): Locks a specific tab by its key
  • UnlockTab(key): Unlocks a specific tab by its key
  • IsTabLocked(key): Returns true if the specified tab is locked
  • LockTabsToTheLeft(): Locks all tabs from index 0 to current tab (exclusive)
  • LockTabsToTheRight(): Locks all tabs from current tab + 1 to the end
  • UnlockTabs(): Clears all types of locks (both general and individual)

Example Usage

s.AddPage("first", "First Tab", firstModel)
s.AddPage("second", "Second Tab", secondModel)
s.AddPage("third", "Third Tab", thirdModel)
s.AddPage("fourth", "Fourth Tab", fourthModel)
s.AddPage("fifth", "Fifth Tab", fifthModel)

// Individual tab locking
s.LockTab("second")      // Locks second tab
s.UnlockTab("second")    // Unlocks second tab
s.IsTabLocked("second")  // Checks if second tab is locked

// Bulk tab locking
s.LockTabsToTheLeft()    // Locks all tabs to the left of current tab
s.LockTabsToTheRight()   // Locks all tabs to the right of current tab
s.UnlockTabs()          // Unlocks all tabs

Testing

  • Tested individual tab locking/unlocking
  • Tested bulk tab locking (left/right)
  • Verified tab navigation with locked tabs
  • Confirmed that UnlockTabs() properly clears all locks
  • Tested boundary conditions (first/last tab)

…ds to lock/unlock individual tabs and update tab navigation logic accordingly.
@canack canack self-assigned this Jan 4, 2025
@canack canack added the enhancement New feature or request label Jan 4, 2025
canack added 2 commits January 4, 2025 22:55
- Simplified the updateSkeleton method by removing unnecessary parameters.
- Streamlined command accumulation in the Update method, ensuring better command batching.
- Enhanced handling of various message types to maintain clarity and efficiency in command processing.
- Removed the lockTabs field from both header and skeleton structs.
@canack canack merged commit ab29597 into main Jan 4, 2025
2 checks passed
@canack canack deleted the improved-locking branch January 5, 2025 07:55
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant