feat: merged most of simpleprogram into MP

ref: N25B-398
This commit is contained in:
Tuurminator69
2026-01-05 17:35:32 +01:00
parent 873b1cfb0b
commit 9601f56ea9
2 changed files with 57 additions and 10 deletions

View File

@@ -1,7 +1,32 @@
import React from 'react';
import styles from './MonitoringPage.module.css';
import useProgramStore from "../../utils/programStore.ts";
export default function MonitoringPage() {
type Goal = { id?: string | number; description?: string; achieved?: boolean };
type Trigger = { id?: string | number; label?: string ; achieved?: boolean };
type Norm = { id?: string | number; norm?: string };
const MonitoringPage: React.FC = () => {
const getPhaseIds = useProgramStore((s) => s.getPhaseIds);
const getNormsInPhase = useProgramStore((s) => s.getNormsInPhase);
const getGoalsInPhase = useProgramStore((s) => s.getGoalsInPhase);
const getTriggersInPhase = useProgramStore((s) => s.getTriggersInPhase);
const phaseIds = getPhaseIds();
const [phaseIndex, setPhaseIndex] = React.useState(0);
if (phaseIds.length === 0) {
return <p className={styles.empty}>No program loaded.</p>;
}
const phaseId = phaseIds[phaseIndex];
const goals = getGoalsInPhase(phaseId) as Goal[];
const triggers = getTriggersInPhase(phaseId) as Trigger[];
const norms = getNormsInPhase(phaseId) as Norm[];
return (
<div className={styles.dashboardContainer}>
{/* HEADER */}
@@ -44,26 +69,45 @@ export default function MonitoringPage() {
<section className={styles.phaseBox}>
<h3>Goals</h3>
<ul>
<li className={styles.checked}>Convince the RP that you are a fish</li>
<li>Reference Shakespeare</li>
<li>Give a compliment</li>
{goals.length > 0 ? (
goals.map((goal, idx) => (
<li key={goal.id ?? idx}>
<span>{goal.achieved ? "✔️" : "❌"}</span> {goal.description}
</li>
))) : (
<p>No goals defined.</p>
)
}
</ul>
</section>
<section className={styles.phaseBox}>
<h3>Triggers</h3>
<ul>
<li className={styles.checked}>Convince the RP that you are a fish</li>
<li>Reference Shakespeare</li>
<li>Give a compliment</li>
{triggers.length > 0 ? (
triggers.map((trigger, idx) => (
<li key={trigger.id ?? idx}>
<span>{trigger.achieved ? "✔️" : "❌"}</span> {trigger.label}
</li>
))) : (
<p>No triggers defined.</p>
)
}
</ul>
</section>
<section className={styles.phaseBox}>
<h3>Norms</h3>
<ul>
<li>Rhyme when talking</li>
<li>Talk like a fish</li>
{norms.length > 0 ? (
norms.map((norm, idx) => (
<li key={norm.id ?? idx}>
{norm.norm}
</li>
))) : (
<p>No norms defined.</p>
)
}
</ul>
</section>
@@ -125,3 +169,5 @@ export default function MonitoringPage() {
</div>
);
}
export default MonitoringPage;