fansunited-frontend-components 0.0.1-RC4 → 0.0.1-RC5
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/{components.js → classic-quiz-play.es.js} +1 -1
- package/classic-quiz-play.umd.js +174 -0
- package/index.d.ts +3 -0
- package/package.json +2 -2
- package/src/components/ClassicQuizNotFound.d.ts +4 -0
- package/src/components/ClassicQuizNotFound.d.ts.map +1 -0
- package/src/components/ClassicQuizNotFound.js +55 -0
- package/src/components/ClassicQuizPlay.d.ts +5 -0
- package/src/components/ClassicQuizPlay.d.ts.map +1 -0
- package/src/components/ClassicQuizPlay.js +321 -0
- package/src/components/Leads/CollectLead.d.ts +22 -0
- package/src/components/Leads/CollectLead.d.ts.map +1 -0
- package/src/components/Leads/CollectLead.js +20 -0
- package/src/components/Leads/LeadAgreementCheckbox.d.ts +10 -0
- package/src/components/Leads/LeadAgreementCheckbox.d.ts.map +1 -0
- package/src/components/Leads/LeadAgreementCheckbox.js +45 -0
- package/src/components/Leads/LeadForm.d.ts +20 -0
- package/src/components/Leads/LeadForm.d.ts.map +1 -0
- package/src/components/Leads/LeadForm.js +289 -0
- package/src/components/Shared/AlertMessage.d.ts +10 -0
- package/src/components/Shared/AlertMessage.d.ts.map +1 -0
- package/src/components/Shared/AlertMessage.js +37 -0
- package/src/components/Shared/Answers/Answers.d.ts +14 -0
- package/src/components/Shared/Answers/Answers.d.ts.map +1 -0
- package/src/components/Shared/Answers/Answers.js +31 -0
- package/src/components/Shared/Answers/Option.d.ts +13 -0
- package/src/components/Shared/Answers/Option.d.ts.map +1 -0
- package/src/components/Shared/Answers/Option.js +118 -0
- package/src/components/Shared/Button.d.ts +12 -0
- package/src/components/Shared/Button.d.ts.map +1 -0
- package/src/components/Shared/Button.js +43 -0
- package/src/components/Shared/MainCard.d.ts +10 -0
- package/src/components/Shared/MainCard.d.ts.map +1 -0
- package/src/components/Shared/MainCard.js +24 -0
- package/src/components/Shared/Pagination.d.ts +10 -0
- package/src/components/Shared/Pagination.d.ts.map +1 -0
- package/src/components/Shared/Pagination.js +118 -0
- package/src/components/Shared/PresentedBy.d.ts +8 -0
- package/src/components/Shared/PresentedBy.d.ts.map +1 -0
- package/src/components/Shared/PresentedBy.js +51 -0
- package/src/components/Shared/ScoreStateWrapper.d.ts +13 -0
- package/src/components/Shared/ScoreStateWrapper.d.ts.map +1 -0
- package/src/components/Shared/ScoreStateWrapper.js +254 -0
- package/src/components/Shared/Stepper.d.ts +11 -0
- package/src/components/Shared/Stepper.d.ts.map +1 -0
- package/src/components/Shared/Stepper.js +75 -0
- package/src/components/Shared/Stopwatch.d.ts +12 -0
- package/src/components/Shared/Stopwatch.d.ts.map +1 -0
- package/src/components/Shared/Stopwatch.js +103 -0
- package/src/components/Variants/Overlay/AuthError/OverlayAuthError.d.ts +8 -0
- package/src/components/Variants/Overlay/AuthError/OverlayAuthError.d.ts.map +1 -0
- package/src/components/Variants/Overlay/AuthError/OverlayAuthError.js +68 -0
- package/src/components/Variants/Overlay/AuthError/OverlayAuthError.styles.d.ts +118 -0
- package/src/components/Variants/Overlay/AuthError/OverlayAuthError.styles.d.ts.map +1 -0
- package/src/components/Variants/Overlay/AuthError/OverlayAuthError.styles.js +103 -0
- package/src/components/Variants/Overlay/OverlayVariant.d.ts +5 -0
- package/src/components/Variants/Overlay/OverlayVariant.d.ts.map +1 -0
- package/src/components/Variants/Overlay/OverlayVariant.js +100 -0
- package/src/components/Variants/Overlay/OverlayVariant.styles.d.ts +286 -0
- package/src/components/Variants/Overlay/OverlayVariant.styles.d.ts.map +1 -0
- package/src/components/Variants/Overlay/OverlayVariant.styles.js +266 -0
- package/src/components/Variants/Overlay/ScoreState/OverlayScoreState.d.ts +16 -0
- package/src/components/Variants/Overlay/ScoreState/OverlayScoreState.d.ts.map +1 -0
- package/src/components/Variants/Overlay/ScoreState/OverlayScoreState.js +90 -0
- package/src/components/Variants/Overlay/ScoreState/OverlayScoreState.styles.d.ts +364 -0
- package/src/components/Variants/Overlay/ScoreState/OverlayScoreState.styles.d.ts.map +1 -0
- package/src/components/Variants/Overlay/ScoreState/OverlayScoreState.styles.js +374 -0
- package/src/components/Variants/Split/AuthError/SplitAuthError.d.ts +8 -0
- package/src/components/Variants/Split/AuthError/SplitAuthError.d.ts.map +1 -0
- package/src/components/Variants/Split/AuthError/SplitAuthError.js +44 -0
- package/src/components/Variants/Split/AuthError/SplitAuthError.styles.d.ts +126 -0
- package/src/components/Variants/Split/AuthError/SplitAuthError.styles.d.ts.map +1 -0
- package/src/components/Variants/Split/AuthError/SplitAuthError.styles.js +95 -0
- package/src/components/Variants/Split/ScoreState/SplitScoreState.d.ts +16 -0
- package/src/components/Variants/Split/ScoreState/SplitScoreState.d.ts.map +1 -0
- package/src/components/Variants/Split/ScoreState/SplitScoreState.js +84 -0
- package/src/components/Variants/Split/ScoreState/SplitScoreState.styles.d.ts +403 -0
- package/src/components/Variants/Split/ScoreState/SplitScoreState.styles.d.ts.map +1 -0
- package/src/components/Variants/Split/ScoreState/SplitScoreState.styles.js +400 -0
- package/src/components/Variants/Split/SplitVariant.d.ts +5 -0
- package/src/components/Variants/Split/SplitVariant.d.ts.map +1 -0
- package/src/components/Variants/Split/SplitVariant.js +79 -0
- package/src/components/Variants/Split/SplitVariant.styles.d.ts +252 -0
- package/src/components/Variants/Split/SplitVariant.styles.d.ts.map +1 -0
- package/src/components/Variants/Split/SplitVariant.styles.js +216 -0
- package/src/components/Variants/Standard/AuthError/StandardAuthError.d.ts +9 -0
- package/src/components/Variants/Standard/AuthError/StandardAuthError.d.ts.map +1 -0
- package/src/components/Variants/Standard/AuthError/StandardAuthError.js +43 -0
- package/src/components/Variants/Standard/AuthError/StandardAuthError.styles.d.ts +231 -0
- package/src/components/Variants/Standard/AuthError/StandardAuthError.styles.d.ts.map +1 -0
- package/src/components/Variants/Standard/AuthError/StandardAuthError.styles.js +201 -0
- package/src/components/Variants/Standard/ScoreState/StandardScoreState.d.ts +17 -0
- package/src/components/Variants/Standard/ScoreState/StandardScoreState.d.ts.map +1 -0
- package/src/components/Variants/Standard/ScoreState/StandardScoreState.js +78 -0
- package/src/components/Variants/Standard/ScoreState/StandardScoreState.styles.d.ts +350 -0
- package/src/components/Variants/Standard/ScoreState/StandardScoreState.styles.d.ts.map +1 -0
- package/src/components/Variants/Standard/ScoreState/StandardScoreState.styles.js +349 -0
- package/src/components/Variants/Standard/StandardVariant.d.ts +10 -0
- package/src/components/Variants/Standard/StandardVariant.d.ts.map +1 -0
- package/src/components/Variants/Standard/StandardVariant.js +82 -0
- package/src/components/Variants/Standard/StandardVariant.styles.d.ts +414 -0
- package/src/components/Variants/Standard/StandardVariant.styles.d.ts.map +1 -0
- package/src/components/Variants/Standard/StandardVariant.styles.js +373 -0
- package/src/constants/constants.d.ts +7 -0
- package/src/constants/constants.d.ts.map +1 -0
- package/src/constants/constants.js +446 -0
- package/src/hooks/useClassicQuizById.d.ts +3 -0
- package/src/hooks/useClassicQuizById.d.ts.map +1 -0
- package/src/hooks/useClassicQuizById.js +20 -0
- package/src/hooks/useEmbedCodeContainer.d.ts +2 -0
- package/src/hooks/useEmbedCodeContainer.d.ts.map +1 -0
- package/src/hooks/useEmbedCodeContainer.js +38 -0
- package/src/hooks/useMyParticipation.d.ts +3 -0
- package/src/hooks/useMyParticipation.d.ts.map +1 -0
- package/src/hooks/useMyParticipation.js +22 -0
- package/src/hooks/useScoreStateHelpers.d.ts +18 -0
- package/src/hooks/useScoreStateHelpers.d.ts.map +1 -0
- package/src/hooks/useScoreStateHelpers.js +156 -0
- package/src/index.d.ts +2 -3
- package/src/index.d.ts.map +1 -1
- package/src/index.js +2 -0
- package/src/main.d.ts +5 -0
- package/src/main.d.ts.map +1 -0
- package/src/main.js +53 -0
- package/src/services/service.d.ts +1 -0
- package/src/services/service.d.ts.map +1 -0
- package/src/services/service.js +1 -0
- package/src/styles/form.styles.d.ts +19 -0
- package/src/styles/form.styles.d.ts.map +1 -0
- package/src/styles/form.styles.js +18 -0
- package/src/types/types.d.ts +28 -0
- package/src/types/types.d.ts.map +1 -0
- package/src/types/types.js +1 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/components.d.ts +0 -1
- package/src/indexUmd.d.ts +0 -2
- package/src/indexUmd.d.ts.map +0 -1
- package/vite.config.d.ts +0 -3
- package/vite.config.d.ts.map +0 -1
- package/vite.config.umd.d.ts +0 -3
- package/vite.config.umd.d.ts.map +0 -1
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Typography } from "@mui/joy";
|
|
3
|
+
import { useInternalTheme } from "@fansunited/common";
|
|
4
|
+
import CheckIcon from "@mui/icons-material/Check";
|
|
5
|
+
import CloseIcon from "@mui/icons-material/Close";
|
|
6
|
+
const Pagination = (props) => {
|
|
7
|
+
const renderSteps = () => {
|
|
8
|
+
const theme = useInternalTheme();
|
|
9
|
+
const borderRadius = theme.customRadius.light.full;
|
|
10
|
+
const fontFamilySecondary = theme.customFontFamily.light.secondary;
|
|
11
|
+
const totalQuestions = props.classicQuiz.questionsCount;
|
|
12
|
+
// Create an array of step indicators
|
|
13
|
+
return Array.from({ length: totalQuestions }, (_, index) => {
|
|
14
|
+
const questionNumber = index + 1;
|
|
15
|
+
// Determine the background, border colors and textColor based on question status
|
|
16
|
+
let backgroundColor, borderColor;
|
|
17
|
+
let textColor = "#FFFFFF";
|
|
18
|
+
if (questionNumber < props.currentQuestion) {
|
|
19
|
+
// This question has been answered
|
|
20
|
+
const questionParticipation = props.userParticipation.find((p) => p.questionId === props.classicQuiz.questions[index].questionId);
|
|
21
|
+
if (questionParticipation) {
|
|
22
|
+
// Find if the selected option was correct
|
|
23
|
+
const question = props.classicQuiz.questions[index];
|
|
24
|
+
const selectedOption = question.options.find((option) => option.optionId === questionParticipation.optionId);
|
|
25
|
+
if (selectedOption?.correct) {
|
|
26
|
+
// Correct answer
|
|
27
|
+
backgroundColor =
|
|
28
|
+
theme.colorSchemes.light.palette.success.plainColor;
|
|
29
|
+
borderColor =
|
|
30
|
+
theme.colorSchemes.light.palette.success.outlinedBorder;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
// Incorrect answer
|
|
34
|
+
backgroundColor =
|
|
35
|
+
theme.colorSchemes.light.palette.danger.plainColor;
|
|
36
|
+
borderColor =
|
|
37
|
+
theme.colorSchemes.light.palette.danger.outlinedBorder;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
// Fallback if participation data is missing
|
|
42
|
+
backgroundColor = theme.colorSchemes.light.secondaryContainer;
|
|
43
|
+
borderColor = theme.colorSchemes.light.secondaryContainer;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else if (questionNumber === props.currentQuestion) {
|
|
47
|
+
// Current question - use primary color
|
|
48
|
+
backgroundColor = theme.colorSchemes.light.palette.primary.plainColor;
|
|
49
|
+
borderColor = theme.colorSchemes.light.palette.primary.outlinedBorder;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
// Future questions - use neutral/secondary color
|
|
53
|
+
// backgroundColor = theme.colorSchemes?.light?.secondaryContainer;
|
|
54
|
+
// borderColor = theme.colorSchemes?.light?.outlineEnabledBorder;
|
|
55
|
+
backgroundColor = "transparent";
|
|
56
|
+
borderColor = "transparent";
|
|
57
|
+
textColor =
|
|
58
|
+
theme.colorSchemes.light.palette.primary.plainColor || "#1A77D2";
|
|
59
|
+
}
|
|
60
|
+
// Determine what to display inside the circle
|
|
61
|
+
let content;
|
|
62
|
+
if (questionNumber < props.currentQuestion) {
|
|
63
|
+
const questionParticipation = props.userParticipation.find((p) => p.questionId === props.classicQuiz.questions[index].questionId);
|
|
64
|
+
if (questionParticipation) {
|
|
65
|
+
const question = props.classicQuiz.questions[index];
|
|
66
|
+
const selectedOption = question.options.find((option) => option.optionId === questionParticipation.optionId);
|
|
67
|
+
if (selectedOption?.correct) {
|
|
68
|
+
// Show checkmark for correct answer
|
|
69
|
+
content = (_jsx(CheckIcon, { sx: {
|
|
70
|
+
color: "#FAFAFA",
|
|
71
|
+
fontSize: "1rem",
|
|
72
|
+
} }));
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
// Show X for incorrect answer
|
|
76
|
+
content = (_jsx(CloseIcon, { sx: {
|
|
77
|
+
color: "#FAFAFA",
|
|
78
|
+
fontSize: "1rem",
|
|
79
|
+
} }));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
// Fallback
|
|
84
|
+
content = questionNumber;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
// For current and future questions, show the question number
|
|
89
|
+
content = questionNumber;
|
|
90
|
+
}
|
|
91
|
+
return (_jsx(Box, { sx: {
|
|
92
|
+
maxWidth: "40px",
|
|
93
|
+
width: "100%",
|
|
94
|
+
height: "40px",
|
|
95
|
+
borderRadius,
|
|
96
|
+
backgroundColor,
|
|
97
|
+
border: `1px solid ${borderColor}`,
|
|
98
|
+
transition: "background-color 0.3s ease",
|
|
99
|
+
display: "flex",
|
|
100
|
+
alignItems: "center",
|
|
101
|
+
justifyContent: "center",
|
|
102
|
+
fontFamily: fontFamilySecondary,
|
|
103
|
+
}, children: typeof content === "number" ? (_jsx(Typography, { level: "body-md", sx: {
|
|
104
|
+
fontWeight: 400,
|
|
105
|
+
lineHeight: "150%",
|
|
106
|
+
letterSpacing: "0.15px",
|
|
107
|
+
fontSize: "1rem",
|
|
108
|
+
color: textColor,
|
|
109
|
+
}, children: content })) : (content) }, `step-${questionNumber}`));
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
return (_jsx(Box, { sx: {
|
|
113
|
+
display: "flex",
|
|
114
|
+
justifyContent: "center",
|
|
115
|
+
gap: "8px",
|
|
116
|
+
}, children: renderSteps() }));
|
|
117
|
+
};
|
|
118
|
+
export default Pagination;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PresentedBy.d.ts","sourceRoot":"","sources":["../../../../src/components/Shared/PresentedBy.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,KAAK,gBAAgB,GAAG;IACtB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B,CAAC;AAEF,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAgF3C,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Typography } from "@mui/joy";
|
|
3
|
+
import { useTranslation } from "react-i18next";
|
|
4
|
+
import { isMobile, useFontFamily } from "@fansunited/common/functions/theme";
|
|
5
|
+
const PresentedBy = (props) => {
|
|
6
|
+
const { t } = useTranslation();
|
|
7
|
+
const fontFamilySecondary = useFontFamily().secondary;
|
|
8
|
+
const label = t("common.presentedBy");
|
|
9
|
+
if (!props.brandingLogo) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
if (isMobile()) {
|
|
13
|
+
return (_jsxs(Box, { sx: {
|
|
14
|
+
display: "flex",
|
|
15
|
+
flexDirection: "column",
|
|
16
|
+
gap: "8px",
|
|
17
|
+
alignItems: "center",
|
|
18
|
+
minWidth: "180px",
|
|
19
|
+
}, children: [_jsx(Typography, { level: "body-sm", sx: {
|
|
20
|
+
fontWeight: 400,
|
|
21
|
+
lineHeight: "166%",
|
|
22
|
+
letterSpacing: "0.4px",
|
|
23
|
+
fontSize: "0.75rem",
|
|
24
|
+
color: props.textColor,
|
|
25
|
+
textAlign: "right",
|
|
26
|
+
fontFamily: fontFamilySecondary,
|
|
27
|
+
}, children: label }), _jsx("img", { src: props.brandingLogo, alt: "branding-logo", style: {
|
|
28
|
+
maxHeight: "50px",
|
|
29
|
+
maxWidth: "100px",
|
|
30
|
+
} })] }));
|
|
31
|
+
}
|
|
32
|
+
return (_jsxs(Box, { sx: {
|
|
33
|
+
minWidth: "180px",
|
|
34
|
+
display: "flex",
|
|
35
|
+
gap: "8px",
|
|
36
|
+
alignItems: "center",
|
|
37
|
+
zIndex: 10,
|
|
38
|
+
}, children: [_jsx(Typography, { level: "body-sm", sx: {
|
|
39
|
+
fontWeight: 400,
|
|
40
|
+
lineHeight: "166%",
|
|
41
|
+
letterSpacing: "0.4px",
|
|
42
|
+
textAlign: "right",
|
|
43
|
+
fontSize: "0.75rem",
|
|
44
|
+
color: props.textColor,
|
|
45
|
+
fontFamily: fontFamilySecondary,
|
|
46
|
+
}, children: t("common.presentedBy") }), _jsx("img", { src: props.brandingLogo, alt: "branding-logo", style: {
|
|
47
|
+
maxHeight: "50px",
|
|
48
|
+
maxWidth: "100px",
|
|
49
|
+
} })] }));
|
|
50
|
+
};
|
|
51
|
+
export default PresentedBy;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from "react";
|
|
2
|
+
import { BrandingColorsModel, ClassicQuizParticipationQuestionModel, ClassicQuizQuestionModel } from "fansunited-sdk-esm";
|
|
3
|
+
import { SxProps } from "@mui/material";
|
|
4
|
+
type ScoreStateWrapperProps = {
|
|
5
|
+
questions: ClassicQuizQuestionModel[];
|
|
6
|
+
userParticipation: ClassicQuizParticipationQuestionModel[];
|
|
7
|
+
resultsTabPanelSxProps?: SxProps;
|
|
8
|
+
isOverlayVariant?: boolean;
|
|
9
|
+
brandingColors?: BrandingColorsModel;
|
|
10
|
+
};
|
|
11
|
+
declare const ScoreStateWrapper: React.FC<ScoreStateWrapperProps & PropsWithChildren>;
|
|
12
|
+
export default ScoreStateWrapper;
|
|
13
|
+
//# sourceMappingURL=ScoreStateWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScoreStateWrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/Shared/ScoreStateWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAcjD,OAAO,EACL,mBAAmB,EACnB,qCAAqC,EACrC,wBAAwB,EACzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AASxC,KAAK,sBAAsB,GAAG;IAC5B,SAAS,EAAE,wBAAwB,EAAE,CAAC;IACtC,iBAAiB,EAAE,qCAAqC,EAAE,CAAC;IAC3D,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE,mBAAmB,CAAC;CACtC,CAAC;AAEF,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAC/B,sBAAsB,GAAG,iBAAiB,CA2Z3C,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Box, Tabs, TabList, Tab, TabPanel, Typography, tabClasses, } from "@mui/joy";
|
|
4
|
+
import { useInternalTheme, stripHtmlTags } from "@fansunited/common";
|
|
5
|
+
import school from "../../assets/school.svg";
|
|
6
|
+
import sportsScore from "../../assets/sports_score.svg";
|
|
7
|
+
import info from "../../assets/info.svg";
|
|
8
|
+
import { useColors, useCornerRadius, useFontFamily, useSpacingScale, } from "@fansunited/common/functions/theme";
|
|
9
|
+
import { useTranslation } from "react-i18next";
|
|
10
|
+
const ScoreStateWrapper = ({ questions, userParticipation, resultsTabPanelSxProps, isOverlayVariant, children, brandingColors, }) => {
|
|
11
|
+
const [activeTab, setActiveTab] = React.useState(0);
|
|
12
|
+
const theme = useInternalTheme();
|
|
13
|
+
const { t } = useTranslation();
|
|
14
|
+
const mdBorderRadius = useCornerRadius().md;
|
|
15
|
+
const colorTextPrimary = isOverlayVariant
|
|
16
|
+
? theme.colorSchemes.dark.textPrimary
|
|
17
|
+
: useColors().textPrimary;
|
|
18
|
+
const colorTextSecondary = isOverlayVariant
|
|
19
|
+
? theme.colorSchemes.dark.textSecondary
|
|
20
|
+
: useColors().textSecondary;
|
|
21
|
+
const fontFamilyPrimary = useFontFamily().primary;
|
|
22
|
+
const fontFamilySecondary = useFontFamily().secondary;
|
|
23
|
+
const borderBottomColor = isOverlayVariant
|
|
24
|
+
? theme.colorSchemes.dark.secondaryContainer
|
|
25
|
+
: useColors().secondaryContainer;
|
|
26
|
+
const contentBgColor = brandingColors?.backgroundColor || isOverlayVariant
|
|
27
|
+
? theme.colorSchemes.dark.surfaceVariant
|
|
28
|
+
: useColors().surfaceVariant;
|
|
29
|
+
const spacingScale = useSpacingScale();
|
|
30
|
+
const successColor = useColors().palette.success.plainColor;
|
|
31
|
+
const dangerColor = useColors().palette.danger.plainColor;
|
|
32
|
+
let primaryColor = isOverlayVariant
|
|
33
|
+
? theme.colorSchemes.dark.textPrimary
|
|
34
|
+
: useColors().textPrimary;
|
|
35
|
+
if (brandingColors?.primaryColor) {
|
|
36
|
+
primaryColor = brandingColors.primaryColor;
|
|
37
|
+
}
|
|
38
|
+
const renderUserAnswer = (participation, index) => {
|
|
39
|
+
const question = questions.find((q) => q.questionId === participation.questionId);
|
|
40
|
+
return (_jsx(Box, { sx: {
|
|
41
|
+
borderRadius: mdBorderRadius,
|
|
42
|
+
p: spacingScale.md,
|
|
43
|
+
display: "flex",
|
|
44
|
+
flexDirection: "column",
|
|
45
|
+
alignItems: "center",
|
|
46
|
+
alignSelf: "stretch",
|
|
47
|
+
gap: spacingScale.md,
|
|
48
|
+
backdropFilter: "blur(4px)",
|
|
49
|
+
position: "relative",
|
|
50
|
+
"&::before": {
|
|
51
|
+
content: '""',
|
|
52
|
+
position: "absolute",
|
|
53
|
+
top: 0,
|
|
54
|
+
left: 0,
|
|
55
|
+
right: 0,
|
|
56
|
+
bottom: 0,
|
|
57
|
+
backgroundColor: contentBgColor,
|
|
58
|
+
opacity: 0.5,
|
|
59
|
+
borderRadius: "inherit",
|
|
60
|
+
zIndex: 0,
|
|
61
|
+
backdropFilter: "blur(4px)",
|
|
62
|
+
},
|
|
63
|
+
"& > *": {
|
|
64
|
+
position: "relative",
|
|
65
|
+
zIndex: 1,
|
|
66
|
+
},
|
|
67
|
+
}, children: _jsxs(Box, { sx: {
|
|
68
|
+
display: "flex",
|
|
69
|
+
flexDirection: "column",
|
|
70
|
+
alignItems: "flex-start",
|
|
71
|
+
gap: "12px",
|
|
72
|
+
alignSelf: "stretch",
|
|
73
|
+
}, children: [_jsxs(Box, { sx: {
|
|
74
|
+
display: "flex",
|
|
75
|
+
flexDirection: "column",
|
|
76
|
+
alignItems: "flex-start",
|
|
77
|
+
alignSelf: "stretch",
|
|
78
|
+
}, children: [_jsxs(Typography, { sx: {
|
|
79
|
+
alignSelf: "stretch",
|
|
80
|
+
color: colorTextSecondary,
|
|
81
|
+
fontFamily: fontFamilySecondary,
|
|
82
|
+
fontSize: "0.75rem",
|
|
83
|
+
fontStyle: "normal",
|
|
84
|
+
fontWeight: 500,
|
|
85
|
+
lineHeight: "166%",
|
|
86
|
+
letterSpacing: "1px",
|
|
87
|
+
textTransform: "uppercase",
|
|
88
|
+
}, children: [t("classicQuiz.question"), " ", index + 1] }), _jsx(Typography, { sx: {
|
|
89
|
+
alignSelf: "stretch",
|
|
90
|
+
color: colorTextPrimary,
|
|
91
|
+
fontFamily: fontFamilyPrimary,
|
|
92
|
+
fontSize: "1.25rem",
|
|
93
|
+
fontStyle: "normal",
|
|
94
|
+
fontWeight: 500,
|
|
95
|
+
lineHeight: "120%",
|
|
96
|
+
letterSpacing: "0.15px",
|
|
97
|
+
}, children: question?.question })] }), _jsx(Box, { sx: { alignSelf: "stretch" }, children: participation.correct ? (_jsxs(Typography, { sx: {
|
|
98
|
+
color: isOverlayVariant
|
|
99
|
+
? theme.colorSchemes.dark.palette.success.plainColor
|
|
100
|
+
: successColor,
|
|
101
|
+
fontFamily: fontFamilySecondary,
|
|
102
|
+
fontSize: "1rem",
|
|
103
|
+
fontStyle: "normal",
|
|
104
|
+
fontWeight: 700,
|
|
105
|
+
lineHeight: "20px",
|
|
106
|
+
letterSpacing: "0.15px",
|
|
107
|
+
}, children: [t("classicQuiz.yourAnswer"), " ", question?.options.find((o) => o.optionId === participation.optionId)?.option] })) : (_jsxs(_Fragment, { children: [_jsxs(Typography, { sx: {
|
|
108
|
+
color: isOverlayVariant
|
|
109
|
+
? theme.colorSchemes.dark.palette.danger.plainColor
|
|
110
|
+
: dangerColor,
|
|
111
|
+
fontFamily: fontFamilySecondary,
|
|
112
|
+
fontSize: "1rem",
|
|
113
|
+
fontStyle: "normal",
|
|
114
|
+
fontWeight: 600,
|
|
115
|
+
lineHeight: "20px",
|
|
116
|
+
letterSpacing: "0.15px",
|
|
117
|
+
}, children: [t("classicQuiz.yourAnswer"), " ", question?.options.find((o) => o.optionId === participation.optionId)?.option] }), _jsxs(Typography, { sx: {
|
|
118
|
+
color: colorTextPrimary,
|
|
119
|
+
fontFamily: fontFamilySecondary,
|
|
120
|
+
fontSize: "1rem",
|
|
121
|
+
fontStyle: "normal",
|
|
122
|
+
fontWeight: 600,
|
|
123
|
+
lineHeight: "20px",
|
|
124
|
+
letterSpacing: "0.15px",
|
|
125
|
+
}, children: [t("classicQuiz.correctAnswer"), " ", question?.options.find((o) => o.correct)?.option] })] })) }), question?.explanation ? (_jsxs(Box, { sx: {
|
|
126
|
+
display: "flex",
|
|
127
|
+
py: "4px",
|
|
128
|
+
pr: "16px",
|
|
129
|
+
pl: "0px",
|
|
130
|
+
justifyContent: "center",
|
|
131
|
+
gap: "10px",
|
|
132
|
+
alignItems: "flex-start",
|
|
133
|
+
alignSelf: "stretch",
|
|
134
|
+
}, children: [_jsx("img", { src: info, alt: "explanation-icon", style: {
|
|
135
|
+
display: "flex",
|
|
136
|
+
width: "20px",
|
|
137
|
+
height: "20px",
|
|
138
|
+
justifyContent: "center",
|
|
139
|
+
alignItems: "center",
|
|
140
|
+
filter: isOverlayVariant ? "brightness(0) invert(1)" : "none",
|
|
141
|
+
} }), _jsx(Typography, { sx: {
|
|
142
|
+
flex: "1 0 0",
|
|
143
|
+
color: colorTextPrimary,
|
|
144
|
+
fontFamily: fontFamilySecondary,
|
|
145
|
+
fontSize: "0.875rem",
|
|
146
|
+
fontStyle: "normal",
|
|
147
|
+
fontWeight: 400,
|
|
148
|
+
lineHeight: "143%",
|
|
149
|
+
letterSpacing: "0.17px",
|
|
150
|
+
}, children: stripHtmlTags(question?.explanation) })] })) : (_jsx(_Fragment, {}))] }, `single-answer-${participation.questionId}`) }, `user-answer-${participation.questionId}`));
|
|
151
|
+
};
|
|
152
|
+
return (_jsx(Box, { sx: { width: "100%" }, children: _jsxs(Tabs, { value: activeTab, onChange: (_, value) => setActiveTab(value), sx: {
|
|
153
|
+
borderRadius: mdBorderRadius,
|
|
154
|
+
width: "100%", // Ensure tabs container takes full width
|
|
155
|
+
backgroundColor: "transparent",
|
|
156
|
+
}, children: [_jsxs(TabList, { children: [_jsx(Tab, { sx: {
|
|
157
|
+
display: "flex",
|
|
158
|
+
flexDirection: "column",
|
|
159
|
+
justifyContent: "center",
|
|
160
|
+
alignItems: "center",
|
|
161
|
+
flex: 1, // Make each tab take equal width
|
|
162
|
+
borderBottom: "1px solid " + borderBottomColor,
|
|
163
|
+
opacity: "60%",
|
|
164
|
+
"&:not(.Mui-selected):hover": {
|
|
165
|
+
bgcolor: isOverlayVariant ? "#FAFAFA14" : "#2121210A", // Highlight selected tab
|
|
166
|
+
},
|
|
167
|
+
[`&.${tabClasses.selected}`]: {
|
|
168
|
+
bgcolor: isOverlayVariant ? "#FAFAFA14" : "#2121210A", // Highlight selected tab
|
|
169
|
+
borderBottom: "3px solid " + primaryColor,
|
|
170
|
+
opacity: "100%",
|
|
171
|
+
mb: "-1px",
|
|
172
|
+
},
|
|
173
|
+
}, disableIndicator: true, children: _jsxs(Box, { sx: {
|
|
174
|
+
display: "flex",
|
|
175
|
+
py: "12px",
|
|
176
|
+
px: "16px",
|
|
177
|
+
justifyContent: "center",
|
|
178
|
+
alignItems: "center",
|
|
179
|
+
gap: "8px",
|
|
180
|
+
width: "100%", // Ensure inner box also takes full width
|
|
181
|
+
}, children: [_jsx("img", { src: sportsScore, alt: "answers-icon", style: {
|
|
182
|
+
display: "flex",
|
|
183
|
+
width: "24px",
|
|
184
|
+
height: "24px",
|
|
185
|
+
justifyContent: "center",
|
|
186
|
+
alignItems: "center",
|
|
187
|
+
filter: isOverlayVariant || theme.mode == "dark"
|
|
188
|
+
? "brightness(0) invert(1)"
|
|
189
|
+
: "none",
|
|
190
|
+
} }), _jsx(Typography, { sx: {
|
|
191
|
+
color: colorTextSecondary,
|
|
192
|
+
fontFamily: fontFamilyPrimary,
|
|
193
|
+
fontSize: "0.875rem",
|
|
194
|
+
fontStyle: "normal",
|
|
195
|
+
fontWeight: 500,
|
|
196
|
+
lineHeight: "24px",
|
|
197
|
+
letterSpacing: "0.4px",
|
|
198
|
+
textTransform: "uppercase",
|
|
199
|
+
}, children: t("classicQuiz.results") })] }) }), _jsx(Tab, { sx: {
|
|
200
|
+
display: "flex",
|
|
201
|
+
flexDirection: "column",
|
|
202
|
+
justifyContent: "center",
|
|
203
|
+
alignItems: "center",
|
|
204
|
+
flex: 1, // Make each tab take equal width
|
|
205
|
+
borderBottom: "1px solid " + borderBottomColor,
|
|
206
|
+
opacity: "60%",
|
|
207
|
+
"&:not(.Mui-selected):hover": {
|
|
208
|
+
bgcolor: isOverlayVariant ? "#FAFAFA14" : "#2121210A", // Highlight selected tab
|
|
209
|
+
},
|
|
210
|
+
[`&.${tabClasses.selected}`]: {
|
|
211
|
+
bgcolor: isOverlayVariant ? "#FAFAFA14" : "#2121210A", // Highlight selected tab
|
|
212
|
+
borderBottom: "3px solid " + primaryColor,
|
|
213
|
+
opacity: "100%",
|
|
214
|
+
mb: "-1px",
|
|
215
|
+
},
|
|
216
|
+
}, disableIndicator: true, children: _jsxs(Box, { sx: {
|
|
217
|
+
display: "flex",
|
|
218
|
+
py: "12px",
|
|
219
|
+
px: "16px",
|
|
220
|
+
justifyContent: "center",
|
|
221
|
+
alignItems: "center",
|
|
222
|
+
gap: "8px",
|
|
223
|
+
width: "100%", // Ensure inner box also takes full width
|
|
224
|
+
}, children: [_jsx("img", { src: school, alt: "answers-icon", style: {
|
|
225
|
+
display: "flex",
|
|
226
|
+
width: "24px",
|
|
227
|
+
height: "24px",
|
|
228
|
+
justifyContent: "center",
|
|
229
|
+
alignItems: "center",
|
|
230
|
+
filter: isOverlayVariant || theme.mode == "dark"
|
|
231
|
+
? "brightness(0) invert(1)"
|
|
232
|
+
: "none",
|
|
233
|
+
} }), _jsx(Typography, { sx: {
|
|
234
|
+
color: colorTextSecondary,
|
|
235
|
+
fontFamily: fontFamilyPrimary,
|
|
236
|
+
fontSize: "0.875rem",
|
|
237
|
+
fontStyle: "normal",
|
|
238
|
+
fontWeight: 500,
|
|
239
|
+
lineHeight: "24px",
|
|
240
|
+
letterSpacing: "0.4px",
|
|
241
|
+
textTransform: "uppercase",
|
|
242
|
+
}, children: t("classicQuiz.answers") })] }) })] }), _jsx(TabPanel, { value: 0, sx: resultsTabPanelSxProps, children: children }), _jsx(TabPanel, { value: 1, sx: {
|
|
243
|
+
overflowY: "auto",
|
|
244
|
+
maxHeight: { md: "calc(100vh - 450px)" },
|
|
245
|
+
}, children: _jsx(Box, { sx: {
|
|
246
|
+
display: "flex",
|
|
247
|
+
flexDirection: "column",
|
|
248
|
+
justifyContent: "center",
|
|
249
|
+
alignItems: "center",
|
|
250
|
+
gap: "16px",
|
|
251
|
+
alignSelf: "stretch",
|
|
252
|
+
}, children: userParticipation.map((p, i) => renderUserAnswer(p, i)) }) })] }) }));
|
|
253
|
+
};
|
|
254
|
+
export default ScoreStateWrapper;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ClassicQuizFullModel, ClassicQuizParticipationBodyModel } from "fansunited-sdk-esm";
|
|
3
|
+
type StepperProps = {
|
|
4
|
+
classicQuiz: ClassicQuizFullModel;
|
|
5
|
+
currentQuestion: number;
|
|
6
|
+
userParticipation: ClassicQuizParticipationBodyModel[];
|
|
7
|
+
brandingPrimaryColor?: string;
|
|
8
|
+
};
|
|
9
|
+
declare const Stepper: React.FC<StepperProps>;
|
|
10
|
+
export default Stepper;
|
|
11
|
+
//# sourceMappingURL=Stepper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stepper.d.ts","sourceRoot":"","sources":["../../../../src/components/Shared/Stepper.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EACL,oBAAoB,EACpB,iCAAiC,EAClC,MAAM,oBAAoB,CAAC;AAE5B,KAAK,YAAY,GAAG;IAClB,WAAW,EAAE,oBAAoB,CAAC;IAClC,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,iCAAiC,EAAE,CAAC;IACvD,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAwFnC,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from "@mui/joy";
|
|
3
|
+
import { getSpacing } from "@fansunited/common/functions/theme";
|
|
4
|
+
import { useInternalTheme } from "@fansunited/common";
|
|
5
|
+
const Stepper = (props) => {
|
|
6
|
+
const renderSteps = () => {
|
|
7
|
+
const theme = useInternalTheme();
|
|
8
|
+
const borderRadius = theme.customRadius.light.full;
|
|
9
|
+
const totalQuestions = props.classicQuiz.questionsCount;
|
|
10
|
+
// Create an array of step indicators
|
|
11
|
+
return Array.from({ length: totalQuestions }, (_, index) => {
|
|
12
|
+
const questionNumber = index + 1;
|
|
13
|
+
// Determine the background and border colors based on question status
|
|
14
|
+
let backgroundColor, borderColor;
|
|
15
|
+
if (questionNumber < props.currentQuestion) {
|
|
16
|
+
// This question has been answered
|
|
17
|
+
const questionParticipation = props.userParticipation.find((p) => p.questionId === props.classicQuiz.questions[index].questionId);
|
|
18
|
+
if (questionParticipation) {
|
|
19
|
+
// Find if the selected option was correct
|
|
20
|
+
const question = props.classicQuiz.questions[index];
|
|
21
|
+
const selectedOption = question.options.find((option) => option.optionId === questionParticipation.optionId);
|
|
22
|
+
if (selectedOption?.correct) {
|
|
23
|
+
// Correct answer
|
|
24
|
+
backgroundColor =
|
|
25
|
+
theme.colorSchemes.light.palette.success.plainColor;
|
|
26
|
+
borderColor =
|
|
27
|
+
theme.colorSchemes.light.palette.success.outlinedBorder;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
// Incorrect answer
|
|
31
|
+
backgroundColor =
|
|
32
|
+
theme.colorSchemes.light.palette.danger.plainColor;
|
|
33
|
+
borderColor =
|
|
34
|
+
theme.colorSchemes.light.palette.danger.outlinedBorder;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
// Fallback if participation data is missing
|
|
39
|
+
backgroundColor = theme.colorSchemes.light.secondaryContainer;
|
|
40
|
+
borderColor = theme.colorSchemes.light.secondaryContainer;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
else if (questionNumber === props.currentQuestion) {
|
|
44
|
+
// Current question - use primary color
|
|
45
|
+
backgroundColor =
|
|
46
|
+
props.brandingPrimaryColor ||
|
|
47
|
+
theme.colorSchemes.light.palette.primary.plainColor;
|
|
48
|
+
borderColor =
|
|
49
|
+
props.brandingPrimaryColor ||
|
|
50
|
+
theme.colorSchemes.light.palette.primary.outlinedBorder;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
// Future questions - use neutral/secondary color
|
|
54
|
+
backgroundColor = theme.colorSchemes.light.secondaryContainer;
|
|
55
|
+
borderColor = theme.colorSchemes.light.outlineEnabledBorder;
|
|
56
|
+
}
|
|
57
|
+
return (_jsx(Box, { sx: {
|
|
58
|
+
maxWidth: "82.67px",
|
|
59
|
+
width: "100%",
|
|
60
|
+
height: "8px",
|
|
61
|
+
borderRadius,
|
|
62
|
+
backgroundColor,
|
|
63
|
+
border: `1px solid ${borderColor}`,
|
|
64
|
+
transition: "background-color 0.3s ease",
|
|
65
|
+
} }, `step-${questionNumber}`));
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
return (_jsx(Box, { sx: {
|
|
69
|
+
display: "flex",
|
|
70
|
+
justifyContent: "center",
|
|
71
|
+
gap: "8px",
|
|
72
|
+
py: getSpacing("xs"),
|
|
73
|
+
}, children: renderSteps() }));
|
|
74
|
+
};
|
|
75
|
+
export default Stepper;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type StopwatchProps = {
|
|
3
|
+
isRunning: boolean;
|
|
4
|
+
timer: number;
|
|
5
|
+
quizType: string;
|
|
6
|
+
initialTime: number;
|
|
7
|
+
brandingPrimaryColor: string | null;
|
|
8
|
+
onTimeUpdate: (time: number) => void;
|
|
9
|
+
};
|
|
10
|
+
declare const Stopwatch: React.FC<StopwatchProps>;
|
|
11
|
+
export default Stopwatch;
|
|
12
|
+
//# sourceMappingURL=Stopwatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stopwatch.d.ts","sourceRoot":"","sources":["../../../../src/components/Shared/Stopwatch.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiC,MAAM,OAAO,CAAC;AAGtD,KAAK,cAAc,GAAG;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC,CAAC;AAEF,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CA0HvC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|