Skip to content

Conversation

@dernerl
Copy link
Owner

@dernerl dernerl commented Dec 8, 2025

πŸ“ Folder Support Implementation

Closes #4

βœ… Implemented Features

1. Data Model & Persistence

  • SwiftData model extended with:
    • parentID: UUID? - Hierarchical structure (nil = root level)
    • isFolder: Bool - Distinguish folders from favorites
    • order: Int - Sorting within the same level
  • Automatic migration with default values

2. User Interface

  • πŸ“‚ Folder display with DisclosureGroup (collapsible)
  • βž• "Add Folder" button in toolbar (CMD+N)
  • βž• "Add to Folder" button inside each folder
  • Hierarchical display with proper indentation
  • Consistent section headers (Favorites & Generated Outputs)

3. Drag & Drop

  • πŸ‘† Move favorites between root and folders
  • πŸ”„ Reorder items within same level
  • Drop zones before/after each item
  • Drop zone at start of lists (for first position)
  • Validation:
    • ❌ Folders cannot be nested (only 1 level deep)
    • ❌ Folders cannot be dropped into themselves
    • βœ… Favorites can move freely between root and folders

4. Export (JSON & Plist)

  • JSON Format (Windows/GPO & Intune Settings Catalog):
    {
      "name": "Work Links",
      "children": [
        { "name": "GitHub", "url": "https://github.com" }
      ]
    }
  • Plist Format (macOS/Intune Configuration Profiles):
    <dict>
      <key>children</key>
      <array>...</array>
      <key>name</key>
      <string>Work Links</string>
    </dict>
  • Correct Microsoft Edge format (children before name in Plist)
  • Sorted by order field for consistent output

5. UX Improvements

  • βš™οΈ TopLevel Name moved to Settings (⌘,)
    • Cleaner main view
    • No drag & drop conflicts
    • Semantically correct location
  • Improved section headers with subtitles
  • Better visual consistency

πŸ“ Changes Overview

Modified Files:

  • Favorite.swift - Data model with hierarchy fields
  • FavoritesViewModel.swift - Folder management & drag & drop logic
  • ContentView.swift - Drag & drop UI implementation
  • FolderRowView.swift - Folder display component
  • FormatGenerator.swift - JSON/Plist generation with children arrays
  • SettingsView.swift - TopLevel Name configuration
  • AppKitTextField.swift - Drag & drop protection (not needed after Settings move)

πŸ§ͺ Testing

Tested Scenarios:

  • βœ… Create folders and add favorites
  • βœ… Drag favorites into folders
  • βœ… Drag favorites out of folders
  • βœ… Reorder items via drag & drop
  • βœ… Export JSON/Plist with folder structure
  • βœ… TopLevel Name in Settings
  • βœ… SwiftData persistence across app restarts

πŸ“¦ Version

This PR prepares for v1.1.0 release (MINOR version bump - new features, backward compatible)

πŸ“Έ Screenshots

Main View with Folders:

  • Folder hierarchy with disclosure triangles
  • Drag & drop visual feedback
  • Clean section headers

Settings:

  • TopLevel Name configuration
  • Version info

Ready for review and merge into main! πŸš€

dernerl added 4 commits December 7, 2025 21:48
- Make url optional (nil = folder, String = favorite)
- Add parentID for hierarchy (nil = root level)
- Add order property for sorting
- Add isFolder computed property
- Update FormatGenerator to filter folders
- Update ContentView to handle optional url
- Only export favorites (not folders) for now

Part of #4
- Create FolderRowView component (yellow folder icon)
- Add DisclosureGroup for collapsible folders
- Show root level items vs. children
- Sort by order property
- Filter and display hierarchy correctly
- Indent child favorites under folders

Part of #4
- Add addFolder() method in ViewModel
- Add 'Add Folder' button in Toolbar
- Keyboard shortcut βŒ˜β‡§N for adding folders
- Folder created with url = nil and default name
- Support parentID parameter in addFavorite() for future use
- Delete works via existing removeFavorite() method

Part of #4
- Add folder hierarchy support (parentID, isFolder, order fields)
- Implement folder UI with DisclosureGroup
- Add drag & drop for reordering and moving favorites
- Generate JSON/Plist with children arrays for folders
- Move TopLevel Name to Settings (CMD+,)
- Fix Plist format (children before name)
- Improve UI consistency for section headers

Closes #4
@dernerl dernerl merged commit e533965 into main Dec 8, 2025
1 check passed
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.

feat: Support folders to organize favorites

1 participant