Skip to content

Commit 28eb7f3

Browse files
authored
Merge pull request ucfopen#1108 from mbusch3/report-page-ui
Rebuilt the reports page
2 parents 46e7dac + 3d1008e commit 28eb7f3

22 files changed

Lines changed: 619 additions & 385 deletions

assets/css/udoit4-theme.css

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
--link-color-light: color-mix(in srgb, var(--link-color) 5%, var(--white) 100%); /* #E9F3FF; */
4646
--link-color-dark: color-mix(in srgb, var(--link-color) 100%, var(--black) 10%);
4747

48-
--text-secondary-color: #2F3741; /* #4A5565; */
48+
--text-secondary-color: #434D5B; /* #4A5565; #2F3741; */
4949
--text-disabled-color: #8B95A7; /* #D1D5DC; */
5050

5151
/* PILLS have three colors: border color, light background color, and text color */
@@ -70,6 +70,7 @@
7070
--help-color-text: #BB4D00;
7171

7272
--background-color: var(--gray-lightest);
73+
--container-color: #F2F4F7;
7374
--border-color: #C5C9D3; /* #E5E7EB; */
7475
--progress-bar-background-color: var(--gray-light);
7576
--progress-bar-color: var(--success-color);
@@ -283,7 +284,6 @@
283284
}
284285
}
285286

286-
287287
.btn-primary {
288288
background-color: var(--primary-color);
289289
border-color: var(--primary-color);
@@ -352,12 +352,13 @@
352352
background-color: transparent;
353353
color: var(--link-color);
354354
padding: .15rem 0.5rem;
355-
border-radius: 8px;
355+
border-radius: var(--element-radius);
356356
cursor: pointer;
357+
box-shadow: none;
357358
}
358359

359360
.btn-header {
360-
border-radius: 8px !important;
361+
border-radius: var(--element-radius) !important;
361362
justify-content: center;
362363
width: 100%;
363364
font-size: 0.9em;
@@ -580,13 +581,20 @@
580581

581582
.close-icon {
582583
cursor: pointer;
583-
padding: .25rem;
584+
padding: .2rem;
584585
margin-inline-end: -.5rem;
586+
border: 1px solid transparent;
587+
fill: var(--text-disabled-color);
588+
box-shadow: none;
589+
border-radius: 50%;
585590

586591
&:hover,
587592
&:focus {
593+
fill: var(--text-color);
588594
background-color: var(--gray-lighter);
589-
border-radius: 50%;
595+
}
596+
597+
&:focus {
590598
outline-offset: -2px;
591599
outline: 2px solid var(--focus-color);
592600
}
@@ -674,6 +682,22 @@
674682
}
675683
}
676684

685+
.ufixit-widget code,
686+
.ufixit-widget-dialog code,
687+
.ufixit-learn-container code,
688+
.info-popover-content code {
689+
padding: 0.15rem 0.4rem;
690+
background-color: var(--gray-dark);
691+
color: var(--white);
692+
border-radius: 4px;
693+
font-size: 0.9em;
694+
695+
strong {
696+
font-weight: 400;
697+
text-decoration: underline;
698+
}
699+
}
700+
677701
}
678702

679703
@layer udoit-layout {
@@ -1150,8 +1174,8 @@
11501174
}
11511175

11521176
.disabled {
1153-
color: var(--text-disabled);
1154-
fill: var(--text-disabled);
1177+
color: var(--text-disabled-color);
1178+
fill: var(--text-disabled-color);
11551179
}
11561180

