style: auto-fix lint and format
This commit is contained in:
1 parent
b902f93a3c
commit
db31f880c2
4 files changed
+32
-37
No files matched your search
@@ -4,14 +4,12 @@ import { createOneIntegrationMiddleware } from "../../middlewares/integration";
|
|||||||
import { createTRPCRouter, publicProcedure } from "../../trpc";
|
import { createTRPCRouter, publicProcedure } from "../../trpc";
|
||||||
|
|
||||||
export const dawarichRouter = createTRPCRouter({
|
export const dawarichRouter = createTRPCRouter({
|
||||||
getStatistics: publicProcedure
|
getStatistics: publicProcedure.concat(createOneIntegrationMiddleware("query", "dawarich")).query(async ({ ctx }) => {
|
||||||
.concat(createOneIntegrationMiddleware("query", "dawarich"))
|
const { dawarichStatisticsRequestHandler } = await import("@homarr/request-handler/dawarich");
|
||||||
.query(async ({ ctx }) => {
|
const innerHandler = dawarichStatisticsRequestHandler.handler(ctx.integration, {});
|
||||||
const { dawarichStatisticsRequestHandler } = await import("@homarr/request-handler/dawarich");
|
const data = await innerHandler.getCachedOrUpdatedDataAsync({ forceUpdate: false });
|
||||||
const innerHandler = dawarichStatisticsRequestHandler.handler(ctx.integration, {});
|
return data.data;
|
||||||
const data = await innerHandler.getCachedOrUpdatedDataAsync({ forceUpdate: false });
|
}),
|
||||||
return data.data;
|
|
||||||
}),
|
|
||||||
|
|
||||||
getPlaces: publicProcedure
|
getPlaces: publicProcedure
|
||||||
.concat(createOneIntegrationMiddleware("query", "dawarich"))
|
.concat(createOneIntegrationMiddleware("query", "dawarich"))
|
||||||
@@ -26,4 +24,4 @@ export const dawarichRouter = createTRPCRouter({
|
|||||||
const { data } = await innerHandler.getCachedOrUpdatedDataAsync({ forceUpdate: false });
|
const { data } = await innerHandler.getCachedOrUpdatedDataAsync({ forceUpdate: false });
|
||||||
return data.slice(0, input.limit);
|
return data.slice(0, input.limit);
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
@@ -1,31 +1,31 @@
|
|||||||
import {z} from "zod/v4";
|
import { z } from "zod/v4";
|
||||||
|
|
||||||
export const dawarichStatisticsSchema = z.object({
|
export const dawarichStatisticsSchema = z.object({
|
||||||
totalDistanceKm: z.number(),
|
totalDistanceKm: z.number(),
|
||||||
totalPointsTracked: z.number(),
|
totalPointsTracked: z.number(),
|
||||||
totalReverseGeocodedPoints: z.number(),
|
totalReverseGeocodedPoints: z.number(),
|
||||||
totalCountriesVisited: z.number(),
|
totalCountriesVisited: z.number(),
|
||||||
totalCitiesVisited: z.number()
|
totalCitiesVisited: z.number(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const dawarichPlaceTagSchema = z.object({
|
export const dawarichPlaceTagSchema = z.object({
|
||||||
id: z.number(),
|
id: z.number(),
|
||||||
name: z.string(),
|
name: z.string(),
|
||||||
icon: z.string(),
|
icon: z.string(),
|
||||||
color: z.string()
|
color: z.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const dawarichPlaceSchema = z.object({
|
export const dawarichPlaceSchema = z.object({
|
||||||
id: z.number(),
|
id: z.number(),
|
||||||
name: z.string(),
|
name: z.string(),
|
||||||
latitude: z.number(),
|
latitude: z.number(),
|
||||||
longitude: z.number(),
|
longitude: z.number(),
|
||||||
source: z.string().optional(),
|
source: z.string().optional(),
|
||||||
icon: z.string().nullable(),
|
icon: z.string().nullable(),
|
||||||
color: z.string().nullable(),
|
color: z.string().nullable(),
|
||||||
visits_count: z.number(),
|
visits_count: z.number(),
|
||||||
created_at: z.string(),
|
created_at: z.string(),
|
||||||
tags: z.array(dawarichPlaceTagSchema)
|
tags: z.array(dawarichPlaceTagSchema),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const dawarichPlacesSchema = z.array(dawarichPlaceSchema);
|
export const dawarichPlacesSchema = z.array(dawarichPlaceSchema);
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { z } from "zod/v4";
|
import type { z } from "zod/v4";
|
||||||
import { dawarichPlacesSchema, dawarichStatisticsSchema } from "./dawarich-schemas";
|
import type { dawarichPlacesSchema, dawarichStatisticsSchema } from "./dawarich-schemas";
|
||||||
|
|
||||||
export type DawarichStatistics = z.infer<typeof dawarichStatisticsSchema>;
|
export type DawarichStatistics = z.infer<typeof dawarichStatisticsSchema>;
|
||||||
export type DawarichPlace = z.infer<typeof dawarichPlacesSchema>[number];
|
export type DawarichPlace = z.infer<typeof dawarichPlacesSchema>[number];
|
||||||
@@ -10,10 +10,7 @@ import { WidgetEmptyState } from "../common/empty-state";
|
|||||||
import type { WidgetComponentProps } from "../definition";
|
import type { WidgetComponentProps } from "../definition";
|
||||||
import classes from "./component.module.css";
|
import classes from "./component.module.css";
|
||||||
|
|
||||||
export default function DawarichPlacesWidget({
|
export default function DawarichPlacesWidget({ integrationIds, options }: WidgetComponentProps<"dawarichPlaces">) {
|
||||||
integrationIds,
|
|
||||||
options,
|
|
||||||
}: WidgetComponentProps<"dawarichPlaces">) {
|
|
||||||
const t = useI18n();
|
const t = useI18n();
|
||||||
const { data: places } = clientApi.widget.dawarich.getPlaces.useQuery(
|
const { data: places } = clientApi.widget.dawarich.getPlaces.useQuery(
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user