Skip to content

Commit

Permalink
chore: linting the code
Browse files Browse the repository at this point in the history
  • Loading branch information
vwh committed Sep 7, 2024
1 parent f61b33d commit 7fed6c9
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/components/editor/editor.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useCallback, useMemo } from "react";

import { useStore } from "@/store/useStore";
import MonacoEditor, { OnMount } from "@monaco-editor/react";

import MonacoEditor, { type OnMount } from "@monaco-editor/react";
import Loader from "@/components/loader";

export default function Editor() {
Expand Down
23 changes: 13 additions & 10 deletions src/components/editor/terminal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState, useRef, useCallback } from "react";
import { useEffect, useState, useRef, useCallback, useMemo } from "react";
import { useStore } from "@/store/useStore";
import Loader from "@/components/loader";

Expand Down Expand Up @@ -39,15 +39,18 @@ export default function Terminal() {
setError(null);
}, [clearOutput, setError]);

const commandHandlers: CommandHandlers = {
"pip install": async (input: string) => await pipInstall(input),
"echo ": async (input: string) =>
await setOutput(input.split(" ").slice(1).join(" ")),
pwd: getCwd,
cwd: getCwd,
clear: clearTerminal,
cls: clearTerminal
};
const commandHandlers: CommandHandlers = useMemo(
() => ({
"pip install": async (input: string) => await pipInstall(input),
"echo ": async (input: string) =>
await setOutput(input.split(" ").slice(1).join(" ")),
pwd: getCwd,
cwd: getCwd,
clear: clearTerminal,
cls: clearTerminal
}),
[pipInstall, setOutput, getCwd, clearTerminal]
);

const handleReplSubmit = useCallback(
async (e: React.FormEvent<HTMLFormElement>) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/settings.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback } from "react";
import { useCallback } from "react";
import { useStore } from "@/store/useStore";

import { Input } from "./ui/input";
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/ripple.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { CSSProperties } from "react";
import React, { type CSSProperties } from "react";

interface RippleProps {
mainCircleSize?: number;
Expand Down
2 changes: 1 addition & 1 deletion src/store/useStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const useStore = create<State & Actions>((set, get) => ({

setCode: (code) => set({ code }),
setOutput: (newOutput) =>
set((state) => ({ output: state.output + "\n" + newOutput })),
set((state) => ({ output: `${state.output}\n${newOutput}` })),
clearOutput: (defaultValue = "") => set({ output: defaultValue }),
setError: (error) => set({ error }),
setDirection: (direction) => set({ direction }),
Expand Down

0 comments on commit 7fed6c9

Please sign in to comment.