@licklist/design 0.78.5-dev.107 → 0.78.5-dev.108

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 (414) hide show
  1. package/bitbucket-pipelines.yml +4 -13
  2. package/dist/Maintenance/Maintenance.scss.js +1 -1
  3. package/dist/index.js +2 -0
  4. package/dist/product-set/form/ProductsControl.d.ts +1 -2
  5. package/dist/product-set/form/ProductsControl.d.ts.map +1 -1
  6. package/dist/product-set/form/ProductsControl.js +24 -0
  7. package/dist/v2/components/ActionMenu/ActionMenu.scss.js +1 -1
  8. package/dist/v2/components/Badge/Badge.scss.js +1 -1
  9. package/dist/v2/components/Button/Button.scss.js +1 -1
  10. package/dist/v2/components/Button/GhostButton.scss.js +1 -1
  11. package/dist/v2/components/Checkbox/Checkbox.scss.js +1 -1
  12. package/dist/v2/components/DataTable/DataTable.d.ts.map +1 -1
  13. package/dist/v2/components/DataTable/DataTable.js +2 -86
  14. package/dist/v2/components/IconButton/IconButton.scss.js +1 -1
  15. package/dist/v2/components/Modal/DeleteModal.d.ts.map +1 -1
  16. package/dist/v2/components/Modal/DeleteModal.js +11 -13
  17. package/dist/v2/components/Modal/DeleteModal.scss.js +1 -1
  18. package/dist/v2/components/NPSScore/NPSScore.scss.js +1 -1
  19. package/dist/v2/components/NewTabs/NewTabs.scss.js +1 -1
  20. package/dist/v2/components/PeriodCard/PeriodCard.d.ts +66 -0
  21. package/dist/v2/components/PeriodCard/PeriodCard.d.ts.map +1 -0
  22. package/dist/v2/components/PeriodCard/PeriodCard.js +351 -0
  23. package/dist/v2/components/PeriodCard/PeriodCard.scss.js +6 -0
  24. package/dist/v2/components/PeriodCard/index.d.ts +3 -0
  25. package/dist/v2/components/PeriodCard/index.d.ts.map +1 -0
  26. package/dist/v2/components/ReorderRow/ReorderRow.d.ts +24 -0
  27. package/dist/v2/components/ReorderRow/ReorderRow.d.ts.map +1 -0
  28. package/dist/v2/components/ReorderRow/ReorderRow.js +109 -0
  29. package/dist/v2/components/ReorderRow/ReorderRow.scss.js +6 -0
  30. package/dist/v2/components/ReorderRow/index.d.ts +3 -0
  31. package/dist/v2/components/ReorderRow/index.d.ts.map +1 -0
  32. package/dist/v2/components/Select/Select.scss.js +1 -1
  33. package/dist/v2/components/StatusBadge/StatusBadge.scss.js +1 -1
  34. package/dist/v2/components/StepIndicator/StepIndicator.scss.js +1 -1
  35. package/dist/v2/components/Tabs/Tabs.scss.js +1 -1
  36. package/dist/v2/components/Toggle/Toggle.d.ts.map +1 -1
  37. package/dist/v2/components/Toggle/Toggle.js +5 -8
  38. package/dist/v2/components/Tooltip/Tooltip.scss.js +1 -1
  39. package/dist/v2/components/UserAvatar/UserAvatar.scss.js +1 -1
  40. package/dist/v2/components/UserPanel/UserPanel.scss.js +1 -1
  41. package/dist/v2/components/WYSIWYGEditor/WYSIWYGEditor.scss.js +1 -1
  42. package/dist/v2/components/ZoneCard/ZoneCard.scss.js +1 -1
  43. package/dist/v2/components/index.d.ts +4 -0
  44. package/dist/v2/components/index.d.ts.map +1 -1
  45. package/dist/v2/dashboard-analytics/chart/Chart.scss.js +1 -1
  46. package/dist/v2/dashboard-analytics/metric-card/MetricCard.scss.js +1 -1
  47. package/dist/v2/dashboard-analytics/venue-card/VenueCard.scss.js +1 -1
  48. package/dist/v2/dashboard-analytics/venue-closed-card/VenueClosedCard.scss.js +1 -1
  49. package/dist/v2/icons/index.js +16 -1
  50. package/dist/v2/index.d.ts +8 -0
  51. package/dist/v2/index.d.ts.map +1 -1
  52. package/dist/v2/navigation/DashboardLayout/AdminSidebar.scss.js +1 -1
  53. package/dist/v2/navigation/DashboardLayout/DashboardLayout.scss.js +1 -1
  54. package/dist/v2/navigation/DashboardLayout/ProviderSidebar.scss.js +1 -1
  55. package/dist/v2/navigation/DashboardLayout/TopNavigation.scss.js +1 -1
  56. package/dist/v2/pages/Settings/SettingsTabs.scss.js +1 -1
  57. package/dist/v2/pages/Settings/components/SidebarCustomisation.js +5 -0
  58. package/dist/v2/pages/Settings/components/SidebarCustomisation.scss.js +1 -1
  59. package/dist/v2/pages/Settings/components/SidebarNavItem.js +5 -0
  60. package/dist/v2/pages/auth/AuthLayout/AuthLayout.scss.js +1 -1
  61. package/dist/v2/shadcn/components/ui/accordion.d.ts +8 -0
  62. package/dist/v2/shadcn/components/ui/accordion.d.ts.map +1 -0
  63. package/dist/v2/shadcn/components/ui/alert-dialog.d.ts +21 -0
  64. package/dist/v2/shadcn/components/ui/alert-dialog.d.ts.map +1 -0
  65. package/dist/v2/shadcn/components/ui/alert.d.ts +9 -0
  66. package/dist/v2/shadcn/components/ui/alert.d.ts.map +1 -0
  67. package/dist/v2/shadcn/components/ui/aspect-ratio.d.ts +4 -0
  68. package/dist/v2/shadcn/components/ui/aspect-ratio.d.ts.map +1 -0
  69. package/dist/v2/shadcn/components/ui/avatar.d.ts +7 -0
  70. package/dist/v2/shadcn/components/ui/avatar.d.ts.map +1 -0
  71. package/dist/v2/shadcn/components/ui/badge.d.ts +10 -0
  72. package/dist/v2/shadcn/components/ui/badge.d.ts.map +1 -0
  73. package/dist/v2/shadcn/components/ui/breadcrumb.d.ts +20 -0
  74. package/dist/v2/shadcn/components/ui/breadcrumb.d.ts.map +1 -0
  75. package/dist/v2/shadcn/components/ui/button.d.ts +14 -0
  76. package/dist/v2/shadcn/components/ui/button.d.ts.map +1 -0
  77. package/dist/v2/shadcn/components/ui/calendar.d.ts +9 -0
  78. package/dist/v2/shadcn/components/ui/calendar.d.ts.map +1 -0
  79. package/dist/v2/shadcn/components/ui/card.d.ts +9 -0
  80. package/dist/v2/shadcn/components/ui/card.d.ts.map +1 -0
  81. package/dist/v2/shadcn/components/ui/carousel.d.ts +19 -0
  82. package/dist/v2/shadcn/components/ui/carousel.d.ts.map +1 -0
  83. package/dist/v2/shadcn/components/ui/checkbox.d.ts +6 -0
  84. package/dist/v2/shadcn/components/ui/checkbox.d.ts.map +1 -0
  85. package/dist/v2/shadcn/components/ui/checkbox.js +115 -0
  86. package/dist/v2/shadcn/components/ui/checkbox.scss.js +6 -0
  87. package/dist/v2/shadcn/components/ui/collapsible.d.ts +6 -0
  88. package/dist/v2/shadcn/components/ui/collapsible.d.ts.map +1 -0
  89. package/dist/v2/shadcn/components/ui/command.d.ts +83 -0
  90. package/dist/v2/shadcn/components/ui/command.d.ts.map +1 -0
  91. package/dist/v2/shadcn/components/ui/context-menu.d.ts +28 -0
  92. package/dist/v2/shadcn/components/ui/context-menu.d.ts.map +1 -0
  93. package/dist/v2/shadcn/components/ui/dialog.d.ts +20 -0
  94. package/dist/v2/shadcn/components/ui/dialog.d.ts.map +1 -0
  95. package/dist/v2/shadcn/components/ui/dialog.js +169 -0
  96. package/dist/v2/shadcn/components/ui/drawer.d.ts +23 -0
  97. package/dist/v2/shadcn/components/ui/drawer.d.ts.map +1 -0
  98. package/dist/v2/shadcn/components/ui/dropdown-menu.d.ts +28 -0
  99. package/dist/v2/shadcn/components/ui/dropdown-menu.d.ts.map +1 -0
  100. package/dist/v2/shadcn/components/ui/form.d.ts +24 -0
  101. package/dist/v2/shadcn/components/ui/form.d.ts.map +1 -0
  102. package/dist/v2/shadcn/components/ui/hover-card.d.ts +7 -0
  103. package/dist/v2/shadcn/components/ui/hover-card.d.ts.map +1 -0
  104. package/dist/v2/shadcn/components/ui/input-otp.d.ts +35 -0
  105. package/dist/v2/shadcn/components/ui/input-otp.d.ts.map +1 -0
  106. package/dist/v2/shadcn/components/ui/input.d.ts +6 -0
  107. package/dist/v2/shadcn/components/ui/input.d.ts.map +1 -0
  108. package/dist/v2/shadcn/components/ui/label.d.ts +6 -0
  109. package/dist/v2/shadcn/components/ui/label.d.ts.map +1 -0
  110. package/dist/v2/shadcn/components/ui/menubar.d.ts +34 -0
  111. package/dist/v2/shadcn/components/ui/menubar.d.ts.map +1 -0
  112. package/dist/v2/shadcn/components/ui/navigation-menu.d.ts +13 -0
  113. package/dist/v2/shadcn/components/ui/navigation-menu.d.ts.map +1 -0
  114. package/dist/v2/shadcn/components/ui/pagination.d.ts +29 -0
  115. package/dist/v2/shadcn/components/ui/pagination.d.ts.map +1 -0
  116. package/dist/v2/shadcn/components/ui/popover.d.ts +7 -0
  117. package/dist/v2/shadcn/components/ui/popover.d.ts.map +1 -0
  118. package/dist/v2/shadcn/components/ui/progress.d.ts +5 -0
  119. package/dist/v2/shadcn/components/ui/progress.d.ts.map +1 -0
  120. package/dist/v2/shadcn/components/ui/radio-card.d.ts +12 -0
  121. package/dist/v2/shadcn/components/ui/radio-card.d.ts.map +1 -0
  122. package/dist/v2/shadcn/components/ui/radio-group.d.ts +6 -0
  123. package/dist/v2/shadcn/components/ui/radio-group.d.ts.map +1 -0
  124. package/dist/v2/shadcn/components/ui/scroll-area.d.ts +6 -0
  125. package/dist/v2/shadcn/components/ui/scroll-area.d.ts.map +1 -0
  126. package/dist/v2/shadcn/components/ui/select.d.ts +14 -0
  127. package/dist/v2/shadcn/components/ui/select.d.ts.map +1 -0
  128. package/dist/v2/shadcn/components/ui/separator.d.ts +5 -0
  129. package/dist/v2/shadcn/components/ui/separator.d.ts.map +1 -0
  130. package/dist/v2/shadcn/components/ui/sheet.d.ts +26 -0
  131. package/dist/v2/shadcn/components/ui/sheet.d.ts.map +1 -0
  132. package/dist/v2/shadcn/components/ui/sidebar.d.ts +67 -0
  133. package/dist/v2/shadcn/components/ui/sidebar.d.ts.map +1 -0
  134. package/dist/v2/shadcn/components/ui/skeleton.d.ts +3 -0
  135. package/dist/v2/shadcn/components/ui/skeleton.d.ts.map +1 -0
  136. package/dist/v2/shadcn/components/ui/slider.d.ts +5 -0
  137. package/dist/v2/shadcn/components/ui/slider.d.ts.map +1 -0
  138. package/dist/v2/shadcn/components/ui/switch.d.ts +6 -0
  139. package/dist/v2/shadcn/components/ui/switch.d.ts.map +1 -0
  140. package/dist/v2/shadcn/components/ui/switch.js +115 -0
  141. package/dist/v2/shadcn/components/ui/switch.scss.js +6 -0
  142. package/dist/v2/shadcn/components/ui/table-pagination.d.ts +11 -0
  143. package/dist/v2/shadcn/components/ui/table-pagination.d.ts.map +1 -0
  144. package/dist/v2/shadcn/components/ui/table.d.ts +11 -0
  145. package/dist/v2/shadcn/components/ui/table.d.ts.map +1 -0
  146. package/dist/v2/shadcn/components/ui/tabs.d.ts +8 -0
  147. package/dist/v2/shadcn/components/ui/tabs.d.ts.map +1 -0
  148. package/dist/v2/shadcn/components/ui/textarea.d.ts +6 -0
  149. package/dist/v2/shadcn/components/ui/textarea.d.ts.map +1 -0
  150. package/dist/v2/shadcn/components/ui/toast.d.ts +16 -0
  151. package/dist/v2/shadcn/components/ui/toast.d.ts.map +1 -0
  152. package/dist/v2/shadcn/components/ui/toaster.d.ts +2 -0
  153. package/dist/v2/shadcn/components/ui/toaster.d.ts.map +1 -0
  154. package/dist/v2/shadcn/components/ui/toggle-group.d.ts +13 -0
  155. package/dist/v2/shadcn/components/ui/toggle-group.d.ts.map +1 -0
  156. package/dist/v2/shadcn/components/ui/toggle.d.ts +13 -0
  157. package/dist/v2/shadcn/components/ui/toggle.d.ts.map +1 -0
  158. package/dist/v2/shadcn/components/ui/tooltip.d.ts +8 -0
  159. package/dist/v2/shadcn/components/ui/tooltip.d.ts.map +1 -0
  160. package/dist/v2/shadcn/components/ui/use-toast.d.ts +3 -0
  161. package/dist/v2/shadcn/components/ui/use-toast.d.ts.map +1 -0
  162. package/dist/v2/shadcn/hooks/use-mobile.d.ts +2 -0
  163. package/dist/v2/shadcn/hooks/use-mobile.d.ts.map +1 -0
  164. package/dist/v2/shadcn/hooks/use-toast.d.ts +45 -0
  165. package/dist/v2/shadcn/hooks/use-toast.d.ts.map +1 -0
  166. package/dist/v2/shadcn/index.d.ts +20 -0
  167. package/dist/v2/shadcn/index.d.ts.map +1 -0
  168. package/dist/v2/shadcn/lib/utils.d.ts +3 -0
  169. package/dist/v2/shadcn/lib/utils.d.ts.map +1 -0
  170. package/dist/v2/shadcn/lib/utils.js +11 -0
  171. package/dist/v2/shadcn/styles/globals.css +112 -0
  172. package/dist/v2/styles/form/NewInput.scss.js +1 -1
  173. package/package.json +6 -6
  174. package/rollup.config.js +2 -16
  175. package/src/iframe/payment/payment-status-page/PaymentStatusPage.tsx +1 -1
  176. package/src/product-set/form/ProductsControl.tsx +1 -2
  177. package/src/v2/components/DataTable/DataTable.tsx +1 -23
  178. package/src/v2/components/Modal/DeleteModal.tsx +20 -12
  179. package/src/v2/components/PeriodCard/PeriodCard.scss +157 -0
  180. package/src/v2/components/PeriodCard/PeriodCard.stories.tsx +245 -0
  181. package/src/v2/components/PeriodCard/PeriodCard.tsx +350 -0
  182. package/src/v2/components/PeriodCard/index.ts +8 -0
  183. package/src/v2/components/ReorderRow/ReorderRow.scss +68 -0
  184. package/src/v2/components/ReorderRow/ReorderRow.stories.tsx +124 -0
  185. package/src/v2/components/ReorderRow/ReorderRow.tsx +88 -0
  186. package/src/v2/components/ReorderRow/index.ts +2 -0
  187. package/src/v2/components/Toggle/Toggle.tsx +5 -6
  188. package/src/v2/components/index.ts +6 -0
  189. package/src/v2/index.ts +82 -0
  190. package/src/v2/shadcn/_reference/AccountManagerCard.tsx +45 -0
  191. package/src/v2/shadcn/_reference/AffiliatesTable.tsx +178 -0
  192. package/src/v2/shadcn/_reference/AuditArchive.tsx +165 -0
  193. package/src/v2/shadcn/_reference/AuditContent.tsx +270 -0
  194. package/src/v2/shadcn/_reference/AutomationsGeneralSettings.tsx +251 -0
  195. package/src/v2/shadcn/_reference/AvatarUpload.tsx +150 -0
  196. package/src/v2/shadcn/_reference/BookingsSummaryCard.tsx +268 -0
  197. package/src/v2/shadcn/_reference/CodeCleanUpAudit.tsx +274 -0
  198. package/src/v2/shadcn/_reference/CompaniesTable.tsx +387 -0
  199. package/src/v2/shadcn/_reference/ComponentAudit.tsx +239 -0
  200. package/src/v2/shadcn/_reference/ConfigureSettingsCard.tsx +95 -0
  201. package/src/v2/shadcn/_reference/CustomerCard.tsx +155 -0
  202. package/src/v2/shadcn/_reference/DashboardCards.tsx +50 -0
  203. package/src/v2/shadcn/_reference/DashboardFooter.tsx +18 -0
  204. package/src/v2/shadcn/_reference/DiarySettings.tsx +187 -0
  205. package/src/v2/shadcn/_reference/DiaryView.tsx +998 -0
  206. package/src/v2/shadcn/_reference/EmptyState.tsx +76 -0
  207. package/src/v2/shadcn/_reference/EntityInfoCard.tsx +48 -0
  208. package/src/v2/shadcn/_reference/ExistingUserAssignments.tsx +131 -0
  209. package/src/v2/shadcn/_reference/FeatureToggle.tsx +72 -0
  210. package/src/v2/shadcn/_reference/FlowCard.tsx +170 -0
  211. package/src/v2/shadcn/_reference/FlowsContent.tsx +688 -0
  212. package/src/v2/shadcn/_reference/FlowsGeneralSettings.tsx +27 -0
  213. package/src/v2/shadcn/_reference/GeneralSettings.tsx +33 -0
  214. package/src/v2/shadcn/_reference/InventoryGeneralSettings.tsx +82 -0
  215. package/src/v2/shadcn/_reference/LanguageSelector.tsx +97 -0
  216. package/src/v2/shadcn/_reference/LoadingScreen.tsx +25 -0
  217. package/src/v2/shadcn/_reference/LoadingSpinner.tsx +41 -0
  218. package/src/v2/shadcn/_reference/ManagedClientsList.tsx +121 -0
  219. package/src/v2/shadcn/_reference/NPSScore.tsx +379 -0
  220. package/src/v2/shadcn/_reference/NPSSummaryCard.tsx +181 -0
  221. package/src/v2/shadcn/_reference/NotificationBanner.tsx +129 -0
  222. package/src/v2/shadcn/_reference/NotificationPanel.tsx +208 -0
  223. package/src/v2/shadcn/_reference/OnlineUsersCard.tsx +73 -0
  224. package/src/v2/shadcn/_reference/ProtectedRoute.tsx +39 -0
  225. package/src/v2/shadcn/_reference/ProvidersTable.tsx +353 -0
  226. package/src/v2/shadcn/_reference/QuickAddPanel.tsx +1057 -0
  227. package/src/v2/shadcn/_reference/QuickFilters.tsx +112 -0
  228. package/src/v2/shadcn/_reference/ScheduleView.tsx +410 -0
  229. package/src/v2/shadcn/_reference/ScrollToTop.tsx +14 -0
  230. package/src/v2/shadcn/_reference/SecondaryNav.tsx +50 -0
  231. package/src/v2/shadcn/_reference/SecuritySettings.tsx +258 -0
  232. package/src/v2/shadcn/_reference/SessionDetailView.tsx +294 -0
  233. package/src/v2/shadcn/_reference/Sidebar.tsx +14 -0
  234. package/src/v2/shadcn/_reference/SidebarAwareLayout.tsx +30 -0
  235. package/src/v2/shadcn/_reference/SidebarLabelCustomization.tsx +285 -0
  236. package/src/v2/shadcn/_reference/SimulationBanner.tsx +57 -0
  237. package/src/v2/shadcn/_reference/SortControls.tsx +65 -0
  238. package/src/v2/shadcn/_reference/StatusBadge.tsx +49 -0
  239. package/src/v2/shadcn/_reference/StyleGuideContent.tsx +331 -0
  240. package/src/v2/shadcn/_reference/TableActionMenu.tsx +126 -0
  241. package/src/v2/shadcn/_reference/ThemeProvider.tsx +119 -0
  242. package/src/v2/shadcn/_reference/ThemeSettings.tsx +73 -0
  243. package/src/v2/shadcn/_reference/TopNavigation.tsx +332 -0
  244. package/src/v2/shadcn/_reference/UserActivityHistory.tsx +209 -0
  245. package/src/v2/shadcn/_reference/UserLanguageSettings.tsx +94 -0
  246. package/src/v2/shadcn/_reference/UserPanel.tsx +472 -0
  247. package/src/v2/shadcn/_reference/UsersTable.tsx +1023 -0
  248. package/src/v2/shadcn/_reference/WaiverForm.tsx +301 -0
  249. package/src/v2/shadcn/_reference/WaiversGeneralSettings.tsx +46 -0
  250. package/src/v2/shadcn/_reference/WaiversTable.tsx +290 -0
  251. package/src/v2/shadcn/_reference/WaiversTemplatesSettings.tsx +416 -0
  252. package/src/v2/shadcn/_reference/ai/AIChatPanel.tsx +313 -0
  253. package/src/v2/shadcn/_reference/ai/AIChatSearchBar.tsx +36 -0
  254. package/src/v2/shadcn/_reference/ai/ChatInteractiveBlock.tsx +298 -0
  255. package/src/v2/shadcn/_reference/ai/ChatMessageContent.tsx +40 -0
  256. package/src/v2/shadcn/_reference/ai/parseInteractiveBlocks.ts +142 -0
  257. package/src/v2/shadcn/_reference/auth/AuthLayout.tsx +55 -0
  258. package/src/v2/shadcn/_reference/auth/CreatePasswordForm.tsx +285 -0
  259. package/src/v2/shadcn/_reference/auth/CreatePasswordPanel.tsx +20 -0
  260. package/src/v2/shadcn/_reference/auth/LoginFooter.tsx +14 -0
  261. package/src/v2/shadcn/_reference/auth/LoginForm.tsx +205 -0
  262. package/src/v2/shadcn/_reference/auth/LoginPanel.tsx +41 -0
  263. package/src/v2/shadcn/_reference/auth/ResetPasswordForm.tsx +102 -0
  264. package/src/v2/shadcn/_reference/auth/ResetPasswordPanel.tsx +20 -0
  265. package/src/v2/shadcn/_reference/auth/VerifyEmailForm.tsx +95 -0
  266. package/src/v2/shadcn/_reference/auth/VerifyEmailPanel.tsx +20 -0
  267. package/src/v2/shadcn/_reference/email/EmailAttachment.tsx +119 -0
  268. package/src/v2/shadcn/_reference/email/EmailAutomation.tsx +92 -0
  269. package/src/v2/shadcn/_reference/email/EmailPlaceholders.tsx +64 -0
  270. package/src/v2/shadcn/_reference/email/UnlayerEmailEditor.tsx +41 -0
  271. package/src/v2/shadcn/_reference/email/emailTemplateData.ts +53 -0
  272. package/src/v2/shadcn/_reference/emptyStateIcons.tsx +103 -0
  273. package/src/v2/shadcn/_reference/games/MazeGame.tsx +394 -0
  274. package/src/v2/shadcn/_reference/games/RunnerGame.tsx +497 -0
  275. package/src/v2/shadcn/_reference/logos/BookedLogoFull.tsx +36 -0
  276. package/src/v2/shadcn/_reference/logos/BookedLogoMark.tsx +31 -0
  277. package/src/v2/shadcn/_reference/logos/BookedLogoNew.tsx +36 -0
  278. package/src/v2/shadcn/_reference/pricing/DynamicPricingRulesEditor.tsx +401 -0
  279. package/src/v2/shadcn/_reference/pricing/DynamicPricingTierCard.tsx +77 -0
  280. package/src/v2/shadcn/_reference/pricing/DynamicPricingTiersList.tsx +218 -0
  281. package/src/v2/shadcn/_reference/pricing/PricingCalendar.tsx +810 -0
  282. package/src/v2/shadcn/_reference/pricing/PricingPeriodCard.tsx +152 -0
  283. package/src/v2/shadcn/_reference/pricing/PricingPeriodForm.tsx +377 -0
  284. package/src/v2/shadcn/_reference/pricing/PricingPeriodsList.tsx +213 -0
  285. package/src/v2/shadcn/_reference/pricing/getRuleSummary.ts +39 -0
  286. package/src/v2/shadcn/_reference/products/AvailabilityRulesSection.tsx +184 -0
  287. package/src/v2/shadcn/_reference/products/AvailabilitySection.tsx +677 -0
  288. package/src/v2/shadcn/_reference/products/BookingTypeConfigOptions.tsx +40 -0
  289. package/src/v2/shadcn/_reference/products/CapacityPeriodsSection.tsx +238 -0
  290. package/src/v2/shadcn/_reference/products/DynamicPricingTiersSection.tsx +131 -0
  291. package/src/v2/shadcn/_reference/products/GiftCardOrdersTab.tsx +192 -0
  292. package/src/v2/shadcn/_reference/products/GiftCardSettings.tsx +342 -0
  293. package/src/v2/shadcn/_reference/products/PackageProductsSection.tsx +322 -0
  294. package/src/v2/shadcn/_reference/products/PricingSection.tsx +173 -0
  295. package/src/v2/shadcn/_reference/products/ProductTypeFields.tsx +353 -0
  296. package/src/v2/shadcn/_reference/products/ProductTypeIcon.tsx +95 -0
  297. package/src/v2/shadcn/_reference/products/VariablePricingSection.tsx +140 -0
  298. package/src/v2/shadcn/_reference/products/productTypeConfig.ts +182 -0
  299. package/src/v2/shadcn/_reference/shared/BackButton.tsx +50 -0
  300. package/src/v2/shadcn/_reference/shared/CancelConfirmationDialog.tsx +18 -0
  301. package/src/v2/shadcn/_reference/shared/ConfirmationDialog.tsx +136 -0
  302. package/src/v2/shadcn/_reference/shared/DeleteConfirmationDialog.tsx +18 -0
  303. package/src/v2/shadcn/_reference/shared/DeleteEntityPage.tsx +221 -0
  304. package/src/v2/shadcn/_reference/shared/SidebarIcons.tsx +108 -0
  305. package/src/v2/shadcn/_reference/shared/UnifiedSidebar.tsx +722 -0
  306. package/src/v2/shadcn/_reference/tables/BulkActionsBar.tsx +68 -0
  307. package/src/v2/shadcn/_reference/tables/DataTable.tsx +221 -0
  308. package/src/v2/shadcn/_reference/tables/TableControls.tsx +94 -0
  309. package/src/v2/shadcn/_reference/tables/index.ts +3 -0
  310. package/src/v2/shadcn/_reference/tables/types.ts +79 -0
  311. package/src/v2/shadcn/_reference/zones/LegacyZoneSettings.tsx +299 -0
  312. package/src/v2/shadcn/components/ui/accordion.stories.tsx +63 -0
  313. package/src/v2/shadcn/components/ui/accordion.tsx +52 -0
  314. package/src/v2/shadcn/components/ui/alert-dialog.stories.tsx +44 -0
  315. package/src/v2/shadcn/components/ui/alert-dialog.tsx +104 -0
  316. package/src/v2/shadcn/components/ui/alert.stories.tsx +44 -0
  317. package/src/v2/shadcn/components/ui/alert.tsx +43 -0
  318. package/src/v2/shadcn/components/ui/aspect-ratio.stories.tsx +46 -0
  319. package/src/v2/shadcn/components/ui/aspect-ratio.tsx +5 -0
  320. package/src/v2/shadcn/components/ui/avatar.stories.tsx +39 -0
  321. package/src/v2/shadcn/components/ui/avatar.tsx +38 -0
  322. package/src/v2/shadcn/components/ui/badge.stories.tsx +17 -0
  323. package/src/v2/shadcn/components/ui/badge.tsx +30 -0
  324. package/src/v2/shadcn/components/ui/breadcrumb.stories.tsx +91 -0
  325. package/src/v2/shadcn/components/ui/breadcrumb.tsx +90 -0
  326. package/src/v2/shadcn/components/ui/button.stories.tsx +20 -0
  327. package/src/v2/shadcn/components/ui/button.tsx +60 -0
  328. package/src/v2/shadcn/components/ui/calendar.stories.tsx +61 -0
  329. package/src/v2/shadcn/components/ui/calendar.tsx +54 -0
  330. package/src/v2/shadcn/components/ui/card.stories.tsx +37 -0
  331. package/src/v2/shadcn/components/ui/card.tsx +43 -0
  332. package/src/v2/shadcn/components/ui/carousel.stories.tsx +92 -0
  333. package/src/v2/shadcn/components/ui/carousel.tsx +224 -0
  334. package/src/v2/shadcn/components/ui/checkbox.scss +38 -0
  335. package/src/v2/shadcn/components/ui/checkbox.stories.tsx +23 -0
  336. package/src/v2/shadcn/components/ui/checkbox.tsx +24 -0
  337. package/src/v2/shadcn/components/ui/collapsible.stories.tsx +59 -0
  338. package/src/v2/shadcn/components/ui/collapsible.tsx +9 -0
  339. package/src/v2/shadcn/components/ui/command.stories.tsx +70 -0
  340. package/src/v2/shadcn/components/ui/command.tsx +132 -0
  341. package/src/v2/shadcn/components/ui/context-menu.stories.tsx +72 -0
  342. package/src/v2/shadcn/components/ui/context-menu.tsx +178 -0
  343. package/src/v2/shadcn/components/ui/dialog.stories.tsx +67 -0
  344. package/src/v2/shadcn/components/ui/dialog.tsx +95 -0
  345. package/src/v2/shadcn/components/ui/drawer.stories.tsx +50 -0
  346. package/src/v2/shadcn/components/ui/drawer.tsx +87 -0
  347. package/src/v2/shadcn/components/ui/dropdown-menu.stories.tsx +73 -0
  348. package/src/v2/shadcn/components/ui/dropdown-menu.tsx +179 -0
  349. package/src/v2/shadcn/components/ui/form.stories.tsx +105 -0
  350. package/src/v2/shadcn/components/ui/form.tsx +129 -0
  351. package/src/v2/shadcn/components/ui/hover-card.stories.tsx +35 -0
  352. package/src/v2/shadcn/components/ui/hover-card.tsx +27 -0
  353. package/src/v2/shadcn/components/ui/input-otp.stories.tsx +72 -0
  354. package/src/v2/shadcn/components/ui/input-otp.tsx +61 -0
  355. package/src/v2/shadcn/components/ui/input.stories.tsx +16 -0
  356. package/src/v2/shadcn/components/ui/input.tsx +25 -0
  357. package/src/v2/shadcn/components/ui/label.stories.tsx +13 -0
  358. package/src/v2/shadcn/components/ui/label.tsx +17 -0
  359. package/src/v2/shadcn/components/ui/menubar.stories.tsx +86 -0
  360. package/src/v2/shadcn/components/ui/menubar.tsx +207 -0
  361. package/src/v2/shadcn/components/ui/navigation-menu.stories.tsx +68 -0
  362. package/src/v2/shadcn/components/ui/navigation-menu.tsx +120 -0
  363. package/src/v2/shadcn/components/ui/pagination.stories.tsx +78 -0
  364. package/src/v2/shadcn/components/ui/pagination.tsx +81 -0
  365. package/src/v2/shadcn/components/ui/popover.stories.tsx +44 -0
  366. package/src/v2/shadcn/components/ui/popover.tsx +29 -0
  367. package/src/v2/shadcn/components/ui/progress.stories.tsx +17 -0
  368. package/src/v2/shadcn/components/ui/progress.tsx +23 -0
  369. package/src/v2/shadcn/components/ui/radio-card.stories.tsx +68 -0
  370. package/src/v2/shadcn/components/ui/radio-card.tsx +52 -0
  371. package/src/v2/shadcn/components/ui/radio-group.stories.tsx +77 -0
  372. package/src/v2/shadcn/components/ui/radio-group.tsx +35 -0
  373. package/src/v2/shadcn/components/ui/scroll-area.stories.tsx +56 -0
  374. package/src/v2/shadcn/components/ui/scroll-area.tsx +38 -0
  375. package/src/v2/shadcn/components/ui/select.stories.tsx +60 -0
  376. package/src/v2/shadcn/components/ui/select.tsx +148 -0
  377. package/src/v2/shadcn/components/ui/separator.stories.tsx +30 -0
  378. package/src/v2/shadcn/components/ui/separator.tsx +20 -0
  379. package/src/v2/shadcn/components/ui/sheet.stories.tsx +115 -0
  380. package/src/v2/shadcn/components/ui/sheet.tsx +107 -0
  381. package/src/v2/shadcn/components/ui/sidebar.stories.tsx +167 -0
  382. package/src/v2/shadcn/components/ui/sidebar.tsx +637 -0
  383. package/src/v2/shadcn/components/ui/skeleton.stories.tsx +36 -0
  384. package/src/v2/shadcn/components/ui/skeleton.tsx +7 -0
  385. package/src/v2/shadcn/components/ui/slider.stories.tsx +16 -0
  386. package/src/v2/shadcn/components/ui/slider.tsx +23 -0
  387. package/src/v2/shadcn/components/ui/switch.scss +63 -0
  388. package/src/v2/shadcn/components/ui/switch.stories.tsx +23 -0
  389. package/src/v2/shadcn/components/ui/switch.tsx +24 -0
  390. package/src/v2/shadcn/components/ui/table-pagination.stories.tsx +81 -0
  391. package/src/v2/shadcn/components/ui/table-pagination.tsx +61 -0
  392. package/src/v2/shadcn/components/ui/table.stories.tsx +40 -0
  393. package/src/v2/shadcn/components/ui/table.tsx +72 -0
  394. package/src/v2/shadcn/components/ui/tabs.stories.tsx +85 -0
  395. package/src/v2/shadcn/components/ui/tabs.tsx +53 -0
  396. package/src/v2/shadcn/components/ui/textarea.stories.tsx +15 -0
  397. package/src/v2/shadcn/components/ui/textarea.tsx +21 -0
  398. package/src/v2/shadcn/components/ui/toast.stories.tsx +77 -0
  399. package/src/v2/shadcn/components/ui/toast.tsx +111 -0
  400. package/src/v2/shadcn/components/ui/toaster.stories.tsx +46 -0
  401. package/src/v2/shadcn/components/ui/toaster.tsx +24 -0
  402. package/src/v2/shadcn/components/ui/toggle-group.stories.tsx +95 -0
  403. package/src/v2/shadcn/components/ui/toggle-group.tsx +49 -0
  404. package/src/v2/shadcn/components/ui/toggle.stories.tsx +18 -0
  405. package/src/v2/shadcn/components/ui/toggle.tsx +37 -0
  406. package/src/v2/shadcn/components/ui/tooltip.stories.tsx +57 -0
  407. package/src/v2/shadcn/components/ui/tooltip.tsx +28 -0
  408. package/src/v2/shadcn/components/ui/use-toast.ts +3 -0
  409. package/src/v2/shadcn/hooks/use-mobile.tsx +19 -0
  410. package/src/v2/shadcn/hooks/use-toast.ts +184 -0
  411. package/src/v2/shadcn/index.ts +76 -0
  412. package/src/v2/shadcn/lib/utils.ts +6 -0
  413. package/src/v2/shadcn/styles/globals.css +112 -0
  414. package/.vscode/settings.json +0 -3
