Skip to content

Feature/api migration and personal mode #49

New issue

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

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

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Maphikza
Copy link
Member

Summary

This PR implements a complete NPUB management system with full CRUD functionality for the allowed users feature. It fixes critical issues
with form integration, API field mapping, and adds comprehensive edit capabilities.

Key Features

  • Complete NPUB Management: Add, view, edit, and delete users with tier and permission controls
  • Smart Edit Functionality: Edit user tiers and permissions with intelligent backend synchronization
  • Improved Form Integration: Fixed Ant Design form switch components for proper value handling
  • Backend Field Mapping: Added proper transformation between frontend (tier) and backend (tier_name) field formats
  • Enhanced UI/UX: Improved paid subscribers modal with horizontal layout and proper npub encoding

Changes Made

🔧 Core Functionality

  • NPUB Management Modal: Complete form for adding users with tier selection and read/write permissions
  • Edit User Modal: Full edit capabilities allowing tier changes and permission updates
  • Smart Update Logic: Removes and re-adds entries when tiers change to prevent backend conflicts
  • Unified State Management: Merges read and write NPUBs into a single table view with proper tier preservation

🐛 Bug Fixes

  • Form Integration: Fixed switch components not properly updating form values in Ant Design forms
  • Field Mapping: Added tier_name to tier transformation in API responses to match backend format
  • Tier Fallbacks: Implemented robust fallback logic for undefined tier values
  • View All Modal: Fixed non-functional "View All" button for paid subscribers with proper npub encoding

🎨 UI Improvements

  • Action Buttons: Added edit and delete buttons with proper tooltips and styling
  • Modal Layouts: Improved layouts for better user experience
  • Permission Controls: Better organized read/write access switches
  • Data Display: Enhanced table with proper NPUB truncation and tier tags

🛠️ Technical Improvements

  • API Consistency: Standardized field naming between frontend and backend
  • Error Handling: Added user-friendly error messages and proper error boundaries
  • Code Cleanup: Removed verbose debugging logs while maintaining essential functionality
  • Type Safety: Proper TypeScript interfaces and validation

Testing

✅ Add new users with both read and write permissions
✅ Edit existing users to change tiers and permissions
✅ Toggle permissions directly in the table
✅ Remove users completely
✅ View all paid subscribers with proper npub formatting
✅ Form validation and error handling

Maphikza added 2 commits June 25, 2025 20:26
- Fix form switch components to properly integrate with Ant Design forms
- Add tier_name to tier field mapping in API responses
- Improve tier fallback logic in unified state reconstruction
- Clean up debugging logs
- Add edit button to actions column with edit icon
- Create edit user modal with tier and permission controls
- Implement smart update logic that removes and re-adds entries for tier changes
- Fix form integration with proper initialValues and delayed field setting
- Add error handling with user-friendly messages
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