From d315f2904ef8ec290b47ae93d02e0d02c244393a Mon Sep 17 00:00:00 2001 From: shahanneda Date: Thu, 26 Jan 2023 22:43:22 -0500 Subject: [PATCH 1/3] Hid wierd percentage and added percent symbol --- components/StackedBarGraph.tsx | 38 ++++++++++++++++++++++++++++++---- pages/coop.tsx | 4 ++++ 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/components/StackedBarGraph.tsx b/components/StackedBarGraph.tsx index 0a98371..88bb6f4 100644 --- a/components/StackedBarGraph.tsx +++ b/components/StackedBarGraph.tsx @@ -53,6 +53,14 @@ export type StackedBarProps = { scalePadding?: number; /** Margin for each item in the legend */ itemMargin?: string; + /** Hide the first data value in tooltip*/ + hideDataValueInTooltip?: boolean; + //** Top tooltip label */ + tooltipTopLabel?: string; + //** Bottom tooltip label */ + tooltipBottomLabel?: string; + //** Display percentage */ + displayPercentage?: boolean; }; let tooltipTimeout: number; @@ -79,6 +87,10 @@ export const StackedBarGraphVertical = withTooltip< tooltipData, hideTooltip, showTooltip, + hideDataValueInTooltip, + tooltipBottomLabel = "", + tooltipTopLabel = "", + displayPercentage, }: StackedBarProps & WithTooltipProvidedProps) => { const yTotals = data.reduce((allTotals, currCategory) => { const yTotal = keys.reduce((categoryTotal, k) => { @@ -230,8 +242,15 @@ export const StackedBarGraphVertical = withTooltip< left={tooltipLeft} header={tooltipData.key} > -

{tooltipData.bar.data[tooltipData.key]}

-

{getCategory(tooltipData.bar.data)}

+ {hideDataValueInTooltip ? null : ( +

+ {tooltipTopLabel} {tooltipData.bar.data[tooltipData.key]} + {displayPercentage ? "%" : ""} +

+ )} +

+ {tooltipBottomLabel} {getCategory(tooltipData.bar.data)} +

) : null} @@ -261,6 +280,10 @@ export const StackedBarGraphHorizontal = withTooltip< tooltipData, hideTooltip, showTooltip, + hideDataValueInTooltip, + tooltipBottomLabel = "", + tooltipTopLabel = "", + displayPercentage, }: StackedBarProps & WithTooltipProvidedProps) => { const yTotals = data.reduce((allTotals, currCategory) => { const yTotal = keys.reduce((categoryTotal, k) => { @@ -409,8 +432,15 @@ export const StackedBarGraphHorizontal = withTooltip< left={tooltipLeft} header={tooltipData.key} > -

{tooltipData.bar.data[tooltipData.key]}

-

{getCategory(tooltipData.bar.data)}

+ {hideDataValueInTooltip ? null : ( +

+ {tooltipTopLabel} {tooltipData.bar.data[tooltipData.key]} + {displayPercentage ? "%" : ""} +

+ )} +

+ {tooltipBottomLabel} {getCategory(tooltipData.bar.data)} +

) : null} diff --git a/pages/coop.tsx b/pages/coop.tsx index 84de69b..73da4a2 100644 --- a/pages/coop.tsx +++ b/pages/coop.tsx @@ -231,6 +231,8 @@ export default function CoopPage() { ]} data={C7v} margin={barGraphMargin} + hideDataValueInTooltip + tooltipBottomLabel="Coop Term: " /> @@ -256,6 +258,8 @@ export default function CoopPage() { ]} data={C7vi} margin={barGraphMargin} + tooltipBottomLabel="Coop Term: " + displayPercentage /> From 229260cba9df046225edf4fc7500128b4f2002ed Mon Sep 17 00:00:00 2001 From: shahanneda Date: Thu, 26 Jan 2023 22:44:45 -0500 Subject: [PATCH 2/3] Revert "Hid wierd percentage and added percent symbol" This reverts commit d315f2904ef8ec290b47ae93d02e0d02c244393a. --- components/StackedBarGraph.tsx | 38 ++++------------------------------ pages/coop.tsx | 4 ---- 2 files changed, 4 insertions(+), 38 deletions(-) diff --git a/components/StackedBarGraph.tsx b/components/StackedBarGraph.tsx index 88bb6f4..0a98371 100644 --- a/components/StackedBarGraph.tsx +++ b/components/StackedBarGraph.tsx @@ -53,14 +53,6 @@ export type StackedBarProps = { scalePadding?: number; /** Margin for each item in the legend */ itemMargin?: string; - /** Hide the first data value in tooltip*/ - hideDataValueInTooltip?: boolean; - //** Top tooltip label */ - tooltipTopLabel?: string; - //** Bottom tooltip label */ - tooltipBottomLabel?: string; - //** Display percentage */ - displayPercentage?: boolean; }; let tooltipTimeout: number; @@ -87,10 +79,6 @@ export const StackedBarGraphVertical = withTooltip< tooltipData, hideTooltip, showTooltip, - hideDataValueInTooltip, - tooltipBottomLabel = "", - tooltipTopLabel = "", - displayPercentage, }: StackedBarProps & WithTooltipProvidedProps) => { const yTotals = data.reduce((allTotals, currCategory) => { const yTotal = keys.reduce((categoryTotal, k) => { @@ -242,15 +230,8 @@ export const StackedBarGraphVertical = withTooltip< left={tooltipLeft} header={tooltipData.key} > - {hideDataValueInTooltip ? null : ( -

- {tooltipTopLabel} {tooltipData.bar.data[tooltipData.key]} - {displayPercentage ? "%" : ""} -

- )} -

