Skip to content

Commit b263f25

Browse files
sid597trangdoan982
authored andcommitted
ENG-1187: Prod: Implement get and set for block prop based settings (#669)
* address review * address review * address michael review
1 parent fa7b2ec commit b263f25

5 files changed

Lines changed: 702 additions & 169 deletions

File tree

Lines changed: 129 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -1,142 +1,140 @@
1-
import type { DiscourseRelationSettings } from "~/components/settings/utils/zodSchema";
21
/* eslint-disable @typescript-eslint/naming-convention */ // This is for nodePosition keys
2+
import type { DiscourseRelationSettings } from "~/components/settings/utils/zodSchema";
33

44
// TODO: Delete the original default relations in data/defaultRelations.ts when fully migrated.
5-
const DEFAULT_RELATIONS_BLOCK_PROPS: DiscourseRelationSettings[] = [
5+
const DEFAULT_RELATIONS_BLOCK_PROPS: Record<string, DiscourseRelationSettings> =
66
{
7-
id: "informs",
8-
label: "Informs",
9-
source: "_EVD-node",
10-
destination: "_QUE-node",
11-
complement: "Informed By",
12-
ifConditions: [
13-
{
14-
triples: [
15-
["Page", "is a", "source"],
16-
["Block", "references", "Page"],
17-
["Block", "is in page", "ParentPage"],
18-
["ParentPage", "is a", "destination"],
19-
],
20-
nodePositions: {
21-
"0": "100 57",
22-
"1": "100 208",
23-
"2": "100 345",
24-
source: "281 57",
25-
destination: "281 345",
7+
"_INFO-rel": {
8+
label: "Informs",
9+
source: "_EVD-node",
10+
destination: "_QUE-node",
11+
complement: "Informed By",
12+
ifConditions: [
13+
{
14+
triples: [
15+
["Page", "is a", "source"],
16+
["Block", "references", "Page"],
17+
["Block", "is in page", "ParentPage"],
18+
["ParentPage", "is a", "destination"],
19+
],
20+
nodePositions: {
21+
"0": "100 57",
22+
"1": "100 208",
23+
"2": "100 345",
24+
source: "281 57",
25+
destination: "281 345",
26+
},
2627
},
27-
},
28-
],
29-
},
30-
{
31-
id: "supports",
32-
label: "Supports",
33-
source: "_EVD-node",
34-
destination: "_CLM-node",
35-
complement: "Supported By",
36-
ifConditions: [
37-
{
38-
triples: [
39-
["Page", "is a", "source"],
40-
["Block", "references", "Page"],
41-
["SBlock", "references", "SPage"],
42-
["SPage", "has title", "SupportedBy"],
43-
["SBlock", "has child", "Block"],
44-
["PBlock", "references", "ParentPage"],
45-
["PBlock", "has child", "SBlock"],
46-
["ParentPage", "is a", "destination"],
47-
],
48-
nodePositions: {
49-
"0": "250 325",
50-
"1": "100 325",
51-
"2": "100 200",
52-
"3": "250 200",
53-
"4": "400 200",
54-
"5": "100 75",
55-
"6": "250 75",
56-
source: "400 325",
57-
destination: "400 75",
28+
],
29+
},
30+
"_SUPP-rel": {
31+
label: "Supports",
32+
source: "_EVD-node",
33+
destination: "_CLM-node",
34+
complement: "Supported By",
35+
ifConditions: [
36+
{
37+
triples: [
38+
["Page", "is a", "source"],
39+
["Block", "references", "Page"],
40+
["SBlock", "references", "SPage"],
41+
["SPage", "has title", "SupportedBy"],
42+
["SBlock", "has child", "Block"],
43+
["PBlock", "references", "ParentPage"],
44+
["PBlock", "has child", "SBlock"],
45+
["ParentPage", "is a", "destination"],
46+
],
47+
nodePositions: {
48+
"0": "250 325",
49+
"1": "100 325",
50+
"2": "100 200",
51+
"3": "250 200",
52+
"4": "400 200",
53+
"5": "100 75",
54+
"6": "250 75",
55+
source: "400 325",
56+
destination: "400 75",
57+
},
5858
},
59-
},
60-
{
61-
triples: [
62-
["Page", "is a", "destination"],
63-
["Block", "references", "Page"],
64-
["SBlock", "references", "SPage"],
65-
["SPage", "has title", "Supports"],
66-
["SBlock", "has child", "Block"],
67-
["PBlock", "references", "ParentPage"],
68-
["PBlock", "has child", "SBlock"],
69-
["ParentPage", "is a", "source"],
70-
],
71-
nodePositions: {
72-
"7": "250 325",
73-
"8": "100 325",
74-
"9": "100 200",
75-
"10": "250 200",
76-
"11": "400 200",
77-
"12": "100 75",
78-
"13": "250 75",
79-
source: "400 75",
80-
destination: "400 325",
59+
{
60+
triples: [
61+
["Page", "is a", "destination"],
62+
["Block", "references", "Page"],
63+
["SBlock", "references", "SPage"],
64+
["SPage", "has title", "Supports"],
65+
["SBlock", "has child", "Block"],
66+
["PBlock", "references", "ParentPage"],
67+
["PBlock", "has child", "SBlock"],
68+
["ParentPage", "is a", "source"],
69+
],
70+
nodePositions: {
71+
"7": "250 325",
72+
"8": "100 325",
73+
"9": "100 200",
74+
"10": "250 200",
75+
"11": "400 200",
76+
"12": "100 75",
77+
"13": "250 75",
78+
source: "400 75",
79+
destination: "400 325",
80+
},
8181
},
82-
},
83-
],
84-
},
85-
{
86-
id: "opposes",
87-
label: "Opposes",
88-
source: "_EVD-node",
89-
destination: "_CLM-node",
90-
complement: "Opposed By",
91-
ifConditions: [
92-
{
93-
triples: [
94-
["Page", "is a", "source"],
95-
["Block", "references", "Page"],
96-
["SBlock", "references", "SPage"],
97-
["SPage", "has title", "OpposedBy"],
98-
["SBlock", "has child", "Block"],
99-
["PBlock", "references", "ParentPage"],
100-
["PBlock", "has child", "SBlock"],
101-
["ParentPage", "is a", "destination"],
102-
],
103-
nodePositions: {
104-
"0": "250 325",
105-
"1": "100 325",
106-
"2": "100 200",
107-
"3": "250 200",
108-
"4": "400 200",
109-
"5": "100 75",
110-
"6": "250 75",
111-
source: "400 325",
112-
destination: "400 75",
82+
],
83+
},
84+
"_OPPO-rel": {
85+
label: "Opposes",
86+
source: "_EVD-node",
87+
destination: "_CLM-node",
88+
complement: "Opposed By",
89+
ifConditions: [
90+
{
91+
triples: [
92+
["Page", "is a", "source"],
93+
["Block", "references", "Page"],
94+
["SBlock", "references", "SPage"],
95+
["SPage", "has title", "OpposedBy"],
96+
["SBlock", "has child", "Block"],
97+
["PBlock", "references", "ParentPage"],
98+
["PBlock", "has child", "SBlock"],
99+
["ParentPage", "is a", "destination"],
100+
],
101+
nodePositions: {
102+
"0": "250 325",
103+
"1": "100 325",
104+
"2": "100 200",
105+
"3": "250 200",
106+
"4": "400 200",
107+
"5": "100 75",
108+
"6": "250 75",
109+
source: "400 325",
110+
destination: "400 75",
111+
},
113112
},
114-
},
115-
{
116-
triples: [
117-
["Page", "is a", "destination"],
118-
["Block", "references", "Page"],
119-
["SBlock", "references", "SPage"],
120-
["SPage", "has title", "Opposes"],
121-
["SBlock", "has child", "Block"],
122-
["PBlock", "references", "ParentPage"],
123-
["PBlock", "has child", "SBlock"],
124-
["ParentPage", "is a", "source"],
125-
],
126-
nodePositions: {
127-
"7": "250 325",
128-
"8": "100 325",
129-
"9": "100 200",
130-
"10": "250 200",
131-
"11": "400 200",
132-
"12": "100 75",
133-
"13": "250 75",
134-
source: "400 75",
135-
destination: "400 325",
113+
{
114+
triples: [
115+
["Page", "is a", "destination"],
116+
["Block", "references", "Page"],
117+
["SBlock", "references", "SPage"],
118+
["SPage", "has title", "Opposes"],
119+
["SBlock", "has child", "Block"],
120+
["PBlock", "references", "ParentPage"],
121+
["PBlock", "has child", "SBlock"],
122+
["ParentPage", "is a", "source"],
123+
],
124+
nodePositions: {
125+
"7": "250 325",
126+
"8": "100 325",
127+
"9": "100 200",
128+
"10": "250 200",
129+
"11": "400 200",
130+
"12": "100 75",
131+
"13": "250 75",
132+
source: "400 75",
133+
destination: "400 325",
134+
},
136135
},
137-
},
138-
],
139-
},
140-
];
136+
],
137+
},
138+
};
141139

142140
export default DEFAULT_RELATIONS_BLOCK_PROPS;

0 commit comments

Comments
 (0)