Skip to content

Commit c601dba

Browse files
authored
Saga updates style changes (#2384)
1 parent 50e8b1d commit c601dba

File tree

2 files changed

+50
-122
lines changed

2 files changed

+50
-122
lines changed

src/Frontend/src/components/CodeEditor.vue

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,38 +19,38 @@ const props = withDefaults(
1919
showGutter?: boolean;
2020
showCopyToClipboard?: boolean;
2121
ariaLabel?: string;
22-
css?: string;
22+
extensions?: Extension[];
2323
}>(),
24-
{ readOnly: true, showGutter: true, showCopyToClipboard: true }
24+
{ readOnly: true, showGutter: true, showCopyToClipboard: true, extensions: () => [] }
2525
);
2626
2727
const extensions = computed(() => {
28-
const extensions: Extension[] = [];
28+
const allExtensions: Extension[] = [...(props.extensions || [])];
2929
3030
switch (props.language) {
3131
case "json":
32-
extensions.push(json());
32+
allExtensions.push(json());
3333
break;
3434
case "xml":
35-
extensions.push(xml());
35+
allExtensions.push(xml());
3636
break;
3737
case "shell":
38-
extensions.push(StreamLanguage.define(shell));
38+
allExtensions.push(StreamLanguage.define(shell));
3939
break;
4040
case "powershell":
41-
extensions.push(StreamLanguage.define(powerShell));
41+
allExtensions.push(StreamLanguage.define(powerShell));
4242
break;
4343
case "csharp":
44-
extensions.push(StreamLanguage.define(csharp));
44+
allExtensions.push(StreamLanguage.define(csharp));
4545
break;
4646
}
4747
48-
return extensions;
48+
return allExtensions;
4949
});
5050
</script>
5151

5252
<template>
53-
<div class="wrapper" :aria-label="ariaLabel" :class="css">
53+
<div class="wrapper" :aria-label="ariaLabel">
5454
<div v-if="props.showCopyToClipboard || $slots.toolbarLeft || $slots.toolbarRight" class="toolbar">
5555
<div><slot name="toolbarLeft"></slot></div>
5656
<div>

src/Frontend/src/components/messages2/SagaDiagram/SagaUpdateNode.vue

