Bridge integration
This commit is contained in:
parent
42a5e09c94
commit
162390008b
56 changed files with 776 additions and 591 deletions
|
|
@ -0,0 +1,11 @@
|
|||
import { Create } from "bridge-ui";
|
||||
|
||||
type PageProps = {
|
||||
params: { segment: string[] };
|
||||
};
|
||||
|
||||
export default function Page({ params: { segment } }: PageProps) {
|
||||
const service = segment[0];
|
||||
|
||||
return <Create service={service} />;
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
import { db } from "bridge-common";
|
||||
import { serviceConfig, Detail } from "bridge-ui";
|
||||
|
||||
type Props = {
|
||||
params: { segment: string[] };
|
||||
};
|
||||
|
||||
export default async function Page({ params: { segment } }: Props) {
|
||||
const service = segment[0];
|
||||
const id = segment?.[1];
|
||||
|
||||
if (!id) return null;
|
||||
|
||||
const {
|
||||
[service]: { table },
|
||||
} = serviceConfig;
|
||||
|
||||
const row = await db
|
||||
.selectFrom(table)
|
||||
.selectAll()
|
||||
.where("id", "=", id)
|
||||
.executeTakeFirst();
|
||||
|
||||
if (!row) return null;
|
||||
|
||||
return <Detail service={service} row={row} />;
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
import { db } from "bridge-common";
|
||||
import { serviceConfig, Edit } from "bridge-ui";
|
||||
|
||||
type PageProps = {
|
||||
params: { segment: string[] };
|
||||
};
|
||||
|
||||
export default async function Page({ params: { segment } }: PageProps) {
|
||||
const service = segment[0];
|
||||
const id = segment?.[1];
|
||||
|
||||
if (!id) return null;
|
||||
|
||||
const {
|
||||
[service]: { table },
|
||||
} = serviceConfig;
|
||||
|
||||
const row = await db
|
||||
.selectFrom(table)
|
||||
.selectAll()
|
||||
.where("id", "=", id)
|
||||
.executeTakeFirst();
|
||||
|
||||
if (!row) return null;
|
||||
|
||||
return <Edit service={service} row={row} />;
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
import { ServiceLayout } from "bridge-ui";
|
||||
|
||||
export default ServiceLayout;
|
||||
22
apps/link/app/(main)/admin/bridge/[...segment]/page.tsx
Normal file
22
apps/link/app/(main)/admin/bridge/[...segment]/page.tsx
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import { db } from "bridge-common";
|
||||
import { serviceConfig, List } from "bridge-ui";
|
||||
|
||||
type PageProps = {
|
||||
params: {
|
||||
segment: string[];
|
||||
};
|
||||
};
|
||||
|
||||
export default async function Page({ params: { segment } }: PageProps) {
|
||||
const service = segment[0];
|
||||
|
||||
if (!service) return null;
|
||||
|
||||
const config = serviceConfig[service];
|
||||
|
||||
if (!config) return null;
|
||||
|
||||
const rows = await db.selectFrom(config.table).selectAll().execute();
|
||||
|
||||
return <List service={service} rows={rows} />;
|
||||
}
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
// import { Admin } from "./_components/Admin";
|
||||
import { Box } from "@mui/material";
|
||||
import { Home } from "bridge-ui";
|
||||
|
||||
export default function Page() {
|
||||
return <Box />;
|
||||
return <Home />;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue