@bailaya/react 1.0.6 → 1.0.8

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 (47) hide show
  1. package/README.md +36 -30
  2. package/dist/components/ClassSchedule.d.ts +40 -0
  3. package/dist/components/ClassSchedule.d.ts.map +1 -0
  4. package/dist/components/ClassSchedule.js +65 -0
  5. package/dist/components/ClassScheduleByType.d.ts +42 -0
  6. package/dist/components/ClassScheduleByType.d.ts.map +1 -0
  7. package/dist/components/ClassScheduleByType.js +68 -0
  8. package/dist/components/InstructorList.d.ts +34 -0
  9. package/dist/components/InstructorList.d.ts.map +1 -0
  10. package/dist/components/InstructorList.js +39 -0
  11. package/dist/components/StudioDescription.d.ts +26 -0
  12. package/dist/components/StudioDescription.d.ts.map +1 -0
  13. package/dist/components/StudioDescription.js +51 -0
  14. package/dist/components/StudioProfileCard.d.ts +47 -0
  15. package/dist/components/StudioProfileCard.d.ts.map +1 -0
  16. package/dist/components/StudioProfileCard.js +59 -0
  17. package/dist/components/UserProfileCard.d.ts +47 -0
  18. package/dist/components/UserProfileCard.d.ts.map +1 -0
  19. package/dist/components/UserProfileCard.js +61 -0
  20. package/dist/components/ui/LoadingIcon.d.ts +3 -0
  21. package/dist/components/ui/LoadingIcon.d.ts.map +1 -0
  22. package/dist/components/ui/LoadingIcon.js +13 -0
  23. package/dist/context/BailayaProvider.d.ts +8 -0
  24. package/dist/context/BailayaProvider.d.ts.map +1 -0
  25. package/dist/context/BailayaProvider.js +52 -0
  26. package/dist/hooks/useClasses.d.ts +16 -0
  27. package/dist/hooks/useClasses.d.ts.map +1 -0
  28. package/dist/hooks/useClasses.js +60 -0
  29. package/dist/hooks/useClassesByType.d.ts +17 -0
  30. package/dist/hooks/useClassesByType.d.ts.map +1 -0
  31. package/dist/hooks/useClassesByType.js +61 -0
  32. package/dist/hooks/useInstructors.d.ts +15 -0
  33. package/dist/hooks/useInstructors.d.ts.map +1 -0
  34. package/dist/hooks/useInstructors.js +55 -0
  35. package/dist/hooks/useStudioProfile.d.ts +15 -0
  36. package/dist/hooks/useStudioProfile.d.ts.map +1 -0
  37. package/dist/hooks/useStudioProfile.js +55 -0
  38. package/dist/hooks/useUserProfile.d.ts +16 -0
  39. package/dist/hooks/useUserProfile.d.ts.map +1 -0
  40. package/dist/hooks/useUserProfile.js +62 -0
  41. package/dist/index.d.ts +30 -0
  42. package/dist/index.d.ts.map +1 -0
  43. package/dist/index.js +58 -0
  44. package/dist/types.d.ts +5 -0
  45. package/dist/types.d.ts.map +1 -0
  46. package/dist/types.js +2 -0
  47. package/package.json +3 -5
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  `@bailaya/react` builds on top of **@bailaya/core** to provide:
8
8
 
9
9
  - A **`BailayaProvider`** + **`useBailayaClient`** context
10
- - React Query–powered **hooks** for fetching all core data
10
+ - React **hooks** for fetching all core data (with `loading`, `error`, `data`, and `refetch`)
11
11
  - **Components** with sensible Tailwind defaults (and full styling slots)
12
12
  - Full TypeScript support, including localized text & date formatting
13
13
 
@@ -16,7 +16,7 @@ Whether you need a quick `<StudioProfileCard />` or fine-grained hooks like `use
16
16
  ## Features
17
17
 
18
18
  - **Context + client** (`BailayaProvider` + `useBailayaClient`)
19
- - **Hooks**
19
+ - **Hooks** (all return `{ data, error, loading, refetch }`)
20
20
  - `useStudioProfile(overrideId?)`
21
21
  - `useUserProfile(userId)`
22
22
  - `useInstructors(overrideId?)`
@@ -37,40 +37,34 @@ Whether you need a quick `<StudioProfileCard />` or fine-grained hooks like `use
37
37
  ## Installation
38
38
 
