All files / src/components/debugger DebuggerScriptCtxBreadcrumb.tsx

0% Statements 0/11
0% Branches 0/9
0% Functions 0/1
0% Lines 0/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54                                                                                                           
import React from "react";
import DebuggerActorLink from "components/debugger/DebuggerActorLink";
import DebuggerCustomEventLink from "components/debugger/DebuggerCustomEventLink";
import DebuggerSceneLink from "components/debugger/DebuggerSceneLink";
import DebuggerTriggerLink from "components/debugger/DebuggerTriggerLink";
import type { ScriptEditorCtx } from "shared/lib/scripts/context";
import styled from "styled-components";
 
interface DebuggerScriptCtxBreadcrumbProps {
  context: ScriptEditorCtx;
}
 
const Separator = styled.span`
  margin: 0 5px;
  opacity: 0.5;
`;
 
const DebuggerScriptCtxBreadcrumb = ({
  context,
}: DebuggerScriptCtxBreadcrumbProps) => {
  const { sceneId, entityType, entityId, scriptKey } = context;
  return (
    <>
      {sceneId && entityType !== "customEvent" && (
        <>
          <DebuggerSceneLink id={sceneId} />
          <Separator>/</Separator>
        </>
      )}
      {entityType === "actor" && (
        <>
          <DebuggerActorLink id={entityId} sceneId={sceneId} />
          <Separator>/</Separator>
        </>
      )}
      {entityType === "trigger" && (
        <>
          <DebuggerTriggerLink id={entityId} sceneId={sceneId} />
          <Separator>/</Separator>
        </>
      )}
      {entityType === "customEvent" && (
        <>
          <DebuggerCustomEventLink id={entityId} />
          <Separator>/</Separator>
        </>
      )}
      {scriptKey}
    </>
  );
};
 
export default DebuggerScriptCtxBreadcrumb;