Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions app/components/device-detail/device-detail-box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -526,12 +526,11 @@ export default function DeviceDetailBox() {
: "h-2 w-2 rounded-full bg-red-500"
}
></div>
<p className="text-xs text-muted-foreground">
{formatDistanceToNow(
new Date(sensor.time),
)}{" "}
ago
</p>
<p className="text-xs text-muted-foreground">
{sensor.time
? `${formatDistanceToNow(new Date(sensor.time), { addSuffix: true })}`
: "No recent data"}
</p>
</div>
</CardFooter>
</label>
Expand Down Expand Up @@ -593,12 +592,11 @@ export default function DeviceDetailBox() {
: "h-2 w-2 rounded-full bg-red-500"
}
></div>
<p className="text-xs text-muted-foreground">
{formatDistanceToNow(
new Date(sensor.time),
)}{" "}
ago
</p>
<p className="text-xs text-muted-foreground">
{sensor.time
? `${formatDistanceToNow(new Date(sensor.time), { addSuffix: true })}`
: "No recent data"}
</p>
</div>
</CardFooter>
</label>
Expand Down
2 changes: 1 addition & 1 deletion app/models/sensor.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export async function getSensorsWithLastMeasurement(
const ret = {
...r,
lastMeasurement:
(r as any)["lastMeasurements"]["measurements"][0] ?? null,
(r as any)["lastMeasurements"]?.[0] ?? null,
} as any;
if (count === 1) delete ret["lastMeasurements"];
return ret;
Expand Down
22 changes: 12 additions & 10 deletions app/routes/profile.$username.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export async function loader({ params, request }: LoaderFunctionArgs) {
) {
return redirect('/explore')
} else {
// const profileMail = profile?.user?.email || ''
const profileMail = profile?.user?.email || ''
// Get the access token using the getMyBadgesAccessToken function
// const authToken = await getMyBadgesAccessToken().then((authData) => {
// return authData.access_token;
Expand Down Expand Up @@ -71,15 +71,17 @@ export default function () {
<div className="flex w-full flex-col gap-6 p-8 md:flex-row md:gap-8 md:pt-4">
<div className="flex w-full flex-col gap-6 rounded-xl bg-white p-6 shadow-lg dark:bg-dark-background md:w-1/3">
<div className="flex items-center gap-4 dark:text-dark-text">
<Avatar className="h-16 w-16">
<AvatarImage
className="aspect-auto h-full w-full rounded-full object-cover"
src={'/resources/file/' + profile?.profileImage?.id}
/>
<AvatarFallback>
{getInitials(profile?.username ?? '')}
</AvatarFallback>
</Avatar>
<Avatar className="h-16 w-16">
{profile?.profileImage?.id ? (
<AvatarImage
className="aspect-auto w-full h-full rounded-full object-cover"
src={`/resources/file/${profile.profileImage.id}`}
/>
) : null}
<AvatarFallback>
{getInitials(profile?.username ?? '')}
</AvatarFallback>
</Avatar>
<div>
<h3 className="text-2xl font-semibold dark:text-dark-text">
{profile?.user?.name || ''}
Expand Down
Loading