Skip to content

Certificate btn on last #146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
May 13, 2025
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.certificateButton {
font-size: small;
margin-right: 32px;
display: flex;
align-items: center;
justify-content: center;
Expand Down
45 changes: 25 additions & 20 deletions app/components/CodeEditor/CodeEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@ import Editor, { Monaco } from "@monaco-editor/react";
import { Flex, useColorMode } from "@chakra-ui/react";
import { useEffect, useState, useRef } from "react";
import MyBtn from "../MyBtn";
import { tryFormattingCode, validateCode } from "@/lib/client-functions";
import {
isTheTourCompleted,
tryFormattingCode,
validateCode,
} from "@/lib/client-functions";
import FiChevronRight from "@/app/styles/icons/HiChevronRightGreen";
import { useRouter } from "next/navigation";
import { useUserSolutionStore, useEditorStore } from "@/lib/stores";
import { sendGAEvent } from "@next/third-parties/google";
import { CodeFile, OutputResult } from "@/lib/types";
import { OutputReducerAction } from "@/lib/reducers";
import CertificateButton from "../CertificateButton/CertificateButton";

// Custom hook for editor theme setup
const useEditorTheme = (monaco: Monaco, colorMode: "dark" | "light") => {
Expand Down Expand Up @@ -108,7 +113,6 @@ const EditorControls = ({
outputResult: OutputResult;
}) => {
const router = useRouter();

return (
<div className={styles.buttonsWrapper}>
<Flex dir="row" gap="8px" alignItems="end">
Expand All @@ -127,25 +131,26 @@ const EditorControls = ({
Reset
</MyBtn>
</Flex>
<MyBtn
onClick={() => {
if (nextStepPath) router.push("/" + nextStepPath);
}}
variant={
outputResult.validityStatus === "valid" ? "default" : "success"
}
isDisabled={!nextStepPath}
size={outputResult.validityStatus === "valid" ? "sm" : "xs"}
>
Next <span style={{ marginLeft: "4px" }}></span>
<FiChevronRight
color={
outputResult.validityStatus === "valid"
? "white"
: "hsl(var(--success))"
{!nextStepPath ? (
<CertificateButton />
) : (
<MyBtn
onClick={() => router.push("/" + nextStepPath)}
variant={
outputResult.validityStatus === "valid" ? "default" : "success"
}
/>
</MyBtn>
size={outputResult.validityStatus === "valid" ? "sm" : "xs"}
>
Next <span style={{ marginLeft: "4px" }}></span>
<FiChevronRight
color={
outputResult.validityStatus === "valid"
? "white"
: "hsl(var(--success))"
}
/>
</MyBtn>
)}
</div>
);
};
Expand Down
2 changes: 1 addition & 1 deletion app/components/OutlineDrawer/OutlineDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function OutlineDrawer({
<DrawerOverlay />
<DrawerContent>
<DrawerCloseButton />
<DrawerHeader display={"flex"} justifyContent={"space-between"}>
<DrawerHeader display={"flex"} justifyContent={"space-between"} paddingRight={12}>
Outline
<CertificateButton />
</DrawerHeader>
Expand Down