- {tooltipBottomLabel} {getCategory(tooltipData.bar.data)} -

+

{tooltipData.bar.data[tooltipData.key]}

+

{getCategory(tooltipData.bar.data)}

) : null} @@ -280,10 +261,6 @@ export const StackedBarGraphHorizontal = withTooltip< tooltipData, hideTooltip, showTooltip, - hideDataValueInTooltip, - tooltipBottomLabel = "", - tooltipTopLabel = "", - displayPercentage, }: StackedBarProps & WithTooltipProvidedProps) => { const yTotals = data.reduce((allTotals, currCategory) => { const yTotal = keys.reduce((categoryTotal, k) => { @@ -432,15 +409,8 @@ export const StackedBarGraphHorizontal = withTooltip< left={tooltipLeft} header={tooltipData.key} > - {hideDataValueInTooltip ? null : ( -

- {tooltipTopLabel} {tooltipData.bar.data[tooltipData.key]} - {displayPercentage ? "%" : ""} -

- )} -

- {tooltipBottomLabel} {getCategory(tooltipData.bar.data)} -

+

{tooltipData.bar.data[tooltipData.key]}

+

{getCategory(tooltipData.bar.data)}

) : null} diff --git a/pages/coop.tsx b/pages/coop.tsx index 73da4a2..84de69b 100644 --- a/pages/coop.tsx +++ b/pages/coop.tsx @@ -231,8 +231,6 @@ export default function CoopPage() { ]} data={C7v} margin={barGraphMargin} - hideDataValueInTooltip - tooltipBottomLabel="Coop Term: " /> @@ -258,8 +256,6 @@ export default function CoopPage() { ]} data={C7vi} margin={barGraphMargin} - tooltipBottomLabel="Coop Term: " - displayPercentage /> From 45264a8ae089eed5b4b31c31668fb899a7fba00c Mon Sep 17 00:00:00 2001 From: Richard Shuai Date: Sun, 29 Jan 2023 17:58:55 -0500 Subject: [PATCH 3/3] Merge religion (#151) Closes #141 Merged the no religious affliation option with the atheist option. Co-authored-by: ricsign Reviewed-on: https://git.csclub.uwaterloo.ca/www/cs-2022-class-profile/pulls/151 Reviewed-by: Mark Chiu --- data/demographics.ts | 6 +----- pages/contributors.tsx | 12 +++++++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/data/demographics.ts b/data/demographics.ts index f0f1160..6f63f4a 100644 --- a/data/demographics.ts +++ b/data/demographics.ts @@ -311,16 +311,12 @@ export const D10 = [ export const D11 = [ { category: "No religious affiliation", - value: 79, + value: 80, }, { category: "Christianity", value: 16, }, - { - category: "Atheist", - value: 1, - }, { category: "Judaism", value: 3, diff --git a/pages/contributors.tsx b/pages/contributors.tsx index 71c5076..b529c7d 100644 --- a/pages/contributors.tsx +++ b/pages/contributors.tsx @@ -27,9 +27,15 @@ export function ContributorGroup({ group }: ContributorGroupProps) { .map((d, idx) => { return (
  • - - {d.name} - + {d.link ? ( + + {d.name} + + ) : ( + e.preventDefault()}> + {d.name} + + )}
  • ); })}