Pull Request: buildDotMoi-Style Tabs Interface for MoiPosterImproved
Description
This PR enhances the MoiPosterImproved project to better reflect how content appears on a buildDotMoi profile. It implements a tabs-based navigation system that matches the actual buildDotMoi interface, with support for:
A default "Posts" tab that shows all vals with moi.md files (not excluded from posts)
Custom tabs defined in moi.md frontmatter "tabs" field
An "Unposted" tab for vals without moi.md files
The original tabs for Code (Public), Unlisted, and Private still exist for convenience
Implementation Details
Frontend Changes
ProfilePreview.tsx: Completely redesigned to fetch and display moi information for all vals, with proper sorting by tier
Now displays custom tabs from moi.md files as defined in frontmatter
Supports tier-based sorting (no tier first, then lowest to highest)
Respects the "excludeFromPosts" setting from moi.md files
Added informative notices explaining what each tab displays
Backend Changes
moiProcessor.ts:
Added a dedicated parseMoiConfig function to extract configuration from moi.md files
Enhanced parsing to properly handle tier, tabs, and excludeFromPosts properties
index.ts:
Updated API endpoints to include parsed moi.md configuration in responses
Added config parsing to both file fetching and creation/update endpoints
Features Added
Dynamic Tab Generation: Tabs are populated from the "tabs" fields in moi.md files
Tier-Based Sorting: Vals are sorted by tier with no tier first, then lowest to highest
Exclusion Support: "excludeFromPosts" property allows vals to appear in custom tabs but not in the main Posts tab
Improved Preview: The interface better represents how content will appear on a buildDotMoi profile
Testing Instructions
Start the app and enter your Val Town API key
Notice the new tab interface showing "Posts" first, followed by any custom tabs found in your moi.md files, then "Unposted"
Edit a val's moi.md and add a custom tab using the "Tabs" field
Save and verify the new tab appears in the interface
Try setting different tier values to see how it affects sorting
Test the "Exclude from Posts" checkbox and verify it removes items from the Posts tab but keeps them in custom tabs
Notes
The existing functionality for editing moi.md files remains unchanged - this PR only enhances the preview interface
The MoiEditor component already supported the tabs, tier, and excludeFromPosts properties
The generators.ts file already included support for these properties in the default moi.md generation