Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/AgreementHtml.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function AgreementHtml({
loading,
isModal,
}: {
loading: any;
loading: boolean;
isModal?: boolean;
}) {
const agreementHtml = useAppStore((state) => state.agreementHtml);
Expand Down
19 changes: 16 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,19 @@ const App = () => {

useEffect(() => {
const initializeApp = async () => {
try{
await init();
const compressedData = searchParams.get("data");
if (compressedData) {
await loadFromLink(compressedData);
}
} catch(error){
console.error(error);
} finally {
setLoading(false);
};
initializeApp();
}
};
void initializeApp();

// DarkMode Styles
const style = document.createElement("style");
Expand All @@ -72,10 +77,18 @@ const App = () => {
}, [init, loadFromLink, searchParams, textColor, backgroundColor]);

useEffect(() => {
const startTour = async () => {
try {
await tour.start();
} catch (error) {
console.error("Tour failed to start:", error);
}
};

const showTour = searchParams.get("showTour") === "true";

if (showTour || !localStorage.getItem("hasVisited")) {
tour.start();
void startTour();
localStorage.setItem("hasVisited", "true");
}
}, [searchParams]);
Expand Down
2 changes: 1 addition & 1 deletion src/components/FullScreenModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { FullscreenOutlined } from "@ant-design/icons";
import useAppStore from "../store/store";

const FullScreenModal: React.FC = () => {
const [open, setOpen] = useState(false);
const [open, setOpen] = useState<boolean>(false);
const textColor = useAppStore((state) => state.textColor);
const backgroundColor = useAppStore((state) => state.backgroundColor);

Expand Down
8 changes: 6 additions & 2 deletions src/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ import ToggleDarkMode from "./ToggleDarkMode";

const { useBreakpoint } = Grid;

function Navbar({ scrollToFooter }: { scrollToFooter: any }) {
interface NavbarProps {
scrollToFooter: () => void;
}

function Navbar({ scrollToFooter }: NavbarProps) {
const [hovered, setHovered] = useState<
null | "home" | "explore" | "help" | "github" | "join"
>(null);
Expand All @@ -33,7 +37,7 @@ function Navbar({ scrollToFooter }: { scrollToFooter: any }) {

const helpMenu = (
<Menu>
<Menu.ItemGroup title="Info">
<Menu.ItemGroup key="info" title="Info">
<Menu.Item key="about">
<a
href="https://github.com/accordproject/template-playground/blob/main/README.md"
Expand Down
11 changes: 6 additions & 5 deletions src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ import {
} from "../styles/components/Sidebar";
import { BulbOutlined } from "@ant-design/icons";

const Sidebar: React.FC<{ steps: { title: string; link: string }[] }> = ({
steps,
}) => {
interface SidebarProps {
steps: { title: string; link: string }[];
}
const Sidebar: React.FC<SidebarProps> = ({ steps }) => {
return (
<SidebarContainer>
<SidebarTitle>Learning Pathway</SidebarTitle>
Expand All @@ -24,7 +25,7 @@ const Sidebar: React.FC<{ steps: { title: string; link: string }[] }> = ({
<SidebarListItem key={index}>
<SidebarLink
to={step.link}
className={({ isActive }) => (isActive ? "active" : undefined)}
className={({ isActive }) => (isActive ? "active" : "")}
>
{step.title}
</SidebarLink>
Expand All @@ -38,7 +39,7 @@ const Sidebar: React.FC<{ steps: { title: string; link: string }[] }> = ({
</HelperIcon>
<HelperText>
Welcome to the Learning Pathway! Use the sidebar to follow the guide.
Open the{" "}
Open the {" "}
<Link to="/" target="_blank" rel="noopener noreferrer">
Template Playground
</Link>{" "}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change affected the white space in the text here. Please fix.
Screenshot 2025-03-13 at 5 18 53 PM

Expand Down
18 changes: 9 additions & 9 deletions src/editors/ConcertoEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useMonaco } from "@monaco-editor/react";
import { lazy, Suspense, useCallback, useEffect, useMemo } from "react";
import { editor, MarkerSeverity } from "monaco-editor";
import * as monaco from "monaco-editor";
import useAppStore from "../store/store";

const MonacoEditor = lazy(() =>
Expand Down Expand Up @@ -40,15 +40,15 @@ const concertoTypes = [
"Boolean",
];

const handleEditorWillMount = (monaco: any) => {
monaco.languages.register({
const handleEditorWillMount = (monacoInstance: typeof monaco) => {
monacoInstance.languages.register({
id: "concerto",
extensions: [".cto"],
aliases: ["Concerto", "concerto"],
mimetypes: ["application/vnd.accordproject.concerto"],
});

monaco.languages.setMonarchTokensProvider("concerto", {
monacoInstance.languages.setMonarchTokensProvider("concerto", {
keywords: concertoKeywords,
typeKeywords: concertoTypes,
operators: ["=", "{", "}", "@", '"'],
Expand Down Expand Up @@ -83,7 +83,7 @@ const handleEditorWillMount = (monaco: any) => {
},
});

monaco.editor.defineTheme("concertoTheme", {
monacoInstance.editor.defineTheme("concertoTheme", {
base: "vs",
inherit: true,
rules: [
Expand All @@ -98,7 +98,7 @@ const handleEditorWillMount = (monaco: any) => {
colors: {},
});

monaco.editor.setTheme("concertoTheme");
monacoInstance.editor.setTheme("concertoTheme");
};

interface ConcertoEditorProps {
Expand All @@ -120,7 +120,7 @@ export default function ConcertoEditor({
[backgroundColor]
);

const options: editor.IStandaloneEditorConstructionOptions = {
const options: monaco.editor.IStandaloneEditorConstructionOptions = {
minimap: { enabled: false },
wordWrap: "on",
automaticLayout: true,
Expand All @@ -137,7 +137,7 @@ export default function ConcertoEditor({
useEffect(() => {
if (!monacoInstance) return;

const model = monacoInstance.editor.getModels()[0];
const model = monacoInstance.editor.getModels()?.[0];
if (!model) return;

if (ctoErr) {
Expand All @@ -152,7 +152,7 @@ export default function ConcertoEditor({
endLineNumber: lineNumber,
endColumn: columnNumber + 1,
message: ctoErr,
severity: MarkerSeverity.Error,
severity: monaco.MarkerSeverity.Error,
},
]);
}
Expand Down
4 changes: 1 addition & 3 deletions src/editors/MarkdownEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ export default function MarkdownEditor({
scrollBeyondLastLine: false,
};

const options = useMemo(() => editorOptions, []);

const handleChange = useCallback(
(val: string | undefined) => {
if (onChange) onChange(val);
Expand All @@ -64,7 +62,7 @@ export default function MarkdownEditor({
<div className="editorwrapper">
<Suspense fallback={<div>Loading Editor...</div>}>
<MonacoEditor
options={options}
options={editorOptions}
language="markdown"
height="60vh"
value={value}
Expand Down