Skip to content

Commit

Permalink
chore: changed the way to set visual cues in BattereryIndicator
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagohernandez committed Aug 25, 2023
1 parent 258addc commit 94709a4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
16 changes: 8 additions & 8 deletions src/renderer/component/Battery/BatteryStatusSide.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,13 @@ const BatteryStatusSide: React.FC<BatteryStatusSideProps> = ({ side, batteryLeve
// console.log("batteryStatus", batteryStatus);
switch (batteryStatus) {
case 0:
setSideStatus("status--default");
if (batteryLevel > 10 && batteryLevel < 20 && !isSavingMode) {
setSideStatus("status--warning");
} else if (batteryLevel <= 10 && !isSavingMode) {
setSideStatus("status--critical");
} else {
setSideStatus("status--default");
}
break;
case 1:
setSideStatus("status--charging");
Expand All @@ -253,13 +259,7 @@ const BatteryStatusSide: React.FC<BatteryStatusSideProps> = ({ side, batteryLeve
default:
setSideStatus("status--fatal-error");
}
if (batteryLevel > 10 && batteryLevel < 20 && !isSavingMode && batteryStatus === 0) {
setSideStatus("status--warning");
}
if (batteryLevel < 10 && !isSavingMode && batteryStatus === 0) {
setSideStatus("status--critical");
}
}, [size, batteryLevel, batteryStatus, isSavingMode]);
}, [batteryLevel, batteryStatus, isSavingMode]);

if (loading) return null;
return (
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/component/Battery/PileIndicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const PileIndicator = ({ batteryLevel, batteryStatus }: PileIndicatorProps) => {
useEffect(() => {
switch (batteryStatus) {
case 0:
if (batteryLevel < 5) {
if (batteryLevel <= 5) {
setBatteryWidth(1);
} else {
setBatteryWidth((16 * batteryLevel) / 100);
Expand Down
14 changes: 14 additions & 0 deletions src/renderer/component/Select/SelectSuperKeyCustomDropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,20 @@ width: 100%;
height: 142px;
overflow-y: auto;
}
@media (max-width: 980px) {
.custom-dropdown {
.dropdownItem {
overflow: initial;
position: relative;
}
.badge.badge-primary {
font-size: 7px;
position: absolute;
top: -6px;
margin-left: -3px;
}
}
}
`;

class SelectSuperKeyCustomDropdown extends Component {
Expand Down

0 comments on commit 94709a4

Please # to comment.