analytica-frontend-lib 1.1.47 → 1.1.49
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/hooks/useTheme/index.d.mts +8 -0
- package/dist/hooks/useTheme/index.d.ts +8 -0
- package/dist/hooks/useTheme/index.js +52 -0
- package/dist/hooks/useTheme/index.js.map +1 -0
- package/dist/hooks/useTheme/index.mjs +27 -0
- package/dist/hooks/useTheme/index.mjs.map +1 -0
- package/dist/index.d.mts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +180 -153
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +56 -30
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -147,6 +147,7 @@ __export(src_exports, {
|
|
|
147
147
|
useMobile: () => useMobile,
|
|
148
148
|
useQuizStore: () => useQuizStore,
|
|
149
149
|
useRouteAuth: () => useRouteAuth,
|
|
150
|
+
useTheme: () => useTheme,
|
|
150
151
|
useToastStore: () => ToastStore_default,
|
|
151
152
|
useUrlAuthentication: () => useUrlAuthentication,
|
|
152
153
|
withAuth: () => withAuth
|
|
@@ -6068,9 +6069,33 @@ var useMobile = () => {
|
|
|
6068
6069
|
};
|
|
6069
6070
|
};
|
|
6070
6071
|
|
|
6072
|
+
// src/hooks/useTheme.ts
|
|
6073
|
+
var import_react20 = require("react");
|
|
6074
|
+
var useTheme = () => {
|
|
6075
|
+
(0, import_react20.useEffect)(() => {
|
|
6076
|
+
const htmlElement = document.documentElement;
|
|
6077
|
+
const currentTheme = htmlElement.getAttribute("data-theme");
|
|
6078
|
+
if (currentTheme && !htmlElement.getAttribute("data-original-theme")) {
|
|
6079
|
+
htmlElement.setAttribute("data-original-theme", currentTheme);
|
|
6080
|
+
}
|
|
6081
|
+
const applyTheme = () => {
|
|
6082
|
+
const isDarkMode = window.matchMedia(
|
|
6083
|
+
"(prefers-color-scheme: dark)"
|
|
6084
|
+
).matches;
|
|
6085
|
+
const originalTheme = htmlElement.getAttribute("data-original-theme");
|
|
6086
|
+
if (isDarkMode) {
|
|
6087
|
+
htmlElement.setAttribute("data-theme", "dark");
|
|
6088
|
+
} else if (originalTheme) {
|
|
6089
|
+
htmlElement.setAttribute("data-theme", originalTheme);
|
|
6090
|
+
}
|
|
6091
|
+
};
|
|
6092
|
+
applyTheme();
|
|
6093
|
+
}, []);
|
|
6094
|
+
};
|
|
6095
|
+
|
|
6071
6096
|
// src/components/Select/Select.tsx
|
|
6072
6097
|
var import_zustand5 = require("zustand");
|
|
6073
|
-
var
|
|
6098
|
+
var import_react21 = require("react");
|
|
6074
6099
|
var import_phosphor_react16 = require("phosphor-react");
|
|
6075
6100
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
6076
6101
|
var VARIANT_CLASSES4 = {
|
|
@@ -6130,13 +6155,13 @@ function getLabelAsNode(children) {
|
|
|
6130
6155
|
if (typeof children === "string" || typeof children === "number") {
|
|
6131
6156
|
return children;
|
|
6132
6157
|
}
|
|
6133
|
-
const flattened =
|
|
6158
|
+
const flattened = import_react21.Children.toArray(children);
|
|
6134
6159
|
if (flattened.length === 1) return flattened[0];
|
|
6135
6160
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: flattened });
|
|
6136
6161
|
}
|
|
6137
6162
|
var injectStore4 = (children, store, size, selectId) => {
|
|
6138
|
-
return
|
|
6139
|
-
if ((0,
|
|
6163
|
+
return import_react21.Children.map(children, (child) => {
|
|
6164
|
+
if ((0, import_react21.isValidElement)(child)) {
|
|
6140
6165
|
const typedChild = child;
|
|
6141
6166
|
const newProps = {
|
|
6142
6167
|
store
|
|
@@ -6153,7 +6178,7 @@ var injectStore4 = (children, store, size, selectId) => {
|
|
|
6153
6178
|
selectId
|
|
6154
6179
|
);
|
|
6155
6180
|
}
|
|
6156
|
-
return (0,
|
|
6181
|
+
return (0, import_react21.cloneElement)(typedChild, newProps);
|
|
6157
6182
|
}
|
|
6158
6183
|
return child;
|
|
6159
6184
|
});
|
|
@@ -6170,18 +6195,18 @@ var Select = ({
|
|
|
6170
6195
|
errorMessage,
|
|
6171
6196
|
id
|
|
6172
6197
|
}) => {
|
|
6173
|
-
const storeRef = (0,
|
|
6198
|
+
const storeRef = (0, import_react21.useRef)(null);
|
|
6174
6199
|
storeRef.current ??= createSelectStore(onValueChange);
|
|
6175
6200
|
const store = storeRef.current;
|
|
6176
|
-
const selectRef = (0,
|
|
6201
|
+
const selectRef = (0, import_react21.useRef)(null);
|
|
6177
6202
|
const { open, setOpen, setValue, selectedLabel } = (0, import_zustand5.useStore)(store, (s) => s);
|
|
6178
|
-
const generatedId = (0,
|
|
6203
|
+
const generatedId = (0, import_react21.useId)();
|
|
6179
6204
|
const selectId = id ?? `select-${generatedId}`;
|
|
6180
6205
|
const findLabelForValue = (children2, targetValue) => {
|
|
6181
6206
|
let found = null;
|
|
6182
6207
|
const search = (nodes) => {
|
|
6183
|
-
|
|
6184
|
-
if (!(0,
|
|
6208
|
+
import_react21.Children.forEach(nodes, (child) => {
|
|
6209
|
+
if (!(0, import_react21.isValidElement)(child)) return;
|
|
6185
6210
|
const typedChild = child;
|
|
6186
6211
|
if (typedChild.type === SelectItem && typedChild.props.value === targetValue) {
|
|
6187
6212
|
if (typeof typedChild.props.children === "string")
|
|
@@ -6194,13 +6219,13 @@ var Select = ({
|
|
|
6194
6219
|
search(children2);
|
|
6195
6220
|
return found;
|
|
6196
6221
|
};
|
|
6197
|
-
(0,
|
|
6222
|
+
(0, import_react21.useEffect)(() => {
|
|
6198
6223
|
if (!selectedLabel && defaultValue) {
|
|
6199
6224
|
const label2 = findLabelForValue(children, defaultValue);
|
|
6200
6225
|
if (label2) store.setState({ selectedLabel: label2 });
|
|
6201
6226
|
}
|
|
6202
6227
|
}, [children, defaultValue, selectedLabel]);
|
|
6203
|
-
(0,
|
|
6228
|
+
(0, import_react21.useEffect)(() => {
|
|
6204
6229
|
const handleClickOutside = (event) => {
|
|
6205
6230
|
if (selectRef.current && !selectRef.current.contains(event.target)) {
|
|
6206
6231
|
setOpen(false);
|
|
@@ -6235,7 +6260,7 @@ var Select = ({
|
|
|
6235
6260
|
document.removeEventListener("keydown", handleArrowKeys);
|
|
6236
6261
|
};
|
|
6237
6262
|
}, [open]);
|
|
6238
|
-
(0,
|
|
6263
|
+
(0, import_react21.useEffect)(() => {
|
|
6239
6264
|
if (propValue) {
|
|
6240
6265
|
setValue(propValue);
|
|
6241
6266
|
const label2 = findLabelForValue(children, propValue);
|
|
@@ -6272,7 +6297,7 @@ var SelectValue = ({
|
|
|
6272
6297
|
const value = (0, import_zustand5.useStore)(store, (s) => s.value);
|
|
6273
6298
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-inherit flex gap-2 items-center", children: selectedLabel || placeholder || value });
|
|
6274
6299
|
};
|
|
6275
|
-
var SelectTrigger = (0,
|
|
6300
|
+
var SelectTrigger = (0, import_react21.forwardRef)(
|
|
6276
6301
|
({
|
|
6277
6302
|
className,
|
|
6278
6303
|
invalid = false,
|
|
@@ -6326,7 +6351,7 @@ var SelectTrigger = (0, import_react20.forwardRef)(
|
|
|
6326
6351
|
}
|
|
6327
6352
|
);
|
|
6328
6353
|
SelectTrigger.displayName = "SelectTrigger";
|
|
6329
|
-
var SelectContent = (0,
|
|
6354
|
+
var SelectContent = (0, import_react21.forwardRef)(
|
|
6330
6355
|
({
|
|
6331
6356
|
children,
|
|
6332
6357
|
className,
|
|
@@ -6356,7 +6381,7 @@ var SelectContent = (0, import_react20.forwardRef)(
|
|
|
6356
6381
|
}
|
|
6357
6382
|
);
|
|
6358
6383
|
SelectContent.displayName = "SelectContent";
|
|
6359
|
-
var SelectItem = (0,
|
|
6384
|
+
var SelectItem = (0, import_react21.forwardRef)(
|
|
6360
6385
|
({
|
|
6361
6386
|
className,
|
|
6362
6387
|
children,
|
|
@@ -6415,7 +6440,7 @@ var Select_default = Select;
|
|
|
6415
6440
|
|
|
6416
6441
|
// src/components/Menu/Menu.tsx
|
|
6417
6442
|
var import_zustand6 = require("zustand");
|
|
6418
|
-
var
|
|
6443
|
+
var import_react22 = require("react");
|
|
6419
6444
|
var import_phosphor_react17 = require("phosphor-react");
|
|
6420
6445
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
6421
6446
|
var createMenuStore = (onValueChange) => (0, import_zustand6.create)((set) => ({
|
|
@@ -6436,7 +6461,7 @@ var VARIANT_CLASSES5 = {
|
|
|
6436
6461
|
"menu-overflow": "",
|
|
6437
6462
|
breadcrumb: "bg-transparent shadow-none !px-0"
|
|
6438
6463
|
};
|
|
6439
|
-
var Menu = (0,
|
|
6464
|
+
var Menu = (0, import_react22.forwardRef)(
|
|
6440
6465
|
({
|
|
6441
6466
|
className,
|
|
6442
6467
|
children,
|
|
@@ -6446,11 +6471,11 @@ var Menu = (0, import_react21.forwardRef)(
|
|
|
6446
6471
|
onValueChange,
|
|
6447
6472
|
...props
|
|
6448
6473
|
}, ref) => {
|
|
6449
|
-
const storeRef = (0,
|
|
6474
|
+
const storeRef = (0, import_react22.useRef)(null);
|
|
6450
6475
|
storeRef.current ??= createMenuStore(onValueChange);
|
|
6451
6476
|
const store = storeRef.current;
|
|
6452
6477
|
const { setValue } = (0, import_zustand6.useStore)(store, (s) => s);
|
|
6453
|
-
(0,
|
|
6478
|
+
(0, import_react22.useEffect)(() => {
|
|
6454
6479
|
setValue(propValue ?? defaultValue);
|
|
6455
6480
|
}, [defaultValue, propValue, setValue]);
|
|
6456
6481
|
const baseClasses = variant === "menu-overflow" ? "w-fit py-2 flex flex-row items-center justify-center" : "w-full py-2 flex flex-row items-center justify-center";
|
|
@@ -6471,7 +6496,7 @@ var Menu = (0, import_react21.forwardRef)(
|
|
|
6471
6496
|
}
|
|
6472
6497
|
);
|
|
6473
6498
|
Menu.displayName = "Menu";
|
|
6474
|
-
var MenuContent = (0,
|
|
6499
|
+
var MenuContent = (0, import_react22.forwardRef)(
|
|
6475
6500
|
({ className, children, variant = "menu", ...props }, ref) => {
|
|
6476
6501
|
const baseClasses = "w-full flex flex-row items-center gap-2";
|
|
6477
6502
|
const variantClasses = variant === "menu2" || variant === "menu-overflow" ? "overflow-x-auto scroll-smooth" : "";
|
|
@@ -6493,7 +6518,7 @@ var MenuContent = (0, import_react21.forwardRef)(
|
|
|
6493
6518
|
}
|
|
6494
6519
|
);
|
|
6495
6520
|
MenuContent.displayName = "MenuContent";
|
|
6496
|
-
var MenuItem = (0,
|
|
6521
|
+
var MenuItem = (0, import_react22.forwardRef)(
|
|
6497
6522
|
({
|
|
6498
6523
|
className,
|
|
6499
6524
|
children,
|
|
@@ -6651,10 +6676,10 @@ var MenuOverflow = ({
|
|
|
6651
6676
|
onValueChange,
|
|
6652
6677
|
...props
|
|
6653
6678
|
}) => {
|
|
6654
|
-
const containerRef = (0,
|
|
6655
|
-
const [showLeftArrow, setShowLeftArrow] = (0,
|
|
6656
|
-
const [showRightArrow, setShowRightArrow] = (0,
|
|
6657
|
-
(0,
|
|
6679
|
+
const containerRef = (0, import_react22.useRef)(null);
|
|
6680
|
+
const [showLeftArrow, setShowLeftArrow] = (0, import_react22.useState)(false);
|
|
6681
|
+
const [showRightArrow, setShowRightArrow] = (0, import_react22.useState)(false);
|
|
6682
|
+
(0, import_react22.useEffect)(() => {
|
|
6658
6683
|
const checkScroll = () => internalCheckScroll(
|
|
6659
6684
|
containerRef.current,
|
|
6660
6685
|
setShowLeftArrow,
|
|
@@ -6714,11 +6739,11 @@ var MenuOverflow = ({
|
|
|
6714
6739
|
}
|
|
6715
6740
|
);
|
|
6716
6741
|
};
|
|
6717
|
-
var injectStore5 = (children, store) =>
|
|
6718
|
-
if (!(0,
|
|
6742
|
+
var injectStore5 = (children, store) => import_react22.Children.map(children, (child) => {
|
|
6743
|
+
if (!(0, import_react22.isValidElement)(child)) return child;
|
|
6719
6744
|
const typedChild = child;
|
|
6720
6745
|
const shouldInject = typedChild.type === MenuItem;
|
|
6721
|
-
return (0,
|
|
6746
|
+
return (0, import_react22.cloneElement)(typedChild, {
|
|
6722
6747
|
...shouldInject ? { store } : {},
|
|
6723
6748
|
...typedChild.props.children ? { children: injectStore5(typedChild.props.children, store) } : {}
|
|
6724
6749
|
});
|
|
@@ -6726,7 +6751,7 @@ var injectStore5 = (children, store) => import_react21.Children.map(children, (c
|
|
|
6726
6751
|
var Menu_default = Menu;
|
|
6727
6752
|
|
|
6728
6753
|
// src/components/Skeleton/Skeleton.tsx
|
|
6729
|
-
var
|
|
6754
|
+
var import_react23 = require("react");
|
|
6730
6755
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
6731
6756
|
var SKELETON_ANIMATION_CLASSES = {
|
|
6732
6757
|
pulse: "animate-pulse",
|
|
@@ -6744,7 +6769,7 @@ var SPACING_CLASSES = {
|
|
|
6744
6769
|
medium: "space-y-2",
|
|
6745
6770
|
large: "space-y-3"
|
|
6746
6771
|
};
|
|
6747
|
-
var Skeleton = (0,
|
|
6772
|
+
var Skeleton = (0, import_react23.forwardRef)(
|
|
6748
6773
|
({
|
|
6749
6774
|
variant = "text",
|
|
6750
6775
|
width,
|
|
@@ -6793,13 +6818,13 @@ var Skeleton = (0, import_react22.forwardRef)(
|
|
|
6793
6818
|
);
|
|
6794
6819
|
}
|
|
6795
6820
|
);
|
|
6796
|
-
var SkeletonText = (0,
|
|
6821
|
+
var SkeletonText = (0, import_react23.forwardRef)(
|
|
6797
6822
|
(props, ref) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Skeleton, { ref, variant: "text", ...props })
|
|
6798
6823
|
);
|
|
6799
|
-
var SkeletonCircle = (0,
|
|
6800
|
-
var SkeletonRectangle = (0,
|
|
6801
|
-
var SkeletonRounded = (0,
|
|
6802
|
-
var SkeletonCard = (0,
|
|
6824
|
+
var SkeletonCircle = (0, import_react23.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Skeleton, { ref, variant: "circular", ...props }));
|
|
6825
|
+
var SkeletonRectangle = (0, import_react23.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Skeleton, { ref, variant: "rectangular", ...props }));
|
|
6826
|
+
var SkeletonRounded = (0, import_react23.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Skeleton, { ref, variant: "rounded", ...props }));
|
|
6827
|
+
var SkeletonCard = (0, import_react23.forwardRef)(
|
|
6803
6828
|
({
|
|
6804
6829
|
showAvatar = true,
|
|
6805
6830
|
showTitle = true,
|
|
@@ -6835,7 +6860,7 @@ var SkeletonCard = (0, import_react22.forwardRef)(
|
|
|
6835
6860
|
);
|
|
6836
6861
|
}
|
|
6837
6862
|
);
|
|
6838
|
-
var SkeletonList = (0,
|
|
6863
|
+
var SkeletonList = (0, import_react23.forwardRef)(
|
|
6839
6864
|
({
|
|
6840
6865
|
items = 3,
|
|
6841
6866
|
showAvatar = true,
|
|
@@ -6854,7 +6879,7 @@ var SkeletonList = (0, import_react22.forwardRef)(
|
|
|
6854
6879
|
] }, index)) });
|
|
6855
6880
|
}
|
|
6856
6881
|
);
|
|
6857
|
-
var SkeletonTable = (0,
|
|
6882
|
+
var SkeletonTable = (0, import_react23.forwardRef)(
|
|
6858
6883
|
({ rows = 5, columns = 4, showHeader = true, className = "", ...props }, ref) => {
|
|
6859
6884
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { ref, className: cn("w-full", className), ...props, children: [
|
|
6860
6885
|
showHeader && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex space-x-2 mb-3", children: Array.from({ length: columns }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
@@ -6979,7 +7004,7 @@ var NotFound = ({
|
|
|
6979
7004
|
var NotFound_default = NotFound;
|
|
6980
7005
|
|
|
6981
7006
|
// src/components/VideoPlayer/VideoPlayer.tsx
|
|
6982
|
-
var
|
|
7007
|
+
var import_react24 = require("react");
|
|
6983
7008
|
var import_phosphor_react18 = require("phosphor-react");
|
|
6984
7009
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
6985
7010
|
var CONTROLS_HIDE_TIMEOUT = 3e3;
|
|
@@ -7084,26 +7109,26 @@ var VideoPlayer = ({
|
|
|
7084
7109
|
autoSave = true,
|
|
7085
7110
|
storageKey = "video-progress"
|
|
7086
7111
|
}) => {
|
|
7087
|
-
const videoRef = (0,
|
|
7088
|
-
const [isPlaying, setIsPlaying] = (0,
|
|
7089
|
-
const [currentTime, setCurrentTime] = (0,
|
|
7090
|
-
const [duration, setDuration] = (0,
|
|
7091
|
-
const [isMuted, setIsMuted] = (0,
|
|
7092
|
-
const [volume, setVolume] = (0,
|
|
7093
|
-
const [isFullscreen, setIsFullscreen] = (0,
|
|
7094
|
-
const [showControls, setShowControls] = (0,
|
|
7095
|
-
const [hasCompleted, setHasCompleted] = (0,
|
|
7096
|
-
const [showCaptions, setShowCaptions] = (0,
|
|
7097
|
-
(0,
|
|
7112
|
+
const videoRef = (0, import_react24.useRef)(null);
|
|
7113
|
+
const [isPlaying, setIsPlaying] = (0, import_react24.useState)(false);
|
|
7114
|
+
const [currentTime, setCurrentTime] = (0, import_react24.useState)(0);
|
|
7115
|
+
const [duration, setDuration] = (0, import_react24.useState)(0);
|
|
7116
|
+
const [isMuted, setIsMuted] = (0, import_react24.useState)(false);
|
|
7117
|
+
const [volume, setVolume] = (0, import_react24.useState)(1);
|
|
7118
|
+
const [isFullscreen, setIsFullscreen] = (0, import_react24.useState)(false);
|
|
7119
|
+
const [showControls, setShowControls] = (0, import_react24.useState)(true);
|
|
7120
|
+
const [hasCompleted, setHasCompleted] = (0, import_react24.useState)(false);
|
|
7121
|
+
const [showCaptions, setShowCaptions] = (0, import_react24.useState)(false);
|
|
7122
|
+
(0, import_react24.useEffect)(() => {
|
|
7098
7123
|
setHasCompleted(false);
|
|
7099
7124
|
}, [src]);
|
|
7100
|
-
const [playbackRate, setPlaybackRate] = (0,
|
|
7101
|
-
const [showSpeedMenu, setShowSpeedMenu] = (0,
|
|
7102
|
-
const lastSaveTimeRef = (0,
|
|
7103
|
-
const trackRef = (0,
|
|
7104
|
-
const controlsTimeoutRef = (0,
|
|
7105
|
-
const lastMousePositionRef = (0,
|
|
7106
|
-
const isUserInteracting = (0,
|
|
7125
|
+
const [playbackRate, setPlaybackRate] = (0, import_react24.useState)(1);
|
|
7126
|
+
const [showSpeedMenu, setShowSpeedMenu] = (0, import_react24.useState)(false);
|
|
7127
|
+
const lastSaveTimeRef = (0, import_react24.useRef)(0);
|
|
7128
|
+
const trackRef = (0, import_react24.useRef)(null);
|
|
7129
|
+
const controlsTimeoutRef = (0, import_react24.useRef)(null);
|
|
7130
|
+
const lastMousePositionRef = (0, import_react24.useRef)({ x: 0, y: 0 });
|
|
7131
|
+
const isUserInteracting = (0, import_react24.useCallback)(() => {
|
|
7107
7132
|
if (showSpeedMenu) {
|
|
7108
7133
|
return true;
|
|
7109
7134
|
}
|
|
@@ -7120,13 +7145,13 @@ var VideoPlayer = ({
|
|
|
7120
7145
|
}
|
|
7121
7146
|
return false;
|
|
7122
7147
|
}, [showSpeedMenu]);
|
|
7123
|
-
const clearControlsTimeout = (0,
|
|
7148
|
+
const clearControlsTimeout = (0, import_react24.useCallback)(() => {
|
|
7124
7149
|
if (controlsTimeoutRef.current) {
|
|
7125
7150
|
clearTimeout(controlsTimeoutRef.current);
|
|
7126
7151
|
controlsTimeoutRef.current = null;
|
|
7127
7152
|
}
|
|
7128
7153
|
}, []);
|
|
7129
|
-
const showControlsWithTimer = (0,
|
|
7154
|
+
const showControlsWithTimer = (0, import_react24.useCallback)(() => {
|
|
7130
7155
|
setShowControls(true);
|
|
7131
7156
|
clearControlsTimeout();
|
|
7132
7157
|
if (isFullscreen) {
|
|
@@ -7141,7 +7166,7 @@ var VideoPlayer = ({
|
|
|
7141
7166
|
}, CONTROLS_HIDE_TIMEOUT);
|
|
7142
7167
|
}
|
|
7143
7168
|
}, [isFullscreen, isPlaying, clearControlsTimeout]);
|
|
7144
|
-
const handleMouseMove = (0,
|
|
7169
|
+
const handleMouseMove = (0, import_react24.useCallback)(
|
|
7145
7170
|
(event) => {
|
|
7146
7171
|
const currentX = event.clientX;
|
|
7147
7172
|
const currentY = event.clientY;
|
|
@@ -7154,10 +7179,10 @@ var VideoPlayer = ({
|
|
|
7154
7179
|
},
|
|
7155
7180
|
[showControlsWithTimer]
|
|
7156
7181
|
);
|
|
7157
|
-
const handleMouseEnter = (0,
|
|
7182
|
+
const handleMouseEnter = (0, import_react24.useCallback)(() => {
|
|
7158
7183
|
showControlsWithTimer();
|
|
7159
7184
|
}, [showControlsWithTimer]);
|
|
7160
|
-
const handleMouseLeave = (0,
|
|
7185
|
+
const handleMouseLeave = (0, import_react24.useCallback)(() => {
|
|
7161
7186
|
const userInteracting = isUserInteracting();
|
|
7162
7187
|
clearControlsTimeout();
|
|
7163
7188
|
if (!isFullscreen && !userInteracting) {
|
|
@@ -7166,13 +7191,13 @@ var VideoPlayer = ({
|
|
|
7166
7191
|
}, LEAVE_HIDE_TIMEOUT);
|
|
7167
7192
|
}
|
|
7168
7193
|
}, [isFullscreen, clearControlsTimeout, isUserInteracting]);
|
|
7169
|
-
(0,
|
|
7194
|
+
(0, import_react24.useEffect)(() => {
|
|
7170
7195
|
if (videoRef.current) {
|
|
7171
7196
|
videoRef.current.volume = volume;
|
|
7172
7197
|
videoRef.current.muted = isMuted;
|
|
7173
7198
|
}
|
|
7174
7199
|
}, [volume, isMuted]);
|
|
7175
|
-
(0,
|
|
7200
|
+
(0, import_react24.useEffect)(() => {
|
|
7176
7201
|
const video = videoRef.current;
|
|
7177
7202
|
if (!video) return;
|
|
7178
7203
|
const onPlay = () => setIsPlaying(true);
|
|
@@ -7187,7 +7212,7 @@ var VideoPlayer = ({
|
|
|
7187
7212
|
video.removeEventListener("ended", onEnded);
|
|
7188
7213
|
};
|
|
7189
7214
|
}, []);
|
|
7190
|
-
(0,
|
|
7215
|
+
(0, import_react24.useEffect)(() => {
|
|
7191
7216
|
if (isPlaying) {
|
|
7192
7217
|
showControlsWithTimer();
|
|
7193
7218
|
} else {
|
|
@@ -7199,7 +7224,7 @@ var VideoPlayer = ({
|
|
|
7199
7224
|
}
|
|
7200
7225
|
}
|
|
7201
7226
|
}, [isPlaying, isFullscreen, showControlsWithTimer, clearControlsTimeout]);
|
|
7202
|
-
(0,
|
|
7227
|
+
(0, import_react24.useEffect)(() => {
|
|
7203
7228
|
const handleFullscreenChange = () => {
|
|
7204
7229
|
const isCurrentlyFullscreen = !!document.fullscreenElement;
|
|
7205
7230
|
setIsFullscreen(isCurrentlyFullscreen);
|
|
@@ -7212,7 +7237,7 @@ var VideoPlayer = ({
|
|
|
7212
7237
|
document.removeEventListener("fullscreenchange", handleFullscreenChange);
|
|
7213
7238
|
};
|
|
7214
7239
|
}, [showControlsWithTimer]);
|
|
7215
|
-
(0,
|
|
7240
|
+
(0, import_react24.useEffect)(() => {
|
|
7216
7241
|
const init = () => {
|
|
7217
7242
|
if (!isFullscreen) {
|
|
7218
7243
|
showControlsWithTimer();
|
|
@@ -7234,7 +7259,7 @@ var VideoPlayer = ({
|
|
|
7234
7259
|
};
|
|
7235
7260
|
}
|
|
7236
7261
|
}, []);
|
|
7237
|
-
const getInitialTime = (0,
|
|
7262
|
+
const getInitialTime = (0, import_react24.useCallback)(() => {
|
|
7238
7263
|
if (!autoSave || !storageKey) {
|
|
7239
7264
|
return Number.isFinite(initialTime) && initialTime >= 0 ? initialTime : void 0;
|
|
7240
7265
|
}
|
|
@@ -7245,14 +7270,14 @@ var VideoPlayer = ({
|
|
|
7245
7270
|
if (hasValidSaved) return saved;
|
|
7246
7271
|
return void 0;
|
|
7247
7272
|
}, [autoSave, storageKey, src, initialTime]);
|
|
7248
|
-
(0,
|
|
7273
|
+
(0, import_react24.useEffect)(() => {
|
|
7249
7274
|
const start = getInitialTime();
|
|
7250
7275
|
if (start !== void 0 && videoRef.current) {
|
|
7251
7276
|
videoRef.current.currentTime = start;
|
|
7252
7277
|
setCurrentTime(start);
|
|
7253
7278
|
}
|
|
7254
7279
|
}, [getInitialTime]);
|
|
7255
|
-
const saveProgress = (0,
|
|
7280
|
+
const saveProgress = (0, import_react24.useCallback)(
|
|
7256
7281
|
(time) => {
|
|
7257
7282
|
if (!autoSave || !storageKey) return;
|
|
7258
7283
|
const now = Date.now();
|
|
@@ -7263,7 +7288,7 @@ var VideoPlayer = ({
|
|
|
7263
7288
|
},
|
|
7264
7289
|
[autoSave, storageKey, src]
|
|
7265
7290
|
);
|
|
7266
|
-
const togglePlayPause = (0,
|
|
7291
|
+
const togglePlayPause = (0, import_react24.useCallback)(async () => {
|
|
7267
7292
|
const video = videoRef.current;
|
|
7268
7293
|
if (!video) return;
|
|
7269
7294
|
if (!video.paused) {
|
|
@@ -7275,7 +7300,7 @@ var VideoPlayer = ({
|
|
|
7275
7300
|
} catch {
|
|
7276
7301
|
}
|
|
7277
7302
|
}, []);
|
|
7278
|
-
const handleVolumeChange = (0,
|
|
7303
|
+
const handleVolumeChange = (0, import_react24.useCallback)(
|
|
7279
7304
|
(newVolume) => {
|
|
7280
7305
|
const video = videoRef.current;
|
|
7281
7306
|
if (!video) return;
|
|
@@ -7294,7 +7319,7 @@ var VideoPlayer = ({
|
|
|
7294
7319
|
},
|
|
7295
7320
|
[isMuted]
|
|
7296
7321
|
);
|
|
7297
|
-
const toggleMute = (0,
|
|
7322
|
+
const toggleMute = (0, import_react24.useCallback)(() => {
|
|
7298
7323
|
const video = videoRef.current;
|
|
7299
7324
|
if (!video) return;
|
|
7300
7325
|
if (isMuted) {
|
|
@@ -7308,13 +7333,13 @@ var VideoPlayer = ({
|
|
|
7308
7333
|
setIsMuted(true);
|
|
7309
7334
|
}
|
|
7310
7335
|
}, [isMuted, volume]);
|
|
7311
|
-
const handleSeek = (0,
|
|
7336
|
+
const handleSeek = (0, import_react24.useCallback)((newTime) => {
|
|
7312
7337
|
const video = videoRef.current;
|
|
7313
7338
|
if (video) {
|
|
7314
7339
|
video.currentTime = newTime;
|
|
7315
7340
|
}
|
|
7316
7341
|
}, []);
|
|
7317
|
-
const toggleFullscreen = (0,
|
|
7342
|
+
const toggleFullscreen = (0, import_react24.useCallback)(() => {
|
|
7318
7343
|
const container = videoRef.current?.parentElement;
|
|
7319
7344
|
if (!container) return;
|
|
7320
7345
|
if (!isFullscreen && container.requestFullscreen) {
|
|
@@ -7323,23 +7348,23 @@ var VideoPlayer = ({
|
|
|
7323
7348
|
document.exitFullscreen();
|
|
7324
7349
|
}
|
|
7325
7350
|
}, [isFullscreen]);
|
|
7326
|
-
const handleSpeedChange = (0,
|
|
7351
|
+
const handleSpeedChange = (0, import_react24.useCallback)((speed) => {
|
|
7327
7352
|
if (videoRef.current) {
|
|
7328
7353
|
videoRef.current.playbackRate = speed;
|
|
7329
7354
|
setPlaybackRate(speed);
|
|
7330
7355
|
setShowSpeedMenu(false);
|
|
7331
7356
|
}
|
|
7332
7357
|
}, []);
|
|
7333
|
-
const toggleSpeedMenu = (0,
|
|
7358
|
+
const toggleSpeedMenu = (0, import_react24.useCallback)(() => {
|
|
7334
7359
|
setShowSpeedMenu(!showSpeedMenu);
|
|
7335
7360
|
}, [showSpeedMenu]);
|
|
7336
|
-
const toggleCaptions = (0,
|
|
7361
|
+
const toggleCaptions = (0, import_react24.useCallback)(() => {
|
|
7337
7362
|
if (!trackRef.current?.track || !subtitles) return;
|
|
7338
7363
|
const newShowCaptions = !showCaptions;
|
|
7339
7364
|
setShowCaptions(newShowCaptions);
|
|
7340
7365
|
trackRef.current.track.mode = newShowCaptions && subtitles ? "showing" : "hidden";
|
|
7341
7366
|
}, [showCaptions, subtitles]);
|
|
7342
|
-
const checkVideoCompletion = (0,
|
|
7367
|
+
const checkVideoCompletion = (0, import_react24.useCallback)(
|
|
7343
7368
|
(progressPercent) => {
|
|
7344
7369
|
if (progressPercent >= 95 && !hasCompleted) {
|
|
7345
7370
|
setHasCompleted(true);
|
|
@@ -7348,7 +7373,7 @@ var VideoPlayer = ({
|
|
|
7348
7373
|
},
|
|
7349
7374
|
[hasCompleted, onVideoComplete]
|
|
7350
7375
|
);
|
|
7351
|
-
const handleTimeUpdate = (0,
|
|
7376
|
+
const handleTimeUpdate = (0, import_react24.useCallback)(() => {
|
|
7352
7377
|
const video = videoRef.current;
|
|
7353
7378
|
if (!video) return;
|
|
7354
7379
|
const current = video.currentTime;
|
|
@@ -7361,17 +7386,17 @@ var VideoPlayer = ({
|
|
|
7361
7386
|
checkVideoCompletion(progressPercent);
|
|
7362
7387
|
}
|
|
7363
7388
|
}, [duration, saveProgress, onTimeUpdate, onProgress, checkVideoCompletion]);
|
|
7364
|
-
const handleLoadedMetadata = (0,
|
|
7389
|
+
const handleLoadedMetadata = (0, import_react24.useCallback)(() => {
|
|
7365
7390
|
if (videoRef.current) {
|
|
7366
7391
|
setDuration(videoRef.current.duration);
|
|
7367
7392
|
}
|
|
7368
7393
|
}, []);
|
|
7369
|
-
(0,
|
|
7394
|
+
(0, import_react24.useEffect)(() => {
|
|
7370
7395
|
if (trackRef.current?.track) {
|
|
7371
7396
|
trackRef.current.track.mode = showCaptions && subtitles ? "showing" : "hidden";
|
|
7372
7397
|
}
|
|
7373
7398
|
}, [subtitles, showCaptions]);
|
|
7374
|
-
(0,
|
|
7399
|
+
(0, import_react24.useEffect)(() => {
|
|
7375
7400
|
const handleVisibilityChange = () => {
|
|
7376
7401
|
if (document.hidden && isPlaying && videoRef.current) {
|
|
7377
7402
|
videoRef.current.pause();
|
|
@@ -7393,13 +7418,13 @@ var VideoPlayer = ({
|
|
|
7393
7418
|
};
|
|
7394
7419
|
}, [isPlaying, clearControlsTimeout]);
|
|
7395
7420
|
const progressPercentage = duration > 0 ? currentTime / duration * 100 : 0;
|
|
7396
|
-
const getTopControlsOpacity = (0,
|
|
7421
|
+
const getTopControlsOpacity = (0, import_react24.useCallback)(() => {
|
|
7397
7422
|
return showControls ? "opacity-100" : "opacity-0";
|
|
7398
7423
|
}, [showControls]);
|
|
7399
|
-
const getBottomControlsOpacity = (0,
|
|
7424
|
+
const getBottomControlsOpacity = (0, import_react24.useCallback)(() => {
|
|
7400
7425
|
return showControls ? "opacity-100" : "opacity-0";
|
|
7401
7426
|
}, [showControls]);
|
|
7402
|
-
const handleVideoKeyDown = (0,
|
|
7427
|
+
const handleVideoKeyDown = (0, import_react24.useCallback)(
|
|
7403
7428
|
(e) => {
|
|
7404
7429
|
if (e.key) {
|
|
7405
7430
|
e.stopPropagation();
|
|
@@ -7624,7 +7649,7 @@ var VideoPlayer = ({
|
|
|
7624
7649
|
var VideoPlayer_default = VideoPlayer;
|
|
7625
7650
|
|
|
7626
7651
|
// src/components/Whiteboard/Whiteboard.tsx
|
|
7627
|
-
var
|
|
7652
|
+
var import_react25 = require("react");
|
|
7628
7653
|
var import_phosphor_react19 = require("phosphor-react");
|
|
7629
7654
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
7630
7655
|
var IMAGE_WIDTH = 225;
|
|
@@ -7637,8 +7662,8 @@ var Whiteboard = ({
|
|
|
7637
7662
|
imagesPerRow = 2,
|
|
7638
7663
|
...rest
|
|
7639
7664
|
}) => {
|
|
7640
|
-
const [imageErrors, setImageErrors] = (0,
|
|
7641
|
-
const handleDownload = (0,
|
|
7665
|
+
const [imageErrors, setImageErrors] = (0, import_react25.useState)(/* @__PURE__ */ new Set());
|
|
7666
|
+
const handleDownload = (0, import_react25.useCallback)(
|
|
7642
7667
|
(image) => {
|
|
7643
7668
|
if (onDownload) {
|
|
7644
7669
|
onDownload(image);
|
|
@@ -7655,7 +7680,7 @@ var Whiteboard = ({
|
|
|
7655
7680
|
},
|
|
7656
7681
|
[onDownload]
|
|
7657
7682
|
);
|
|
7658
|
-
const handleImageError = (0,
|
|
7683
|
+
const handleImageError = (0, import_react25.useCallback)((imageId) => {
|
|
7659
7684
|
setImageErrors((prev) => new Set(prev).add(imageId));
|
|
7660
7685
|
}, []);
|
|
7661
7686
|
const gridColsClass = images?.length === 1 ? "grid-cols-1" : {
|
|
@@ -7742,10 +7767,10 @@ var Whiteboard = ({
|
|
|
7742
7767
|
var Whiteboard_default = Whiteboard;
|
|
7743
7768
|
|
|
7744
7769
|
// src/components/Auth/Auth.tsx
|
|
7745
|
-
var
|
|
7770
|
+
var import_react26 = require("react");
|
|
7746
7771
|
var import_react_router_dom = require("react-router-dom");
|
|
7747
7772
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
7748
|
-
var AuthContext = (0,
|
|
7773
|
+
var AuthContext = (0, import_react26.createContext)(void 0);
|
|
7749
7774
|
var AuthProvider = ({
|
|
7750
7775
|
children,
|
|
7751
7776
|
checkAuthFn,
|
|
@@ -7755,12 +7780,12 @@ var AuthProvider = ({
|
|
|
7755
7780
|
getSessionFn,
|
|
7756
7781
|
getTokensFn
|
|
7757
7782
|
}) => {
|
|
7758
|
-
const [authState, setAuthState] = (0,
|
|
7783
|
+
const [authState, setAuthState] = (0, import_react26.useState)({
|
|
7759
7784
|
isAuthenticated: false,
|
|
7760
7785
|
isLoading: true,
|
|
7761
7786
|
...initialAuthState
|
|
7762
7787
|
});
|
|
7763
|
-
const checkAuth = (0,
|
|
7788
|
+
const checkAuth = (0, import_react26.useCallback)(async () => {
|
|
7764
7789
|
try {
|
|
7765
7790
|
setAuthState((prev) => ({ ...prev, isLoading: true }));
|
|
7766
7791
|
if (!checkAuthFn) {
|
|
@@ -7791,7 +7816,7 @@ var AuthProvider = ({
|
|
|
7791
7816
|
return false;
|
|
7792
7817
|
}
|
|
7793
7818
|
}, [checkAuthFn, getUserFn, getSessionFn, getTokensFn]);
|
|
7794
|
-
const signOut = (0,
|
|
7819
|
+
const signOut = (0, import_react26.useCallback)(() => {
|
|
7795
7820
|
if (signOutFn) {
|
|
7796
7821
|
signOutFn();
|
|
7797
7822
|
}
|
|
@@ -7803,10 +7828,10 @@ var AuthProvider = ({
|
|
|
7803
7828
|
tokens: void 0
|
|
7804
7829
|
}));
|
|
7805
7830
|
}, [signOutFn]);
|
|
7806
|
-
(0,
|
|
7831
|
+
(0, import_react26.useEffect)(() => {
|
|
7807
7832
|
checkAuth();
|
|
7808
7833
|
}, [checkAuth]);
|
|
7809
|
-
const contextValue = (0,
|
|
7834
|
+
const contextValue = (0, import_react26.useMemo)(
|
|
7810
7835
|
() => ({
|
|
7811
7836
|
...authState,
|
|
7812
7837
|
checkAuth,
|
|
@@ -7817,7 +7842,7 @@ var AuthProvider = ({
|
|
|
7817
7842
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(AuthContext.Provider, { value: contextValue, children });
|
|
7818
7843
|
};
|
|
7819
7844
|
var useAuth = () => {
|
|
7820
|
-
const context = (0,
|
|
7845
|
+
const context = (0, import_react26.useContext)(AuthContext);
|
|
7821
7846
|
if (context === void 0) {
|
|
7822
7847
|
throw new Error("useAuth deve ser usado dentro de um AuthProvider");
|
|
7823
7848
|
}
|
|
@@ -7957,7 +7982,7 @@ function createZustandAuthAdapter(useAuthStore) {
|
|
|
7957
7982
|
}
|
|
7958
7983
|
|
|
7959
7984
|
// src/components/Auth/useUrlAuthentication.ts
|
|
7960
|
-
var
|
|
7985
|
+
var import_react27 = require("react");
|
|
7961
7986
|
var import_react_router_dom2 = require("react-router-dom");
|
|
7962
7987
|
var getAuthParams = (location, extractParams) => {
|
|
7963
7988
|
const searchParams = new URLSearchParams(location.search);
|
|
@@ -8005,8 +8030,8 @@ var handleUserData = (responseData, setUser) => {
|
|
|
8005
8030
|
};
|
|
8006
8031
|
function useUrlAuthentication(options) {
|
|
8007
8032
|
const location = (0, import_react_router_dom2.useLocation)();
|
|
8008
|
-
const processedRef = (0,
|
|
8009
|
-
(0,
|
|
8033
|
+
const processedRef = (0, import_react27.useRef)(false);
|
|
8034
|
+
(0, import_react27.useEffect)(() => {
|
|
8010
8035
|
const handleAuthentication = async () => {
|
|
8011
8036
|
if (processedRef.current) {
|
|
8012
8037
|
return;
|
|
@@ -8077,9 +8102,9 @@ function useUrlAuthentication(options) {
|
|
|
8077
8102
|
}
|
|
8078
8103
|
|
|
8079
8104
|
// src/components/Auth/useApiConfig.ts
|
|
8080
|
-
var
|
|
8105
|
+
var import_react28 = require("react");
|
|
8081
8106
|
function useApiConfig(api) {
|
|
8082
|
-
return (0,
|
|
8107
|
+
return (0, import_react28.useMemo)(
|
|
8083
8108
|
() => ({
|
|
8084
8109
|
get: (endpoint, config) => api.get(endpoint, config)
|
|
8085
8110
|
}),
|
|
@@ -8089,7 +8114,7 @@ function useApiConfig(api) {
|
|
|
8089
8114
|
|
|
8090
8115
|
// src/components/Quiz/Quiz.tsx
|
|
8091
8116
|
var import_phosphor_react20 = require("phosphor-react");
|
|
8092
|
-
var
|
|
8117
|
+
var import_react29 = require("react");
|
|
8093
8118
|
|
|
8094
8119
|
// src/components/Quiz/useQuizStore.ts
|
|
8095
8120
|
var import_zustand7 = require("zustand");
|
|
@@ -8744,18 +8769,18 @@ var getStatusStyles = (variantCorrect) => {
|
|
|
8744
8769
|
return "bg-error-background border-error-300";
|
|
8745
8770
|
}
|
|
8746
8771
|
};
|
|
8747
|
-
var Quiz = (0,
|
|
8772
|
+
var Quiz = (0, import_react29.forwardRef)(({ children, className, variant = "default", ...props }, ref) => {
|
|
8748
8773
|
const { setVariant } = useQuizStore();
|
|
8749
|
-
(0,
|
|
8774
|
+
(0, import_react29.useEffect)(() => {
|
|
8750
8775
|
setVariant(variant);
|
|
8751
8776
|
}, [variant, setVariant]);
|
|
8752
8777
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { ref, className: cn("flex flex-col", className), ...props, children });
|
|
8753
8778
|
});
|
|
8754
|
-
var QuizHeaderResult = (0,
|
|
8779
|
+
var QuizHeaderResult = (0, import_react29.forwardRef)(
|
|
8755
8780
|
({ className, ...props }, ref) => {
|
|
8756
8781
|
const { getQuestionResultByQuestionId, getCurrentQuestion } = useQuizStore();
|
|
8757
|
-
const [status, setStatus] = (0,
|
|
8758
|
-
(0,
|
|
8782
|
+
const [status, setStatus] = (0, import_react29.useState)(void 0);
|
|
8783
|
+
(0, import_react29.useEffect)(() => {
|
|
8759
8784
|
const cq = getCurrentQuestion();
|
|
8760
8785
|
if (!cq) {
|
|
8761
8786
|
setStatus(void 0);
|
|
@@ -8808,7 +8833,7 @@ var QuizHeaderResult = (0, import_react28.forwardRef)(
|
|
|
8808
8833
|
);
|
|
8809
8834
|
}
|
|
8810
8835
|
);
|
|
8811
|
-
var QuizTitle = (0,
|
|
8836
|
+
var QuizTitle = (0, import_react29.forwardRef)(
|
|
8812
8837
|
({ className, ...props }, ref) => {
|
|
8813
8838
|
const {
|
|
8814
8839
|
currentQuestionIndex,
|
|
@@ -8818,7 +8843,7 @@ var QuizTitle = (0, import_react28.forwardRef)(
|
|
|
8818
8843
|
formatTime: formatTime2,
|
|
8819
8844
|
isStarted
|
|
8820
8845
|
} = useQuizStore();
|
|
8821
|
-
const [showExitConfirmation, setShowExitConfirmation] = (0,
|
|
8846
|
+
const [showExitConfirmation, setShowExitConfirmation] = (0, import_react29.useState)(false);
|
|
8822
8847
|
const totalQuestions = getTotalQuestions();
|
|
8823
8848
|
const quizTitle = getQuizTitle();
|
|
8824
8849
|
const handleBackClick = () => {
|
|
@@ -8879,7 +8904,7 @@ var QuizTitle = (0, import_react28.forwardRef)(
|
|
|
8879
8904
|
] });
|
|
8880
8905
|
}
|
|
8881
8906
|
);
|
|
8882
|
-
var QuizSubTitle = (0,
|
|
8907
|
+
var QuizSubTitle = (0, import_react29.forwardRef)(
|
|
8883
8908
|
({ subTitle, ...props }, ref) => {
|
|
8884
8909
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "px-4 pb-2 pt-6", ...props, ref, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "font-bold text-lg text-text-950", children: subTitle }) });
|
|
8885
8910
|
}
|
|
@@ -8896,7 +8921,7 @@ var QuizHeader = () => {
|
|
|
8896
8921
|
}
|
|
8897
8922
|
);
|
|
8898
8923
|
};
|
|
8899
|
-
var QuizContainer = (0,
|
|
8924
|
+
var QuizContainer = (0, import_react29.forwardRef)(({ children, className, ...props }, ref) => {
|
|
8900
8925
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8901
8926
|
"div",
|
|
8902
8927
|
{
|
|
@@ -8910,7 +8935,7 @@ var QuizContainer = (0, import_react28.forwardRef)(({ children, className, ...pr
|
|
|
8910
8935
|
}
|
|
8911
8936
|
);
|
|
8912
8937
|
});
|
|
8913
|
-
var QuizContent = (0,
|
|
8938
|
+
var QuizContent = (0, import_react29.forwardRef)(({ paddingBottom }) => {
|
|
8914
8939
|
const { getCurrentQuestion } = useQuizStore();
|
|
8915
8940
|
const currentQuestion = getCurrentQuestion();
|
|
8916
8941
|
const questionComponents = {
|
|
@@ -8995,15 +9020,15 @@ var QuizMultipleChoice = ({ paddingBottom }) => {
|
|
|
8995
9020
|
const currentQuestionResult = getQuestionResultByQuestionId(
|
|
8996
9021
|
currentQuestion?.id || ""
|
|
8997
9022
|
);
|
|
8998
|
-
const prevSelectedValuesRef = (0,
|
|
8999
|
-
const prevQuestionIdRef = (0,
|
|
9000
|
-
const allCurrentAnswerIds = (0,
|
|
9023
|
+
const prevSelectedValuesRef = (0, import_react29.useRef)([]);
|
|
9024
|
+
const prevQuestionIdRef = (0, import_react29.useRef)("");
|
|
9025
|
+
const allCurrentAnswerIds = (0, import_react29.useMemo)(() => {
|
|
9001
9026
|
return allCurrentAnswers?.map((answer) => answer.optionId) || [];
|
|
9002
9027
|
}, [allCurrentAnswers]);
|
|
9003
|
-
const selectedValues = (0,
|
|
9028
|
+
const selectedValues = (0, import_react29.useMemo)(() => {
|
|
9004
9029
|
return allCurrentAnswerIds?.filter((id) => id !== null) || [];
|
|
9005
9030
|
}, [allCurrentAnswerIds]);
|
|
9006
|
-
const stableSelectedValues = (0,
|
|
9031
|
+
const stableSelectedValues = (0, import_react29.useMemo)(() => {
|
|
9007
9032
|
const currentQuestionId = currentQuestion?.id || "";
|
|
9008
9033
|
const hasQuestionChanged = prevQuestionIdRef.current !== currentQuestionId;
|
|
9009
9034
|
if (hasQuestionChanged) {
|
|
@@ -9027,7 +9052,7 @@ var QuizMultipleChoice = ({ paddingBottom }) => {
|
|
|
9027
9052
|
variant,
|
|
9028
9053
|
currentQuestionResult?.selectedOptions
|
|
9029
9054
|
]);
|
|
9030
|
-
const handleSelectedValues = (0,
|
|
9055
|
+
const handleSelectedValues = (0, import_react29.useCallback)(
|
|
9031
9056
|
(values) => {
|
|
9032
9057
|
if (currentQuestion) {
|
|
9033
9058
|
selectMultipleAnswer(currentQuestion.id, values);
|
|
@@ -9035,7 +9060,7 @@ var QuizMultipleChoice = ({ paddingBottom }) => {
|
|
|
9035
9060
|
},
|
|
9036
9061
|
[currentQuestion, selectMultipleAnswer]
|
|
9037
9062
|
);
|
|
9038
|
-
const questionKey = (0,
|
|
9063
|
+
const questionKey = (0, import_react29.useMemo)(
|
|
9039
9064
|
() => `question-${currentQuestion?.id || "1"}`,
|
|
9040
9065
|
[currentQuestion?.id]
|
|
9041
9066
|
);
|
|
@@ -9090,13 +9115,13 @@ var QuizDissertative = ({ paddingBottom }) => {
|
|
|
9090
9115
|
currentQuestion?.id || ""
|
|
9091
9116
|
);
|
|
9092
9117
|
const currentAnswer = getCurrentAnswer();
|
|
9093
|
-
const textareaRef = (0,
|
|
9118
|
+
const textareaRef = (0, import_react29.useRef)(null);
|
|
9094
9119
|
const handleAnswerChange = (value) => {
|
|
9095
9120
|
if (currentQuestion) {
|
|
9096
9121
|
selectDissertativeAnswer(currentQuestion.id, value);
|
|
9097
9122
|
}
|
|
9098
9123
|
};
|
|
9099
|
-
const adjustTextareaHeight = (0,
|
|
9124
|
+
const adjustTextareaHeight = (0, import_react29.useCallback)(() => {
|
|
9100
9125
|
if (textareaRef.current) {
|
|
9101
9126
|
textareaRef.current.style.height = "auto";
|
|
9102
9127
|
const scrollHeight = textareaRef.current.scrollHeight;
|
|
@@ -9106,7 +9131,7 @@ var QuizDissertative = ({ paddingBottom }) => {
|
|
|
9106
9131
|
textareaRef.current.style.height = `${newHeight}px`;
|
|
9107
9132
|
}
|
|
9108
9133
|
}, []);
|
|
9109
|
-
(0,
|
|
9134
|
+
(0, import_react29.useEffect)(() => {
|
|
9110
9135
|
adjustTextareaHeight();
|
|
9111
9136
|
}, [currentAnswer, adjustTextareaHeight]);
|
|
9112
9137
|
if (!currentQuestion) {
|
|
@@ -9245,7 +9270,7 @@ var QuizConnectDots = ({ paddingBottom }) => {
|
|
|
9245
9270
|
isCorrect: false
|
|
9246
9271
|
}
|
|
9247
9272
|
];
|
|
9248
|
-
const [userAnswers, setUserAnswers] = (0,
|
|
9273
|
+
const [userAnswers, setUserAnswers] = (0, import_react29.useState)(() => {
|
|
9249
9274
|
if (variant === "result") {
|
|
9250
9275
|
return mockUserAnswers;
|
|
9251
9276
|
}
|
|
@@ -9364,8 +9389,8 @@ var QuizFill = ({ paddingBottom }) => {
|
|
|
9364
9389
|
isCorrect: true
|
|
9365
9390
|
}
|
|
9366
9391
|
];
|
|
9367
|
-
const [answers, setAnswers] = (0,
|
|
9368
|
-
const baseId = (0,
|
|
9392
|
+
const [answers, setAnswers] = (0, import_react29.useState)({});
|
|
9393
|
+
const baseId = (0, import_react29.useId)();
|
|
9369
9394
|
const getAvailableOptionsForSelect = (selectId) => {
|
|
9370
9395
|
const usedOptions = Object.entries(answers).filter(([key]) => key !== selectId).map(([, value]) => value);
|
|
9371
9396
|
return options.filter((option) => !usedOptions.includes(option));
|
|
@@ -9502,7 +9527,7 @@ var QuizImageQuestion = ({ paddingBottom }) => {
|
|
|
9502
9527
|
};
|
|
9503
9528
|
const correctRadiusRelative = calculateCorrectRadiusRelative();
|
|
9504
9529
|
const mockUserAnswerRelative = { x: 0.72, y: 0.348 };
|
|
9505
|
-
const [clickPositionRelative, setClickPositionRelative] = (0,
|
|
9530
|
+
const [clickPositionRelative, setClickPositionRelative] = (0, import_react29.useState)(variant == "result" ? mockUserAnswerRelative : null);
|
|
9506
9531
|
const convertToRelativeCoordinates = (x, y, rect) => {
|
|
9507
9532
|
const safeWidth = Math.max(rect.width, 1e-3);
|
|
9508
9533
|
const safeHeight = Math.max(rect.height, 1e-3);
|
|
@@ -9702,7 +9727,7 @@ var QuizQuestionList = ({
|
|
|
9702
9727
|
)
|
|
9703
9728
|
] });
|
|
9704
9729
|
};
|
|
9705
|
-
var QuizFooter = (0,
|
|
9730
|
+
var QuizFooter = (0, import_react29.forwardRef)(
|
|
9706
9731
|
({
|
|
9707
9732
|
className,
|
|
9708
9733
|
onGoToSimulated,
|
|
@@ -9730,11 +9755,11 @@ var QuizFooter = (0, import_react28.forwardRef)(
|
|
|
9730
9755
|
const currentAnswer = getCurrentAnswer();
|
|
9731
9756
|
const currentQuestion = getCurrentQuestion();
|
|
9732
9757
|
const isCurrentQuestionSkipped = currentQuestion ? getQuestionStatusFromUserAnswers(currentQuestion.id) === "skipped" : false;
|
|
9733
|
-
const [alertDialogOpen, setAlertDialogOpen] = (0,
|
|
9734
|
-
const [modalResultOpen, setModalResultOpen] = (0,
|
|
9735
|
-
const [modalNavigateOpen, setModalNavigateOpen] = (0,
|
|
9736
|
-
const [modalResolutionOpen, setModalResolutionOpen] = (0,
|
|
9737
|
-
const [filterType, setFilterType] = (0,
|
|
9758
|
+
const [alertDialogOpen, setAlertDialogOpen] = (0, import_react29.useState)(false);
|
|
9759
|
+
const [modalResultOpen, setModalResultOpen] = (0, import_react29.useState)(false);
|
|
9760
|
+
const [modalNavigateOpen, setModalNavigateOpen] = (0, import_react29.useState)(false);
|
|
9761
|
+
const [modalResolutionOpen, setModalResolutionOpen] = (0, import_react29.useState)(false);
|
|
9762
|
+
const [filterType, setFilterType] = (0, import_react29.useState)("all");
|
|
9738
9763
|
const unansweredQuestions = getUnansweredQuestionsFromUserAnswers();
|
|
9739
9764
|
const allQuestions = getTotalQuestions();
|
|
9740
9765
|
const handleFinishQuiz = async () => {
|
|
@@ -9979,7 +10004,7 @@ var QuizBadge = ({
|
|
|
9979
10004
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Badge_default, { variant: "solid", action: "info", "data-testid": "quiz-badge", children: subtype });
|
|
9980
10005
|
}
|
|
9981
10006
|
};
|
|
9982
|
-
var QuizResultHeaderTitle = (0,
|
|
10007
|
+
var QuizResultHeaderTitle = (0, import_react29.forwardRef)(({ className, ...props }, ref) => {
|
|
9983
10008
|
const { getActiveQuiz } = useQuizStore();
|
|
9984
10009
|
const activeQuiz = getActiveQuiz();
|
|
9985
10010
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
@@ -9995,7 +10020,7 @@ var QuizResultHeaderTitle = (0, import_react28.forwardRef)(({ className, ...prop
|
|
|
9995
10020
|
}
|
|
9996
10021
|
);
|
|
9997
10022
|
});
|
|
9998
|
-
var QuizResultTitle = (0,
|
|
10023
|
+
var QuizResultTitle = (0, import_react29.forwardRef)(({ className, ...props }, ref) => {
|
|
9999
10024
|
const { getQuizTitle } = useQuizStore();
|
|
10000
10025
|
const quizTitle = getQuizTitle();
|
|
10001
10026
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
@@ -10008,7 +10033,7 @@ var QuizResultTitle = (0, import_react28.forwardRef)(({ className, ...props }, r
|
|
|
10008
10033
|
}
|
|
10009
10034
|
);
|
|
10010
10035
|
});
|
|
10011
|
-
var QuizResultPerformance = (0,
|
|
10036
|
+
var QuizResultPerformance = (0, import_react29.forwardRef)(
|
|
10012
10037
|
({ ...props }, ref) => {
|
|
10013
10038
|
const {
|
|
10014
10039
|
getTotalQuestions,
|
|
@@ -10133,7 +10158,7 @@ var QuizResultPerformance = (0, import_react28.forwardRef)(
|
|
|
10133
10158
|
);
|
|
10134
10159
|
}
|
|
10135
10160
|
);
|
|
10136
|
-
var QuizListResult = (0,
|
|
10161
|
+
var QuizListResult = (0, import_react29.forwardRef)(({ className, onSubjectClick, ...props }, ref) => {
|
|
10137
10162
|
const { getQuestionsGroupedBySubject } = useQuizStore();
|
|
10138
10163
|
const groupedQuestions = getQuestionsGroupedBySubject();
|
|
10139
10164
|
const subjectsStats = Object.entries(groupedQuestions).map(
|
|
@@ -10216,9 +10241,9 @@ var QuizListResultByMateria = ({
|
|
|
10216
10241
|
};
|
|
10217
10242
|
|
|
10218
10243
|
// src/components/LoadingModal/loadingModal.tsx
|
|
10219
|
-
var
|
|
10244
|
+
var import_react30 = require("react");
|
|
10220
10245
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
10221
|
-
var LoadingModal = (0,
|
|
10246
|
+
var LoadingModal = (0, import_react30.forwardRef)(
|
|
10222
10247
|
({ open, title = "Titulo...", subtitle = "Subtitulo...", ...props }, ref) => {
|
|
10223
10248
|
if (!open) return null;
|
|
10224
10249
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
@@ -10272,7 +10297,7 @@ var loadingModal_default = LoadingModal;
|
|
|
10272
10297
|
|
|
10273
10298
|
// src/components/NotificationCard/NotificationCard.tsx
|
|
10274
10299
|
var import_phosphor_react21 = require("phosphor-react");
|
|
10275
|
-
var
|
|
10300
|
+
var import_react31 = require("react");
|
|
10276
10301
|
|
|
10277
10302
|
// src/store/notificationStore.ts
|
|
10278
10303
|
var import_zustand8 = require("zustand");
|
|
@@ -10711,7 +10736,7 @@ var NotificationCenter = ({
|
|
|
10711
10736
|
className
|
|
10712
10737
|
}) => {
|
|
10713
10738
|
const { isMobile } = useMobile();
|
|
10714
|
-
const [isModalOpen, setIsModalOpen] = (0,
|
|
10739
|
+
const [isModalOpen, setIsModalOpen] = (0, import_react31.useState)(false);
|
|
10715
10740
|
const handleMobileClick = () => {
|
|
10716
10741
|
setIsModalOpen(true);
|
|
10717
10742
|
onFetchNotifications?.();
|
|
@@ -10719,7 +10744,7 @@ var NotificationCenter = ({
|
|
|
10719
10744
|
const handleDesktopClick = () => {
|
|
10720
10745
|
onToggleActive?.();
|
|
10721
10746
|
};
|
|
10722
|
-
(0,
|
|
10747
|
+
(0, import_react31.useEffect)(() => {
|
|
10723
10748
|
if (isActive) {
|
|
10724
10749
|
onFetchNotifications?.();
|
|
10725
10750
|
}
|
|
@@ -10905,7 +10930,7 @@ var createUseNotificationStore = (apiClient) => {
|
|
|
10905
10930
|
};
|
|
10906
10931
|
|
|
10907
10932
|
// src/hooks/useNotifications.ts
|
|
10908
|
-
var
|
|
10933
|
+
var import_react32 = require("react");
|
|
10909
10934
|
var createUseNotifications = (apiClient) => {
|
|
10910
10935
|
const useNotificationStore = createUseNotificationStore(apiClient);
|
|
10911
10936
|
return () => {
|
|
@@ -10924,8 +10949,8 @@ var createUseNotifications = (apiClient) => {
|
|
|
10924
10949
|
resetError,
|
|
10925
10950
|
getGroupedNotifications
|
|
10926
10951
|
} = useNotificationStore();
|
|
10927
|
-
const handleNavigate = (0,
|
|
10928
|
-
(entityType, entityId) => {
|
|
10952
|
+
const handleNavigate = (0, import_react32.useCallback)(
|
|
10953
|
+
(entityType, entityId, onAfterNavigate) => {
|
|
10929
10954
|
if (entityType && entityId) {
|
|
10930
10955
|
switch (entityType.toUpperCase()) {
|
|
10931
10956
|
case "ACTIVITY" /* ACTIVITY */:
|
|
@@ -10937,11 +10962,12 @@ var createUseNotifications = (apiClient) => {
|
|
|
10937
10962
|
default:
|
|
10938
10963
|
break;
|
|
10939
10964
|
}
|
|
10965
|
+
onAfterNavigate?.();
|
|
10940
10966
|
}
|
|
10941
10967
|
},
|
|
10942
10968
|
[]
|
|
10943
10969
|
);
|
|
10944
|
-
const getActionLabel = (0,
|
|
10970
|
+
const getActionLabel = (0, import_react32.useCallback)(
|
|
10945
10971
|
(entityType) => {
|
|
10946
10972
|
if (!entityType) return void 0;
|
|
10947
10973
|
switch (entityType.toUpperCase()) {
|
|
@@ -10955,20 +10981,20 @@ var createUseNotifications = (apiClient) => {
|
|
|
10955
10981
|
},
|
|
10956
10982
|
[]
|
|
10957
10983
|
);
|
|
10958
|
-
const markAsReadAndNavigate = (0,
|
|
10959
|
-
async (id, entityType, entityId) => {
|
|
10984
|
+
const markAsReadAndNavigate = (0, import_react32.useCallback)(
|
|
10985
|
+
async (id, entityType, entityId, onAfterNavigate) => {
|
|
10960
10986
|
await markAsRead(id);
|
|
10961
10987
|
if (entityType && entityId) {
|
|
10962
|
-
handleNavigate(entityType, entityId);
|
|
10988
|
+
handleNavigate(entityType, entityId, onAfterNavigate);
|
|
10963
10989
|
}
|
|
10964
10990
|
},
|
|
10965
10991
|
[markAsRead, handleNavigate]
|
|
10966
10992
|
);
|
|
10967
|
-
const refreshNotifications = (0,
|
|
10993
|
+
const refreshNotifications = (0, import_react32.useCallback)(async () => {
|
|
10968
10994
|
resetError();
|
|
10969
10995
|
await fetchNotifications();
|
|
10970
10996
|
}, [resetError, fetchNotifications]);
|
|
10971
|
-
const formatNotification = (0,
|
|
10997
|
+
const formatNotification = (0, import_react32.useCallback)(
|
|
10972
10998
|
(notification) => ({
|
|
10973
10999
|
...notification,
|
|
10974
11000
|
time: formatTimeAgo(notification.createdAt),
|
|
@@ -10977,7 +11003,7 @@ var createUseNotifications = (apiClient) => {
|
|
|
10977
11003
|
}),
|
|
10978
11004
|
[]
|
|
10979
11005
|
);
|
|
10980
|
-
const getFormattedGroupedNotifications = (0,
|
|
11006
|
+
const getFormattedGroupedNotifications = (0, import_react32.useCallback)(() => {
|
|
10981
11007
|
const groups = getGroupedNotifications();
|
|
10982
11008
|
return groups.map((group) => ({
|
|
10983
11009
|
...group,
|
|
@@ -11132,6 +11158,7 @@ var createNotificationsHook = (apiClient) => {
|
|
|
11132
11158
|
useMobile,
|
|
11133
11159
|
useQuizStore,
|
|
11134
11160
|
useRouteAuth,
|
|
11161
|
+
useTheme,
|
|
11135
11162
|
useToastStore,
|
|
11136
11163
|
useUrlAuthentication,
|
|
11137
11164
|
withAuth
|