11571181
.icon-sm {

assets/js/Components/App.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,7 @@ export default function App(initialData) {
369369
className={`flex-column flex-grow-1 `
370370
+ `${settings?.user?.roles?.font_size || settings.DEFAULT_USER_SETTINGS.FONT_SIZE} `
371371
+ `${settings?.user?.roles?.font_family || settings.DEFAULT_USER_SETTINGS.FONT_FAMILY} `
372-
+ `${settings?.user?.roles?.dark_mode ? 'dark-mode' : ''} `
373-
+ `${('summary' === navigation && welcomeClosed) ? 'clear-background' : ''}`}>
372+
+ `${settings?.user?.roles?.dark_mode ? 'dark-mode' : ''}`}>
374373
{ !welcomeClosed ?
375374
( <WelcomePage
376375
t={t}

assets/js/Components/FixIssuesPage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ export default function FixIssuesPage({
886886
closeDialog()
887887
}
888888
}}
889-
className="close-icon icon-lg text-color"
889+
className="close-icon icon-md"
890890
tabIndex="0"
891891
role="button"
892892
alt={t('fix.button.close')}

assets/js/Components/HomePage.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
box-sizing: border-box;
3333
border: 1px solid var(--border-color);
3434
border-radius: var(--element-radius);
35+
background-color: var(--white);
3536

3637
.summary-icon-container {
3738
padding: .5rem;

assets/js/Components/HomePage.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export default function HomePage({
193193
<SeverityIcon type={panel.type} className='icon-lg' />
194194
</div>
195195
<div className="summary-text-container">
196-
<h2>{t('summary.label.' + panel.translationKey)}</h2>
196+
<h2 className="mt-0">{t('summary.label.' + panel.translationKey)}</h2>
197197
<div aria-label={Html.getTextContent('<p>' + t('summary.' + panel.translationKey + '.description', {count: panel.counter.total}) + '</p>')}>
198198
<div
199199
className="subtext"
@@ -228,7 +228,7 @@ export default function HomePage({
228228

229229
<div className="widget-container">
230230
<div className="callout-container feedback-container flex-column h-fit p-4 flex-grow-1">
231-
<h2 className="text-center">{t('summary.label.course_progress')}</h2>
231+
<h2 className="mt-0 text-center">{t('summary.label.course_progress')}</h2>
232232
<div className="flex-row align-self-center">
233233
<div className="flex-column progress-container">
234234
<div className="flex-row justify-content-center" aria-label={`${combinedCount.percent.toFixed(0)}%`}>

assets/js/Components/Reports/IssuesTable.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.issue-label {
22
display: inline-flex;
33
align-items: center;
4-
gap: 6px;
4+
gap: .75em;
55
}
66

77
.sr-only {

assets/js/Components/Reports/IssuesTable.js

Lines changed: 5 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import React, { useState, useEffect, useRef } from 'react'
22
import SortableTable from '../Widgets/SortableTable'
3-
import { formNameFromRule } from '../../Services/Ufixit'
4-
import InfoPopover from '../Widgets/InfoPopover'
53
import './IssuesTable.css'
64

75
export default function IssuesTable({
86
t,
97
issues,
10-
quickSearchTerm = null,
118
isAdmin,
129
selectedCourse
1310
}) {
@@ -30,20 +27,19 @@ export default function IssuesTable({
3027
ascending: false,
3128
pageNum: 0,
3229
})
33-
const [localIssues, setLocalIssues] = useState([])
3430
const [rows, setRows] = useState([])
3531

3632
const sortContent = () => {
37-
let tempRows = (issues) ? Object.values(localIssues) : []
33+
let tempRows = (issues) ? Object.values(issues) : []
3834
const { sortBy, ascending } = tableSettings
3935

4036
tempRows.sort((a, b) => {
4137
let aValue = a[sortBy]
4238
let bValue = b[sortBy]
4339

44-
if (sortBy === "label") {
45-
aValue = a.labelText || ""
46-
bValue = b.labelText || ""
40+
if (typeof(aValue) === "object" && typeof(bValue) === "object") {
41+
aValue = a[sortBy + "_display"] || ""
42+
bValue = b[sortBy + "_display"] || ""
4743
}
4844

4945
if (isNaN(aValue) || isNaN(bValue)) {
@@ -66,70 +62,7 @@ export default function IssuesTable({
6662

6763
useEffect(() => {
6864
setRows(sortContent())
69-
}, [tableSettings, localIssues])
70-
71-
useEffect(() => {
72-
if (issues) {
73-
let tempIssues = Object.values(issues)
74-
tempIssues.map((issue => {
75-
let label = ''
76-
let searchTerm = ''
77-
let formName = formNameFromRule(issue.id)
78-
if(formName === 'review_only') {
79-
label = t('report.label.unhandled') + issue.id
80-
searchTerm = issue.id
81-
}
82-
else {
83-
label = t(`form.${formName}.title`)
84-
searchTerm = t(`form.${formName}.title`)
85-
}
86-
issue.labelText = label
87-
issue.label = (
88-
<span className="issue-label">
89-
{label}
90-
<InfoPopover
91-
t={t}
92-
content={t(`form.${formName}.summary`)}
93-
/>
94-
</span>
95-
)
96-
issue.summary = t(`form.${formName}.summary`)
97-
if(quickSearchTerm !== null) {
98-
issue.onClick = () => quickSearchTerm(searchTerm)
99-
}
100-
return issue
101-
}))
102-
103-
let mergedIssues = []
104-
let labels = []
105-
tempIssues.forEach((issue) => {
106-
if (!labels.includes(issue.label)) {
107-
labels.push(issue.label)
108-
if(issue.type === 'error' || issue.type === 'issue') {
109-
issue.type = t('filter.label.severity.issue')
110-
}
111-
else if(issue.type === 'potential') {
112-
issue.type = t('filter.label.severity.potential')
113-
}
114-
else if(issue.type === 'suggestion') {
115-
issue.type = t('filter.label.severity.suggestion')
116-
}
117-
issue.handled = (issue.fixed + issue.resolved > 0 ? 1 : 0)
118-
mergedIssues.push(issue)
119-
}
120-
else {
121-
let index = mergedIssues.findIndex((i) => i.label === issue.label)
122-
mergedIssues[index].total += issue.total
123-
mergedIssues[index].active += issue.active
124-
mergedIssues[index].handled += (issue.fixed + issue.resolved > 0 ? 1 : 0)
125-
}
126-
})
127-
setLocalIssues(mergedIssues)
128-
}
129-
else {
130-
setLocalIssues([])
131-
}
132-
}, [issues])
65+
}, [tableSettings, issues])
13366

13467
return (
13568
<>

assets/js/Components/Reports/ReportsTable.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,16 @@ export default function ReportsTable({
5656
};
5757

5858
const getContent = () => {
59-
let list = getLatestReports(reports); // Preprocess reports to get the latest entry per course
59+
let list = []
60+
if(reports && reports.length > 0) {
61+
if(reports[0].courseName) {
62+
list = getLatestReports(reports) // Preprocess reports to get the latest entry per course
63+
}
64+
else {
65+
list = reports // If reports are already in the expected format, use them directly
66+
}
67+
}
68+
6069
if (!list) {
6170
return [];
6271
}

assets/js/Components/Reports/ResolutionsReport.css

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
11
.resolutions-report-container {
22
display: flex;
3-
flex-direction: row;
4-
height: 100%;
3+
flex-direction: column;
4+
height: fit-content;
55
}
66

77
.resolutions-chart-area {
8-
flex: 3;
9-
padding: 20px;
10-
}
11-
12-
.resolutions-header {
13-
text-align: center;
14-
width: 100%;
15-
margin-top: 0;
16-
margin-bottom: 0.5em;
8+
padding-block-start: 1.5rem;
179
}
1810

1911
.resolutions-mode-toggle {

0 commit comments

Comments
 (0)