fix: conflicts resolved

This commit is contained in:
IlyaDoronin 2024-03-06 14:01:52 +03:00
commit 211754fd9d
6 changed files with 44 additions and 36 deletions

@ -28,7 +28,7 @@ type Props = {
export const ContactForm = ({ currentQuestion, onShowResult }: Props) => { export const ContactForm = ({ currentQuestion, onShowResult }: Props) => {
const theme = useTheme(); const theme = useTheme();
const { settings, questions, quizId } = useQuizData(); const { settings, questions, quizId, show_badge } = useQuizData();
const [ready, setReady] = useState(false); const [ready, setReady] = useState(false);
const [name, setName] = useState(""); const [name, setName] = useState("");
@ -275,6 +275,7 @@ export const ContactForm = ({ currentQuestion, onShowResult }: Props) => {
 ознакомлен  ознакомлен
</Typography> </Typography>
</Box> </Box>
{show_badge &&
<Box <Box
component={Link} component={Link}
target={"_blank"} target={"_blank"}
@ -303,6 +304,8 @@ export const ContactForm = ({ currentQuestion, onShowResult }: Props) => {
Сделано на PenaQuiz Сделано на PenaQuiz
</Typography> </Typography>
</Box> </Box>
}
</Box> </Box>
</Box> </Box>
</Box> </Box>

@ -73,7 +73,7 @@ export const Question = ({
prevButton, prevButton,
}: Props) => { }: Props) => {
const theme = useTheme(); const theme = useTheme();
const { settings } = useQuizData(); const { settings, show_badge } = useQuizData();
return ( return (
<Box <Box
@ -113,21 +113,19 @@ export const Question = ({
question={currentQuestion} question={currentQuestion}
stepNumber={currentQuestionStepNumber} stepNumber={currentQuestionStepNumber}
/> />
<Box sx={{ marginLeft: "auto" }}> {show_badge && (
{quizThemes[settings.cfg.theme].isLight ? ( <Link target="_blank" href="https://quiz.pena.digital">
<Link target={"_blank"} href={"https://quiz.pena.digital"}> {quizThemes[settings.cfg.theme].isLight ? (
<NameplateLogoFQ <NameplateLogoFQ
style={{ fontSize: "34px", width: "200px", height: "auto" }} style={{ fontSize: "34px", width: "200px", height: "auto" }}
/> />
</Link> ) : (
) : (
<Link target={"_blank"} href={"https://quiz.pena.digital"}>
<NameplateLogoFQDark <NameplateLogoFQDark
style={{ fontSize: "34px", width: "200px", height: "auto" }} style={{ fontSize: "34px", width: "200px", height: "auto" }}
/> />
</Link> )}
)} </Link>
</Box> )}
</Box> </Box>
<Footer <Footer
stepNumber={currentQuestionStepNumber} stepNumber={currentQuestionStepNumber}

@ -22,7 +22,7 @@ type ResultFormProps = {
export const ResultForm = ({ resultQuestion }: ResultFormProps) => { export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
const theme = useTheme(); const theme = useTheme();
const isMobile = useRootContainerSize() < 650; const isMobile = useRootContainerSize() < 650;
const { settings } = useQuizData(); const { settings, show_badge } = useQuizData();
const spec = settings.cfg.spec const spec = settings.cfg.spec
return ( return (
@ -125,6 +125,7 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
px: "20px", px: "20px",
}} }}
> >
{show_badge &&
<Box <Box
component={Link} component={Link}
target={"_blank"} target={"_blank"}
@ -135,7 +136,7 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
mt: "15px", mt: "15px",
gap: "10px", gap: "10px",
textDecoration: "none", textDecoration: "none",
mb: "5px" mb: "5px"
}} }}
> >
<NameplateLogo <NameplateLogo
@ -154,6 +155,8 @@ export const ResultForm = ({ resultQuestion }: ResultFormProps) => {
Сделано на PenaQuiz Сделано на PenaQuiz
</Typography> </Typography>
</Box> </Box>
}
</Box> </Box>
<Box <Box

@ -22,6 +22,7 @@ export interface GetQuizDataResponse {
p: number; p: number;
c: string; c: string;
}[]; }[];
show_badge: boolean;
} }
export function parseQuizData(quizDataResponse: GetQuizDataResponse): Omit<QuizSettings, "recentlyCompleted"> { export function parseQuizData(quizDataResponse: GetQuizDataResponse): Omit<QuizSettings, "recentlyCompleted"> {
@ -50,5 +51,5 @@ export function parseQuizData(quizDataResponse: GetQuizDataResponse): Omit<QuizS
pausable: quizDataResponse.settings.pausable pausable: quizDataResponse.settings.pausable
}; };
return { cnt: quizDataResponse.cnt, settings, questions: items }; return { cnt: quizDataResponse.cnt, settings, questions: items, show_badge: quizDataResponse.show_badge };
} }

@ -55,9 +55,9 @@ export type QuizSettings = {
}; };
cnt: number; cnt: number;
recentlyCompleted: boolean; recentlyCompleted: boolean;
show_badge: boolean;
}; };
export interface QuizConfig { export interface QuizConfig {
spec: undefined | true; spec: undefined | true;
type: QuizType; type: QuizType;

@ -7,30 +7,33 @@ import QuizAnswerer from "../lib/components/QuizAnswerer";
import { ApologyPage } from "../lib/components/ViewPublicationPage/ApologyPage"; import { ApologyPage } from "../lib/components/ViewPublicationPage/ApologyPage";
// const defaultQuizId = "45ef7f9c-784d-4e58-badb-f6b337f08ba0"; // branching // const defaultQuizId = "45ef7f9c-784d-4e58-badb-f6b337f08ba0"; // branching
const defaultQuizId = "26f2e98b-06ac-4e6c-b82e-0793e2768310"; //looooong header const defaultQuizId = "cde381db-8ccb-402c-b55f-2c814be9bf25"; //looooong header
// const defaultQuizId = "ad7f5a87-b833-4f5b-854e-453706ed655c"; // linear // const defaultQuizId = "ad7f5a87-b833-4f5b-854e-453706ed655c"; // linear
export default function App() { export default function App() {
const quizId = useParams().quizId ?? defaultQuizId; const quizId = useParams().quizId ?? defaultQuizId;
const { data, error, isLoading } = useSWR(["quizData", quizId], params => getQuizData(params[1]), { const { data, error, isLoading } = useSWR(
revalidateOnFocus: false, ["quizData", quizId],
revalidateOnReconnect: false, (params) => getQuizData(params[1]),
shouldRetryOnError: false, {
refreshInterval: 0, revalidateOnFocus: false,
}); revalidateOnReconnect: false,
shouldRetryOnError: false,
refreshInterval: 0,
}
);
if (isLoading) return <LoadingSkeleton />; if (isLoading) return <LoadingSkeleton />;
if (error) return <ApologyPage error={error} />; if (error) return <ApologyPage error={error} />;
if (!data) throw new Error("Quiz data is null"); if (!data) throw new Error("Quiz data is null");
return ( return (
<Box sx={{ <Box
height: "100dvh", sx={{
}}> height: "100dvh",
<QuizAnswerer }}
quizSettings={data} >
quizId={quizId} <QuizAnswerer quizSettings={data} quizId={quizId} />
/> </Box>
</Box> );
);
} }