39
39
  ```bash
40
- npm install @bailaya/react @tanstack/react-query
40
+ npm install @bailaya/react
41
41
  ````
42
42
 
43
43
  or with Yarn:
44
44
 
45
45
  ```bash
46
- yarn add @bailaya/react @tanstack/react-query
46
+ yarn add @bailaya/react
47
47
  ```
48
48
 
49
49
  > **Peer Dependencies**
50
50
  >
51
51
  > * `"react": ">=17"`
52
52
  > * `"react-dom": ">=17"`
53
- > * `"@tanstack/react-query": ">=5"`
54
53
 
55
54
  ## Quick Start
56
55
 
57
- First, wrap your app with both **React Query** and **BailayaProvider**:
56
+ First, wrap your app with **BailayaProvider**:
58
57
 
59
58
  ```tsx
60
59
  // App.tsx
61
60
  import React from "react";
62
- import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
63
61
  import { BailayaProvider } from "@bailaya/react";
64
62
 
65
- const queryClient = new QueryClient();
66
-
67
63
  export default function App() {
68
64
  return (
69
- <QueryClientProvider client={queryClient}>
70
- <BailayaProvider config={{ studioId: "YOUR_STUDIO_ID" }}>
71
- {/* ...your app */}
72
- </BailayaProvider>
73
- </QueryClientProvider>
65
+ <BailayaProvider config={{ studioId: "YOUR_STUDIO_ID" }}>
66
+ {/* ...your app */}
67
+ </BailayaProvider>
74
68
  );
75
69
  }
76
70
  ```
@@ -84,17 +78,20 @@ import React from "react";
84
78
  import { useInstructors } from "@bailaya/react";
85
79
 
86
80
  export function TeamSection() {
87
- const { data: instructors, isLoading, error } = useInstructors();
81
+ const { data: instructors, loading, error, refetch } = useInstructors();
88
82
 
89
- if (isLoading) return <p>Loading...</p>;
83
+ if (loading) return <p>Loading...</p>;
90
84
  if (error) return <p>Error: {error.message}</p>;
91
85
 
92
86
  return (
93
- <ul>
94
- {instructors.map((i) => (
95
- <li key={i.id}>{i.name} {i.lastname}</li>
96
- ))}
97
- </ul>
87
+ <>
88
+ <button onClick={refetch}>Refresh</button>
89
+ <ul>
90
+ {instructors?.map((i) => (
91
+ <li key={i.id}>{i.name} {i.lastname}</li>
92
+ ))}
93
+ </ul>
94
+ </>
98
95
  );
99
96
  }
100
97
  ```
@@ -132,15 +129,24 @@ Provides `useBailayaClient()` context.
132
129
 
133
130
  ### Hooks
134
131
 
135
- | Hook | Description |
136
- |--------------------------------------------------| -------------------------------------------------------------------- |
137
- | `useStudioProfile(overrideId?)` | Fetch & parse a studio’s profile. |
138
- | `useUserProfile(userId)` | Fetch & parse a user’s profile / bio. |
139
- | `useInstructors(overrideId?)` | Fetch & parse list of active instructors (owner, admin, instructor). |
140
- | `useClasses(from?, overrideId?)` | Fetch & parse next 7 days of classes (all types). |
141
- | `useClassesByType(typeName, from?, overrideId?)` | Fetch & parse next 7 days of classes filtered by `typeName`. |
132
+ All hooks return:
133
+
134
+ ```ts
135
+ {
136
+ data: T | null;
137
+ error: Error | null;
138
+ loading: boolean;
139
+ refetch: () => Promise<void>;
140
+ }
141
+ ```
142
142
 
143
- Each returns a **`UseQueryResult<..., Error>`**.
143
+ | Hook | Description |
144
+ | ------------------------------------------------ | ------------------------------------------------------------ |
145
+ | `useStudioProfile(overrideId?)` | Fetch a studio’s profile. |
146
+ | `useUserProfile(userId)` | Fetch a user’s profile / bio. |
147
+ | `useInstructors(overrideId?)` | Fetch list of active instructors (owner, admin, instructor). |
148
+ | `useClasses(from?, overrideId?)` | Fetch next 7 days of classes (all types). |
149
+ | `useClassesByType(typeName, from?, overrideId?)` | Fetch next 7 days of classes filtered by `typeName`. |
144
150
 
145
151
  ### Components
146
152
 
@@ -152,7 +158,7 @@ All components share:
152
158
  * **`renderItem`** for full JSX override
153
159
 
