Skip to content

Commit

Permalink
Merge branch 'main' into jh/follow-on-feedback-component
Browse files Browse the repository at this point in the history
  • Loading branch information
jamdelion authored Nov 1, 2024
2 parents 015867c + 9546e09 commit 25d8a09
Showing 1 changed file with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { Link } from "react-navi";

import { useStore } from "../../../lib/store";
import { DataField } from "./DataField";
import { FlagBand, NoFlagBand } from "./FlagBand";
import Hanger from "./Hanger";
import Node from "./Node";
import { Thumbnail } from "./Thumbnail";
import { FlagBand, NoFlagBand } from "./FlagBand";

const Option: React.FC<any> = (props) => {
const childNodes = useStore((state) => state.childNodesOf(props.id));
Expand All @@ -20,7 +20,9 @@ const Option: React.FC<any> = (props) => {
// Question & Checklist Options set zero or many flag values under "data.flag"
if (props.data?.flag) {
if (Array.isArray(props.data?.flag)) {
flags = flatFlags.filter(({ value }) => props.data?.flag?.includes(value));
flags = flatFlags.filter(
({ value }) => props.data?.flag?.includes(value),
);
} else {
flags = flatFlags.filter(({ value }) => props.data?.flag === value);
}
Expand All @@ -46,11 +48,17 @@ const Option: React.FC<any> = (props) => {
imageAltText={props.data.text}
/>
)}
{flags ? (
flags.map((flag) => (<FlagBand key={`${props.id}-${flag.value}`} flag={flag} />))
) : (<NoFlagBand />)}
{flags && flags.length > 0 ? (
flags.map((flag) => (
<FlagBand key={`${props.id}-${flag.value}`} flag={flag} />
))
) : (
<NoFlagBand />
)}
<div className="text">{props.data.text}</div>
{props.data?.val && (<DataField value={props.data.val} variant="child" />)}
{props.data?.val && (
<DataField value={props.data.val} variant="child" />
)}
</Link>
<ol className="decisions">
{childNodes.map((child: any) => (<Node key={child.id} parent={props.id} {...child} />))}
Expand Down

0 comments on commit 25d8a09

Please sign in to comment.