-
-
Notifications
You must be signed in to change notification settings - Fork 102
[feature] Add netjsongraph static files #517 #675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
f09ebd6
c25f7fa
d0c817e
c09ac34
f15d6d9
7af1b24
5d7dd5c
19bba45
17152da
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,89 @@ | ||||||||||||||
| .njg-container .leaflet-control-zoom-in, | ||||||||||||||
| .njg-container .leaflet-control-zoom-out { | ||||||||||||||
| pointer-events: auto; | ||||||||||||||
| opacity: 1; | ||||||||||||||
| cursor: pointer; | ||||||||||||||
| background: rgba(217, 79, 52, 0.85) !important; | ||||||||||||||
| color: #fff !important; | ||||||||||||||
|
Comment on lines
+6
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial | 💤 Low value Document or verify necessity of Multiple rules use If /* Using !important to override Leaflet default styles */
.njg-container .leaflet-control-zoom-in,
.njg-container .leaflet-control-zoom-out {
background: rgba(217, 79, 52, 0.85) !important;
color: `#fff` !important;
}Also applies to: 17-18, 70-71, 81-81 🤖 Prompt for AI Agents |
||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| .njg-container .leaflet-control-zoom-in.leaflet-disabled, | ||||||||||||||
| .njg-container .leaflet-control-zoom-out.leaflet-disabled { | ||||||||||||||
| opacity: 0.7; | ||||||||||||||
| cursor: default; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| .njg-container .leaflet-control-layers { | ||||||||||||||
| background: rgba(217, 79, 52, 0.85) !important; | ||||||||||||||
| color: #fff !important; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| .njg-container .switch-wrap { | ||||||||||||||
| color: #fff; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| .njg-container .switch-wrap label { | ||||||||||||||
| border: 1px solid #dfdfdf; | ||||||||||||||
| background: #ffffff; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| .njg-container .switch-wrap label::before { | ||||||||||||||
| box-shadow: 0 1px 3px rgba(0, 0, 0, 1); | ||||||||||||||
| background-color: #fff; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| .njg-container .switch-wrap input[type="checkbox"]:checked + label { | ||||||||||||||
| background: grey; | ||||||||||||||
| } | ||||||||||||||
|
Comment on lines
+35
to
+37
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Description: Check WCAG color contrast for grey background with white text
python3 << 'EOF'
def relative_luminance(rgb):
"""Calculate relative luminance for RGB color"""
rgb = [x / 255.0 for x in rgb]
rgb = [(x / 12.92 if x <= 0.03928 else ((x + 0.055) / 1.055) ** 2.4) for x in rgb]
return 0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]
def contrast_ratio(rgb1, rgb2):
"""Calculate contrast ratio between two colors"""
l1 = relative_luminance(rgb1)
l2 = relative_luminance(rgb2)
lighter = max(l1, l2)
darker = min(l1, l2)
return (lighter + 0.05) / (darker + 0.05)
# grey (`#808080`) vs white (`#ffffff`)
grey = [128, 128, 128]
white = [255, 255, 255]
ratio = contrast_ratio(grey, white)
print(f"Contrast ratio: {ratio:.2f}:1")
print(f"WCAG AA (normal text): {'PASS' if ratio >= 4.5 else 'FAIL'}")
print(f"WCAG AA (large text): {'PASS' if ratio >= 3 else 'FAIL'}")
print(f"WCAG AAA (normal text): {'PASS' if ratio >= 7 else 'FAIL'}")
EOFRepository: openwisp/openwisp-utils Length of output: 174 🏁 Script executed: # First, let's read the CSS file to understand the context around line 36
cat -n openwisp_utils/static/netjsongraph/css/netjsongraph-theme.css | head -50Repository: openwisp/openwisp-utils Length of output: 1458 🏁 Script executed: # Check if qa-checks script exists and run it as required by coding guidelines
if [ -f "./run-qa-checks" ]; then
./run-qa-checks -- openwisp_utils/static/netjsongraph/css/netjsongraph-theme.css
else
echo "run-qa-checks script not found"
fiRepository: openwisp/openwisp-utils Length of output: 131 🏁 Script executed: # Verify the proposed fix color (`#555555`) contrast ratio
python3 << 'EOF'
def relative_luminance(rgb):
"""Calculate relative luminance for RGB color"""
rgb = [x / 255.0 for x in rgb]
rgb = [(x / 12.92 if x <= 0.03928 else ((x + 0.055) / 1.055) ** 2.4) for x in rgb]
return 0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]
def contrast_ratio(rgb1, rgb2):
"""Calculate contrast ratio between two colors"""
l1 = relative_luminance(rgb1)
l2 = relative_luminance(rgb2)
lighter = max(l1, l2)
darker = min(l1, l2)
return (lighter + 0.05) / (darker + 0.05)
# Proposed fix: `#555555` vs white (`#ffffff`)
proposed = [85, 85, 85]
white = [255, 255, 255]
ratio = contrast_ratio(proposed, white)
print(f"Proposed color (`#555555`) vs white:")
print(f"Contrast ratio: {ratio:.2f}:1")
print(f"WCAG AA (normal text): {'PASS' if ratio >= 4.5 else 'FAIL'}")
print(f"WCAG AA (large text): {'PASS' if ratio >= 3 else 'FAIL'}")
print(f"WCAG AAA (normal text): {'PASS' if ratio >= 7 else 'FAIL'}")
EOFRepository: openwisp/openwisp-utils Length of output: 209 Use a darker background color to meet WCAG AA contrast requirements. The checked checkbox label uses grey ( Proposed fix.njg-container .switch-wrap input[type="checkbox"]:checked + label {
- background: grey;
+ background: `#555555`;
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
|
|
||||||||||||||
| .njg-container .njg-date { | ||||||||||||||
| color: #fff; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| .njg-container .njg-selectIcon { | ||||||||||||||
| background: rgba(217, 79, 52, 0.85); | ||||||||||||||
| color: #ffffff; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| .njg-container .njg-searchBtn { | ||||||||||||||
| background-color: white; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| .njg-container .njg-sideBar { | ||||||||||||||
| background-color: #fff; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| .njg-container .sideBarHandle { | ||||||||||||||
| background: rgba(217, 79, 52, 0.85); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| .njg-container .sideBarHandle::before { | ||||||||||||||
| color: #fff; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| .njg-container .njg-metaData, | ||||||||||||||
| .njg-container .njg-infoContainer { | ||||||||||||||
| background-color: inherit; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| .njg-container .njg-tooltip { | ||||||||||||||
| background: #fff !important; | ||||||||||||||
| border: none !important; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| .njg-container .njg-tooltip-key, | ||||||||||||||
| .njg-container .njg-tooltip-value { | ||||||||||||||
| color: #000; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| .njg-container .marker-cluster div { | ||||||||||||||
| color: #fff; | ||||||||||||||
| background-color: rgba(21, 102, 169, 0.8) !important; | ||||||||||||||
| } | ||||||||||||||
|
Comment on lines
+1
to
+82
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial | ⚡ Quick win Consider extracting repeated colors to CSS custom properties. The primary theme color ♻️ Refactor with CSS custom propertiesAdd at the top of the file: .njg-container {
--theme-primary: rgba(217, 79, 52, 0.85);
--theme-white: `#ffffff`;
--theme-grey: `#555555`;
}Then replace the hardcoded values: .njg-container .leaflet-control-zoom-in,
.njg-container .leaflet-control-zoom-out {
pointer-events: auto;
opacity: 1;
cursor: pointer;
- background: rgba(217, 79, 52, 0.85) !important;
- color: `#fff` !important;
+ background: var(--theme-primary) !important;
+ color: var(--theme-white) !important;
}Apply similar changes to lines 17, 44, and 57. 🤖 Prompt for AI Agents |
||||||||||||||
|
|
||||||||||||||
| @media only screen and (max-width: 850px) { | ||||||||||||||
| .njg-container .njg-sideBar { | ||||||||||||||
| background: rgba(255, 255, 255, 0.96); | ||||||||||||||
| color: #000; | ||||||||||||||
| } | ||||||||||||||
| } | ||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.