aboutsummaryrefslogtreecommitdiff
path: root/174bg/manager/src/components/RequiredInfo.jsx
diff options
context:
space:
mode:
authorAlex Pooley (@zuedev) <zuedev@gmail.com>2026-07-25 17:27:38 +0100
committerAlex Pooley (@zuedev) <zuedev@gmail.com>2026-07-25 17:27:38 +0100
commita85a54651070765d6254287369835d747be1c276 (patch)
tree6598d2e36bf5a3770c9450e1acceefcfcb092842 /174bg/manager/src/components/RequiredInfo.jsx
parent0d001f0094f2784033be52fa2a28102c271ffb1e (diff)
downloadunnamed-group-a85a54651070765d6254287369835d747be1c276.tar
unnamed-group-a85a54651070765d6254287369835d747be1c276.tar.gz
unnamed-group-a85a54651070765d6254287369835d747be1c276.tar.bz2
unnamed-group-a85a54651070765d6254287369835d747be1c276.tar.xz
unnamed-group-a85a54651070765d6254287369835d747be1c276.zip
manager is now using react
Diffstat (limited to '174bg/manager/src/components/RequiredInfo.jsx')
-rw-r--r--174bg/manager/src/components/RequiredInfo.jsx66
1 files changed, 66 insertions, 0 deletions
diff --git a/174bg/manager/src/components/RequiredInfo.jsx b/174bg/manager/src/components/RequiredInfo.jsx
new file mode 100644
index 0000000..67c6799
--- /dev/null
+++ b/174bg/manager/src/components/RequiredInfo.jsx
@@ -0,0 +1,66 @@
+import { RANK_NAMES } from "../lib/roles";
+
+const REQUIRED_INFO_FIELDS = [
+ { field: "id", label: "174BG ID" },
+ { field: "UEE_Citizen_Record_ID", label: "UEE Citizen Record ID" },
+ { field: "RSI_Display_Name", label: "RSI Display Name" },
+ { field: "RSI_Handle", label: "RSI Handle" },
+ { field: "joined_rsi_org", label: "Joined RSI Organisation" },
+ { field: "email", label: "Email" },
+ { field: "Branch", label: "Branch" },
+ { field: "Rank_Number", label: "Rank Number" },
+];
+
+export default function RequiredInfo({ record }) {
+ let anyMissing = false;
+
+ const rows = REQUIRED_INFO_FIELDS.map(({ field, label }) => {
+ const value = record?.[field];
+ // Treat only null/undefined/empty-string as missing so legitimately
+ // falsy values (e.g. Rank_Number 0, joined_rsi_org false) still show.
+ const missing = value == null || value === "";
+ if (missing) anyMissing = true;
+ return { field, label, value, missing };
+ });
+
+ const branch = record?.Branch;
+ const rankNumber = record?.Rank_Number;
+ const rankName = RANK_NAMES[branch]?.[rankNumber];
+ if (!rankName) anyMissing = true;
+
+ const staffRolesRaw = record?.StaffRoles;
+ const staffList = Array.isArray(staffRolesRaw)
+ ? staffRolesRaw
+ : staffRolesRaw
+ ? [staffRolesRaw]
+ : [];
+
+ return (
+ <div id="required-info">
+ <h2>Required Information</h2>
+ {rows.map(({ field, label, value, missing }) => (
+ <div key={field}>
+ <b>{label}:</b>{" "}
+ <span style={{ color: missing ? "red" : "" }}>
+ {missing ? "MISSING" : value}
+ </span>
+ </div>
+ ))}
+ <div>
+ <b>Rank Name:</b>{" "}
+ <span style={{ color: rankName ? "" : "red" }}>
+ {rankName ?? "MISSING"}
+ </span>
+ </div>
+ <div>
+ <b>Staff Roles:</b>{" "}
+ <span>{staffList.length > 0 ? staffList.join(", ") : "none"}</span>
+ </div>
+ {anyMissing && (
+ <div id="profile-warning">
+ ⚠️ Your profile is incomplete. Message an officer ASAP!
+ </div>
+ )}
+ </div>
+ );
+}