Skip to content

Commit

Permalink
Merge pull request #1138 from spencerckhuang/fix/ui-bug-fixes-10-24
Browse files Browse the repository at this point in the history
Fixed bug that showed invalid areas of focus
  • Loading branch information
spencerckhuang authored Oct 8, 2024
2 parents 48a8608 + c8ada54 commit e22425b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions static/js/redux/ui/SearchResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,24 @@ const SearchResult = (props: SearchResultProps) => {
};

type AreaBubbleProps = { areas: string[] };
export const AreaBubble = ({ areas }: AreaBubbleProps) =>
areas.length > 0 ? (
export const AreaBubble = ({ areas }: AreaBubbleProps) => {
const isValidArea = (rawAreaSingle: string): boolean => {
const validAreas = ["H", "S", "N", "E", "Q", "writing"];
return validAreas.includes(rawAreaSingle);
};

const validAreas = areas.filter((areaCandidate) => isValidArea(areaCandidate));

return validAreas.length > 0 ? (
<div className="areas">
{areas.map((area) => (
{validAreas.map((area) => (
<div className={`bubble ${area}`} key={area}>
{area}
</div>
))}
</div>
) : null;
};

type WritingIntensiveProps = { isWritingIntensive: string };
export const WritingIntensive = ({ isWritingIntensive }: WritingIntensiveProps) =>
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"allowJs": true,
"moduleResolution": "node",
"esModuleInterop": true,
"lib": ["es2015", "DOM"]
"lib": ["DOM", "es2016"]
}
}

0 comments on commit e22425b

Please sign in to comment.