@bailaya/react 1.0.6 → 1.0.7
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.
- package/dist/components/ClassSchedule.d.ts +40 -0
- package/dist/components/ClassSchedule.d.ts.map +1 -0
- package/dist/components/ClassSchedule.js +65 -0
- package/dist/components/ClassScheduleByType.d.ts +42 -0
- package/dist/components/ClassScheduleByType.d.ts.map +1 -0
- package/dist/components/ClassScheduleByType.js +68 -0
- package/dist/components/InstructorList.d.ts +34 -0
- package/dist/components/InstructorList.d.ts.map +1 -0
- package/dist/components/InstructorList.js +39 -0
- package/dist/components/StudioDescription.d.ts +26 -0
- package/dist/components/StudioDescription.d.ts.map +1 -0
- package/dist/components/StudioDescription.js +51 -0
- package/dist/components/StudioProfileCard.d.ts +47 -0
- package/dist/components/StudioProfileCard.d.ts.map +1 -0
- package/dist/components/StudioProfileCard.js +59 -0
- package/dist/components/UserProfileCard.d.ts +47 -0
- package/dist/components/UserProfileCard.d.ts.map +1 -0
- package/dist/components/UserProfileCard.js +61 -0
- package/dist/components/ui/LoadingIcon.d.ts +3 -0
- package/dist/components/ui/LoadingIcon.d.ts.map +1 -0
- package/dist/components/ui/LoadingIcon.js +13 -0
- package/dist/context/BailayaProvider.d.ts +8 -0
- package/dist/context/BailayaProvider.d.ts.map +1 -0
- package/dist/context/BailayaProvider.js +52 -0
- package/dist/hooks/useClasses.d.ts +15 -0
- package/dist/hooks/useClasses.d.ts.map +1 -0
- package/dist/hooks/useClasses.js +25 -0
- package/dist/hooks/useClassesByType.d.ts +16 -0
- package/dist/hooks/useClassesByType.d.ts.map +1 -0
- package/dist/hooks/useClassesByType.js +28 -0
- package/dist/hooks/useInstructors.d.ts +15 -0
- package/dist/hooks/useInstructors.d.ts.map +1 -0
- package/dist/hooks/useInstructors.js +23 -0
- package/dist/hooks/useStudioProfile.d.ts +10 -0
- package/dist/hooks/useStudioProfile.d.ts.map +1 -0
- package/dist/hooks/useStudioProfile.js +18 -0
- package/dist/hooks/useUserProfile.d.ts +12 -0
- package/dist/hooks/useUserProfile.d.ts.map +1 -0
- package/dist/hooks/useUserProfile.js +20 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +58 -0
- package/dist/types.d.ts +9 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/package.json +2 -2
|
@@ -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, 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, 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, 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, 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, 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;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { UserProfile } from '@bailaya/core';
|
|
3
|
+
export interface UserProfileCardProps {
|
|
4
|
+
/** The user ID to fetch */
|
|
5
|
+
userId: string;
|
|
6
|
+
/** Locale code (e.g. "en", "es") for picking the bio */
|
|
7
|
+
locale?: string;
|
|
8
|
+
/** Root container wrapper */
|
|
9
|
+
className?: string;
|
|
10
|
+
/** Wrapper for the entire "card" */
|
|
11
|
+
itemClassName?: string;
|
|
12
|
+
/** Wrapper around the profile image */
|
|
13
|
+
imageWrapperClassName?: string;
|
|
14
|
+
/** The `<img>` element itself */
|
|
15
|
+
imageClassName?: string;
|
|
16
|
+
/** Container for the name + bio + labels */
|
|
17
|
+
bodyClassName?: string;
|
|
18
|
+
/** Heading for the user’s name */
|
|
19
|
+
nameClassName?: string;
|
|
20
|
+
/** Paragraph for the bio */
|
|
21
|
+
bioClassName?: string;
|
|
22
|
+
/** Label/value lines (occupation, experience) */
|
|
23
|
+
labelClassName?: string;
|
|
24
|
+
/**
|
|
25
|
+
* If provided, completely overrides the default card render.
|
|
26
|
+
*/
|
|
27
|
+
renderProfile?: (profile: UserProfile) => React.ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* Custom text labels (useful for localization):
|
|
30
|
+
* - occupationLabel
|
|
31
|
+
* - experienceLabel
|
|
32
|
+
*/
|
|
33
|
+
labels?: {
|
|
34
|
+
occupationLabel?: string;
|
|
35
|
+
experienceLabel?: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Displays a single user's profile as a "card":
|
|
40
|
+
* - photo
|
|
41
|
+
* - full name
|
|
42
|
+
* - localized bio
|
|
43
|
+
* - occupation
|
|
44
|
+
* - years of experience
|
|
45
|
+
*/
|
|
46
|
+
export declare const UserProfileCard: React.FC<UserProfileCardProps>;
|
|
47
|
+
//# sourceMappingURL=UserProfileCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserProfileCard.d.ts","sourceRoot":"","sources":["../../src/components/UserProfileCard.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD,MAAM,WAAW,oBAAoB;IACnC,2BAA2B;IAC3B,MAAM,EAAE,MAAM,CAAC;IAEf,wDAAwD;IACxD,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,oCAAoC;IACpC,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,uCAAuC;IACvC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B,iCAAiC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,4CAA4C;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,kCAAkC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,4BAA4B;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,iDAAiD;IACjD,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,KAAK,CAAC,SAAS,CAAC;IAE1D;;;;OAIG;IACH,MAAM,CAAC,EAAE;QACP,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA8E1D,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
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.UserProfileCard = void 0;
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const useUserProfile_1 = require("../hooks/useUserProfile");
|
|
10
|
+
const LoadingIcon_1 = require("./ui/LoadingIcon");
|
|
11
|
+
/**
|
|
12
|
+
* Displays a single user's profile as a "card":
|
|
13
|
+
* - photo
|
|
14
|
+
* - full name
|
|
15
|
+
* - localized bio
|
|
16
|
+
* - occupation
|
|
17
|
+
* - years of experience
|
|
18
|
+
*/
|
|
19
|
+
const UserProfileCard = ({ userId, 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]', bioClassName = 'mt-2 text-xs md:text-xl font-sourcesans font-semibold text-[#464646]', labelClassName = 'mt-1 text-sm text-gray-600', renderProfile, labels = {}, }) => {
|
|
20
|
+
var _a, _b;
|
|
21
|
+
const { data: profile, isLoading, error } = (0, useUserProfile_1.useUserProfile)(userId);
|
|
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 bio by locale, fallback to first
|
|
33
|
+
const bioMap = profile.bio || {};
|
|
34
|
+
const locales = Object.keys(bioMap);
|
|
35
|
+
const selectedBio = (locale && bioMap[locale]) ||
|
|
36
|
+
bioMap[locales[0]] ||
|
|
37
|
+
'';
|
|
38
|
+
if (renderProfile) {
|
|
39
|
+
return react_1.default.createElement(react_1.default.Fragment, null, renderProfile(profile));
|
|
40
|
+
}
|
|
41
|
+
const occLabel = (_a = labels === null || labels === void 0 ? void 0 : labels.occupationLabel) !== null && _a !== void 0 ? _a : (locale === 'es' ? 'Ocupación' : 'Occupation');
|
|
42
|
+
const expLabel = (_b = labels === null || labels === void 0 ? void 0 : labels.experienceLabel) !== null && _b !== void 0 ? _b : (locale === 'es' ? 'Años de experiencia' : 'Years of experience');
|
|
43
|
+
return (react_1.default.createElement("div", { className: className },
|
|
44
|
+
react_1.default.createElement("div", { className: itemClassName },
|
|
45
|
+
profile.image && (react_1.default.createElement("div", { className: imageWrapperClassName },
|
|
46
|
+
react_1.default.createElement("img", { src: profile.image, alt: `${profile.name}${profile.lastname ? ' ' + profile.lastname : ''}`, className: imageClassName }))),
|
|
47
|
+
react_1.default.createElement("div", { className: bodyClassName },
|
|
48
|
+
react_1.default.createElement("h3", { className: nameClassName },
|
|
49
|
+
profile.name,
|
|
50
|
+
profile.lastname ? ` ${profile.lastname}` : ''),
|
|
51
|
+
selectedBio && (react_1.default.createElement("p", { className: bioClassName }, selectedBio)),
|
|
52
|
+
profile.occupation && (react_1.default.createElement("p", { className: labelClassName },
|
|
53
|
+
occLabel,
|
|
54
|
+
": ",
|
|
55
|
+
profile.occupation)),
|
|
56
|
+
profile.yearsOfExperience != null && (react_1.default.createElement("p", { className: labelClassName },
|
|
57
|
+
expLabel,
|
|
58
|
+
": ",
|
|
59
|
+
profile.yearsOfExperience))))));
|
|
60
|
+
};
|
|
61
|
+
exports.UserProfileCard = UserProfileCard;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadingIcon.d.ts","sourceRoot":"","sources":["../../../src/components/ui/LoadingIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,eAAO,MAAM,WAAW,yBAMvB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.LoadingIcon = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const lucide_react_1 = require("lucide-react");
|
|
9
|
+
const LoadingIcon = () => {
|
|
10
|
+
return (react_1.default.createElement("div", { className: "flex items-center justify-center h-screen" },
|
|
11
|
+
react_1.default.createElement(lucide_react_1.Loader, { className: "animate-spin w-12 h-12 text-blue-500" })));
|
|
12
|
+
};
|
|
13
|
+
exports.LoadingIcon = LoadingIcon;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BailayaClient, BailayaClientOptions } from '@bailaya/core';
|
|
3
|
+
export declare const BailayaProvider: React.FC<{
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
config: BailayaClientOptions;
|
|
6
|
+
}>;
|
|
7
|
+
export declare const useBailayaClient: () => BailayaClient;
|
|
8
|
+
//# sourceMappingURL=BailayaProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BailayaProvider.d.ts","sourceRoot":"","sources":["../../src/context/BailayaProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAIpE,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC;IACrC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,EAAE,oBAAoB,CAAC;CAC9B,CAOA,CAAC;AAEF,eAAO,MAAM,gBAAgB,qBAI5B,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.useBailayaClient = exports.BailayaProvider = void 0;
|
|
38
|
+
const react_1 = __importStar(require("react"));
|
|
39
|
+
const core_1 = require("@bailaya/core");
|
|
40
|
+
const BailayaContext = (0, react_1.createContext)(null);
|
|
41
|
+
const BailayaProvider = ({ children, config }) => {
|
|
42
|
+
const client = new core_1.BailayaClient(config);
|
|
43
|
+
return (react_1.default.createElement(BailayaContext.Provider, { value: client }, children));
|
|
44
|
+
};
|
|
45
|
+
exports.BailayaProvider = BailayaProvider;
|
|
46
|
+
const useBailayaClient = () => {
|
|
47
|
+
const ctx = (0, react_1.useContext)(BailayaContext);
|
|
48
|
+
if (!ctx)
|
|
49
|
+
throw new Error('useBailayaClient must be used inside a BailayaProvider');
|
|
50
|
+
return ctx;
|
|
51
|
+
};
|
|
52
|
+
exports.useBailayaClient = useBailayaClient;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
|
+
import type { StudioClass } from '@bailaya/core';
|
|
3
|
+
/**
|
|
4
|
+
* Hook to fetch upcoming classes for a studio within a 7-day window.
|
|
5
|
+
*
|
|
6
|
+
* Utilizes the Bailaya API client from context and caches results with React Query.
|
|
7
|
+
*
|
|
8
|
+
* @param from - Optional Date object to start the 7-day window; defaults to today.
|
|
9
|
+
* @param overrideId - Optional studio ID to override the default configured ID.
|
|
10
|
+
* @returns A React Query result with an array of `StudioClass` objects,
|
|
11
|
+
* or an error if the fetch fails.
|
|
12
|
+
* @throws If used outside of a `BailayaProvider`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useClasses(from?: Date, overrideId?: string): UseQueryResult<StudioClass[], Error>;
|
|
15
|
+
//# sourceMappingURL=useClasses.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useClasses.d.ts","sourceRoot":"","sources":["../../src/hooks/useClasses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CACxB,IAAI,CAAC,EAAE,IAAI,EACX,UAAU,CAAC,EAAE,MAAM,GAClB,cAAc,CAAC,WAAW,EAAE,EAAE,KAAK,CAAC,CAUtC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useClasses = useClasses;
|
|
4
|
+
const react_query_1 = require("@tanstack/react-query");
|
|
5
|
+
const BailayaProvider_1 = require("../context/BailayaProvider");
|
|
6
|
+
/**
|
|
7
|
+
* Hook to fetch upcoming classes for a studio within a 7-day window.
|
|
8
|
+
*
|
|
9
|
+
* Utilizes the Bailaya API client from context and caches results with React Query.
|
|
10
|
+
*
|
|
11
|
+
* @param from - Optional Date object to start the 7-day window; defaults to today.
|
|
12
|
+
* @param overrideId - Optional studio ID to override the default configured ID.
|
|
13
|
+
* @returns A React Query result with an array of `StudioClass` objects,
|
|
14
|
+
* or an error if the fetch fails.
|
|
15
|
+
* @throws If used outside of a `BailayaProvider`.
|
|
16
|
+
*/
|
|
17
|
+
function useClasses(from, overrideId) {
|
|
18
|
+
const client = (0, BailayaProvider_1.useBailayaClient)();
|
|
19
|
+
// Convert `from` to YYYY-MM-DD for the query key
|
|
20
|
+
const fromKey = from ? from.toISOString().split('T')[0] : 'today';
|
|
21
|
+
return (0, react_query_1.useQuery)({
|
|
22
|
+
queryKey: ['classes', fromKey],
|
|
23
|
+
queryFn: () => client.getClasses(from),
|
|
24
|
+
});
|
|
25
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
|
+
import type { StudioClass } from '@bailaya/core';
|
|
3
|
+
/**
|
|
4
|
+
* Hook to fetch upcoming classes of a specific dance type for a studio within a 7-day window.
|
|
5
|
+
*
|
|
6
|
+
* Utilizes the Bailaya API client from context and caches results with React Query.
|
|
7
|
+
*
|
|
8
|
+
* @param typeName - Name of the dance type to filter by (e.g., "Salsa").
|
|
9
|
+
* @param from - Optional start `Date` for the 7-day window; defaults to today.
|
|
10
|
+
* @param overrideId - Optional studio ID to override the default configured ID.
|
|
11
|
+
* @returns A React Query result with an array of `StudioClass` objects,
|
|
12
|
+
* or an error if the fetch fails.
|
|
13
|
+
* @throws If used outside of a `BailayaProvider` or if `typeName` is missing.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useClassesByType(typeName: string, from?: Date, overrideId?: string): UseQueryResult<StudioClass[], Error>;
|
|
16
|
+
//# sourceMappingURL=useClassesByType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useClassesByType.d.ts","sourceRoot":"","sources":["../../src/hooks/useClassesByType.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,IAAI,EACX,UAAU,CAAC,EAAE,MAAM,GAClB,cAAc,CAAC,WAAW,EAAE,EAAE,KAAK,CAAC,CAatC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useClassesByType = useClassesByType;
|
|
4
|
+
const react_query_1 = require("@tanstack/react-query");
|
|
5
|
+
const BailayaProvider_1 = require("../context/BailayaProvider");
|
|
6
|
+
/**
|
|
7
|
+
* Hook to fetch upcoming classes of a specific dance type for a studio within a 7-day window.
|
|
8
|
+
*
|
|
9
|
+
* Utilizes the Bailaya API client from context and caches results with React Query.
|
|
10
|
+
*
|
|
11
|
+
* @param typeName - Name of the dance type to filter by (e.g., "Salsa").
|
|
12
|
+
* @param from - Optional start `Date` for the 7-day window; defaults to today.
|
|
13
|
+
* @param overrideId - Optional studio ID to override the default configured ID.
|
|
14
|
+
* @returns A React Query result with an array of `StudioClass` objects,
|
|
15
|
+
* or an error if the fetch fails.
|
|
16
|
+
* @throws If used outside of a `BailayaProvider` or if `typeName` is missing.
|
|
17
|
+
*/
|
|
18
|
+
function useClassesByType(typeName, from, overrideId) {
|
|
19
|
+
const client = (0, BailayaProvider_1.useBailayaClient)();
|
|
20
|
+
if (!typeName) {
|
|
21
|
+
throw new Error('useClassesByType requires a typeName argument');
|
|
22
|
+
}
|
|
23
|
+
const fromKey = from ? from.toISOString().split('T')[0] : 'today';
|
|
24
|
+
return (0, react_query_1.useQuery)({
|
|
25
|
+
queryKey: ['classesByType', typeName, overrideId !== null && overrideId !== void 0 ? overrideId : 'default', fromKey],
|
|
26
|
+
queryFn: () => client.getClasses(from),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
|
+
import type { Instructor } from '@bailaya/core';
|
|
3
|
+
/**
|
|
4
|
+
* Hook to fetch the list of instructors for a studio.
|
|
5
|
+
*
|
|
6
|
+
* Utilizes the Bailaya API client from context to retrieve instructor data
|
|
7
|
+
* and caches results using React Query.
|
|
8
|
+
*
|
|
9
|
+
* @param overrideId - Optional studio ID to override the default configured ID.
|
|
10
|
+
* @returns A React Query result containing an array of `Instructor` objects,
|
|
11
|
+
* or an error if the fetch fails.
|
|
12
|
+
* @throws If used outside of a `BailayaProvider`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useInstructors(overrideId?: string): UseQueryResult<Instructor[], Error>;
|
|
15
|
+
//# sourceMappingURL=useInstructors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInstructors.d.ts","sourceRoot":"","sources":["../../src/hooks/useInstructors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAC5B,UAAU,CAAC,EAAE,MAAM,GAClB,cAAc,CAAC,UAAU,EAAE,EAAE,KAAK,CAAC,CAOrC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useInstructors = useInstructors;
|
|
4
|
+
const react_query_1 = require("@tanstack/react-query");
|
|
5
|
+
const BailayaProvider_1 = require("../context/BailayaProvider");
|
|
6
|
+
/**
|
|
7
|
+
* Hook to fetch the list of instructors for a studio.
|
|
8
|
+
*
|
|
9
|
+
* Utilizes the Bailaya API client from context to retrieve instructor data
|
|
10
|
+
* and caches results using React Query.
|
|
11
|
+
*
|
|
12
|
+
* @param overrideId - Optional studio ID to override the default configured ID.
|
|
13
|
+
* @returns A React Query result containing an array of `Instructor` objects,
|
|
14
|
+
* or an error if the fetch fails.
|
|
15
|
+
* @throws If used outside of a `BailayaProvider`.
|
|
16
|
+
*/
|
|
17
|
+
function useInstructors(overrideId) {
|
|
18
|
+
const client = (0, BailayaProvider_1.useBailayaClient)();
|
|
19
|
+
return (0, react_query_1.useQuery)({
|
|
20
|
+
queryKey: ['instructors', overrideId !== null && overrideId !== void 0 ? overrideId : 'default'],
|
|
21
|
+
queryFn: () => client.getInstructors(overrideId),
|
|
22
|
+
});
|
|
23
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
|
+
import type { StudioProfile } from '@bailaya/core';
|
|
3
|
+
/**
|
|
4
|
+
* Hook to fetch the studio profile.
|
|
5
|
+
*
|
|
6
|
+
* @param overrideId - Optional studio ID to override the default configured ID.
|
|
7
|
+
* @returns A React Query result with the `StudioProfile` object.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useStudioProfile(overrideId?: string): UseQueryResult<StudioProfile, Error>;
|
|
10
|
+
//# sourceMappingURL=useStudioProfile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStudioProfile.d.ts","sourceRoot":"","sources":["../../src/hooks/useStudioProfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,CAAC,EAAE,MAAM,GAClB,cAAc,CAAC,aAAa,EAAE,KAAK,CAAC,CAOtC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useStudioProfile = useStudioProfile;
|
|
4
|
+
const react_query_1 = require("@tanstack/react-query");
|
|
5
|
+
const BailayaProvider_1 = require("../context/BailayaProvider");
|
|
6
|
+
/**
|
|
7
|
+
* Hook to fetch the studio profile.
|
|
8
|
+
*
|
|
9
|
+
* @param overrideId - Optional studio ID to override the default configured ID.
|
|
10
|
+
* @returns A React Query result with the `StudioProfile` object.
|
|
11
|
+
*/
|
|
12
|
+
function useStudioProfile(overrideId) {
|
|
13
|
+
const client = (0, BailayaProvider_1.useBailayaClient)();
|
|
14
|
+
return (0, react_query_1.useQuery)({
|
|
15
|
+
queryKey: ['instructors', overrideId !== null && overrideId !== void 0 ? overrideId : 'default'],
|
|
16
|
+
queryFn: () => client.getStudioProfile(overrideId),
|
|
17
|
+
});
|
|
18
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
|
+
import type { UserProfile } from '@bailaya/core';
|
|
3
|
+
/**
|
|
4
|
+
* Hook to fetch a user’s profile by their ID.
|
|
5
|
+
*
|
|
6
|
+
* Wraps the BailayaClient.getUserProfile call in React Query.
|
|
7
|
+
*
|
|
8
|
+
* @param userId - The ID of the user to fetch.
|
|
9
|
+
* @returns A React Query result containing a `UserProfile` or an error.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useUserProfile(userId: string): UseQueryResult<UserProfile, Error>;
|
|
12
|
+
//# sourceMappingURL=useUserProfile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUserProfile.d.ts","sourceRoot":"","sources":["../../src/hooks/useUserProfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,GACb,cAAc,CAAC,WAAW,EAAE,KAAK,CAAC,CAOpC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useUserProfile = useUserProfile;
|
|
4
|
+
const react_query_1 = require("@tanstack/react-query");
|
|
5
|
+
const BailayaProvider_1 = require("../context/BailayaProvider");
|
|
6
|
+
/**
|
|
7
|
+
* Hook to fetch a user’s profile by their ID.
|
|
8
|
+
*
|
|
9
|
+
* Wraps the BailayaClient.getUserProfile call in React Query.
|
|
10
|
+
*
|
|
11
|
+
* @param userId - The ID of the user to fetch.
|
|
12
|
+
* @returns A React Query result containing a `UserProfile` or an error.
|
|
13
|
+
*/
|
|
14
|
+
function useUserProfile(userId) {
|
|
15
|
+
const client = (0, BailayaProvider_1.useBailayaClient)();
|
|
16
|
+
return (0, react_query_1.useQuery)({
|
|
17
|
+
queryKey: ['userProfile', userId],
|
|
18
|
+
queryFn: () => client.getUserProfile(userId),
|
|
19
|
+
});
|
|
20
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exports all components and hooks for interacting with the Bailaya API.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Re-exported context and hooks for easy import
|
|
8
|
+
*/
|
|
9
|
+
export { BailayaProvider, useBailayaClient } from './context/BailayaProvider';
|
|
10
|
+
/**
|
|
11
|
+
* Data hooks
|
|
12
|
+
*/
|
|
13
|
+
export { useStudioProfile } from './hooks/useStudioProfile';
|
|
14
|
+
export { useInstructors } from './hooks/useInstructors';
|
|
15
|
+
export { useClasses } from './hooks/useClasses';
|
|
16
|
+
export { useClassesByType } from './hooks/useClassesByType';
|
|
17
|
+
/**
|
|
18
|
+
* React components
|
|
19
|
+
*/
|
|
20
|
+
export { ClassSchedule, ClassScheduleProps } from './components/ClassSchedule';
|
|
21
|
+
export { ClassScheduleByType, ClassScheduleByTypeProps } from './components/ClassScheduleByType';
|
|
22
|
+
export { InstructorList, InstructorListProps } from './components/InstructorList';
|
|
23
|
+
export { StudioProfileCard, StudioProfileCardProps } from './components/StudioProfileCard';
|
|
24
|
+
export { UserProfileCard, UserProfileCardProps } from './components/UserProfileCard';
|
|
25
|
+
export { StudioDescription } from './components/StudioDescription';
|
|
26
|
+
/**
|
|
27
|
+
* Types re-exported for consumer convenience
|
|
28
|
+
*/
|
|
29
|
+
export * from './types';
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE9E;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AACjG,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE;;GAEG;AACH,cAAc,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Exports all components and hooks for interacting with the Bailaya API.
|
|
4
|
+
*
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.StudioDescription = exports.UserProfileCard = exports.StudioProfileCard = exports.InstructorList = exports.ClassScheduleByType = exports.ClassSchedule = exports.useClassesByType = exports.useClasses = exports.useInstructors = exports.useStudioProfile = exports.useBailayaClient = exports.BailayaProvider = void 0;
|
|
23
|
+
/**
|
|
24
|
+
* Re-exported context and hooks for easy import
|
|
25
|
+
*/
|
|
26
|
+
var BailayaProvider_1 = require("./context/BailayaProvider");
|
|
27
|
+
Object.defineProperty(exports, "BailayaProvider", { enumerable: true, get: function () { return BailayaProvider_1.BailayaProvider; } });
|
|
28
|
+
Object.defineProperty(exports, "useBailayaClient", { enumerable: true, get: function () { return BailayaProvider_1.useBailayaClient; } });
|
|
29
|
+
/**
|
|
30
|
+
* Data hooks
|
|
31
|
+
*/
|
|
32
|
+
var useStudioProfile_1 = require("./hooks/useStudioProfile");
|
|
33
|
+
Object.defineProperty(exports, "useStudioProfile", { enumerable: true, get: function () { return useStudioProfile_1.useStudioProfile; } });
|
|
34
|
+
var useInstructors_1 = require("./hooks/useInstructors");
|
|
35
|
+
Object.defineProperty(exports, "useInstructors", { enumerable: true, get: function () { return useInstructors_1.useInstructors; } });
|
|
36
|
+
var useClasses_1 = require("./hooks/useClasses");
|
|
37
|
+
Object.defineProperty(exports, "useClasses", { enumerable: true, get: function () { return useClasses_1.useClasses; } });
|
|
38
|
+
var useClassesByType_1 = require("./hooks/useClassesByType");
|
|
39
|
+
Object.defineProperty(exports, "useClassesByType", { enumerable: true, get: function () { return useClassesByType_1.useClassesByType; } });
|
|
40
|
+
/**
|
|
41
|
+
* React components
|
|
42
|
+
*/
|
|
43
|
+
var ClassSchedule_1 = require("./components/ClassSchedule");
|
|
44
|
+
Object.defineProperty(exports, "ClassSchedule", { enumerable: true, get: function () { return ClassSchedule_1.ClassSchedule; } });
|
|
45
|
+
var ClassScheduleByType_1 = require("./components/ClassScheduleByType");
|
|
46
|
+
Object.defineProperty(exports, "ClassScheduleByType", { enumerable: true, get: function () { return ClassScheduleByType_1.ClassScheduleByType; } });
|
|
47
|
+
var InstructorList_1 = require("./components/InstructorList");
|
|
48
|
+
Object.defineProperty(exports, "InstructorList", { enumerable: true, get: function () { return InstructorList_1.InstructorList; } });
|
|
49
|
+
var StudioProfileCard_1 = require("./components/StudioProfileCard");
|
|
50
|
+
Object.defineProperty(exports, "StudioProfileCard", { enumerable: true, get: function () { return StudioProfileCard_1.StudioProfileCard; } });
|
|
51
|
+
var UserProfileCard_1 = require("./components/UserProfileCard");
|
|
52
|
+
Object.defineProperty(exports, "UserProfileCard", { enumerable: true, get: function () { return UserProfileCard_1.UserProfileCard; } });
|
|
53
|
+
var StudioDescription_1 = require("./components/StudioDescription");
|
|
54
|
+
Object.defineProperty(exports, "StudioDescription", { enumerable: true, get: function () { return StudioDescription_1.StudioDescription; } });
|
|
55
|
+
/**
|
|
56
|
+
* Types re-exported for consumer convenience
|
|
57
|
+
*/
|
|
58
|
+
__exportStar(require("./types"), exports);
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core API data structures re-exported from @bailaya/core for convenience.
|
|
3
|
+
*/
|
|
4
|
+
export type { RawStudioProfile, StudioProfile, RawStudioType, StudioType, RawUserProfile, UserProfile, RawInstructor, Instructor, RawStudioClass, StudioClass, } from '@bailaya/core';
|
|
5
|
+
/**
|
|
6
|
+
* React Query result types for library hooks.
|
|
7
|
+
*/
|
|
8
|
+
export type { UseQueryResult, } from '@tanstack/react-query';
|
|
9
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,YAAY,EACV,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,UAAU,EACV,cAAc,EACd,WAAW,EACX,aAAa,EACb,UAAU,EACV,cAAc,EACd,WAAW,GACZ,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,YAAY,EACV,cAAc,GACf,MAAM,uBAAuB,CAAC"}
|
package/dist/types.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bailaya/react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "A React component library for the BailaYa public API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"typescript": "^5.8.3"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@bailaya/core": "^1.0.
|
|
31
|
+
"@bailaya/core": "^1.0.6",
|
|
32
32
|
"lucide-react": "^0.536.0"
|
|
33
33
|
},
|
|
34
34
|
"license": "ISC"
|