Skip to content

Commit

Permalink
Merge pull request meshtastic#216 from Hunter275/issue-215-battery-le…
Browse files Browse the repository at this point in the history
…vel-display

add battery and voltage to sidebar
  • Loading branch information
thebentern authored Jun 15, 2024
2 parents 9d2084b + 87f8288 commit af6a418
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {
MessageSquareIcon,
SettingsIcon,
UsersIcon,
ZapIcon,
BatteryMediumIcon
} from "lucide-react";

export interface SidebarProps {
Expand Down Expand Up @@ -58,7 +60,7 @@ export const Sidebar = ({ children }: SidebarProps): JSX.Element => {

return (
<div className="min-w-[280px] max-w-min flex-col overflow-y-auto border-r-[0.5px] border-slate-300 bg-transparent dark:border-slate-700">
<div className="flex justify-between px-8 py-6">
<div className="flex justify-between px-8 pt-6">
<div>
<span className="text-lg font-medium">
{myNode?.user?.shortName ?? "UNK"}
Expand All @@ -73,6 +75,16 @@ export const Sidebar = ({ children }: SidebarProps): JSX.Element => {
<EditIcon size={16} />
</button>
</div>
<div className="px-8 pb-6">
<div className="flex items-center">
<BatteryMediumIcon size={24} viewBox={'0 0 28 24'}/>
<Subtle>{myNode?.deviceMetrics?.batteryLevel ?? "UNK"}%</Subtle>
</div>
<div className="flex items-center">
<ZapIcon size={24} viewBox={'0 0 36 24'}/>
<Subtle>{myNode?.deviceMetrics?.voltage.toPrecision(3) ?? "UNK"} volts</Subtle>
</div>
</div>

<SidebarSection label="Navigation">
{pages.map((link) => (
Expand Down

0 comments on commit af6a418

Please sign in to comment.