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

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

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

@ -22,6 +22,7 @@ export interface GetQuizDataResponse {
p: number;
c: string;
}[];
show_badge: boolean;
}
export function parseQuizData(quizDataResponse: GetQuizDataResponse): Omit<QuizSettings, "recentlyCompleted"> {
@ -50,5 +51,5 @@ export function parseQuizData(quizDataResponse: GetQuizDataResponse): Omit<QuizS
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;
recentlyCompleted: boolean;
show_badge: boolean;
};
export interface QuizConfig {
spec: undefined | true;
type: QuizType;

@ -7,30 +7,33 @@ import QuizAnswerer from "../lib/components/QuizAnswerer";
import { ApologyPage } from "../lib/components/ViewPublicationPage/ApologyPage";
// 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
export default function App() {
const quizId = useParams().quizId ?? defaultQuizId;
const { data, error, isLoading } = useSWR(["quizData", quizId], params => getQuizData(params[1]), {
revalidateOnFocus: false,
revalidateOnReconnect: false,
shouldRetryOnError: false,
refreshInterval: 0,
});
const quizId = useParams().quizId ?? defaultQuizId;
const { data, error, isLoading } = useSWR(
["quizData", quizId],
(params) => getQuizData(params[1]),
{
revalidateOnFocus: false,
revalidateOnReconnect: false,
shouldRetryOnError: false,
refreshInterval: 0,
}
);
if (isLoading) return <LoadingSkeleton />;
if (error) return <ApologyPage error={error} />;
if (!data) throw new Error("Quiz data is null");
if (isLoading) return <LoadingSkeleton />;
if (error) return <ApologyPage error={error} />;
if (!data) throw new Error("Quiz data is null");
return (
<Box sx={{
height: "100dvh",
}}>
<QuizAnswerer
quizSettings={data}
quizId={quizId}
/>
</Box>
);
return (
<Box
sx={{
height: "100dvh",
}}
>
<QuizAnswerer quizSettings={data} quizId={quizId} />
</Box>
);
}