feat: add dynamic variant selector with color swatches

- Fix Printify options parsing (Color/Size were swapped)
- Add extract_option_types/1 for frontend display with hex colors
- Filter option types to only published variants (not full catalog)
- Track selected variant in LiveView with price updates
- Color swatches for color-type options, text buttons for size
- Disable unavailable combinations
- Add startup recovery for stale sync status

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
jamey
2026-02-03 22:17:48 +00:00
parent 1b49b470f2
commit 880e7a2888
8 changed files with 572 additions and 40 deletions

View File

@@ -35,11 +35,21 @@ defmodule SimpleshopTheme.Images.VariantCache do
Logger.info("[VariantCache] Checking image variant cache...")
File.mkdir_p!(Optimizer.cache_dir())
reset_stale_sync_status()
ensure_database_image_variants()
ensure_mockup_variants()
ensure_product_image_downloads()
end
# Reset any provider connections stuck in "syncing" status from interrupted syncs
defp reset_stale_sync_status do
{count, _} = Products.reset_stale_sync_status()
if count > 0 do
Logger.info("[VariantCache] Reset #{count} stale sync status(es) to idle")
end
end
defp ensure_database_image_variants do
incomplete =
ImageSchema