diff --git a/frontend/src/app/[locale]/projects/[projectId]/home/TestPriorityDonutChart.tsx b/frontend/src/app/[locale]/projects/[projectId]/home/TestPriorityDonutChart.tsx index 974a278..e099aa7 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/home/TestPriorityDonutChart.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/home/TestPriorityDonutChart.tsx @@ -9,11 +9,13 @@ const Chart = dynamic(() => import("react-apexcharts"), { ssr: false }); type Props = { priorityCounts: CasePriorityCountType[]; messages: HomeMessages; + theme: string; }; export default function TestPriorityDonutChart({ priorityCounts, messages, + theme, }: Props) { const [chartData, setChartData] = useState({ series: [], @@ -33,16 +35,27 @@ export default function TestPriorityDonutChart({ const labels = priorities.map((entry) => messages[entry.uid]); const colors = priorities.map((entry) => entry.chartColor); + const legend = { + labels: { + colors: priorities.map((entry) => { + if (theme === "light") { + return "black"; + } else { + return "white"; + } + }), + }, + }; setChartData({ series, - options: { labels, colors }, + options: { labels, colors, legend }, }); } }; updateChartDate(); - }, [priorityCounts]); + }, [priorityCounts, theme]); return ( import("react-apexcharts"), { ssr: false }); type Props = { progressSeries: ProgressSeriesType[]; progressCategories: string[]; + theme: string; }; export default function TestProgressBarChart({ progressSeries, progressCategories, + theme, }: Props) { const [chartData, setChartData] = useState({ series: [], @@ -25,6 +27,16 @@ export default function TestProgressBarChart({ useEffect(() => { const updateChartDate = () => { if (progressSeries) { + const legendsLabelColors = testRunCaseStatus.map((itr) => { + if (theme === "light") { + return "black"; + } else { + return "white"; + } + }); + + const xaxisLabelColor = theme === "light" ? "black" : "white"; + setChartData({ series: progressSeries, options: { @@ -36,6 +48,9 @@ export default function TestProgressBarChart({ }, legend: { position: "right", + labels: { + colors: legendsLabelColors, + }, }, colors: testRunCaseStatus.map((itr) => { return itr.chartColor; @@ -43,6 +58,14 @@ export default function TestProgressBarChart({ xaxis: { type: "datetime", categories: progressCategories, + labels: { + style: { + colors: xaxisLabelColor, + }, + }, + }, + tooltip: { + theme: theme, }, }, }); @@ -50,7 +73,7 @@ export default function TestProgressBarChart({ }; updateChartDate(); - }, [progressSeries, progressCategories]); + }, [progressSeries, progressCategories, theme]); return ( import("react-apexcharts"), { ssr: false }); type Props = { typesCounts: CaseTypeCountType[]; messages: HomeMessages; + theme: string; }; -export default function TestTypesDonutChart({ typesCounts, messages }: Props) { +export default function TestTypesDonutChart({ + typesCounts, + messages, + theme, +}: Props) { const [chartData, setChartData] = useState({ series: [], options: { @@ -30,16 +35,27 @@ export default function TestTypesDonutChart({ typesCounts, messages }: Props) { const labels = testTypes.map((entry) => messages[entry.uid]); const colors = testTypes.map((entry) => entry.chartColor); + const legend = { + labels: { + colors: testTypes.map((entry) => { + if (theme === "light") { + return "black"; + } else { + return "white"; + } + }), + }, + }; setChartData({ series, - options: { labels, colors }, + options: { labels, colors, legend }, }); } }; updateChartDate(); - }, [typesCounts]); + }, [typesCounts, theme]); return ( {project.detail && ( - + {project.detail} )} @@ -134,6 +139,7 @@ export function Home({ projectId, messages }: Props) { @@ -142,13 +148,18 @@ export function Home({ projectId, messages }: Props) {

{messages.byType}

- +

{messages.byPriority}

diff --git a/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/RunEditor.tsx b/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/RunEditor.tsx index 3dd08af..9689044 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/RunEditor.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/RunEditor.tsx @@ -51,6 +51,7 @@ import { } from "../runsControl"; import { fetchFolders } from "../../folders/foldersControl"; import { fetchCases } from "../../folders/[folderId]/cases/caseControl"; +import { useTheme } from "next-themes"; const defaultTestRun = { id: 0, @@ -74,6 +75,7 @@ export default function RunEditor({ messages, locale, }: Props) { + const { theme, setTheme } = useTheme(); const [testRun, setTestRun] = useState(defaultTestRun); const [folders, setFolders] = useState([]); const [runCases, setRunCases] = useState([]); @@ -273,6 +275,7 @@ export default function RunEditor({ diff --git a/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/RunPregressDonutChart.tsx b/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/RunPregressDonutChart.tsx index 43620a5..59db96a 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/RunPregressDonutChart.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/runs/[runId]/RunPregressDonutChart.tsx @@ -8,9 +8,14 @@ const Chart = dynamic(() => import("react-apexcharts"), { ssr: false }); type Props = { statusCounts: RunStatusCountType[]; messages: RunMessages; + theme: string; }; -export default function RunProgressDounut({ statusCounts, messages }: Props) { +export default function RunProgressDounut({ + statusCounts, + messages, + theme, +}: Props) { const [chartData, setChartData] = useState({ series: [], options: { @@ -29,16 +34,27 @@ export default function RunProgressDounut({ statusCounts, messages }: Props) { const labels = testRunCaseStatus.map((entry) => messages[entry.uid]); const colors = testRunCaseStatus.map((entry) => entry.chartColor); + const legend = { + labels: { + colors: testRunCaseStatus.map((entry) => { + if (theme === "light") { + return "black"; + } else { + return "white"; + } + }), + }, + }; setChartData({ series, - options: { labels, colors }, + options: { labels, colors, legend }, }); } }; updateChartDate(); - }, [statusCounts]); + }, [statusCounts, theme]); return (