Move modeling status code to its own module (#2866)
* Move ModelingStatus to its own file * Move getModelingStatus to modeling status module
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import { ModeledMethod } from "../modeled-method";
|
||||
|
||||
export type ModelingStatus = "unmodeled" | "unsaved" | "saved";
|
||||
|
||||
export function getModelingStatus(
|
||||
modeledMethod: ModeledMethod | undefined,
|
||||
methodIsUnsaved: boolean,
|
||||
): ModelingStatus {
|
||||
if (modeledMethod) {
|
||||
if (methodIsUnsaved) {
|
||||
return "unsaved";
|
||||
} else if (modeledMethod.type !== "none") {
|
||||
return "saved";
|
||||
}
|
||||
}
|
||||
return "unmodeled";
|
||||
}
|
||||
@@ -1,9 +1,7 @@
|
||||
import * as React from "react";
|
||||
import { styled } from "styled-components";
|
||||
import {
|
||||
ModelingStatus,
|
||||
ModelingStatusIndicator,
|
||||
} from "../model-editor/ModelingStatusIndicator";
|
||||
import { ModelingStatus } from "../../model-editor/shared/modeling-status";
|
||||
import { ModelingStatusIndicator } from "../model-editor/ModelingStatusIndicator";
|
||||
import { Method } from "../../model-editor/method";
|
||||
import { MethodName } from "../model-editor/MethodName";
|
||||
import { ModeledMethod } from "../../model-editor/modeled-method";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as React from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { MethodModeling } from "./MethodModeling";
|
||||
import { ModelingStatus } from "../model-editor/ModelingStatusIndicator";
|
||||
import { ModelingStatus } from "../../model-editor/shared/modeling-status";
|
||||
import { Method } from "../../model-editor/method";
|
||||
import { ToMethodModelingMessage } from "../../common/interface-types";
|
||||
import { assertNever } from "../../common/helpers-pure";
|
||||
|
||||
@@ -14,10 +14,8 @@ import { ModeledMethod } from "../../model-editor/modeled-method";
|
||||
import { ModelKindDropdown } from "./ModelKindDropdown";
|
||||
import { Mode } from "../../model-editor/shared/mode";
|
||||
import { MethodClassifications } from "./MethodClassifications";
|
||||
import {
|
||||
ModelingStatus,
|
||||
ModelingStatusIndicator,
|
||||
} from "./ModelingStatusIndicator";
|
||||
import { getModelingStatus } from "../../model-editor/shared/modeling-status";
|
||||
import { ModelingStatusIndicator } from "./ModelingStatusIndicator";
|
||||
import { InProgressDropdown } from "./InProgressDropdown";
|
||||
import { MethodName } from "./MethodName";
|
||||
import { ModelTypeDropdown } from "./ModelTypeDropdown";
|
||||
@@ -181,17 +179,3 @@ function sendJumpToUsageMessage(method: Method) {
|
||||
usage: method.usages[0],
|
||||
});
|
||||
}
|
||||
|
||||
function getModelingStatus(
|
||||
modeledMethod: ModeledMethod | undefined,
|
||||
methodIsUnsaved: boolean,
|
||||
): ModelingStatus {
|
||||
if (modeledMethod) {
|
||||
if (methodIsUnsaved) {
|
||||
return "unsaved";
|
||||
} else if (modeledMethod.type !== "none") {
|
||||
return "saved";
|
||||
}
|
||||
}
|
||||
return "unmodeled";
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import * as React from "react";
|
||||
import { assertNever } from "../../common/helpers-pure";
|
||||
import { Codicon } from "../common/icon/Codicon";
|
||||
|
||||
export type ModelingStatus = "unmodeled" | "unsaved" | "saved";
|
||||
import { ModelingStatus } from "../../model-editor/shared/modeling-status";
|
||||
|
||||
interface Props {
|
||||
status: ModelingStatus;
|
||||
|
||||
Reference in New Issue
Block a user