Skip to content

Commit 758a2b0

Browse files
CATEGORIES and ORDERING start
1 parent 97f98db commit 758a2b0

File tree

2 files changed

+92
-35
lines changed

2 files changed

+92
-35
lines changed

src/features/small-microcircuit/_components/utils.ts

Lines changed: 87 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -15,42 +15,97 @@ export function isAtom<T>(val: unknown): val is Atom<T> {
1515
return typeof val === 'object' && val !== null && 'read' in val;
1616
}
1717

18-
export const ORDERING: Record<string, { order: number; category: string }> = {
19-
info: {
20-
order: 0,
21-
category: 'Setup',
22-
},
23-
initialize: {
24-
order: 1,
25-
category: 'Setup',
18+
// export const ORDERING: Record<string, { order: number; category: string }> = {
19+
// info: {
20+
// order: 0,
21+
// category: 'Setup',
22+
// },
23+
// initialize: {
24+
// order: 1,
25+
// category: 'Setup',
26+
// },
27+
// equations: {
28+
// order: 2,
29+
// category: 'Equations',
30+
// },
31+
// stimuli: {
32+
// order: 3,
33+
// category: 'Stimuli & Recordings',
34+
// },
35+
// recordings: {
36+
// order: 4,
37+
// category: 'Stimuli & Recordings',
38+
// },
39+
// neuron_sets: {
40+
// order: 5,
41+
// category: 'Circuit components',
42+
// },
43+
// timestamps: {
44+
// order: 6,
45+
// category: 'Events',
46+
// },
47+
// synaptic_manipulations: {
48+
// order: 7,
49+
// category: 'Circuit components',
50+
// },
51+
// };
52+
53+
54+
export const ORDERING: Record<
55+
string,
56+
Record<string, { order: number; category: string }>
57+
> = {
58+
a: {
59+
info: {
60+
order: 0,
61+
category: 'Setup',
62+
},
63+
initialize: {
64+
order: 1,
65+
category: 'Setup',
66+
},
67+
equations: {
68+
order: 2,
69+
category: 'Equations',
70+
},
2671
},
27-
equations: {
28-
order: 2,
29-
category: 'Equations',
72+
b: {
73+
info: {
74+
order: 0,
75+
category: 'Setup',
76+
},
77+
initialize: {
78+
order: 1,
79+
category: 'Setup',
80+
},
81+
stimuli: {
82+
order: 2,
83+
category: 'Stimuli & Recordings',
84+
},
85+
recordings: {
86+
order: 3,
87+
category: 'Stimuli & Recordings',
88+
},
89+
neuron_sets: {
90+
order: 4,
91+
category: 'Circuit components',
92+
},
93+
timestamps: {
94+
order: 5,
95+
category: 'Events',
96+
},
97+
synaptic_manipulations: {
98+
order: 6,
99+
category: 'Circuit components',
100+
},
30101
},
31-
// stimuli: {
32-
// order: 3,
33-
// category: 'Stimuli & Recordings',
34-
// },
35-
// recordings: {
36-
// order: 4,
37-
// category: 'Stimuli & Recordings',
38-
// },
39-
// neuron_sets: {
40-
// order: 5,
41-
// category: 'Circuit components',
42-
// },
43-
// timestamps: {
44-
// order: 6,
45-
// category: 'Events',
46-
// },
47-
// synaptic_manipulations: {
48-
// order: 7,
49-
// category: 'Circuit components',
50-
// },
51102
};
52103

53-
export const CATEGORIES: string[] = uniq(Object.values(ORDERING).map((o) => o.category));
104+
105+
export const CATEGORIES: Record<'a' | 'b', string[]> = {
106+
a: uniq(Object.values(ORDERING.a).map(o => o.category)),
107+
b: uniq(Object.values(ORDERING.b).map(o => o.category)),
108+
};
54109

55110
const simExecStatusListordered = [
56111
CircuitSimulationExecutionStatus.CREATED,

src/features/small-microcircuit/index.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import { match } from 'ts-pattern';
1111
// James asked to only comment it out for now.
1212
// import CircuitName from './_components/circuit-name';
1313

14+
const groupKey = 'a';
15+
1416
import { ICircuitSimulation } from '@/api/entitycore/types/entities/circuit-simulation';
1517
import { CircuitSimulationExecutionStatus } from '@/api/entitycore/types/entities/circuit-simulation-execution';
1618
import ApiError from '@/api/error';
@@ -149,15 +151,15 @@ export default function SimulationCampaignConfiguration({
149151
<div className={styles.threeColumns}>
150152
<div className={styles.scrollable}>
151153
<div className="flex flex-grow flex-col items-center gap-5 overflow-y-auto pr-5 pb-5">
152-
{CATEGORIES.map((c) => {
154+
{CATEGORIES["a"].map((c) => {
153155
return (
154156
<Fragment key={c}>
155157
<div className="self-start text-gray-500 uppercase">{c}</div>
156158
{schema.properties &&
157159
Object.entries(schema.properties)
158-
.filter(([k]) => k !== 'type' && ORDERING[k]?.category === c)
160+
.filter(([k]) => k !== 'type' && ORDERING["a"][k]?.category === c)
159161
.sort((a, b) => {
160-
const order = (k: string) => ORDERING[k]?.order ?? 999;
162+
const order = (k: string) => ORDERING["a"][k]?.order ?? 999;
161163
return order(a[0]) - order(b[0]);
162164
})
163165
.map(([k, v]) => {

0 commit comments

Comments
 (0)