154
160
  | Component | Props |
155
- |---------------------------|-----------------------------------------------------------------------------------------------------------------------------------|
161
+ | ------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
156
162
  | `<StudioProfileCard />` | `overrideId?`, `locale?`, `labels?`, `className?`, `nameClassName?`, `descriptionClassName?`, `labelClassName?`, `renderProfile?` |
157
163
  | `<UserProfileCard />` | `userId`, `locale?`, `labels?`, `className?`, `nameClassName?`, `bioClassName?`, `renderProfile?` |
158
164
  | `<InstructorList />` | `overrideId?`, `renderItem?`, plus styling slots: `className?`, `itemClassName?`, `imageWrapperClassName?`, etc. |
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ import type { StudioClass } from '@bailaya/core';
3
+ export interface ClassScheduleProps {
4
+ /** Optional start date for the 7-day window; defaults to today */
5
+ from?: Date;
6
+ /** Optional studio ID to override the default configured ID */
7
+ overrideId?: string;
8
+ /** Locale code for date formatting (e.g. "en", "es"); falls back to browser default */
9
+ locale?: string;
10
+ /** Custom labels (e.g. for "Instructor:" text) */
11
+ labels?: {
12
+ /** Label text for the instructor line; defaults to "Instructor:" */
13
+ instructor?: string;
14
+ };
15
+ /** Root container wrapper */
16
+ className?: string;
17
+ /** Each class "card" wrapper */
18
+ itemClassName?: string;
19
+ /** Class name element */
20
+ nameClassName?: string;
21
+ /** Details (date/time) element */
22
+ detailsClassName?: string;
23
+ /** Instructor line element */
24
+ instructorClassName?: string;
25
+ /**
26
+ * Completely override the default renderItem
27
+ */
28
+ renderItem?: (cls: StudioClass) => React.ReactNode;
29
+ }
30
+ /**
31
+ * Displays an upcoming-class schedule for a studio:
32
+ * • name + level
33
+ * • weekday, MM-DD, time
34
+ * • optional instructor
35
+ *
36
+ * Uses sensible Tailwind defaults, but you can override
37
+ * every slot via props or replace the layout entirely.
38
+ */
39
+ export declare const ClassSchedule: React.FC<ClassScheduleProps>;
40
+ //# sourceMappingURL=ClassSchedule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClassSchedule.d.ts","sourceRoot":"","sources":["../../src/components/ClassSchedule.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD,MAAM,WAAW,kBAAkB;IACjC,kEAAkE;IAClE,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,uFAAuF;IACvF,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,kDAAkD;IAClD,MAAM,CAAC,EAAE;QACP,oEAAoE;QACpE,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB,CAAA;IACD,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gCAAgC;IAChC,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,yBAAyB;IACzB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,kCAAkC;IAClC,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,8BAA8B;IAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,KAAK,CAAC,SAAS,CAAA;CACnD;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA4DtD,CAAA"}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ "use client";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.ClassSchedule = void 0;
8
+ const react_1 = __importDefault(require("react"));
9
+ const useClasses_1 = require("../hooks/useClasses");
10
+ const LoadingIcon_1 = require("./ui/LoadingIcon");
11
+ /**
12
+ * Displays an upcoming-class schedule for a studio:
13
+ * • name + level
14
+ * • weekday, MM-DD, time
15
+ * • optional instructor
16
+ *
17
+ * Uses sensible Tailwind defaults, but you can override
18
+ * every slot via props or replace the layout entirely.
19
+ */
20
+ const ClassSchedule = ({ from, overrideId, locale, labels = {}, className = 'mt-6 md:mt-12 space-y-4', itemClassName = 'p-4 bg-white rounded-lg shadow', nameClassName = 'font-semibold text-lg', detailsClassName = 'text-sm text-gray-600', instructorClassName = 'text-sm text-gray-800 mt-1', renderItem, }) => {
21
+ var _a;
22
+ const { data: classes, loading: isLoading, error } = (0, useClasses_1.useClasses)(from, overrideId);
23
+ const weekdayFmt = new Intl.DateTimeFormat(locale !== null && locale !== void 0 ? locale : 'en', { weekday: 'long' });
24
+ const dateFmt = new Intl.DateTimeFormat(locale !== null && locale !== void 0 ? locale : 'en', { month: 'short', day: 'numeric' });
25
+ const instructorLabel = (_a = labels === null || labels === void 0 ? void 0 : labels.instructor) !== null && _a !== void 0 ? _a : 'Instructor:';
26
+ if (isLoading) {
27
+ return react_1.default.createElement("div", { className: className },
28
+ react_1.default.createElement(LoadingIcon_1.LoadingIcon, null));
29
+ }
30
+ if (error) {
31
+ return react_1.default.createElement("div", { className: className }, error.message);
32
+ }
33
+ return (react_1.default.createElement("ul", { className: className }, classes === null || classes === void 0 ? void 0 : classes.map((cls) => {
34
+ const dateObj = cls.date;
35
+ const dayName = weekdayFmt.format(dateObj);
36
+ const shortDate = dateFmt.format(dateObj);
37
+ if (renderItem) {
38
+ return react_1.default.createElement("li", { key: cls.id }, renderItem(cls));
39
+ }
40
+ return (react_1.default.createElement("li", { key: cls.id, className: itemClassName },
41
+ react_1.default.createElement("div", null,
42
+ react_1.default.createElement("div", { className: nameClassName },
43
+ cls.name,
44
+ ' ',
45
+ react_1.default.createElement("span", { className: "text-sm text-gray-500" },
46
+ "(",
47
+ cls.level,
48
+ ")")),
49
+ react_1.default.createElement("div", { className: detailsClassName },
50
+ dayName,
51
+ ", ",
52
+ shortDate,
53
+ " \u2014 ",
54
+ cls.startTime,
55
+ "\u2013",
56
+ cls.endTime),
57
+ cls.instructor && (react_1.default.createElement("div", { className: instructorClassName },
58
+ instructorLabel,
59
+ ' ',
60
+ react_1.default.createElement("strong", null,
61
+ cls.instructor.name,
62
+ cls.instructor.lastname ? ` ${cls.instructor.lastname}` : ''))))));
63
+ })));
64
+ };
65
+ exports.ClassSchedule = ClassSchedule;
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+ import type { StudioClass } from '@bailaya/core';
3
+ export interface ClassScheduleByTypeProps {
4
+ /** The dance type to filter classes by (e.g., "salsa") */
5
+ typeName: string;
6
+ /** Optional start date for the 7-day window; defaults to today */
7
+ from?: Date;
8
+ /** Optional studio ID to override the default configured ID */
9
+ overrideId?: string;
10
+ /** Locale code for date formatting (e.g. "en", "es"); falls back to browser default */
11
+ locale?: string;
12
+ /** Custom labels (e.g. for "Instructor:" text) */
13
+ labels?: {
14
+ /** Label text for the instructor line; defaults to "Instructor:" */
15
+ instructor?: string;
16
+ };
17
+ /** Root container wrapper */
18
+ className?: string;
19
+ /** Each class "card" wrapper */
20
+ itemClassName?: string;
21
+ /** Class name element */
22
+ nameClassName?: string;
23
+ /** Details (date/time) element */
24
+ detailsClassName?: string;
25
+ /** Instructor line element */
26
+ instructorClassName?: string;
27
+ /**
28
+ * Completely override the default render for each item
29
+ */
30
+ renderItem?: (cls: StudioClass) => React.ReactNode;
31
+ }
32
+ /**
33
+ * Displays a schedule of upcoming classes of a specific dance type:
34
+ * • name + level
35
+ * • weekday, MM-DD, time
36
+ * • optional instructor
37
+ *
38
+ * Uses sensible Tailwind defaults but you can override
39
+ * every slot via props or bypass with renderItem.
40
+ */
41
+ export declare const ClassScheduleByType: React.FC<ClassScheduleByTypeProps>;
42
+ //# sourceMappingURL=ClassScheduleByType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClassScheduleByType.d.ts","sourceRoot":"","sources":["../../src/components/ClassScheduleByType.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,WAAW,wBAAwB;IACvC,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,CAAA;IAEhB,kEAAkE;IAClE,IAAI,CAAC,EAAE,IAAI,CAAA;IAEX,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB,uFAAuF;IACvF,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf,kDAAkD;IAClD,MAAM,CAAC,EAAE;QACP,oEAAoE;QACpE,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB,CAAA;IAED,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gCAAgC;IAChC,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,yBAAyB;IACzB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,kCAAkC;IAClC,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,8BAA8B;IAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAE5B;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,KAAK,CAAC,SAAS,CAAA;CACnD;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAkElE,CAAA"}
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ "use client";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.ClassScheduleByType = void 0;
8
+ const react_1 = __importDefault(require("react"));
9
+ const useClassesByType_1 = require("../hooks/useClassesByType");
10
+ /**
11
+ * Displays a schedule of upcoming classes of a specific dance type:
12
+ * • name + level
13
+ * • weekday, MM-DD, time
14
+ * • optional instructor
15
+ *
16
+ * Uses sensible Tailwind defaults but you can override
17
+ * every slot via props or bypass with renderItem.
18
+ */
19
+ const ClassScheduleByType = ({ typeName, from, overrideId, locale, labels = {}, className = 'mt-6 md:mt-12 space-y-4', itemClassName = 'p-4 bg-white rounded-lg shadow', nameClassName = 'font-semibold text-lg', detailsClassName = 'text-sm text-gray-600', instructorClassName = 'text-sm text-gray-800 mt-1', renderItem, }) => {
20
+ var _a;
21
+ const { data: classes, loading: isLoading, error } = (0, useClassesByType_1.useClassesByType)(typeName, from, overrideId);
22
+ const weekdayFmt = new Intl.DateTimeFormat(locale !== null && locale !== void 0 ? locale : 'en', { weekday: 'long' });
23
+ const dateFmt = new Intl.DateTimeFormat(locale !== null && locale !== void 0 ? locale : 'en', { month: 'short', day: 'numeric' });
24
+ const instructorLabel = (_a = labels === null || labels === void 0 ? void 0 : labels.instructor) !== null && _a !== void 0 ? _a : 'Instructor:';
25
+ if (isLoading) {
26
+ return react_1.default.createElement("div", { className: className },
27
+ "Loading ",
28
+ typeName,
29
+ " classes...");
30
+ }
31
+ if (error) {
32
+ return react_1.default.createElement("div", { className: className },
33
+ "Error: ",
34
+ error.message);
35
+ }
36
+ return (react_1.default.createElement("ul", { className: className }, classes === null || classes === void 0 ? void 0 : classes.map((cls) => {
37
+ const dateObj = cls.date;
38
+ const weekday = weekdayFmt.format(dateObj);
39
+ const dateStr = dateFmt.format(dateObj);
40
+ if (renderItem) {
41
+ return react_1.default.createElement("li", { key: cls.id }, renderItem(cls));
42
+ }
43
+ return (react_1.default.createElement("li", { key: cls.id, className: itemClassName },
44
+ react_1.default.createElement("div", null,
45
+ react_1.default.createElement("div", { className: nameClassName },
46
+ cls.name,
47
+ ' ',
48
+ react_1.default.createElement("span", { className: "text-sm text-gray-500" },
49
+ "(",
50
+ cls.level,
51
+ ")")),
52
+ react_1.default.createElement("div", { className: detailsClassName },
53
+ weekday,
54
+ ", ",
55
+ dateStr,
56
+ " \u2014 ",
57
+ cls.startTime,
58
+ "\u2013",
59
+ cls.endTime),
60
+ cls.instructor && (react_1.default.createElement("div", { className: instructorClassName },
61
+ instructorLabel,
62
+ ' ',
63
+ react_1.default.createElement("strong", null,
64
+ cls.instructor.name,
65
+ cls.instructor.lastname ? ` ${cls.instructor.lastname}` : ''))))));
66
+ })));
67
+ };
68
+ exports.ClassScheduleByType = ClassScheduleByType;
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import type { Instructor } from '@bailaya/core';
3
+ export interface InstructorListProps {
4
+ /** Optional studio ID to override the default configured ID */
5
+ overrideId?: string;
6
+ /** Root container wrapper */
7
+ className?: string;
8
+ /** Each instructor "card" wrapper */
9
+ itemClassName?: string;
10
+ /** Wrapper around the image */
11
+ imageWrapperClassName?: string;
12
+ /** The `<img>` element itself */
13
+ imageClassName?: string;
14
+ /** Container for the name + bio */
15
+ bodyClassName?: string;
16
+ /** Instructor name heading */
17
+ nameClassName?: string;
18
+ /** Instructor bio paragraph */
19
+ bioClassName?: string;
20
+ /**
21
+ * Optional custom render function for each instructor.
22
+ * If provided, will be used instead of the default layout.
23
+ */
24
+ renderItem?: (instr: Instructor) => React.ReactNode;
25
+ }
26
+ /**
27
+ * Component to display a list of instructors for a studio.
28
+ *
29
+ * Fetches instructors via `useInstructors` and renders a list of
30
+ * "cards." You can override any part of the styling via props
31
+ * or completely replace the layout with `renderItem`.
32
+ */
33
+ export declare const InstructorList: React.FC<InstructorListProps>;
34
+ //# sourceMappingURL=InstructorList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InstructorList.d.ts","sourceRoot":"","sources":["../../src/components/InstructorList.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,MAAM,WAAW,mBAAmB;IAClC,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,qCAAqC;IACrC,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,+BAA+B;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B,iCAAiC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,mCAAmC;IACnC,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,8BAA8B;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,+BAA+B;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,KAAK,CAAC,SAAS,CAAC;CACrD;AAED;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAqDxD,CAAC"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ "use client";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.InstructorList = void 0;
8
+ const react_1 = __importDefault(require("react"));
9
+ const useInstructors_1 = require("../hooks/useInstructors");
10
+ const LoadingIcon_1 = require("./ui/LoadingIcon");
11
+ /**
12
+ * Component to display a list of instructors for a studio.
13
+ *
14
+ * Fetches instructors via `useInstructors` and renders a list of
15
+ * "cards." You can override any part of the styling via props
16
+ * or completely replace the layout with `renderItem`.
17
+ */
18
+ const InstructorList = ({ overrideId, className = 'mt-6 md:mt-12 space-y-8', itemClassName = 'flex flex-col md:flex-row items-center rounded-lg border border-[#DCDCDC] shadow-lg overflow-hidden', imageWrapperClassName = 'w-full p-4 pb-0 md:pb-4 md:w-1/3 aspect-square', imageClassName = 'w-full h-full rounded-xl object-cover', bodyClassName = 'p-6 flex-1 text-left', nameClassName = 'text-xl md:text-3xl font-geologica font-semibold text-[#2A2343]', bioClassName = 'mt-2 text-xs md:text-xl font-sourcesans font-semibold text-[#464646]', renderItem, }) => {
19
+ const { data: instructors, loading: isLoading, error } = (0, useInstructors_1.useInstructors)(overrideId);
20
+ if (isLoading) {
21
+ return react_1.default.createElement("div", { className: className },
22
+ react_1.default.createElement(LoadingIcon_1.LoadingIcon, null));
23
+ }
24
+ if (error) {
25
+ return react_1.default.createElement("div", { className: className }, error.message);
26
+ }
27
+ return (react_1.default.createElement("div", { className: className }, instructors === null || instructors === void 0 ? void 0 : instructors.map((instr) => {
28
+ var _a;
29
+ return renderItem ? (renderItem(instr)) : (react_1.default.createElement("div", { key: instr.id, className: itemClassName },
30
+ instr.image && (react_1.default.createElement("div", { className: imageWrapperClassName },
31
+ react_1.default.createElement("img", { src: instr.image, alt: `${instr.name} ${(_a = instr.lastname) !== null && _a !== void 0 ? _a : ''}`.trim(), className: imageClassName }))),
32
+ react_1.default.createElement("div", { className: bodyClassName },
33
+ react_1.default.createElement("h3", { className: nameClassName },
34
+ instr.name,
35
+ instr.lastname ? ` ${instr.lastname}` : ''),
36
+ instr.bio && (react_1.default.createElement("p", { className: bioClassName }, Object.values(instr.bio)[0])))));
37
+ })));
38
+ };
39
+ exports.InstructorList = InstructorList;
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import type { StudioProfile } from '@bailaya/core';
3
+ export interface StudioDescriptionProps {
4
+ /** Optional studio ID to override the default configured ID */
5
+ overrideId?: string;
6
+ /** Locale code (e.g., "en", "es") for picking the description */
7
+ locale?: string;
8
+ /** Wrapper element class (defaults to spacing-neutral container) */
9
+ className?: string;
10
+ /** Paragraph class for each line */
11
+ paragraphClassName?: string;
12
+ /**
13
+ * Optional custom render — receives the computed lines and profile.
14
+ * Return your own JSX to fully control output.
15
+ */
16
+ render?: (lines: string[], profile: StudioProfile) => React.ReactNode;
17
+ }
18
+ /**
19
+ * Displays the studio description, split into paragraphs by line breaks.
20
+ * - Picks localized description by `locale` (falls back to the first available).
21
+ * - Converts `<br>`/`<br/>` to line breaks.
22
+ * - Trims empty lines.
23
+ * - Safe text rendering (no HTML injection).
24
+ */
25
+ export declare const StudioDescription: React.FC<StudioDescriptionProps>;
26
+ //# sourceMappingURL=StudioDescription.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StudioDescription.d.ts","sourceRoot":"","sources":["../../src/components/StudioDescription.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,MAAM,WAAW,sBAAsB;IACnC,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,aAAa,KAAK,KAAK,CAAC,SAAS,CAAC;CACzE;AAED;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAsC9D,CAAC"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ "use client";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.StudioDescription = void 0;
8
+ const react_1 = __importDefault(require("react"));
9
+ const useStudioProfile_1 = require("../hooks/useStudioProfile");
10
+ const LoadingIcon_1 = require("./ui/LoadingIcon");
11
+ /**
12
+ * Displays the studio description, split into paragraphs by line breaks.
13
+ * - Picks localized description by `locale` (falls back to the first available).
14
+ * - Converts `<br>`/`<br/>` to line breaks.
15
+ * - Trims empty lines.
16
+ * - Safe text rendering (no HTML injection).
17
+ */
18
+ const StudioDescription = ({ overrideId, locale, className = '', paragraphClassName = 'text-xs md:text-2xl font-geologica text-[#464646]', render, }) => {
19
+ const { data: profile, loading: isLoading, error } = (0, useStudioProfile_1.useStudioProfile)(overrideId);
20
+ if (isLoading)
21
+ return react_1.default.createElement("div", { className: className },
22
+ react_1.default.createElement(LoadingIcon_1.LoadingIcon, null));
23
+ if (error)
24
+ return react_1.default.createElement("div", { className: className }, error.message);
25
+ if (!profile)
26
+ return null;
27
+ // Pick the best description string for the requested locale
28
+ const descMap = profile.description || {};
29
+ const locales = Object.keys(descMap);
30
+ const desc = (locale && descMap[locale]) ||
31
+ (locales.length ? descMap[locales[0]] : '') ||
32
+ '';
33
+ // Turn <br> into \n, split on newlines, trim, and drop empties
34
+ const lines = splitDescription(desc);
35
+ if (render) {
36
+ return react_1.default.createElement(react_1.default.Fragment, null, render(lines, profile));
37
+ }
38
+ // Default rendering: a <p> per line, using the requested classes
39
+ return (react_1.default.createElement("div", { className: className }, lines.map((line, i) => (react_1.default.createElement("p", { key: i, className: paragraphClassName }, line)))));
40
+ };
41
+ exports.StudioDescription = StudioDescription;
42
+ /** Convert <br> -> newlines, then split, trim, and filter empty lines */
43
+ function splitDescription(text) {
44
+ if (!text)
45
+ return [];
46
+ const normalized = text.replace(/<br\s*\/?>/gi, '\n');
47
+ return normalized
48
+ .split(/\r?\n/)
49
+ .map((l) => l.trim())
50
+ .filter(Boolean);
51
+ }
@@ -0,0 +1,47 @@
1
+ import React from 'react';
2
+ import type { StudioProfile } from '@bailaya/core';
3
+ export interface StudioProfileCardProps {
4
+ /** Optional studio ID to override the default configured ID */
5
+ overrideId?: string;
6
+ /** Locale code (e.g., "en", "es") for picking the description */
7
+ locale?: string;
8
+ /** Root container wrapper */
9
+ className?: string;
10
+ /** Wrapper for the entire "card" */
11
+ itemClassName?: string;
12
+ /** Optional image `<img>` wrapper */
13
+ imageWrapperClassName?: string;
14
+ /** The `<img>` element itself */
15
+ imageClassName?: string;
16
+ /** Container for the body (name, desc, labels) */
17
+ bodyClassName?: string;
18
+ /** Heading for the studio name */
19
+ nameClassName?: string;
20
+ /** Paragraph for the description */
21
+ descriptionClassName?: string;
22
+ /** Paragraph for labels (address, hours) */
23
+ labelClassName?: string;
24
+ /**
25
+ * Completely override the default render
26
+ */
27
+ renderProfile?: (profile: StudioProfile) => React.ReactNode;
28
+ /**
29
+ * Custom text labels (for localization):
30
+ * - addressLabel
31
+ * - businessHoursLabel
32
+ */
33
+ labels?: {
34
+ addressLabel?: string;
35
+ businessHoursLabel?: string;
36
+ };
37
+ }
38
+ /**
39
+ * Displays a "card" summary of a studio:
40
+ * - logo
41
+ * - name
42
+ * - localized description
43
+ * - address/unit
44
+ * - business hours
45
+ */
46
+ export declare const StudioProfileCard: React.FC<StudioProfileCardProps>;
47
+ //# sourceMappingURL=StudioProfileCard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StudioProfileCard.d.ts","sourceRoot":"","sources":["../../src/components/StudioProfileCard.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,MAAM,WAAW,sBAAsB;IACrC,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qCAAqC;IACrC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,iCAAiC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kDAAkD;IAClD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kCAAkC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oCAAoC;IACpC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,4CAA4C;IAC5C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,KAAK,CAAC,SAAS,CAAC;IAC5D;;;;OAIG;IACH,MAAM,CAAC,EAAE;QACP,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC7B,CAAC;CACH;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CA4E9D,CAAC"}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ "use client";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.StudioProfileCard = void 0;
8
+ const react_1 = __importDefault(require("react"));
9
+ const useStudioProfile_1 = require("../hooks/useStudioProfile");
10
+ const LoadingIcon_1 = require("./ui/LoadingIcon");
11
+ /**
12
+ * Displays a "card" summary of a studio:
13
+ * - logo
14
+ * - name
15
+ * - localized description
16
+ * - address/unit
17
+ * - business hours
18
+ */
19
+ const StudioProfileCard = ({ overrideId, locale, className = 'mt-6 md:mt-12 space-y-8', itemClassName = 'flex flex-col md:flex-row items-center rounded-lg border border-[#DCDCDC] shadow-lg overflow-hidden', imageWrapperClassName = 'w-full p-4 pb-0 md:pb-4 md:w-1/3 aspect-square', imageClassName = 'w-full h-full rounded-xl object-cover', bodyClassName = 'p-6 flex-1 text-left', nameClassName = 'text-xl md:text-3xl font-geologica font-semibold text-[#2A2343]', descriptionClassName = 'mt-2 text-xs md:text-lg font-sourcesans text-[#464646]', labelClassName = 'mt-1 text-sm text-gray-600', renderProfile, labels = {}, }) => {
20
+ var _a, _b;
21
+ const { data: profile, loading: isLoading, error } = (0, useStudioProfile_1.useStudioProfile)(overrideId);
22
+ if (isLoading) {
23
+ return react_1.default.createElement("div", { className: className },
24
+ react_1.default.createElement(LoadingIcon_1.LoadingIcon, null));
25
+ }
26
+ if (error) {
27
+ return react_1.default.createElement("div", { className: className }, error.message);
28
+ }
29
+ if (!profile) {
30
+ return null;
31
+ }
32
+ // pick the right description by locale, fallback to first
33
+ const descMap = profile.description || {};
34
+ const locales = Object.keys(descMap);
35
+ const desc = (locale && descMap[locale]) ||
36
+ descMap[locales[0]] ||
37
+ '';
38
+ if (renderProfile) {
39
+ return react_1.default.createElement(react_1.default.Fragment, null, renderProfile(profile));
40
+ }
41
+ const addrLabel = (_a = labels === null || labels === void 0 ? void 0 : labels.addressLabel) !== null && _a !== void 0 ? _a : '';
42
+ const bizLabel = (_b = labels === null || labels === void 0 ? void 0 : labels.businessHoursLabel) !== null && _b !== void 0 ? _b : (locale === 'es' ? 'Horario Comercial' : 'Business Hours');
43
+ return (react_1.default.createElement("div", { className: className },
44
+ react_1.default.createElement("div", { className: itemClassName },
45
+ profile.logo && (react_1.default.createElement("div", { className: imageWrapperClassName },
46
+ react_1.default.createElement("img", { src: profile.logo, alt: `${profile.name} logo`, className: imageClassName }))),
47
+ react_1.default.createElement("div", { className: bodyClassName },
48
+ react_1.default.createElement("h2", { className: nameClassName }, profile.name),
49
+ desc && (react_1.default.createElement("p", { className: descriptionClassName }, desc)),
50
+ profile.address && (react_1.default.createElement("p", { className: labelClassName },
51
+ addrLabel && `${addrLabel}: `,
52
+ profile.address,
53
+ profile.unit ? `, ${profile.unit}` : '')),
54
+ profile.businessHours && (react_1.default.createElement("p", { className: labelClassName },
55
+ bizLabel,
56
+ ": ",
57
+ profile.businessHours))))));
58
+ };
59
+ exports.StudioProfileCard = StudioProfileCard;