From 1e3668e684bb59068c30c4df62f2f2d38489fe12 Mon Sep 17 00:00:00 2001 From: john681611 Date: Fri, 15 Sep 2023 15:38:29 +0100 Subject: [PATCH] Minimal GA styling --- .../src/pages/GapAnalysis/GapAnalysis.tsx | 323 ++++++++---------- application/prompt_client/prompt_client.py | 1 + 2 files changed, 140 insertions(+), 184 deletions(-) diff --git a/application/frontend/src/pages/GapAnalysis/GapAnalysis.tsx b/application/frontend/src/pages/GapAnalysis/GapAnalysis.tsx index 78d8d9aea..d145fed18 100644 --- a/application/frontend/src/pages/GapAnalysis/GapAnalysis.tsx +++ b/application/frontend/src/pages/GapAnalysis/GapAnalysis.tsx @@ -48,6 +48,70 @@ function useQuery() { return React.useMemo(() => new URLSearchParams(search), [search]); } +const GetStrength = (score) => { + if (score < 5) return 'Strong'; + if (score > 20) return 'Weak'; + return 'Average'; +}; + +const GetStrengthColor = (score) => { + if (score < 5) return 'Green'; + if (score > 20) return 'Red'; + return 'Orange'; +}; + +const GetResultLine = (path, gapAnalysis, key) => { + let segmentID = gapAnalysis[key].start.id; + return ( + + {getDocumentDisplayName(path.end, true)} } + > + + {getDocumentDisplayName(gapAnalysis[key].start, true)} + {path.path.map((segment) => { + const { text, nextID } = GetSegmentText(segment, segmentID); + segmentID = nextID; + return text; + })} + + + + ({GetStrength(path.score)}:{path.score}) + + } + > + + Generally: lower is better +
+ {GetStrength(0)}: Closely connected likely to have + majority overlap +
+ {GetStrength(6)}: Connected likely to have partial + overlap +
+ {GetStrength(22)}: Weakly connected likely to have + small or no overlap +
+
+ + + +
+ + ); +}; + export const GapAnalysis = () => { const standardOptionsDefault = [{ key: '', text: '', value: undefined }]; const searchParams = useQuery(); @@ -64,18 +128,6 @@ export const GapAnalysis = () => { const [error, setError] = useState(null); const { apiUrl } = useEnvironment(); - const GetStrength = (score) => { - if (score < 5) return 'Strong'; - if (score > 20) return 'Weak'; - return 'Average'; - }; - - const GetStrengthColor = (score) => { - if (score < 5) return 'Green'; - if (score > 20) return 'Red'; - return 'Orange'; - }; - const GetStrongPathsCount = (paths) => Math.max(Object.values(paths).filter((x) => GetStrength(x.score) === 'Strong').length, 3); @@ -120,12 +172,13 @@ export const GapAnalysis = () => { }; return ( -
- - - -