Lines changed: 40 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import DiffViewer from "@/components/messages2/DiffViewer.vue";
77
import CodeEditor from "@/components/CodeEditor.vue";
88
import { useSagaDiagramStore } from "@/stores/SagaDiagramStore";
99
import { ref, watch, computed } from "vue";
10+
import { EditorView } from "@codemirror/view";
1011
import { parse, stringify } from "lossless-json";
1112
1213
// Import the images directly
@@ -17,6 +18,30 @@ import TimeoutIcon from "@/assets/timeout.svg";
1718
import EventIcon from "@/assets/event.svg";
1819
import SagaTimeoutIcon from "@/assets/SagaTimeoutIcon.svg";
1920
21+
// Define the monospace theme for CodeEditor
22+
const monospaceTheme = EditorView.baseTheme({
23+
"&": {
24+
fontFamily: "monospace",
25+
fontSize: "0.75rem",
26+
backgroundColor: "#f2f2f2",
27+
},
28+
".cm-editor": {
29+
fontFamily: "monospace",
30+
fontSize: "0.75rem",
31+
backgroundColor: "#f2f2f2",
32+
},
33+
".cm-scroller": {
34+
backgroundColor: "#f2f2f2",
35+
},
36+
});
37+
38+
// Define types for JSON values and properties
39+
type JsonValue = string | number | boolean | null | JsonObject | JsonArray;
40+
interface JsonObject {
41+
[key: string]: JsonValue;
42+
}
43+
type JsonArray = Array<JsonValue>;
44+
2045
const props = defineProps<{
2146
update: SagaUpdateViewModel;
2247
showMessageData?: boolean;
@@ -176,8 +201,8 @@ const hasStateChanges = computed(() => {
176201
</div>
177202

178203
<!-- Initial state display -->
179-
<div v-else-if="update.IsFirstNode" class="json-container">
180-
<CodeEditor css="monospace-code" :model-value="sagaUpdateStateChanges.formattedState || ''" language="json" :showCopyToClipboard="false" :showGutter="false" />
204+
<div v-else-if="update.IsFirstNode" class="json-container json-container--first-node">
205+
<CodeEditor :model-value="sagaUpdateStateChanges.formattedState || ''" language="json" :showCopyToClipboard="false" :showGutter="false" :extensions="[monospaceTheme]" />
181206
</div>
182207

183208
<!-- No changes message -->
@@ -288,9 +313,6 @@ const hasStateChanges = computed(() => {
288313
289314
.cell-inner-side--active {
290315
border: solid 5px #00a3c4;
291-
-webkit-animation: blink-border 1.8s ease-in-out;
292-
-moz-animation: blink-border 1.8s ease-in-out;
293-
-o-animation: blink-border 1.8s ease-in-out;
294316
animation: blink-border 1.8s ease-in-out;
295317
}
296318
@@ -404,6 +426,19 @@ const hasStateChanges = computed(() => {
404426
background-color: transparent;
405427
}
406428
429+
.json-container--first-node {
430+
max-height: 300px;
431+
overflow: auto;
432+
}
433+
434+
/* Override CodeEditor wrapper styles */
435+
.json-container :deep(.wrapper) {
436+
border-radius: 0;
437+
border: none;
438+
background-color: #f2f2f2;
439+
margin-top: 0;
440+
}
441+
407442
.no-changes-message {
408443
padding: 1rem;
409444
text-align: center;
@@ -418,113 +453,6 @@ const hasStateChanges = computed(() => {
418453
color: #a94442;
419454
}
420455
421-
/* Monospace font styling that matches DiffViewer */
422-
:deep(.monospace-code) {
423-
border-radius: 0;
424-
border: none;
425-
background-color: #f2f2f2;
426-
}
427-
428-
:deep(.monospace-code) .cm-editor {
429-
font-family: monospace;
430-
font-size: 0.75rem;
431-
background-color: #f2f2f2;
432-
}
433-
434-
:deep(.monospace-code) .cm-scroller {
435-
background-color: #f2f2f2;
436-
}
437-
438-
@-webkit-keyframes blink-border {
439-
0%,
440-
100% {
441-
border-color: #00a3c4;
442-
}
443-
20%,
444-
60% {
445-
border-color: #cccccc;
446-
}
447-
40%,
448-
80% {
449-
border-color: #00a3c4;
450-
}
451-
}
452-
453-
@-moz-keyframes blink-border {
454-
0%,
455-
100% {
456-
border-color: #00a3c4;
457-
}
458-
20%,
459-
60% {
460-
border-color: #cccccc;
461-
}
462-
40%,
463-
80% {
464-
border-color: #00a3c4;
465-
}
466-
}
467-
468-
@-o-keyframes blink-border {
469-
0%,
470-
100% {
471-
border-color: #00a3c4;
472-
}
473-
20%,
474-
60% {
475-
border-color: #cccccc;
476-
}
477-
40%,
478-
80% {
479-
border-color: #00a3c4;
480-
}
481-
}
482-
483-
@keyframes blink-border {
484-
0%,
485-
100% {
486-
border-color: #00a3c4;
487-
}
488-
20%,
489-
60% {
490-
border-color: #cccccc;
491-
}
492-
40%,
493-
80% {
494-
border-color: #00a3c4;
495-
}
496-
}
497-
498-
@-moz-keyframes blink-border {
499-
0%,
500-
100% {
501-
border-color: #000000;
502-
}
503-
20%,
504-
60% {
505-
border-color: #cccccc;
506-
}
507-
40%,
508-
80% {
509-
border-color: #000000;
510-
}
511-
}
512-
513-
@-o-keyframes blink-border {
514-
0%,
515-
100% {
516-
border-color: #000000;
517-
}
518-
20%,
519-
60% {
520-
border-color: #cccccc;
521-
}
522-
40%,
523-
80% {
524-
border-color: #000000;
525-
}
526-
}
527-
528456
@keyframes blink-border {
529457
0%,
530458
100% {

0 commit comments

Comments
 (0)