add more resource columns and add org list to landing page for testing
This commit is contained in:
parent
57ba84eb02
commit
e40328aeb7
5 changed files with 58 additions and 6 deletions
|
@ -40,8 +40,8 @@ export function TopbarNav({
|
||||||
className={cn(
|
className={cn(
|
||||||
"px-2 py-3 text-md",
|
"px-2 py-3 text-md",
|
||||||
pathname.startsWith(item.href.replace("{orgId}", orgId))
|
pathname.startsWith(item.href.replace("{orgId}", orgId))
|
||||||
? "border-b-2 border-secondary text-secondary font-medium"
|
? "border-b-2 border-primary text-primary font-medium"
|
||||||
: "hover:secondary-primary text-muted-foreground font-medium",
|
: "hover:text-primary text-muted-foreground font-medium",
|
||||||
"whitespace-nowrap",
|
"whitespace-nowrap",
|
||||||
disabled && "cursor-not-allowed",
|
disabled && "cursor-not-allowed",
|
||||||
)}
|
)}
|
||||||
|
@ -51,9 +51,7 @@ export function TopbarNav({
|
||||||
>
|
>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
{item.icon && (
|
{item.icon && (
|
||||||
<div className="hidden md:block">
|
<div className="hidden md:block">{item.icon}</div>
|
||||||
{item.icon}
|
|
||||||
</div>
|
|
||||||
)}
|
)}
|
||||||
{item.title}
|
{item.title}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -17,6 +17,8 @@ export type ResourceRow = {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
orgId: string;
|
orgId: string;
|
||||||
|
domain: string;
|
||||||
|
site: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const columns: ColumnDef<ResourceRow>[] = [
|
export const columns: ColumnDef<ResourceRow>[] = [
|
||||||
|
@ -36,6 +38,26 @@ export const columns: ColumnDef<ResourceRow>[] = [
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "site",
|
||||||
|
header: ({ column }) => {
|
||||||
|
return (
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
onClick={() =>
|
||||||
|
column.toggleSorting(column.getIsSorted() === "asc")
|
||||||
|
}
|
||||||
|
>
|
||||||
|
Site
|
||||||
|
<ArrowUpDown className="ml-2 h-4 w-4" />
|
||||||
|
</Button>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "domain",
|
||||||
|
header: "Domain",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: "actions",
|
id: "actions",
|
||||||
cell: ({ row }) => {
|
cell: ({ row }) => {
|
||||||
|
|
|
@ -25,6 +25,8 @@ export default async function Page({ params }: ResourcesPageProps) {
|
||||||
id: resource.resourceId.toString(),
|
id: resource.resourceId.toString(),
|
||||||
name: resource.name,
|
name: resource.name,
|
||||||
orgId: params.orgId,
|
orgId: params.orgId,
|
||||||
|
domain: resource.subdomain || "",
|
||||||
|
site: resource.siteName || "None",
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ type AuthLayoutProps = {
|
||||||
export default async function AuthLayout({ children }: AuthLayoutProps) {
|
export default async function AuthLayout({ children }: AuthLayoutProps) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="mt-32">
|
<div className="p-3 md:mt-32">
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
|
import { internal } from "@app/api";
|
||||||
|
import { authCookieHeader } from "@app/api/cookies";
|
||||||
import { verifySession } from "@app/lib/auth/verifySession";
|
import { verifySession } from "@app/lib/auth/verifySession";
|
||||||
import { LandingProvider } from "@app/providers/LandingProvider";
|
import { LandingProvider } from "@app/providers/LandingProvider";
|
||||||
|
import { ListOrgsResponse } from "@server/routers/org";
|
||||||
|
import { AxiosResponse } from "axios";
|
||||||
|
import { ArrowUpLeft, ArrowUpRight } from "lucide-react";
|
||||||
|
import Link from "next/link";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
|
@ -9,11 +15,35 @@ export default async function Page() {
|
||||||
redirect("/auth/login");
|
redirect("/auth/login");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let orgs: ListOrgsResponse["orgs"] = [];
|
||||||
|
try {
|
||||||
|
const res = await internal.get<AxiosResponse<ListOrgsResponse>>(
|
||||||
|
`/orgs`,
|
||||||
|
authCookieHeader(),
|
||||||
|
);
|
||||||
|
if (res && res.data.data.orgs) {
|
||||||
|
orgs = res.data.data.orgs;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error("Error fetching orgs", e);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<LandingProvider user={user}>
|
<LandingProvider user={user}>
|
||||||
<p>Logged in as {user.email}</p>
|
<p>Logged in as {user.email}</p>
|
||||||
</LandingProvider>
|
</LandingProvider>
|
||||||
|
|
||||||
|
<div className="mt-4">
|
||||||
|
{orgs.map((org) => (
|
||||||
|
<Link key={org.orgId} href={`/${org.orgId}`} className="text-primary underline">
|
||||||
|
<div className="flex items-center">
|
||||||
|
{org.name}
|
||||||
|
<ArrowUpRight className="w-4 h-4"/>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue