Skip to content

Commit

Permalink
code format&style fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmatthewnguyen105 committed Dec 11, 2023
1 parent 8d56cae commit e3a0040
Show file tree
Hide file tree
Showing 61 changed files with 178 additions and 159 deletions.
2 changes: 1 addition & 1 deletion src/_node/apis.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { doFileActions, doNodeActions } from ".";
import { doFileActions, doNodeActions } from "./";

export const callNodeApi = doNodeActions;
export const callFileApi = doFileActions;
3 changes: 2 additions & 1 deletion src/_node/file/actions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { LogAllow } from "@_constants/global";
import { TFileApiPayload, TNodeApiPayload } from "..";

import { TFileApiPayload } from "../";

const add = () => {};
const remove = () => {};
Expand Down
1 change: 0 additions & 1 deletion src/_node/file/constants.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/_node/file/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export * from "./types";
export * from "./constants";
export * from "./apis";
export * from "./helpers";
export * from "./actions";
Expand Down
3 changes: 2 additions & 1 deletion src/_node/file/types.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import JSZip from "jszip";

import { TOsType } from "@_redux/global";

import {
TBasicNodeData,
TNode,
TNodeActionType,
TNodeTreeData,
TNodeUid,
} from "../";
import { TOsType } from "@_redux/global";

export type TFileNode = TNode & {
data: TFileNodeData;
Expand Down
8 changes: 5 additions & 3 deletions src/_node/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { RootNodeUid } from "@_constants/main";
import {
AddNodeActionPrefix,
RenameNodeActionPrefix,
RootNodeUid,
} from "@_constants/main";
import { THtmlReferenceData } from "@_types/main";

import { AddNodeActionPrefix, RenameNodeActionPrefix } from "@_constants/main";

import { THtmlNodeData } from "./node";
import {
TBasicNodeData,
Expand Down
24 changes: 13 additions & 11 deletions src/_node/node/actions.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
import { editor, Range } from "monaco-editor";
import {
getNodeChildIndex,
TNodeApiPayload,
TNodeReferenceData,
TNodeTreeData,
TNodeUid,
} from "..";
import { html_beautify } from "js-beautify";
import { editor, Range } from "monaco-editor";

import {
sortUidsByMaxEndIndex,
sortUidsByMinStartIndex,
} from "@_components/main/actionsPanel/nodeTreeView/helpers";
import { LogAllow } from "@_constants/global";
import {
AddNodeActionPrefix,
DefaultTabSize,
NodePathSplitter,
RenameNodeActionPrefix,
} from "@_constants/main";
import { THtmlReferenceData } from "@_types/main";
import { LogAllow } from "@_constants/global";
import { copyCode, pasteCode, replaceContent } from "./helpers";
import { getValidNodeTree } from "@_pages/main/processor/helpers";
import { setNeedToSelectNodePaths } from "@_redux/main/nodeTree";
import { THtmlReferenceData } from "@_types/main";

import {
getNodeChildIndex,
TNodeApiPayload,
TNodeReferenceData,
TNodeTreeData,
TNodeUid,
} from "../";
import { copyCode, pasteCode, replaceContent } from "./helpers";

const add = ({
actionName,
Expand Down
3 changes: 2 additions & 1 deletion src/_node/node/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { editor, Range } from "monaco-editor";
import { TNodeTreeData, TNodeUid } from "..";

import { TNodeTreeData, TNodeUid } from "../";

export const copyCode = ({
nodeTree,
Expand Down
11 changes: 7 additions & 4 deletions src/_node/node/types.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { Dispatch } from "react";

import { editor } from "monaco-editor";

import { TOsType } from "@_redux/global";
import { AnyAction } from "@reduxjs/toolkit";

import {
TNodeActionType,
TNodeReferenceData,
TNodeTreeData,
TNodeUid,
} from "..";
import { editor } from "monaco-editor";
import { Dispatch } from "react";
import { AnyAction } from "@reduxjs/toolkit";
} from "../";

export type TNodeApiPayloadBase = {
dispatch: Dispatch<AnyAction>;
Expand Down
1 change: 0 additions & 1 deletion src/_redux/global/constants.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/_redux/global/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export * from "./types";
export * from "./constants";
export * from "./slice";
1 change: 0 additions & 1 deletion src/_redux/main/constants.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/_redux/main/context.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Context, createContext, useRef } from "react";
import { Context, createContext } from "react";

import { TMainContext } from "./types";

Expand Down
2 changes: 1 addition & 1 deletion src/_redux/main/fileTree/slice.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TFileNode, TFileNodeData, TFileNodeTreeData } from "@_node/index";
import { TFileNode, TFileNodeTreeData } from "@_node/index";
import { TNodeUid } from "@_node/types";
import { createSlice, PayloadAction } from "@reduxjs/toolkit";

Expand Down
1 change: 0 additions & 1 deletion src/_redux/main/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from "./types";
export * from "./constants";
export * from "./slice";
export * from "./context";
1 change: 0 additions & 1 deletion src/_redux/main/nodeTree/constants.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/_redux/main/nodeTree/event/slice.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import undoable from "redux-undo";

import { TNodeUid } from "@_node/types";
import { createSlice, current, PayloadAction } from "@reduxjs/toolkit";
import { createSlice, PayloadAction } from "@reduxjs/toolkit";

import {
NodeTree_Event_ClearActionType,
Expand Down
1 change: 0 additions & 1 deletion src/_redux/main/nodeTree/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from "./types";
export * from "./constants";
export * from "./slice";
export * from "./event";
1 change: 0 additions & 1 deletion src/_redux/main/processor/constants.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/_redux/main/processor/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export * from "./types";
export * from "./constants";
export * from "./slice";
1 change: 0 additions & 1 deletion src/_redux/main/stageView/constants.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/_redux/main/stageView/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export * from "./types";
export * from "./constants";
export * from "./slice";
5 changes: 2 additions & 3 deletions src/_redux/main/types.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import { MutableRefObject } from "react";

import { editor } from "monaco-editor";

import { TFileHandlerCollection } from "@_node/file";
import { TNodeUid } from "@_node/types";
import {
TCmdkReferenceData,
TCodeChange,
TFilesReferenceData,
THtmlReferenceData,
} from "@_types/main";

import { TProjectContext } from "./fileTree";
import { StageViewSyncConfigs } from "./stageView";
import { MutableRefObject } from "react";

export type TEventHistoryInfo = {
future: number;
Expand Down
3 changes: 2 additions & 1 deletion src/components/common/loader/Loader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import React, { useEffect, useState } from "react";

import LoadingBar from "react-top-loading-bar";

import { LoaderProps } from "./types";
import { useAppState } from "@_redux/useAppState";

import { LoaderProps } from "./types";

export const Loader = ({ show }: LoaderProps) => {
const { theme } = useAppState();

Expand Down
3 changes: 2 additions & 1 deletion src/components/main/actionsPanel/ActionsPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React, { useMemo } from "react";

import { useAppState } from "@_redux/useAppState";

import NavigatorPanel from "./navigatorPanel";
import NodeTreeView from "./nodeTreeView";
import SettingsPanel from "./settingsPanel";
import { ActionsPanelProps } from "./types";
import WorkspaceTreeView from "./workspaceTreeView";
import { useAppState } from "@_redux/useAppState";

export default function ActionsPanel({ ...props }: ActionsPanelProps) {
const { showActionsPanel } = useAppState();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useContext, useEffect, useMemo, useRef, useState } from "react";

import { MainContext } from "@_redux/main";
import { useAppState } from "@_redux/useAppState";

import { AdditionalPanel, DefaultPanel, ProjectPanel } from "./components";
import {
Expand All @@ -11,7 +12,6 @@ import {
} from "./constants";
import { useFavicon, useNavigatorPanelHandlers } from "./hooks";
import { NavigatorPanelProps } from "./types";
import { useAppState } from "@_redux/useAppState";

export default function NavigatorPanel(props: NavigatorPanelProps) {
const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import cx from "classnames";

import { SVGIcon } from "@_components/common";
import { TProject } from "@_redux/main/fileTree";
import { useAppState } from "@_redux/useAppState";

import { isSelected } from "../helpers";
import { useNavigatorPanelHandlers } from "../hooks";
import { useAppState } from "@_redux/useAppState";

interface AdditionalPanelProps {
navigatorPanel: HTMLDivElement | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import React, { useContext, useMemo } from "react";
import { SVGIconI } from "@_components/common";
import { RootNodeUid } from "@_constants/main";
import { MainContext } from "@_redux/main";
import { useAppState } from "@_redux/useAppState";

import { getFileExtension, getFileNameFromPath, isHomeIcon } from "../helpers";
import { useNavigatorPanelHandlers } from "../hooks";
import { useAppState } from "@_redux/useAppState";

export const DefaultPanel = () => {
const { project, fileTree, currentFileUid } = useAppState();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { FC } from "react";

import { SVGIconI } from "@_components/common";
import { useAppState } from "@_redux/useAppState";

import { useNavigatorPanelHandlers } from "../hooks";
import { useAppState } from "@_redux/useAppState";

export const ProjectPanel: FC<{ unsavedProject: boolean }> = ({
unsavedProject,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import { RootNodeUid } from "@_constants/main";
import { TFileNode, TFileNodeData } from "@_node/file";
import { THtmlNodeData } from "@_node/node";
import { TNode, TNodeTreeData, TNodeUid } from "@_node/types";
import { TNode, TNodeTreeData } from "@_node/types";
import { TProject, TWorkspace } from "@_redux/main/fileTree";
import { setSelectedNodeUids } from "@_redux/main/nodeTree";
import {
ActionCreatorWithPayload,
AnyAction,
Dispatch,
} from "@reduxjs/toolkit";

export const isHomeIcon = (node: TNode) =>
node.data.type == "html" &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { useDispatch } from "react-redux";

import { RootNodeUid } from "@_constants/main";
import { setWorkspace } from "@_redux/main/fileTree";
import { useAppState } from "@_redux/useAppState";

import { setWorkspaceFavicon } from "../helpers/";
import { useAppState } from "@_redux/useAppState";

export const useFavicon = (
setFaviconFallback: React.Dispatch<React.SetStateAction<boolean>>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ import { useCallback, useContext } from "react";

import { getMany } from "idb-keyval";
import { useDispatch } from "react-redux";

import { LogAllow } from "@_constants/global";
import { isUnsavedProject } from "@_node/file/helpers";
import { MainContext } from "@_redux/main";
import { TProject } from "@_redux/main/fileTree";
import {
setActivePanel,
setNavigatorDropdownType,
} from "@_redux/main/processor";
import { isUnsavedProject } from "@_node/file/helpers";
import { useAppState } from "@_redux/useAppState";
import { LogAllow } from "@_constants/global";

export const useNavigatorPanelHandlers = () => {
const dispatch = useDispatch();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import React, {
} from "react";

import cx from "classnames";
import { debounce } from "lodash";
import { useDispatch } from "react-redux";

import { TreeView } from "@_components/common";
Expand All @@ -15,6 +16,7 @@ import { RootNodeUid, ShortDelay } from "@_constants/main";
import { StageNodeIdAttr } from "@_node/file/handlers/constants";
import { TFileNodeData, THtmlNodeData } from "@_node/index";
import { TNode, TNodeUid } from "@_node/types";
import { scrollToElement } from "@_pages/main/helper";
import { MainContext } from "@_redux/main";
import {
expandFileTreeNodes,
Expand All @@ -25,6 +27,7 @@ import {
setActivePanel,
setNavigatorDropdownType,
} from "@_redux/main/processor";
import { useAppState } from "@_redux/useAppState";
import { getCommandKey } from "@_services/global";
import { addClass, removeClass } from "@_services/main";
import { THtmlElementsReference } from "@_types/main";
Expand All @@ -36,10 +39,7 @@ import { Container } from "./nodeTreeComponents/Container";
import { DragBetweenLine } from "./nodeTreeComponents/DragBetweenLine";
import { ItemArrow } from "./nodeTreeComponents/ItemArrow";
import { ItemTitle } from "./nodeTreeComponents/ItemTitle";
import { useAppState } from "@_redux/useAppState";
import { NodeIcon } from "./nodeTreeComponents/NodeIcon";
import { debounce } from "lodash";
import { scrollToElement } from "@_pages/main/helper";

const AutoExpandDelayOnDnD = 1 * 1000;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useContext, useEffect } from "react";

import { isAddNodeAction, isRenameNodeAction } from "@_node/helpers";
import { MainContext } from "@_redux/main";
import { useAppState } from "@_redux/useAppState";

import { useNodeActionsHandlers } from "./useNodeActionsHandlers";
import { useAppState } from "@_redux/useAppState";
import { isAddNodeAction, isRenameNodeAction } from "@_node/helpers";

export const useCmdk = () => {
const { activePanel, currentCommand } = useAppState();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { useCallback, useContext } from "react";
import { MainContext } from "@_redux/main";

import { useAppState } from "@_redux/useAppState";
import { useDispatch } from "react-redux";

import { LogAllow } from "@_constants/global";
import { callNodeApi } from "@_node/apis";

import { TNodeUid } from "@_node/types";
import { useDispatch } from "react-redux";
import { MainContext } from "@_redux/main";
import { useAppState } from "@_redux/useAppState";

export const useNodeActionsHandlers = () => {
const dispatch = useDispatch();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { useContext } from "react";

import { DraggingPosition, TreeItem, TreeItemIndex } from "react-complex-tree";

import { getValidNodeUids } from "@_node/helpers";
import { TNodeUid } from "@_node/types";
import { MainContext } from "@_redux/main";
import { useAppState } from "@_redux/useAppState";

import { useNodeViewState } from "./useNodeViewState";
import { useNodeActionsHandlers } from "./useNodeActionsHandlers";
import { useAppState } from "@_redux/useAppState";
import { getValidNodeUids } from "@_node/helpers";
import { useNodeViewState } from "./useNodeViewState";

export const useNodeTreeCallback = (
focusItemValue: TNodeUid | null,
Expand Down
Loading

0 comments on commit e3a0040

Please sign in to comment.