@wix/agent-skills 1.13.0 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (250) hide show
  1. package/README.md +4 -1
  2. package/package.json +1 -1
  3. package/skills/README.md +23 -0
  4. package/skills/wix-app/SKILL.md +10 -2
  5. package/skills/wix-app/references/AUTO_PATTERNS_DASHBOARD.md +326 -0
  6. package/skills/wix-app/references/CODE_QUALITY.md +1 -0
  7. package/skills/wix-app/references/CUSTOM_ELEMENT_WIDGET.md +124 -115
  8. package/skills/wix-app/references/DASHBOARD_PAGE.md +3 -0
  9. package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +23 -9
  10. package/skills/wix-app/references/SITE_PLUGIN.md +1 -1
  11. package/skills/wix-app/references/auto-patterns-dashboard/action-cell.md +115 -0
  12. package/skills/wix-app/references/auto-patterns-dashboard/app-config-structure.md +264 -0
  13. package/skills/wix-app/references/auto-patterns-dashboard/app-context.md +37 -0
  14. package/skills/wix-app/references/auto-patterns-dashboard/bulk-actions.md +86 -0
  15. package/skills/wix-app/references/auto-patterns-dashboard/collection-page-actions.md +119 -0
  16. package/skills/wix-app/references/auto-patterns-dashboard/collection-page.md +103 -0
  17. package/skills/wix-app/references/auto-patterns-dashboard/custom-actions-override.md +76 -0
  18. package/skills/wix-app/references/auto-patterns-dashboard/custom-columns-override.md +82 -0
  19. package/skills/wix-app/references/auto-patterns-dashboard/custom-components-override.md +89 -0
  20. package/skills/wix-app/references/auto-patterns-dashboard/custom-header-override.md +124 -0
  21. package/skills/wix-app/references/auto-patterns-dashboard/custom-sections-override.md +91 -0
  22. package/skills/wix-app/references/auto-patterns-dashboard/custom-slots-override.md +71 -0
  23. package/skills/wix-app/references/auto-patterns-dashboard/entity-page-actions.md +70 -0
  24. package/skills/wix-app/references/auto-patterns-dashboard/entity-page-view-actions.md +73 -0
  25. package/skills/wix-app/references/auto-patterns-dashboard/entity-page.md +98 -0
  26. package/skills/wix-app/references/auto-patterns-dashboard/example-patterns.json +278 -0
  27. package/skills/wix-app/references/auto-patterns-dashboard/pages-configuration.md +94 -0
  28. package/skills/wix-app/references/auto-patterns-dashboard/resolved-action.md +43 -0
  29. package/skills/wix-app/references/auto-patterns-dashboard/sdk-utilities.md +66 -0
  30. package/skills/wix-app/references/auto-patterns-dashboard/views.md +76 -0
  31. package/skills/wix-app/references/editor-react-component/ACCESSIBILITY.md +1 -14
  32. package/skills/wix-app/references/editor-react-component/COMPONENT-API.md +54 -29
  33. package/skills/wix-app/references/editor-react-component/COMPONENT-CONFIGURATION.md +2 -2
  34. package/skills/wix-app/references/editor-react-component/CSS-GUIDELINES.md +17 -105
  35. package/skills/wix-app/references/editor-react-component/DESIGN-STATES.md +127 -0
  36. package/skills/wix-app/references/editor-react-component/PARTS.md +2 -1
  37. package/skills/wix-app/references/editor-react-component/REACT-GUIDELINES.md +15 -15
  38. package/skills/wix-app/references/editor-react-component/REACT-PATTERNS.md +25 -53
  39. package/skills/wix-app/scripts/generate-auto-patterns.js +510 -0
  40. package/skills/wix-auth/SKILL.md +12 -0
  41. package/skills/wix-auth/references/device-flow.md +140 -0
  42. package/skills/wix-docs/SKILL.md +188 -0
  43. package/skills/wix-docs/references/API_SPEC_SEARCH.md +213 -0
  44. package/skills/wix-docs/references/EXTRACTING.md +120 -0
  45. package/skills/wix-headless/SKILL.md +84 -130
  46. package/skills/wix-headless/entry/bootstrap.mjs +93 -0
  47. package/skills/wix-headless/entry/skill.md +78 -0
  48. package/skills/wix-headless/references/AI_FEATURES.md +178 -0
  49. package/skills/wix-headless/references/CAPABILITIES.md +84 -0
  50. package/skills/wix-headless/references/DISCOVERY.md +34 -56
  51. package/skills/wix-headless/references/DOC_DISCOVERY.md +37 -0
  52. package/skills/wix-headless/references/FEEDBACK.md +118 -0
  53. package/skills/wix-headless/references/IMAGE_GENERATION.md +69 -0
  54. package/skills/wix-headless/references/SDK_HANDOFF.md +97 -0
  55. package/skills/wix-headless/references/SEED.md +44 -188
  56. package/skills/wix-headless/references/SETUP.md +32 -103
  57. package/skills/wix-headless/references/astro.md +98 -0
  58. package/skills/wix-headless/references/inline-recipes/how-to-code-a-blog.md +196 -0
  59. package/skills/wix-headless/references/inline-recipes/how-to-code-a-store.md +236 -0
  60. package/skills/wix-headless/references/inline-recipes/how-to-code-bookings.md +279 -0
  61. package/skills/wix-headless/references/inline-recipes/how-to-code-cms.md +163 -0
  62. package/skills/wix-headless/references/inline-recipes/how-to-code-events.md +203 -0
  63. package/skills/wix-headless/references/inline-recipes/how-to-code-forms.md +222 -0
  64. package/skills/wix-headless/references/inline-recipes/how-to-code-members-astro.md +124 -0
  65. package/skills/wix-headless/references/inline-recipes/how-to-code-members-custom-login.md +160 -0
  66. package/skills/wix-headless/references/inline-recipes/how-to-code-members-non-astro.md +118 -0
  67. package/skills/wix-headless/references/inline-recipes/how-to-code-portfolio.md +132 -0
  68. package/skills/wix-headless/references/inline-recipes/how-to-code-pricing-plans.md +124 -0
  69. package/skills/wix-headless/references/inline-recipes/how-to-code-restaurant-orders.md +188 -0
  70. package/skills/wix-headless/references/inline-recipes/how-to-code-restaurant-reservations.md +173 -0
  71. package/skills/wix-headless/references/inline-recipes/how-to-code-restaurants.md +161 -0
  72. package/skills/wix-headless/references/inline-recipes/setup-blog.md +175 -0
  73. package/skills/wix-headless/references/inline-recipes/setup-bookings.md +228 -0
  74. package/skills/wix-headless/references/inline-recipes/setup-cms.md +200 -0
  75. package/skills/wix-headless/references/inline-recipes/setup-events.md +196 -0
  76. package/skills/wix-headless/references/inline-recipes/setup-forms.md +174 -0
  77. package/skills/wix-headless/references/inline-recipes/setup-online-store.md +176 -0
  78. package/skills/wix-headless/references/inline-recipes/setup-portfolio.md +153 -0
  79. package/skills/wix-headless/references/inline-recipes/setup-pricing-plans.md +229 -0
  80. package/skills/wix-headless/references/inline-recipes/setup-restaurant-orders.md +161 -0
  81. package/skills/wix-headless/references/inline-recipes/setup-restaurant-reservations.md +117 -0
  82. package/skills/wix-headless/references/inline-recipes/setup-restaurants.md +152 -0
  83. package/skills/wix-headless/references/managed/AUTHENTICATION.md +57 -0
  84. package/skills/wix-headless/references/managed/CONNECT.md +74 -0
  85. package/skills/wix-headless/references/managed/CREATE.md +130 -0
  86. package/skills/wix-headless/references/managed/DEPLOYMENT.md +57 -0
  87. package/skills/wix-headless/references/non-astro.md +59 -0
  88. package/skills/wix-headless/references/self-managed/AUTHENTICATION.md +22 -0
  89. package/skills/wix-headless/references/self-managed/DEPLOYMENT.md +7 -0
  90. package/skills/wix-headless/references/stripe/AUTHENTICATION.md +55 -0
  91. package/skills/wix-headless/references/stripe/DEPLOYMENT.md +63 -0
  92. package/skills/wix-manage/SKILL.md +24 -1
  93. package/skills/wix-manage/references/analytics/query-site-analytics.md +241 -0
  94. package/skills/wix-manage/references/bookings/create-and-update-booking-services.md +1 -1
  95. package/skills/wix-manage/references/bookings/diagnose-availability-issues.md +265 -0
  96. package/skills/wix-manage/references/marketing/create-and-publish-social-post.md +436 -0
  97. package/skills/wix-manage/references/marketing/generate-and-publish-marketing-plan.md +209 -0
  98. package/skills/wix-manage/references/rich-content/author-ricos-rich-content.md +249 -0
  99. package/skills/wix-manage/references/stores/create-product-with-options-catalog-v3.md +51 -0
  100. package/skills/wix-vibe-headless/SKILL.md +136 -0
  101. package/skills/wix-vibe-headless/references/blog/INSTRUCTIONS.md +128 -0
  102. package/skills/wix-vibe-headless/references/blog/wix-blog.js +217 -0
  103. package/skills/wix-vibe-headless/references/bookings/INSTRUCTIONS.md +153 -0
  104. package/skills/wix-vibe-headless/references/bookings/wix-bookings-checkout.js +147 -0
  105. package/skills/wix-vibe-headless/references/bookings/wix-bookings-services.js +215 -0
  106. package/skills/wix-vibe-headless/references/cms/INSTRUCTIONS.md +154 -0
  107. package/skills/wix-vibe-headless/references/cms/wix-cms.js +186 -0
  108. package/skills/wix-vibe-headless/references/events/INSTRUCTIONS.md +142 -0
  109. package/skills/wix-vibe-headless/references/events/wix-events-browse.js +135 -0
  110. package/skills/wix-vibe-headless/references/events/wix-events-registration.js +187 -0
  111. package/skills/wix-vibe-headless/references/members/INSTRUCTIONS.md +211 -0
  112. package/skills/wix-vibe-headless/references/members/wix-members-auth.js +387 -0
  113. package/skills/wix-vibe-headless/references/portfolio/INSTRUCTIONS.md +111 -0
  114. package/skills/wix-vibe-headless/references/portfolio/wix-portfolio.js +194 -0
  115. package/skills/wix-vibe-headless/references/pricing-plans/INSTRUCTIONS.md +127 -0
  116. package/skills/wix-vibe-headless/references/pricing-plans/wix-pricing-plans.js +157 -0
  117. package/skills/wix-vibe-headless/references/restaurants/INSTRUCTIONS.md +138 -0
  118. package/skills/wix-vibe-headless/references/restaurants/wix-restaurants-menu.js +224 -0
  119. package/skills/wix-vibe-headless/references/restaurants/wix-restaurants-ordering.js +156 -0
  120. package/skills/wix-vibe-headless/references/restaurants/wix-restaurants-reservations.js +107 -0
  121. package/skills/wix-vibe-headless/references/shared/wix-client.js +186 -0
  122. package/skills/wix-vibe-headless/references/storefront/INSTRUCTIONS.md +155 -0
  123. package/skills/wix-vibe-headless/references/storefront/wix-store-cart.js +147 -0
  124. package/skills/wix-vibe-headless/references/storefront/wix-store-catalog.js +142 -0
  125. package/skills/wix-headless/references/BUILD-astro.md +0 -244
  126. package/skills/wix-headless/references/BUILD-own-build.md +0 -167
  127. package/skills/wix-headless/references/BUILD.md +0 -105
  128. package/skills/wix-headless/references/DESIGN_SYSTEM.md +0 -165
  129. package/skills/wix-headless/references/DISCOVERY-connect.md +0 -55
  130. package/skills/wix-headless/references/DISCOVERY-create.md +0 -238
  131. package/skills/wix-headless/references/PLAN-connect.md +0 -19
  132. package/skills/wix-headless/references/PLAN-create.md +0 -17
  133. package/skills/wix-headless/references/PLAN.md +0 -92
  134. package/skills/wix-headless/references/astro/blog/BLOG_PAGES.md +0 -300
  135. package/skills/wix-headless/references/astro/blog/BLOG_SETUP.md +0 -218
  136. package/skills/wix-headless/references/astro/bookings/COMPONENTS.md +0 -45
  137. package/skills/wix-headless/references/astro/bookings/SERVICES_PAGES.md +0 -77
  138. package/skills/wix-headless/references/astro/cms/CMS_FOUNDATIONS.md +0 -214
  139. package/skills/wix-headless/references/astro/cms/FAQ_KNOWLEDGE_BASE.md +0 -231
  140. package/skills/wix-headless/references/astro/cms/PORTFOLIO.md +0 -453
  141. package/skills/wix-headless/references/astro/cms/RESOURCE_LIBRARY.md +0 -354
  142. package/skills/wix-headless/references/astro/cms/TEAM_DIRECTORY.md +0 -299
  143. package/skills/wix-headless/references/astro/designer/INSTRUCTIONS.md +0 -351
  144. package/skills/wix-headless/references/astro/ecom/CART_PAGES.md +0 -119
  145. package/skills/wix-headless/references/astro/ecom/CART_WIRING.md +0 -103
  146. package/skills/wix-headless/references/astro/ecom/COMPONENTS_CSS.md +0 -132
  147. package/skills/wix-headless/references/astro/forms/CONTACT_FORM.md +0 -463
  148. package/skills/wix-headless/references/astro/gift-cards/COMPONENTS.md +0 -119
  149. package/skills/wix-headless/references/astro/gift-cards/PAGES.md +0 -129
  150. package/skills/wix-headless/references/astro/stores/BACK_IN_STOCK.md +0 -178
  151. package/skills/wix-headless/references/astro/stores/CATEGORY_PAGES.md +0 -85
  152. package/skills/wix-headless/references/astro/stores/COMPONENTS_CSS.md +0 -129
  153. package/skills/wix-headless/references/astro/stores/HOME_AND_NAV.md +0 -229
  154. package/skills/wix-headless/references/astro/stores/PRODUCT_PAGES.md +0 -215
  155. package/skills/wix-headless/references/astro/stores/SHARED_WIRING.md +0 -165
  156. package/skills/wix-headless/references/astro/templates/Footer.astro +0 -27
  157. package/skills/wix-headless/references/astro/templates/Layout.astro +0 -132
  158. package/skills/wix-headless/references/astro/templates/Navigation.astro +0 -38
  159. package/skills/wix-headless/references/astro/templates/astro.config.mjs +0 -41
  160. package/skills/wix-headless/references/astro/templates/bookings/AvailabilityCalendar.tsx +0 -374
  161. package/skills/wix-headless/references/astro/templates/bookings/BookingForm.tsx +0 -136
  162. package/skills/wix-headless/references/astro/templates/bookings/SeoTags.astro +0 -25
  163. package/skills/wix-headless/references/astro/templates/bookings/ServiceBookingFlow.tsx +0 -71
  164. package/skills/wix-headless/references/astro/templates/bookings/ServiceCard.astro +0 -54
  165. package/skills/wix-headless/references/astro/templates/bookings/booking-confirmation.astro +0 -49
  166. package/skills/wix-headless/references/astro/templates/bookings/bookingDriver.ts +0 -245
  167. package/skills/wix-headless/references/astro/templates/bookings/components-bookings.css +0 -424
  168. package/skills/wix-headless/references/astro/templates/bookings/services/[slug].astro +0 -176
  169. package/skills/wix-headless/references/astro/templates/bookings/services/index.astro +0 -181
  170. package/skills/wix-headless/references/astro/templates/ecom/CartBadge.tsx +0 -84
  171. package/skills/wix-headless/references/astro/templates/ecom/CartView.tsx +0 -543
  172. package/skills/wix-headless/references/astro/templates/ecom/cart.astro +0 -13
  173. package/skills/wix-headless/references/astro/templates/ecom/components-ecom.css +0 -302
  174. package/skills/wix-headless/references/astro/templates/ecom/discounts.ts +0 -71
  175. package/skills/wix-headless/references/astro/templates/ecom/thank-you.astro +0 -24
  176. package/skills/wix-headless/references/astro/templates/gift-cards/GiftCardPurchase.tsx +0 -172
  177. package/skills/wix-headless/references/astro/templates/gift-cards/_home-teaser-snippet.astro +0 -42
  178. package/skills/wix-headless/references/astro/templates/gift-cards/_nav-snippet.astro +0 -11
  179. package/skills/wix-headless/references/astro/templates/gift-cards/components-gift-cards.css +0 -220
  180. package/skills/wix-headless/references/astro/templates/gift-cards/gift-cards.astro +0 -51
  181. package/skills/wix-headless/references/astro/templates/gift-cards/gift-cards.ts +0 -75
  182. package/skills/wix-headless/references/astro/templates/global.css +0 -288
  183. package/skills/wix-headless/references/astro/templates/index.astro +0 -56
  184. package/skills/wix-headless/references/astro/templates/stores/AddToCartButton.tsx +0 -77
  185. package/skills/wix-headless/references/astro/templates/stores/BackInStockForm.tsx +0 -176
  186. package/skills/wix-headless/references/astro/templates/stores/CategoryRail.astro +0 -69
  187. package/skills/wix-headless/references/astro/templates/stores/ProductCard.astro +0 -79
  188. package/skills/wix-headless/references/astro/templates/stores/ProductPurchase.tsx +0 -397
  189. package/skills/wix-headless/references/astro/templates/stores/SeoTags.astro +0 -21
  190. package/skills/wix-headless/references/astro/templates/stores/back-in-stock.ts +0 -67
  191. package/skills/wix-headless/references/astro/templates/stores/categories.ts +0 -155
  192. package/skills/wix-headless/references/astro/templates/stores/category/[slug].astro +0 -130
  193. package/skills/wix-headless/references/astro/templates/stores/components-stores.css +0 -400
  194. package/skills/wix-headless/references/astro/templates/stores/products/[slug].astro +0 -128
  195. package/skills/wix-headless/references/astro/templates/stores/products/index.astro +0 -101
  196. package/skills/wix-headless/references/blog/BLOG_CONTENT.md +0 -161
  197. package/skills/wix-headless/references/blog/INSTRUCTIONS.md +0 -32
  198. package/skills/wix-headless/references/bookings/FLOW.md +0 -246
  199. package/skills/wix-headless/references/bookings/INSTRUCTIONS.md +0 -95
  200. package/skills/wix-headless/references/bookings/SERVICES_DATA.md +0 -355
  201. package/skills/wix-headless/references/cms/CMS_FOUNDATIONS.md +0 -176
  202. package/skills/wix-headless/references/cms/INSTRUCTIONS.md +0 -71
  203. package/skills/wix-headless/references/commands/known-apps.json +0 -6
  204. package/skills/wix-headless/references/custom/CONNECTION_PLAN.md +0 -142
  205. package/skills/wix-headless/references/custom/INSTRUCTIONS.md +0 -88
  206. package/skills/wix-headless/references/custom/blog/WIRING.md +0 -52
  207. package/skills/wix-headless/references/custom/bookings/WIRING.md +0 -197
  208. package/skills/wix-headless/references/custom/cms/WIRING.md +0 -97
  209. package/skills/wix-headless/references/custom/ecom/WIRING.md +0 -67
  210. package/skills/wix-headless/references/custom/forms/WIRING.md +0 -101
  211. package/skills/wix-headless/references/custom/stores/WIRING.md +0 -80
  212. package/skills/wix-headless/references/ecom/INSTRUCTIONS.md +0 -59
  213. package/skills/wix-headless/references/forms/INSTRUCTIONS.md +0 -43
  214. package/skills/wix-headless/references/gift-cards/INSTRUCTIONS.md +0 -51
  215. package/skills/wix-headless/references/images/INSTRUCTIONS.md +0 -357
  216. package/skills/wix-headless/references/seed-recipes.md +0 -49
  217. package/skills/wix-headless/references/shared/AGENTS_MD.md +0 -47
  218. package/skills/wix-headless/references/shared/AUTHENTICATION.md +0 -108
  219. package/skills/wix-headless/references/shared/BUILD_NOISE.md +0 -8
  220. package/skills/wix-headless/references/shared/DESIGN_MD.md +0 -84
  221. package/skills/wix-headless/references/shared/DOCS_SEARCH.md +0 -41
  222. package/skills/wix-headless/references/shared/IMAGE_GENERATION.md +0 -186
  223. package/skills/wix-headless/references/shared/IMPLEMENTER.md +0 -206
  224. package/skills/wix-headless/references/shared/PRODUCTION_SHARP_EDGES.md +0 -97
  225. package/skills/wix-headless/references/shared/RETURN_CONTRACT.md +0 -143
  226. package/skills/wix-headless/references/shared/STYLING.md +0 -141
  227. package/skills/wix-headless/references/stores/INSTRUCTIONS.md +0 -126
  228. package/skills/wix-headless/references/stores/PRODUCT_CATALOG_DATA.md +0 -252
  229. package/skills/wix-headless/references/verticals/_schema.json +0 -74
  230. package/skills/wix-headless/references/verticals/_schema.md +0 -95
  231. package/skills/wix-headless/references/verticals/blog.md +0 -31
  232. package/skills/wix-headless/references/verticals/bookings.md +0 -41
  233. package/skills/wix-headless/references/verticals/cms.md +0 -30
  234. package/skills/wix-headless/references/verticals/ecom.md +0 -25
  235. package/skills/wix-headless/references/verticals/forms.md +0 -26
  236. package/skills/wix-headless/references/verticals/gift-cards.md +0 -24
  237. package/skills/wix-headless/references/verticals/stores.md +0 -33
  238. package/skills/wix-headless/scripts/check-manifest.mjs +0 -335
  239. package/skills/wix-headless/scripts/compose.mjs +0 -525
  240. package/skills/wix-headless/scripts/emit-design-tokens.mjs +0 -157
  241. package/skills/wix-headless/scripts/flatten.sh +0 -61
  242. package/skills/wix-headless/scripts/generate-images.mjs +0 -242
  243. package/skills/wix-headless/scripts/patch-decorative-slots.mjs +0 -148
  244. package/skills/wix-headless/scripts/plan-entity-image-waves.mjs +0 -190
  245. package/skills/wix-headless/scripts/scaffold.sh +0 -139
  246. package/skills/wix-headless/scripts/seed-utilities.sh +0 -93
  247. package/skills/wix-headless/scripts/write-decorative-json.mjs +0 -62
  248. package/skills/wix-headless/shared-utilities/analytics.ts +0 -40
  249. package/skills/wix-headless/shared-utilities/ricos.ts +0 -179
  250. package/skills/wix-headless/shared-utilities/wix-image.ts +0 -72
