feat: add hero banner (#463)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { appRouter as innerAppRouter } from "./router/app";
|
||||
import { boardRouter } from "./router/board";
|
||||
import { groupRouter } from "./router/group";
|
||||
import { homeRouter } from "./router/home";
|
||||
import { iconsRouter } from "./router/icons";
|
||||
import { integrationRouter } from "./router/integration";
|
||||
import { inviteRouter } from "./router/invite";
|
||||
@@ -21,6 +22,7 @@ export const appRouter = createTRPCRouter({
|
||||
location: locationRouter,
|
||||
log: logRouter,
|
||||
icon: iconsRouter,
|
||||
home: homeRouter,
|
||||
});
|
||||
|
||||
// export type definition of API
|
||||
|
||||
31
packages/api/src/router/home.ts
Normal file
31
packages/api/src/router/home.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { count } from "@homarr/db";
|
||||
import {
|
||||
apps,
|
||||
boards,
|
||||
groups,
|
||||
integrations,
|
||||
invites,
|
||||
users,
|
||||
} from "@homarr/db/schema/sqlite";
|
||||
|
||||
import { createTRPCRouter, protectedProcedure } from "../trpc";
|
||||
|
||||
export const homeRouter = createTRPCRouter({
|
||||
getStats: protectedProcedure.query(async ({ ctx }) => {
|
||||
return {
|
||||
countBoards:
|
||||
(await ctx.db.select({ count: count() }).from(boards))[0]?.count ?? 0,
|
||||
countUsers:
|
||||
(await ctx.db.select({ count: count() }).from(users))[0]?.count ?? 0,
|
||||
countGroups:
|
||||
(await ctx.db.select({ count: count() }).from(groups))[0]?.count ?? 0,
|
||||
countInvites:
|
||||
(await ctx.db.select({ count: count() }).from(invites))[0]?.count ?? 0,
|
||||
countIntegrations:
|
||||
(await ctx.db.select({ count: count() }).from(integrations))[0]
|
||||
?.count ?? 0,
|
||||
countApps:
|
||||
(await ctx.db.select({ count: count() }).from(apps))[0]?.count ?? 0,
|
||||
};
|
||||
}),
|
||||
});
|
||||
7
packages/common/src/array.ts
Normal file
7
packages/common/src/array.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export const splitToNChunks = <T>(array: T[], chunks: number): T[][] => {
|
||||
const result: T[][] = [];
|
||||
for (let i = chunks; i > 0; i--) {
|
||||
result.push(array.splice(0, Math.ceil(array.length / i)));
|
||||
}
|
||||
return result;
|
||||
};
|
||||
@@ -1,4 +1,5 @@
|
||||
export * from "./object";
|
||||
export * from "./string";
|
||||
export * from "./cookie";
|
||||
export * from "./array";
|
||||
export * from "./stopwatch";
|
||||
|
||||
@@ -1099,6 +1099,22 @@ export default {
|
||||
},
|
||||
},
|
||||
page: {
|
||||
home: {
|
||||
statistic: {
|
||||
countBoards: "Boards",
|
||||
createUser: "Create new user",
|
||||
createInvite: "Create new invite",
|
||||
addIntegration: "Create integration",
|
||||
addApp: "Add app",
|
||||
manageRoles: "Manage roles",
|
||||
},
|
||||
statisticLabel: {
|
||||
boards: "Boards",
|
||||
resources: "Resources",
|
||||
authentication: "Authentication",
|
||||
authorization: "Authorization",
|
||||
},
|
||||
},
|
||||
board: {
|
||||
title: "Your boards",
|
||||
action: {
|
||||
|
||||
Reference in New Issue
Block a user