Skip to content

Commit 3b78cce

Browse files
committed
linting updates
1 parent 1679735 commit 3b78cce

File tree

3 files changed

+14
-19
lines changed

3 files changed

+14
-19
lines changed

packages/openneuro-app/src/scripts/users/scss/usernotifications.module.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,16 +133,17 @@
133133
color: #770D0D;
134134
background-color: #FFF5F5;
135135
}
136+
136137
.accordionicon {
137-
max-width: 22px;
138+
max-width: 21px;
138139
height: auto;
139140
display: inline-block;
140141
border-radius: 4px;
141142
border: 1px solid #ccc;
142143
padding: 5px;
143144
margin-right: 5px;
144145
&.archiveicon {
145-
max-width: 17px;
146+
max-width: 18px;
146147
}
147148
&.saveicon {
148149
max-width: 23px;

packages/openneuro-app/src/scripts/users/user-notification-accordion.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,17 @@ import iconArchived from "../../assets/icon-archived.png"
88
export const NotificationAccordion = ({ notification, onUpdate }) => {
99
const { id, title, content, status, type, approval } = notification
1010

11-
// Check if content is not empty or null
1211
const hasContent = content && content.trim().length > 0
1312

1413
const [isOpen, setIsOpen] = useState(false)
1514
const toggleAccordion = () => setIsOpen(!isOpen)
1615

1716
const handleApprovalChange = (approvalStatus) => {
18-
onUpdate(id, { approval: approvalStatus }) // Only update the approval field
17+
onUpdate(id, { approval: approvalStatus })
1918
}
2019

2120
const handleStatusChange = (newStatus) => {
22-
onUpdate(id, { status: newStatus }) // Only update the status field
21+
onUpdate(id, { status: newStatus })
2322
}
2423

2524
return (
@@ -48,28 +47,26 @@ export const NotificationAccordion = ({ notification, onUpdate }) => {
4847
<div className={styles.actions}>
4948
{type === "approval" && (
5049
<>
51-
{/* Approve Button */}
5250
{(approval === "not provided" || approval === "approved") && (
5351
<button
5452
className={`${styles.notificationapprove} ${
5553
approval === "approved" ? styles.active : ""
5654
}`}
5755
onClick={() => handleApprovalChange("approved")}
58-
disabled={approval === "approved"} // Disable if already approved
56+
disabled={approval === "approved"}
5957
>
6058
<i className="fa fa-check"></i>{" "}
6159
{approval !== "approved" ? "Approved" : "Approve"}
6260
</button>
6361
)}
6462

65-
{/* Deny Button */}
6663
{(approval === "not provided" || approval === "denied") && (
6764
<button
6865
className={`${styles.notificationdeny} ${
6966
approval === "denied" ? styles.active : ""
7067
}`}
7168
onClick={() => handleApprovalChange("denied")}
72-
disabled={approval === "denied"} // Disable if already denied
69+
disabled={approval === "denied"}
7370
>
7471
<i className="fa fa-times"></i>{" "}
7572
{approval === "denied" ? "Denied" : "Deny"}

packages/openneuro-app/src/scripts/users/user-notifications-view.tsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,43 +12,40 @@ import iconSaved from "../../assets/icon-saved.png"
1212
import iconArchived from "../../assets/icon-archived.png"
1313

1414
export const UserNotificationsView = ({ user }) => {
15-
const tabsRef = useRef(null)
15+
const tabsRef = useRef<HTMLUListElement | null>(null)
1616
const { tab = "unread" } = useParams()
1717
const navigate = useNavigate()
1818
const location = useLocation()
1919

20-
const [indicatorStyle, setIndicatorStyle] = useState({
20+
// Explicitly define the type of indicatorStyle
21+
const [indicatorStyle, setIndicatorStyle] = useState<React.CSSProperties>({
2122
width: "0px",
2223
transform: "translateX(0px)",
2324
position: "absolute",
24-
bottom: "0",
25+
bottom: "0px",
2526
height: "2px",
2627
backgroundColor: "#000",
2728
transition: "transform 0.3s ease, width 0.3s ease",
2829
})
2930

30-
// To store the active tab's offset
31-
const [activePosition, setActivePosition] = useState(0)
32-
3331
// Update the indicator position based on active tab whenever location changes
3432
useEffect(() => {
3533
const activeLink = tabsRef.current?.querySelector(`.${styles.active}`)
3634
if (activeLink) {
37-
const li = activeLink.parentElement
35+
const li = activeLink.parentElement as HTMLElement
3836
if (li) {
39-
setActivePosition(li.offsetLeft)
4037
setIndicatorStyle({
4138
width: `${li.offsetWidth}px`,
4239
transform: `translateX(${li.offsetLeft}px)`,
4340
position: "absolute",
44-
bottom: "0",
41+
bottom: "0px",
4542
height: "2px",
4643
backgroundColor: "#000",
4744
transition: "transform 0.3s ease, width 0.3s ease",
4845
})
4946
}
5047
}
51-
}, [location]) // Re-run whenever the location changes
48+
}, [location])
5249

5350
// Redirect to default tab if no tab is specified
5451
useEffect(() => {

0 commit comments

Comments
 (0)