Skip to content

Commit 242ae5f

Browse files
authored
Merge pull request #20 from Solar-Gators/az/time-display
refactor: fixed derived values time display and date selector
2 parents 9fe25cb + 1ec1d55 commit 242ae5f

5 files changed

Lines changed: 29 additions & 11 deletions

File tree

components/pages/StatsGraphTab.tsx

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -753,14 +753,17 @@ export default function StatsGraphTab() {
753753
<div className="flex flex-col gap-3">
754754
<Input
755755
type="time"
756-
id="time-picker"
756+
id="time-picker-start"
757757
step="1"
758758
defaultValue="01:00:00"
759-
onChange={(time) => {
760-
startDate?.setHours(parseInt(time.target.value.split(":")[0]));
761-
startDate?.setMinutes(
762-
parseInt(time.target.value.split(":")[1]),
763-
);
759+
onChange={(e) => {
760+
if (startDate) {
761+
const newDate = new Date(startDate);
762+
const [hours, minutes] = e.target.value.split(":");
763+
newDate.setHours(parseInt(hours));
764+
newDate.setMinutes(parseInt(minutes));
765+
setStartDate(newDate);
766+
}
764767
}}
765768
className="bg-background appearance-none [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none"
766769
/>
@@ -798,9 +801,18 @@ export default function StatsGraphTab() {
798801
<div className="flex flex-col gap-3">
799802
<Input
800803
type="time"
801-
id="time-picker"
804+
id="time-picker-end"
802805
step="1"
803806
defaultValue="01:00:00"
807+
onChange={(e) => {
808+
if (endDate) {
809+
const newDate = new Date(endDate);
810+
const [hours, minutes] = e.target.value.split(":");
811+
newDate.setHours(parseInt(hours));
812+
newDate.setMinutes(parseInt(minutes));
813+
setEndDate(newDate);
814+
}
815+
}}
804816
className="bg-background appearance-none [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none"
805817
/>
806818
</div>

components/ui/badge.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ const badgeVariants = cva(
2424
);
2525

2626
export interface BadgeProps
27-
extends React.HTMLAttributes<HTMLDivElement>,
27+
extends
28+
React.HTMLAttributes<HTMLDivElement>,
2829
VariantProps<typeof badgeVariants> {}
2930

3031
function Badge({ className, variant, ...props }: BadgeProps) {

components/ui/button.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ const buttonVariants = cva(
3434
);
3535

3636
export interface ButtonProps
37-
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
37+
extends
38+
React.ButtonHTMLAttributes<HTMLButtonElement>,
3839
VariantProps<typeof buttonVariants> {
3940
asChild?: boolean;
4041
}

components/ui/sheet.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ const sheetVariants = cva(
5050
);
5151

5252
interface SheetContentProps
53-
extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,
53+
extends
54+
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,
5455
VariantProps<typeof sheetVariants> {}
5556

5657
const SheetContent = React.forwardRef<

lib/db-utils.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,10 @@ export async function fetchTelemetryDataInRange(
172172
}
173173
}
174174

175-
return mapTelemetryData<number>(transformedRow);
175+
return {
176+
...mapTelemetryData<number>(transformedRow),
177+
created_at: transformedRow.created_at,
178+
};
176179
});
177180
} catch (error) {
178181
console.error("Error fetching telemetry data in range:", error);

0 commit comments

Comments
 (0)