@@ -1,453 +0,0 @@
1
- # Recipe: Portfolio / Projects Showcase
2
-
3
- Build a visual portfolio using `@wix/data` — project grid with category filtering, image galleries, and project detail pages. Use for work samples, case studies, creative projects, or any visual showcase.
4
-
5
- > Read `CMS_FOUNDATIONS.md` (this folder — service module, query patterns, image resolution, elevation) for page-rendering patterns, and `../../cms/CMS_FOUNDATIONS.md` for REST-based seeding.
6
-
7
- ## Collection Schema
8
-
9
- The schema the `seed` scope creates via REST (see `../../cms/CMS_FOUNDATIONS.md`) — fields:
10
-
11
- | Field | Type | Purpose |
12
- |-------|------|---------|
13
- | `title` | Text | Project name |
14
- | `slug` | Text | URL-friendly identifier |
15
- | `category` | Text | Project category (e.g., "Branding", "Web Design") |
16
- | `description` | Rich Text | Project writeup (HTML) |
17
- | `client` | Text | Client or company name |
18
- | `year` | Text | Year completed |
19
- | `coverImage` | Image | Main project image (`wix:image://` — resolve with `media.getScaledToFillImageUrl()`) |
20
- | `galleryImages` | Image Gallery | Additional project images (multi-image array) |
21
- | `tags` | Text | Comma-separated tags |
22
- | `featured` | Boolean | Show on home page |
23
- | `orderIndex` | Number | Manual sort order |
24
-
25
- ## Files to Create
26
-
27
- | File | Purpose |
28
- |------|---------|
29
- | `src/lib/portfolio.ts` | Service module — queries, category filtering, featured projects |
30
- | `src/pages/work/index.astro` | Project grid with category filter tabs |
31
- | `src/pages/work/[slug].astro` | Project detail with image gallery |
32
- | `src/components/ProjectCard.astro` | Visual card for grid layout |
33
- | `src/components/CategoryFilter.astro` | URL-param-based pill buttons |
34
- | `src/components/ImageGallery.tsx` | React island for lightbox/carousel |
35
-
36
- ## Implementation
37
-
38
- ### 1. Portfolio Service Module (`src/lib/portfolio.ts`)
39
-
40
- ```typescript
41
- import { items } from "@wix/data";
42
- import { auth } from "@wix/essentials";
43
- import { media } from "@wix/sdk";
44
-
45
- const COLLECTION_ID = "Projects";
46
-
47
- export interface Project {
48
- _id: string;
49
- title: string;
50
- slug: string;
51
- category: string;
52
- description?: string;
53
- client?: string;
54
- year?: string;
55
- coverImage?: string;
56
- galleryImages: string[];
57
- tags: string[];
58
- featured: boolean;
59
- orderIndex: number;
60
- }
61
-
62
- function resolveImage(url: string | undefined, width = 800, height = 600): string | undefined {
63
- if (!url) return undefined;
64
- return media.getScaledToFillImageUrl(url, width, height, {});
65
- }
66
-
67
- function resolveImages(urls: string[] | undefined, width = 1200, height = 800): string[] {
68
- if (!urls || urls.length === 0) return [];
69
- return urls.map((url) => media.getScaledToFillImageUrl(url, width, height, {}));
70
- }
71
-
72
- function mapProject(item: Record<string, any>): Project {
73
- return {
74
- _id: item._id,
75
- title: item.title ?? "",
76
- slug: item.slug ?? "",
77
- category: item.category ?? "",
78
- description: item.description,
79
- client: item.client,
80
- year: item.year,
81
- coverImage: resolveImage(item.coverImage),
82
- galleryImages: resolveImages(item.galleryImages),
83
- tags: item.tags ? item.tags.split(",").map((t: string) => t.trim()) : [],
84
- featured: item.featured ?? false,
85
- orderIndex: item.orderIndex ?? 0,
86
- };
87
- }
88
-
89
- export async function queryProjects(): Promise<Project[]> {
90
- const elevatedQuery = auth.elevate(items.query);
91
- const { items: results } = await elevatedQuery(COLLECTION_ID)
92
- .ascending("orderIndex")
93
- .limit(50)
94
- .find();
95
-
96
- return results.map(mapProject);
97
- }
98
-
99
- export async function getProjectBySlug(slug: string): Promise<Project | null> {
100
- const elevatedQuery = auth.elevate(items.query);
101
- const { items: results } = await elevatedQuery(COLLECTION_ID)
102
- .eq("slug", slug)
103
- .limit(1)
104
- .find();
105
-
106
- const item = results[0];
107
- if (!item) return null;
108
- return mapProject(item);
109
- }
110
-
111
- export async function queryFeaturedProjects(limit = 3): Promise<Project[]> {
112
- const elevatedQuery = auth.elevate(items.query);
113
- const { items: results } = await elevatedQuery(COLLECTION_ID)
114
- .eq("featured", true)
115
- .ascending("orderIndex")
116
- .limit(limit)
117
- .find();
118
-
119
- return results.map(mapProject);
120
- }
121
- ```
122
-
123
- Key details:
124
- - `resolveImages()` handles the multi-image gallery field — iterates and resolves each URL
125
- - `tags` stored as comma-separated text, split into array at query time
126
- - `queryFeaturedProjects()` is for home page sections — query `featured === true`
127
- - Update `COLLECTION_ID` to match the exact collection name from the Wix dashboard (no namespace prefix for native collections)
128
-
129
- ### 2. Category Filter (`src/components/CategoryFilter.astro`)
130
-
131
- ```astro
132
- ---
133
- interface Props {
134
- categories: string[];
135
- activeCategory: string | null;
136
- basePath: string;
137
- }
138
-
139
- const { categories, activeCategory, basePath } = Astro.props;
140
- ---
141
-
142
- <nav>
143
- <a href={basePath} class:list={[!activeCategory && "active"]}>All</a>
144
- {categories.map((cat) => (
145
- <a
146
- href={`${basePath}?category=${encodeURIComponent(cat)}`}
147
- class:list={[activeCategory === cat && "active"]}
148
- >{cat}</a>
149
- ))}
150
- </nav>
151
- ```
152
-
153
- > **Styling note:** CategoryFilter styling is created by the design skill. See `references/shared/STYLING.md` (Category Filter).
154
-
155
- > Server-rendered, no JavaScript. Category is read from `Astro.url.searchParams` in the page.
156
-
157
- ### 3. Project Card (`src/components/ProjectCard.astro`)
158
-
159
- ```astro
160
- ---
161
- interface Props {
162
- project: {
163
- title: string;
164
- slug: string;
165
- category: string;
166
- coverImage?: string;
167
- client?: string;
168
- year?: string;
169
- };
170
- }
171
-
172
- const { project } = Astro.props;
173
- ---
174
-
175
- <a href={`/work/${project.slug}`}>
176
- <div>
177
- {project.coverImage ? (
178
- <img src={project.coverImage} alt={project.title} />
179
- ) : (
180
- <div>No image</div>
181
- )}
182
- </div>
183
- <div>
184
- <span>{project.category}</span>
185
- {project.year && <span>&middot; {project.year}</span>}
186
- </div>
187
- <h3>{project.title}</h3>
188
- {project.client && <p>{project.client}</p>}
189
- </a>
190
- ```
191
-
192
- > **Styling note:** ProjectCard styling is created by the design skill. See `references/shared/STYLING.md` (Project Card).
193
-
194
- ### 4. Project Grid Page (`src/pages/work/index.astro`)
195
-
196
- ```astro
197
- ---
198
- import Layout from "../../layouts/Layout.astro";
199
- import ProjectCard from "../../components/ProjectCard.astro";
200
- import CategoryFilter from "../../components/CategoryFilter.astro";
201
- import { queryProjects } from "../../lib/portfolio";
202
-
203
- const activeCategory = Astro.url.searchParams.get("category");
204
- const allProjects = await queryProjects();
205
- const filtered = activeCategory
206
- ? allProjects.filter((p) => p.category === activeCategory)
207
- : allProjects;
208
- const categories = [...new Set(allProjects.map((p) => p.category).filter(Boolean))];
209
- ---
210
-
211
- <Layout title="Work">
212
- <main>
213
- <div>
214
- <h1>Work</h1>
215
-
216
- <CategoryFilter categories={categories} activeCategory={activeCategory} basePath="/work" />
217
-
218
- <div>
219
- {filtered.map((project) => (
220
- <ProjectCard project={project} />
221
- ))}
222
- </div>
223
-
224
- {filtered.length === 0 && (
225
- <p>No projects found.</p>
226
- )}
227
- </div>
228
- </main>
229
- </Layout>
230
- ```
231
-
232
- ### 5. Project Detail Page (`src/pages/work/[slug].astro`)
233
-
234
- ```astro
235
- ---
236
- import Layout from "../../layouts/Layout.astro";
237
- import ImageGallery from "../../components/ImageGallery";
238
- import { getProjectBySlug } from "../../lib/portfolio";
239
-
240
- const { slug } = Astro.params;
241
- const project = await getProjectBySlug(slug!);
242
- if (!project) return Astro.redirect("/404");
243
- ---
244
-
245
- <Layout title={project.title}>
246
- <main>
247
- <div>
248
- <a href="/work">
249
- &larr; Back to work
250
- </a>
251
-
252
- {project.coverImage && (
253
- <div>
254
- <img
255
- src={project.coverImage}
256
- alt={project.title}
257
- />
258
- </div>
259
- )}
260
-
261
- <div>
262
- <span>{project.category}</span>
263
- {project.client && (
264
- <>
265
- <span>&middot;</span>
266
- <span>{project.client}</span>
267
- </>
268
- )}
269
- {project.year && (
270
- <>
271
- <span>&middot;</span>
272
- <span>{project.year}</span>
273
- </>
274
- )}
275
- </div>
276
-
277
- <h1>{project.title}</h1>
278
-
279
- {project.description && (
280
- <article set:html={project.description} />
281
- )}
282
-
283
- {project.galleryImages.length > 0 && (
284
- <ImageGallery client:only="react" images={project.galleryImages} alt={project.title} />
285
- )}
286
-
287
- {project.tags.length > 0 && (
288
- <div>
289
- {project.tags.map((tag) => (
290
- <span>{tag}</span>
291
- ))}
292
- </div>
293
- )}
294
- </div>
295
- </main>
296
- </Layout>
297
- ```
298
-
299
- ### 6. Image Gallery React Island (`src/components/ImageGallery.tsx`)
300
-
301
- ```tsx
302
- import { useState } from "react";
303
-
304
- interface Props {
305
- images: string[];
306
- alt: string;
307
- }
308
-
309
- export default function ImageGallery({ images, alt }: Props) {
310
- const [activeIndex, setActiveIndex] = useState<number | null>(null);
311
-
312
- if (images.length === 0) return null;
313
-
314
- return (
315
- <>
316
- <div className="gallery-grid">
317
- {images.map((src, i) => (
318
- <button
319
- key={i}
320
- onClick={() => setActiveIndex(i)}
321
- className="gallery-item"
322
- >
323
- <img
324
- src={src}
325
- alt={`${alt} — image ${i + 1}`}
326
- />
327
- </button>
328
- ))}
329
- </div>
330
-
331
- {activeIndex !== null && (
332
- <div
333
- className="lightbox-overlay"
334
- onClick={() => setActiveIndex(null)}
335
- >
336
- <button
337
- className="lightbox-close"
338
- onClick={() => setActiveIndex(null)}
339
- >
340
- &times;
341
- </button>
342
-
343
- {images.length > 1 && (
344
- <>
345
- <button
346
- className="lightbox-nav prev"
347
- onClick={(e) => {
348
- e.stopPropagation();
349
- setActiveIndex((activeIndex - 1 + images.length) % images.length);
350
- }}
351
- >
352
- &#8249;
353
- </button>
354
- <button
355
- className="lightbox-nav next"
356
- onClick={(e) => {
357
- e.stopPropagation();
358
- setActiveIndex((activeIndex + 1) % images.length);
359
- }}
360
- >
361
- &#8250;
362
- </button>
363
- </>
364
- )}
365
-
366
- <img
367
- src={images[activeIndex]}
368
- alt={`${alt} — image ${activeIndex + 1}`}
369
- className="lightbox-image"
370
- onClick={(e) => e.stopPropagation()}
371
- />
372
- </div>
373
- )}
374
- </>
375
- );
376
- }
377
- ```
378
-
379
- > **Styling note:** Uses `.gallery-grid`, `.gallery-item`, `.lightbox-overlay`, `.lightbox-image`, `.lightbox-nav`, `.lightbox-close` from the designed component's `<style is:global>` block. See `references/shared/STYLING.md` (Image Gallery / Lightbox).
380
-
381
- Key details:
382
- - Renders as a grid; clicking opens a lightbox overlay
383
- - Previous/next navigation wraps around
384
- - `client:only="react"` — requires client-side rendering for `useState`
385
- - No external dependencies — pure React
386
-
387
- ## Home Page Integration
388
-
389
- To show featured projects on the home page, import `queryFeaturedProjects`:
390
-
391
- ```astro
392
- ---
393
- import ProjectCard from "../components/ProjectCard.astro";
394
- import { queryFeaturedProjects } from "../lib/portfolio";
395
-
396
- const featured = await queryFeaturedProjects(3);
397
- ---
398
-
399
- <section>
400
- <div>
401
- <h2>Featured Work</h2>
402
- <div>
403
- {featured.map((project) => (
404
- <ProjectCard project={project} />
405
- ))}
406
- </div>
407
- </div>
408
- </section>
409
- ```
410
-
411
- ## Seed with Images
412
-
413
- After seeding projects via REST, generate cover images (and optionally gallery images) following `../../shared/IMAGE_GENERATION.md` and `../../cms/CMS_FOUNDATIONS.md` → "Seeding with Images".
414
-
415
- **Cover image prompt template:**
416
-
417
- ```
418
- Project showcase image for [TITLE]. [BRAND AESTHETIC]. Color palette: [BRAND COLORS]. Editorial style. No text, no watermarks
419
- ```
420
-
421
- **Patch field:** `coverImage`
422
-
423
- **Optional gallery images** — generate 2-3 additional images per project for the `galleryImages` array. Note: this is slow (each image takes ~10-15s), so only do this if the user wants a fully populated portfolio.
424
-
425
- ```
426
- Gallery image [N] for [TITLE]: [describe a specific aspect/angle of the project]. [BRAND AESTHETIC]. [BRAND COLORS]. No text, no watermarks
427
- ```
428
-
429
- **Patch field:** `galleryImages` (as an array of wixstatic URLs)
430
-
431
- Example patch:
432
-
433
- ```
434
- REST: PATCH https://www.wixapis.com/wix-data/v2/items/{projectId}
435
- body: {
436
- "dataCollectionId": "Projects",
437
- "dataItem": {
438
- "data": {
439
- "coverImage": "<wixstatic-url>",
440
- "galleryImages": ["<wixstatic-url-1>", "<wixstatic-url-2>"]
441
- }
442
- }
443
- }
444
- ```
445
-
446
- ## Testing
447
-
448
- Assumes the `seed` scope has already created the "Projects" collection and inserted items via REST (see `../../cms/CMS_FOUNDATIONS.md`) — 3+ projects with categories (and, after the image pass, cover/gallery images), 1–2 marked `featured: true`.
449
-
450
- 1. Run `npx @wix/cli@latest dev`
451
- 2. `/work` — grid with category filter tabs
452
- 3. Click a category — filters projects
453
- 4. Click a project — detail page with gallery lightbox