Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/frontend/src/document/theory_selector.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
cursor: pointer;
}

& .division {
& .group {
display: flex;
flex-direction: column;
gap: 5px;
}

& .division-name {
& .group-name {
font-weight: 600;
padding-bottom: 1px;
opacity: 35%;
Expand Down
16 changes: 7 additions & 9 deletions packages/frontend/src/document/theory_selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,21 @@ export function TheorySelectorDialog(
export function TheorySelector(props: TheorySelectorProps) {
const groupedTheories = createMemo(() => {
const grouped = new Map<string, TheoryMeta[]>();

for (const theory of props.theories.metadata()) {
const category = theory.divisionCategory ?? "Other";
const group = grouped.get(category) || [];
const groupName = theory.group ?? "Other";
const group = grouped.get(groupName) || [];
group.push(theory);
grouped.set(category, group);
grouped.set(groupName, group);
}

return Array.from(grouped.entries()).sort((a, b) => a[0].localeCompare(b[0]));
return Array.from(grouped.entries());
});

return (
<div class="theory-selector">
<For each={groupedTheories()}>
{([category, theories]) => (
<div class="division">
<h4 class="division-name">{category}</h4>
{([group, theories]) => (
<div class="group">
<h4 class="group-name">{group}</h4>
<For each={theories}>
{(meta) => (
<div class="theory">
Expand Down
24 changes: 13 additions & 11 deletions packages/frontend/src/stdlib/theories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ stdTheories.add(
id: "simple-olog",
name: "Olog",
description: "Ontology log, a simple conceptual model",
divisionCategory: "Knowledge and Data",
group: "Knowledge and Data",
},
(meta) => {
const thCategory = new catlog.ThCategory();
Expand Down Expand Up @@ -61,10 +61,10 @@ stdTheories.add(

stdTheories.add(
{
id: "schema",
id: "simple-schema",
name: "Schema",
description: "Schema for a categorical database",
divisionCategory: "Knowledge and Data",
group: "Knowledge and Data",
},
(meta) => {
const thSchema = new catlog.ThSchema();
Expand Down Expand Up @@ -134,8 +134,8 @@ stdTheories.add(
{
id: "reg-net",
name: "Regulatory network",
description: "Signed graphs to model networks",
divisionCategory: "Life Sciences",
description: "Biochemical species that promote or inhibit each other",
group: "Biology",
},
(meta) => {
const thSignedCategory = new catlog.ThSignedCategory();
Expand Down Expand Up @@ -202,8 +202,8 @@ stdTheories.add(
{
id: "causal-loop",
name: "Causal loop diagram",
description: "Model cause-and-effect relationships",
divisionCategory: "System Dynamics",
description: "Positive and negative causal relationships",
group: "System Dynamics",
},
(meta) => {
const thSignedCategory = new catlog.ThSignedCategory();
Expand Down Expand Up @@ -270,8 +270,10 @@ stdTheories.add(

stdTheories.add(
{
id: "nullable-causal-loop",
name: "Causal loops with indeterminates",
id: "indeterminate-causal-loop",
name: "Causal loop diagram with indeterminates",
description: "Positive, negative, and indeterminate causal relationships",
group: "System Dynamics",
},
(meta) => {
const thNullableSignedCategory = new catlog.ThNullableSignedCategory();
Expand Down Expand Up @@ -331,10 +333,10 @@ stdTheories.add(

stdTheories.add(
{
id: "stock-flow",
id: "primitive-stock-flow",
name: "Stock and flow",
description: "Model accumulation (stocks) and change (flows)",
divisionCategory: "System Dynamics",
group: "System Dynamics",
},
(meta) => {
const thCategoryLinks = new catlog.ThCategoryLinks();
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend/src/stdlib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export type TheoryMeta = {
/** Short description of models of theory. */
description?: string;

/** division Category */
divisionCategory?: string;
/** Group to which the theory belongs */
group?: string;
};

/** Library of double theories configured for the frontend.
Expand Down