Skip to content

Commit bd710d7

Browse files
committed
Fixed TS errors
1 parent 63ab68c commit bd710d7

File tree

7 files changed

+37
-42
lines changed

7 files changed

+37
-42
lines changed

app/base-repo/(overview)/page.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ import RepositoryStatsSkeleton from "@/app/base-repo/components/Dashboard/Reposi
66
import {OverviewPage} from "@/components/OverviewPage/OverviewPage";
77
import {getServerSession, Session} from "next-auth";
88
import {authOptions} from "@/pages/api/auth/[...nextauth]";
9+
import {ActionCardProps} from "@/components/OverviewPage/ActionCard";
910

1011
export default async function Page() {
11-
const basePath: string = ((withBasePath && process.env.NEXT_PUBLIC_BASE_PATH) ? process.env.NEXT_PUBLIC_BASE_PATH : "");
12+
const basePath: string = (process.env.NEXT_PUBLIC_BASE_PATH) ? process.env.NEXT_PUBLIC_BASE_PATH : "";
1213
let session:Session | undefined = await getServerSession(authOptions) as Session;
1314

14-
const actions = [
15+
const actions:ActionCardProps[] = [
1516
{
1617
icon: "add",
1718
title: "Create Document",

app/mapping/(overview)/page.tsx

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,23 @@
11
import * as React from 'react';
2-
import {Suspense} from 'react';
3-
import Breadcrumbs from "@/components/Breadcrumbs/Breadcrumbs";
4-
import SectionCaption from "@/components/SectionCaption/SectionCaption";
5-
import MappingServiceStats from "@/app/mapping/components/Dashboard/MappingServiceStats";
6-
import MappingServiceStatsSkeleton from "@/app/mapping/components/Dashboard/MappingServiceStatsSkeleton";
72
import {getServerSession, Session} from "next-auth";
83
import {authOptions} from "@/pages/api/auth/[...nextauth]";
94
import {OverviewPage} from "@/components/OverviewPage/OverviewPage";
10-
import RepositoryStats from "@/app/base-repo/components/Dashboard/RepositoryStats";
11-
import RepositoryStatsSkeleton from "@/app/base-repo/components/Dashboard/RepositoryStatsSkeleton";
12-
import LatestActivities from "@/app/base-repo/components/Dashboard/LatestActivities";
13-
import LatestActivitiesSkeleton from "@/app/base-repo/components/Dashboard/LatestActivitiesSkeleton";
5+
import MappingServiceStats from "@/app/mapping/components/Dashboard/MappingServiceStats";
6+
import MappingServiceStatsSkeleton from "@/app/mapping/components/Dashboard/MappingServiceStatsSkeleton";
7+
import {ActionCardProps} from "@/components/OverviewPage/ActionCard";
148

159
export default async function Page() {
16-
const basePath: string = ((withBasePath && process.env.NEXT_PUBLIC_BASE_PATH) ? process.env.NEXT_PUBLIC_BASE_PATH : "");
10+
const basePath: string = (process.env.NEXT_PUBLIC_BASE_PATH) ? process.env.NEXT_PUBLIC_BASE_PATH : "";
1711
let session:Session | undefined = await getServerSession(authOptions) as Session;
1812

19-
const actions = [
13+
let actions:ActionCardProps[] =[
2014
{
21-
icon: "add",
22-
title: "Create Mapping",
23-
subtitle: "Start a new mapping",
24-
href: `${basePath}/mapping/map`,
25-
requiresAuth: true,
26-
}
15+
icon: "add",
16+
title: "Create Mapping",
17+
subtitle: "Start a new mapping",
18+
href: `${basePath}/mapping/map`,
19+
requiresAuth: true
20+
}
2721
];
2822

2923
const availableActions = actions.filter(action => {
@@ -36,8 +30,8 @@ export default async function Page() {
3630
breadcrumbs={[
3731
{label: "Overview", href: '/mapping', active: true}
3832
]}
39-
stats={<RepositoryStats />}
40-
statsFallback={<RepositoryStatsSkeleton />}
33+
stats={<MappingServiceStats />}
34+
statsFallback={<MappingServiceStatsSkeleton />}
4135
actions={availableActions}
4236
/>
4337
);

app/mapping/components/Dashboard/MappingServiceStats.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
'use client'
22

3-
import {DocumentDuplicateIcon, PlayIcon, PuzzlePieceIcon} from '@heroicons/react/24/outline';
4-
5-
import {StatusCard} from "@/components/StatusCard/StatusCard";
63
import {formatNumber} from "@/lib/general/format-utils";
74
import {fetchMappingPlugins, fetchMappings} from "@/lib/mapping/client-data";
85
import useMappingStore, {JobStore} from "@/app/mapping/components/MappingListing/MappingStore";
@@ -43,13 +40,12 @@ export default function MappingServiceStats() {
4340
]
4441

4542
return (
46-
<>
47-
{stats.map((stat, i) => {
48-
const Icon = stat.icon;
43+
<div className="grid grid-cols-1 sm:grid-cols-2 gap-2 sm:gap-3">
44+
{stats.map((stat, i) => {
4945
return (
5046
<InfoCard key={i} icon={stat.icon} value={stat.value} text={stat.text}/>
5147
);
5248
})}
53-
</>
49+
</div>
5450
);
5551
}

app/metastore/(overview)/page.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,15 @@ import LatestActivitiesSkeleton from "@/app/base-repo/components/Dashboard/Lates
44
import RepositoryStatsSkeleton from "@/app/base-repo/components/Dashboard/RepositoryStatsSkeleton";
55
import MetastoreStats from "@/app/metastore/components/Dashboard/MetastoreStats";
66
import {OverviewPage} from "@/components/OverviewPage/OverviewPage";
7+
import {getServerSession, Session} from "next-auth";
8+
import {authOptions} from "@/pages/api/auth/[...nextauth]";
9+
import {ActionCardProps} from "@/components/OverviewPage/ActionCard";
710

811
export default async function Page() {
9-
const actions = [
12+
const basePath: string = (process.env.NEXT_PUBLIC_BASE_PATH) ? process.env.NEXT_PUBLIC_BASE_PATH : "";
13+
let session:Session | undefined = await getServerSession(authOptions) as Session;
14+
15+
const actions:ActionCardProps[] = [
1016
{
1117
icon: "add",
1218
title: "Create Schema",

app/page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import SystemStats, {SystemStatsSkeleton} from "@/components/SystemStats/SystemS
66
import {authOptions} from "@/pages/api/auth/[...nextauth]";
77

88
export default async function Page() {
9+
const basePath: string = (process.env.NEXT_PUBLIC_BASE_PATH) ? process.env.NEXT_PUBLIC_BASE_PATH : "";
10+
911
let session:Session | undefined = undefined;
1012
let authError = false;
1113
try {
@@ -29,7 +31,7 @@ export default async function Page() {
2931
</div>
3032
<SectionCaption caption={"Status"} level={"h2"}/>
3133
<div
32-
className="grid justify-center gap-6 rounded-lg px-6 py-0 md:h-1/5 md:px-10 sm:grid-cols-2 lg:grid-cols-4">
34+
className="grid justify-center gap-12 rounded-lg px-6 py-0 md:h-1/5 md:px-10 sm:grid-cols-2 lg:grid-cols-4">
3335
<Suspense fallback={<SystemStatsSkeleton/>}>
3436
<SystemStats/>
3537
</Suspense>

components/OverviewPage/ActionCard.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ import Link from "next/link";
44
import {Icon} from "@iconify-icon/react";
55
import React from "react";
66

7-
type ActionCardProps = {
7+
export type ActionCardProps = {
88
icon: "add" | "list" | "upload" | "search"; // The icon name, e.g., plus
99
title: string; // main label
1010
subtitle?: string; // optional smaller text
1111
href: string; // ref
1212
className?: string;
13+
requiresAuth: boolean;
1314
};
1415

1516
const iconMap = {

components/OverviewPage/OverviewPage.tsx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
11
import SectionCaption from "@/components/SectionCaption/SectionCaption";
22
import Breadcrumbs from "@/components/Breadcrumbs/Breadcrumbs";
3-
import {Suspense} from "react";
4-
import {ActionCard} from "@/components/OverviewPage/ActionCard";
3+
import {ReactNode, Suspense} from "react";
4+
import {ActionCard, ActionCardProps} from "@/components/OverviewPage/ActionCard";
55

6-
type Action = {
7-
icon: string;
8-
title: string;
9-
subtitle?: string;
10-
href: string;
11-
};
126
type OverviewPageProps = {
137
breadcrumbs: { label: string; href: string; active?: boolean }[];
148
title: string;
159

1610
stats: ReactNode;
1711
statsFallback: ReactNode;
1812

19-
activities: ReactNode;
20-
activitiesFallback: ReactNode;
13+
activities?: ReactNode;
14+
activitiesFallback?: ReactNode;
2115

22-
actions: Action[];
16+
actions: ActionCardProps[];
2317
};
2418

2519
export function OverviewPage({
@@ -51,6 +45,7 @@ export function OverviewPage({
5145
subtitle={action.subtitle}
5246
href={action.href}
5347
className="w-full" // ensures every card fills its grid cell
48+
requiresAuth={action.requiresAuth}
5449
/>
5550
))}
5651
</div>

0 commit comments

Comments
 (0)