@@ -0,0 +1,274 @@
1
+ import React from 'react';
2
+
3
+ const CodeCleanUpAudit: React.FC = () => {
4
+ const auditDate = new Date('2025-11-12T15:45:00').toLocaleString('en-US', {
5
+ year: 'numeric',
6
+ month: 'long',
7
+ day: 'numeric',
8
+ hour: '2-digit',
9
+ minute: '2-digit'
10
+ });
11
+
12
+ const findings = [
13
+ {
14
+ category: 'Muted Colors',
15
+ count: 46,
16
+ files: 24,
17
+ tokens: ['muted', 'muted-foreground'],
18
+ recommendation: 'Replace with design system tokens like label-secondary, fill-secondary, or surface-secondary',
19
+ components: [
20
+ 'button.tsx - hover states',
21
+ 'dropdown-menu.tsx - disabled items',
22
+ 'command.tsx - placeholder text',
23
+ 'calendar.tsx - disabled dates',
24
+ 'select.tsx - disabled options',
25
+ 'chart.tsx - grid lines',
26
+ 'table.tsx - header backgrounds',
27
+ 'slider.tsx - track backgrounds'
28
+ ],
29
+ visual: (
30
+ <div className="flex gap-2 items-center flex-wrap">
31
+ <div className="flex items-center gap-2 p-2 bg-muted rounded border border-border-primary">
32
+ <div className="w-6 h-6 bg-muted border border-border-primary rounded"></div>
33
+ <span className="text-muted-foreground text-xs">muted</span>
34
+ </div>
35
+ <div className="flex items-center gap-2 p-2 bg-muted rounded border border-border-primary">
36
+ <span className="text-muted-foreground text-xs font-semibold">Text on muted</span>
37
+ </div>
38
+ </div>
39
+ )
40
+ },
41
+ {
42
+ category: 'Accent Colors',
43
+ count: 74,
44
+ files: 11,
45
+ tokens: ['accent', 'accent-foreground'],
46
+ recommendation: 'Replace with design system tokens like fill-highlight, surface-highlight-soft, or label-highlight',
47
+ components: [
48
+ 'context-menu.tsx - menu items',
49
+ 'menubar.tsx - menu items',
50
+ 'navigation-menu.tsx - active items',
51
+ 'dropdown-menu.tsx - hover states',
52
+ 'command.tsx - selected items',
53
+ 'calendar.tsx - today indicator',
54
+ 'select.tsx - selected option'
55
+ ],
56
+ visual: (
57
+ <div className="flex gap-2 items-center flex-wrap">
58
+ <div className="flex items-center gap-2 p-2 bg-accent rounded border border-border-primary">
59
+ <div className="w-6 h-6 bg-accent border border-border-primary rounded"></div>
60
+ <span className="text-accent-foreground text-xs">accent</span>
61
+ </div>
62
+ <div className="flex items-center gap-2 p-2 bg-accent rounded border border-border-primary">
63
+ <span className="text-accent-foreground text-xs font-semibold">Text on accent</span>
64
+ </div>
65
+ </div>
66
+ )
67
+ },
68
+ {
69
+ category: 'Card Colors',
70
+ count: 3,
71
+ files: 2,
72
+ tokens: ['card', 'card-foreground'],
73
+ recommendation: 'Replace with surface-primary and label-primary',
74
+ components: [
75
+ 'card.tsx - card backgrounds',
76
+ 'card.tsx - card text'
77
+ ],
78
+ visual: (
79
+ <div className="flex gap-2 items-center flex-wrap">
80
+ <div className="flex items-center gap-2 p-2 bg-card rounded border border-border-primary">
81
+ <div className="w-6 h-6 bg-card border border-border-primary rounded"></div>
82
+ <span className="text-card-foreground text-xs">card</span>
83
+ </div>
84
+ <div className="flex items-center gap-2 p-2 bg-card rounded border border-border-primary">
85
+ <span className="text-card-foreground text-xs font-semibold">Text on card</span>
86
+ </div>
87
+ </div>
88
+ )
89
+ },
90
+ {
91
+ category: 'Popover Colors',
92
+ count: 22,
93
+ files: 8,
94
+ tokens: ['popover', 'popover-foreground'],
95
+ recommendation: 'Replace with surface-primary and label-primary',
96
+ components: [
97
+ 'popover.tsx - popover backgrounds',
98
+ 'hover-card.tsx - card backgrounds',
99
+ 'dropdown-menu.tsx - menu backgrounds',
100
+ 'command.tsx - command palette',
101
+ 'select.tsx - dropdown backgrounds',
102
+ 'calendar.tsx - calendar popup',
103
+ 'tooltip.tsx - tooltip backgrounds'
104
+ ],
105
+ visual: (
106
+ <div className="flex gap-2 items-center flex-wrap">
107
+ <div className="flex items-center gap-2 p-2 bg-popover rounded border border-border-primary">
108
+ <div className="w-6 h-6 bg-popover border border-border-primary rounded"></div>
109
+ <span className="text-popover-foreground text-xs">popover</span>
110
+ </div>
111
+ <div className="flex items-center gap-2 p-2 bg-popover rounded border border-border-primary">
112
+ <span className="text-popover-foreground text-xs font-semibold">Text on popover</span>
113
+ </div>
114
+ </div>
115
+ )
116
+ },
117
+ {
118
+ category: 'Ring Offset',
119
+ count: 32,
120
+ files: 16,
121
+ tokens: ['ring-offset-background'],
122
+ recommendation: 'Replace with surface-primary or remove if not needed',
123
+ components: [
124
+ 'input.tsx - focus rings',
125
+ 'checkbox.tsx - focus rings',
126
+ 'radio-group.tsx - focus rings',
127
+ 'switch.tsx - focus rings',
128
+ 'button.tsx - focus rings',
129
+ 'select.tsx - focus rings',
130
+ 'textarea.tsx - focus rings',
131
+ 'slider.tsx - focus rings'
132
+ ],
133
+ visual: (
134
+ <div className="flex gap-2 items-center flex-wrap">
135
+ <div className="p-3 rounded border border-border-primary bg-surface-primary">
136
+ <div className="w-20 h-8 bg-surface-secondary rounded ring-2 ring-primary ring-offset-2 ring-offset-background flex items-center justify-center">
137
+ <span className="text-[10px] text-label-secondary">ring offset</span>
138
+ </div>
139
+ </div>
140
+ </div>
141
+ )
142
+ },
143
+ {
144
+ category: 'Destructive Colors',
145
+ count: 16,
146
+ files: 6,
147
+ tokens: ['destructive', 'destructive-foreground'],
148
+ recommendation: 'Replace with fill-danger, surface-danger-soft, or label-danger',
149
+ components: [
150
+ 'button.tsx - destructive variant',
151
+ 'alert.tsx - destructive variant',
152
+ 'badge.tsx - destructive variant',
153
+ 'alert-dialog.tsx - destructive actions',
154
+ 'form.tsx - error messages',
155
+ 'toast.tsx - error toasts'
156
+ ],
157
+ visual: (
158
+ <div className="flex gap-2 items-center flex-wrap">
159
+ <div className="flex items-center gap-2 p-2 bg-destructive rounded border border-border-primary">
160
+ <div className="w-6 h-6 bg-destructive border border-border-primary rounded"></div>
161
+ <span className="text-destructive-foreground text-xs">destructive</span>
162
+ </div>
163
+ <div className="flex items-center gap-2 p-2 bg-destructive rounded border border-border-primary">
164
+ <span className="text-destructive-foreground text-xs font-semibold">Text on destructive</span>
165
+ </div>
166
+ </div>
167
+ )
168
+ }
169
+ ];
170
+
171
+ const totalIssues = findings.reduce((sum, f) => sum + f.count, 0);
172
+
173
+ return (
174
+ <div className="flex flex-col gap-6 w-full">
175
+ <div className="flex items-center justify-between p-4 bg-surface-secondary rounded-lg">
176
+ <div>
177
+ <div className="flex items-center gap-3">
178
+ <div className="text-label-primary font-semibold text-lg">
179
+ Code Clean Up
180
+ </div>
181
+ <span className="px-2 py-1 bg-surface-status-alert text-label-status-alert text-xs font-semibold rounded">
182
+ Audit #2
183
+ </span>
184
+ </div>
185
+ <div className="text-label-secondary text-sm mt-1">
186
+ {auditDate}
187
+ </div>
188
+ <div className="text-label-secondary text-xs mt-1">
189
+ Shadcn and Tailwind default tokens detected in codebase
190
+ </div>
191
+ </div>
192
+ </div>
193
+
194
+ {/* Overview Stats */}
195
+ <div className="grid grid-cols-3 gap-4 max-sm:grid-cols-1">
196
+ <div className="p-4 bg-surface-status-alert rounded-lg border border-border-status-alert">
197
+ <div className="text-label-status-alert text-xs font-semibold uppercase tracking-wide">Total Instances</div>
198
+ <div className="text-label-primary text-3xl font-bold mt-2">{totalIssues}</div>
199
+ </div>
200
+ <div className="p-4 bg-surface-status-alert rounded-lg border border-border-status-alert">
201
+ <div className="text-label-status-alert text-xs font-semibold uppercase tracking-wide">Categories</div>
202
+ <div className="text-label-primary text-3xl font-bold mt-2">{findings.length}</div>
203
+ </div>
204
+ <div className="p-4 bg-surface-status-alert rounded-lg border border-border-status-alert">
205
+ <div className="text-label-status-alert text-xs font-semibold uppercase tracking-wide">Files Affected</div>
206
+ <div className="text-label-primary text-3xl font-bold mt-2">{Math.max(...findings.map(f => f.files))}</div>
207
+ </div>
208
+ </div>
209
+
210
+ {/* Detailed Findings */}
211
+ {findings.map((finding, index) => (
212
+ <div key={index} className="flex flex-col gap-3 p-4 bg-surface-secondary rounded-lg">
213
+ <div className="flex items-center justify-between">
214
+ <h3 className="text-label-primary font-semibold text-sm">
215
+ {finding.category}
216
+ </h3>
217
+ <span className="px-2 py-0.5 bg-surface-status-alert text-label-status-alert text-xs font-semibold rounded">
218
+ {finding.count} instances in {finding.files} files
219
+ </span>
220
+ </div>
221
+
222
+ <div className="flex flex-col gap-2">
223
+ <div className="text-label-secondary text-xs mb-2">Visual example:</div>
224
+ {finding.visual}
225
+ </div>
226
+
227
+ <div className="flex flex-col gap-2">
228
+ <div className="text-label-secondary text-xs mb-2">Shadcn/Tailwind tokens found:</div>
229
+ <div className="flex flex-wrap gap-2">
230
+ {finding.tokens.map((token, i) => (
231
+ <div key={i} className="p-2 bg-surface-primary rounded border border-border-primary text-xs">
232
+ <code className="text-label-status-error font-mono">{token}</code>
233
+ </div>
234
+ ))}
235
+ </div>
236
+ </div>
237
+
238
+ <div className="flex flex-col gap-2">
239
+ <div className="text-label-secondary text-xs mb-2">Components affected:</div>
240
+ <div className="p-3 bg-surface-primary rounded border border-border-primary">
241
+ <div className="text-label-secondary text-[11px] space-y-1">
242
+ {finding.components.map((component, i) => (
243
+ <div key={i}>• {component}</div>
244
+ ))}
245
+ </div>
246
+ </div>
247
+ </div>
248
+
249
+ <div className="text-xs text-label-secondary mt-2 p-3 bg-surface-highlight-soft rounded">
250
+ <strong>Recommendation:</strong> {finding.recommendation}
251
+ </div>
252
+ </div>
253
+ ))}
254
+
255
+ {/* Summary */}
256
+ <div className="p-4 bg-surface-status-info border border-border-status-info rounded-lg">
257
+ <h3 className="text-label-status-info font-semibold mb-2">Impact Summary</h3>
258
+ <div className="space-y-2 text-sm">
259
+ <div className="text-label-secondary">
260
+ <strong className="text-label-primary">Scope:</strong> This audit identified {totalIssues} instances of Shadcn/Tailwind default tokens across {Math.max(...findings.map(f => f.files))} component files.
261
+ </div>
262
+ <div className="text-label-secondary">
263
+ <strong className="text-label-primary">Priority:</strong> These tokens should be replaced with design system tokens to ensure consistent theming, proper dark mode support, and maintainability.
264
+ </div>
265
+ <div className="text-label-secondary">
266
+ <strong className="text-label-primary">Next Steps:</strong> Replace Shadcn defaults systematically by category, starting with the most frequently used tokens (accent, muted) to maximize impact.
267
+ </div>
268
+ </div>
269
+ </div>
270
+ </div>
271
+ );
272
+ };
273
+
274
+ export default CodeCleanUpAudit;
@@ -0,0 +1,387 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { useTranslation } from 'react-i18next';
3
+ import { useNavigate } from 'react-router-dom';
4
+ import { supabase } from '@/integrations/supabase/client';
5
+ import { DataTable } from './tables/DataTable';
6
+ import { TableControls } from './tables/TableControls';
7
+ import { ColumnConfig, RowAction, HeaderAction } from './tables/types';
8
+ import { Button } from './ui/button';
9
+ import EmptyState from './EmptyState';
10
+ import { IconPlusThick, IconArrowInternalReturn, IconDashboard } from '../../icons';
11
+ import { ActionButton } from './TableActionMenu';
12
+ import LoadingScreen from './LoadingScreen';
13
+ import { useToast } from '../hooks/use-toast';
14
+ import StatusBadge from './StatusBadge';
15
+ import { format } from 'date-fns';
16
+
17
+ interface Company {
18
+ id: string;
19
+ name: string;
20
+ status: string;
21
+ avatar_url?: string;
22
+ created_at: string;
23
+ company_id?: string;
24
+ provider_count?: number;
25
+ }
26
+
27
+ const CompaniesTable: React.FC = () => {
28
+ const navigate = useNavigate();
29
+ const { toast } = useToast();
30
+ const { t } = useTranslation(['Design']);
31
+ const [companies, setCompanies] = useState<Company[]>([]);
32
+ const [filteredCompanies, setFilteredCompanies] = useState<Company[]>([]);
33
+ const [isLoading, setIsLoading] = useState(true);
34
+ const [searchQuery, setSearchQuery] = useState('');
35
+ const [sortKey, setSortKey] = useState<string>('name');
36
+ const [sortDirection, setSortDirection] = useState<'asc' | 'desc'>('asc');
37
+
38
+ const fetchCompanies = async () => {
39
+ try {
40
+ // Fetch companies - no ordering here, we'll sort after combining data
41
+ const { data: companiesData, error } = await supabase
42
+ .from('companies' as any)
43
+ .select('*') as any;
44
+
45
+ if (error) throw error;
46
+
47
+ // Fetch provider counts for each company
48
+ const companiesWithCounts = await Promise.all(
49
+ (companiesData || []).map(async (company: Company) => {
50
+ const { count } = await supabase
51
+ .from('providers')
52
+ .select('*', { count: 'exact', head: true })
53
+ .eq('company_id', company.id);
54
+
55
+ return {
56
+ ...company,
57
+ provider_count: count || 0
58
+ };
59
+ })
60
+ );
61
+
62
+ setCompanies(companiesWithCounts);
63
+ setFilteredCompanies(companiesWithCounts);
64
+ } catch (error) {
65
+ console.error('Error fetching companies:', error);
66
+ toast({
67
+ title: 'Error',
68
+ description: 'Failed to load companies',
69
+ variant: 'destructive',
70
+ });
71
+ } finally {
72
+ setIsLoading(false);
73
+ }
74
+ };
75
+
76
+ useEffect(() => {
77
+ fetchCompanies();
78
+ }, []);
79
+
80
+ const handleSort = (key: string) => {
81
+ if (sortKey === key) {
82
+ setSortDirection(sortDirection === 'asc' ? 'desc' : 'asc');
83
+ } else {
84
+ setSortKey(key);
85
+ setSortDirection('asc');
86
+ }
87
+ };
88
+
89
+ useEffect(() => {
90
+ if (searchQuery.trim()) {
91
+ const filtered = companies.filter(company =>
92
+ company.name.toLowerCase().includes(searchQuery.toLowerCase()) ||
93
+ (company.company_id && company.company_id.includes(searchQuery))
94
+ );
95
+ setFilteredCompanies(filtered);
96
+ } else {
97
+ setFilteredCompanies(companies);
98
+ }
99
+ }, [searchQuery, companies]);
100
+
101
+ const sortedCompanies = [...filteredCompanies].sort((a, b) => {
102
+ let aValue: any;
103
+ let bValue: any;
104
+
105
+ switch (sortKey) {
106
+ case 'name':
107
+ aValue = a.name.toLowerCase();
108
+ bValue = b.name.toLowerCase();
109
+ break;
110
+ case 'created':
111
+ aValue = new Date(a.created_at).getTime();
112
+ bValue = new Date(b.created_at).getTime();
113
+ break;
114
+ case 'provider_count':
115
+ aValue = a.provider_count || 0;
116
+ bValue = b.provider_count || 0;
117
+ break;
118
+ default:
119
+ return 0;
120
+ }
121
+
122
+ if (aValue < bValue) return sortDirection === 'asc' ? -1 : 1;
123
+ if (aValue > bValue) return sortDirection === 'asc' ? 1 : -1;
124
+ return 0;
125
+ });
126
+
127
+ const handleAddCompany = () => {
128
+ navigate('/admin/companies/add');
129
+ };
130
+
131
+ const handleEdit = (company: Company) => {
132
+ navigate(`/admin/companies/${company.id}/edit`);
133
+ };
134
+
135
+ const handleView = (company: Company) => {
136
+ navigate(`/company/${company.id}`);
137
+ };
138
+
139
+ const handleToggleStatus = async (company: Company) => {
140
+ try {
141
+ const newStatus = company.status === 'active' ? 'disabled' : 'active';
142
+
143
+ const { error } = await supabase
144
+ .from('companies' as any)
145
+ .update({ status: newStatus })
146
+ .eq('id', company.id) as any;
147
+
148
+ if (error) throw error;
149
+
150
+ toast({
151
+ title: 'Success',
152
+ description: `Company ${newStatus === 'active' ? 'enabled' : 'disabled'}`,
153
+ });
154
+
155
+ await fetchCompanies();
156
+ } catch (error) {
157
+ console.error('Error toggling company status:', error);
158
+ toast({
159
+ title: 'Error',
160
+ description: 'Failed to update company status',
161
+ variant: 'destructive',
162
+ });
163
+ }
164
+ };
165
+
166
+ const getInitials = (name: string) => {
167
+ return name
168
+ .split(' ')
169
+ .map(word => word[0])
170
+ .join('')
171
+ .toUpperCase()
172
+ .slice(0, 2);
173
+ };
174
+
175
+ const getCompanyIcon = (company: Company) => {
176
+ if (company.avatar_url) {
177
+ return (
178
+ <div className="flex w-10 h-10 justify-center items-center rounded-full overflow-hidden bg-surface-tertiary flex-shrink-0">
179
+ <img
180
+ src={company.avatar_url}
181
+ alt={company.name}
182
+ className="w-full h-full object-cover"
183
+ />
184
+ </div>
185
+ );
186
+ }
187
+
188
+ return (
189
+ <div className="flex w-10 h-10 justify-center items-center rounded-full bg-surface-tertiary flex-shrink-0">
190
+ <span className="text-label-secondary text-sm font-semibold">
191
+ {getInitials(company.name)}
192
+ </span>
193
+ </div>
194
+ );
195
+ };
196
+
197
+ const columns: ColumnConfig<Company>[] = [
198
+ {
199
+ label: t('companyAndId'),
200
+ sortKey: 'name',
201
+ sortable: true,
202
+ render: (company: Company) => (
203
+ <div className="flex items-center gap-3 flex-1">
204
+ {getCompanyIcon(company)}
205
+ <div className="flex flex-col gap-0.5 flex-1 min-w-0">
206
+ <h3 className="text-label-primary text-sm font-semibold leading-4 truncate">
207
+ {company.name}
208
+ </h3>
209
+ <p className="text-label-secondary text-xs font-normal leading-4">
210
+ Company ID: {company.company_id || 'N/A'}
211
+ </p>
212
+ </div>
213
+ </div>
214
+ ),
215
+ },
216
+ {
217
+ label: t('numberOfProviders'),
218
+ sortKey: 'provider_count',
219
+ sortable: true,
220
+ render: (company: Company) => (
221
+ <span className="text-text-secondary">{company.provider_count || 0}</span>
222
+ ),
223
+ width: 'w-[120px]'
224
+ },
225
+ {
226
+ label: t('dateOfCreation'),
227
+ sortKey: 'created',
228
+ sortable: true,
229
+ render: (company: Company) => (
230
+ <span className="text-text-secondary">{format(new Date(company.created_at), 'dd.MM.yyyy')}</span>
231
+ ),
232
+ width: 'w-[140px]'
233
+ },
234
+ {
235
+ label: t('status'),
236
+ render: (company: Company) => <StatusBadge status={company.status as 'active' | 'disabled' | 'invited' | 'suspended'} />,
237
+ width: 'w-[100px]',
238
+ className: 'flex justify-end'
239
+ },
240
+ ];
241
+
242
+ const handleDuplicate = (company: Company) => {
243
+ navigate(`/admin/companies/${company.id}/clone`);
244
+ };
245
+
246
+ const getRowActions = (company: Company) => [
247
+ {
248
+ label: t('goToDashboard'),
249
+ onClick: () => handleView(company),
250
+ },
251
+ {
252
+ label: t('companyDetails'),
253
+ onClick: () => navigate(`/admin/companies/${company.id}`),
254
+ },
255
+ {
256
+ label: t('editCompany'),
257
+ onClick: () => handleEdit(company),
258
+ },
259
+ {
260
+ label: t('duplicateCompany'),
261
+ onClick: () => handleDuplicate(company),
262
+ },
263
+ {
264
+ label: company.status === 'active' ? t('disableCompany') : t('enableCompany'),
265
+ onClick: () => handleToggleStatus(company),
266
+ },
267
+ ];
268
+
269
+ const searchConfig = {
270
+ value: searchQuery,
271
+ onChange: setSearchQuery,
272
+ placeholder: t('searchByCompanyNameOrId'),
273
+ label: t('searchCompanies')
274
+ };
275
+
276
+ const headerActions: HeaderAction[] = [
277
+ {
278
+ label: t('addNewCompany'),
279
+ mobileLabel: t('add'),
280
+ onClick: handleAddCompany,
281
+ icon: <IconPlusThick className="fill-current" />,
282
+ variant: 'ghost',
283
+ withIcon: true,
284
+ },
285
+ ];
286
+
287
+ if (isLoading) {
288
+ return <LoadingScreen />;
289
+ }
290
+
291
+ if (companies.length === 0) {
292
+ return (
293
+ <>
294
+ <TableControls
295
+ searchConfig={searchConfig}
296
+ actions={headerActions}
297
+ />
298
+ <EmptyState
299
+ icon="Company"
300
+ title={t('noCompaniesYet')}
301
+ description={t('addFirstCompanyDescription')}
302
+ />
303
+ </>
304
+ );
305
+ }
306
+
307
+ return (
308
+ <div className="flex flex-col gap-6 w-full">
309
+ <TableControls
310
+ searchConfig={searchConfig}
311
+ actions={headerActions}
312
+ />
313
+
314
+ {/* Mobile card layout */}
315
+ <div className="flex flex-col gap-3 sm:hidden">
316
+ {sortedCompanies.length === 0 ? (
317
+ <div className="flex items-center justify-center py-12">
318
+ <span className="text-label-secondary text-sm">{t('noCompaniesFound')}</span>
319
+ </div>
320
+ ) : (
321
+ sortedCompanies.map((company) => (
322
+ <button
323
+ key={company.id}
324
+ onClick={() => navigate(`/admin/companies/${company.id}`)}
325
+ className="flex items-center gap-3 p-4 bg-surface-primary border border-border-primary rounded-lg w-full text-left"
326
+ >
327
+ {getCompanyIcon(company)}
328
+ <div className="flex flex-col gap-1 flex-1 min-w-0">
329
+ <div className="flex items-center justify-between gap-2">
330
+ <h3 className="text-label-primary text-sm font-semibold leading-4 truncate">
331
+ {company.name}
332
+ </h3>
333
+ <StatusBadge status={company.status as 'active' | 'disabled' | 'invited' | 'suspended'} />
334
+ </div>
335
+ <div className="flex items-center gap-2">
336
+ <span className="text-label-secondary text-xs">
337
+ ID: {company.company_id || 'N/A'}
338
+ </span>
339
+ <span className="text-label-tertiary text-xs">·</span>
340
+ <span className="text-label-tertiary text-xs">
341
+ {company.provider_count || 0} provider{(company.provider_count || 0) !== 1 ? 's' : ''}
342
+ </span>
343
+ <span className="text-label-tertiary text-xs">·</span>
344
+ <span className="text-label-tertiary text-xs">
345
+ {format(new Date(company.created_at), 'dd MMM yyyy')}
346
+ </span>
347
+ </div>
348
+ </div>
349
+ </button>
350
+ ))
351
+ )}
352
+ </div>
353
+
354
+ {/* Desktop table layout */}
355
+ <div className="hidden sm:block">
356
+ <DataTable
357
+ columns={columns}
358
+ data={sortedCompanies}
359
+ keyExtractor={(company) => company.id}
360
+ rowActions={getRowActions}
361
+ rowQuickActions={(company) => (
362
+ <ActionButton
363
+ icon={
364
+ <div className="relative w-[18px] h-[18px]">
365
+ <IconDashboard size={18} className="absolute inset-0 group-hover/dashboard-action:opacity-0 transition-opacity" />
366
+ <IconArrowInternalReturn size={18} className="absolute inset-0 opacity-0 group-hover/dashboard-action:opacity-100 transition-opacity" />
367
+ </div>
368
+ }
369
+ className="group/dashboard-action"
370
+ onClick={() => handleView(company)}
371
+ />
372
+ )}
373
+ onRowClick={(company) => navigate(`/admin/companies/${company.id}`)}
374
+ sortKey={sortKey}
375
+ sortDirection={sortDirection}
376
+ onSort={handleSort}
377
+ pagination={{
378
+ entityName: 'companies'
379
+ }}
380
+ emptyState={t('noCompaniesFound')}
381
+ />
382
+ </div>
383
+ </div>
384
+ );
385
+ };
386
+
387
+ export default CompaniesTable;