-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4a2401c
commit b483e3f
Showing
15 changed files
with
341 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import type { DashboardLoaderData } from "~features/dashboard/pages/root/loader"; | ||
import type { Handle, LazyRoute } from "~features/routing/types"; | ||
import type { TrpcUtils } from "~utils/trpc"; | ||
|
||
export function loadDashboardRoute(trpcUtils: TrpcUtils): LazyRoute { | ||
return async () => { | ||
const { DashboardRoot, loaderBuilder } = await import( | ||
"~features/dashboard/pages/root" | ||
); | ||
|
||
return { | ||
loader: loaderBuilder(trpcUtils), | ||
Component: DashboardRoot, | ||
handle: { | ||
title: () => "Manifold | Dashboard", | ||
description: () => "Where it all begins.", | ||
} satisfies Handle<DashboardLoaderData>, | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import type { Params } from "react-router-dom"; | ||
import type { LazyRouteFunction, Params, RouteObject } from "react-router-dom"; | ||
|
||
export type Handle<Data = unknown> = { | ||
title?: (args: { params: Params; data: Data }) => string; | ||
description?: (args: { params: Params; data: Data }) => string; | ||
}; | ||
|
||
export type LazyRoute = LazyRouteFunction<RouteObject>; |
138 changes: 138 additions & 0 deletions
138
apps/web/src/features/table-version/components/compare-versions-dialog.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
import { useModal } from "@ebay/nice-modal-react"; | ||
import type { RouterOutput } from "@manifold/router"; | ||
import { ReactiveButton } from "@manifold/ui/components/reactive-button"; | ||
import { TableIdentifier } from "@manifold/ui/components/table-identifier"; | ||
import { Button } from "@manifold/ui/components/ui/button"; | ||
import { | ||
Drawer, | ||
DrawerClose, | ||
DrawerContent, | ||
DrawerDescription, | ||
DrawerFooter, | ||
DrawerHeader, | ||
DrawerTitle, | ||
} from "@manifold/ui/components/ui/drawer"; | ||
import { GoX } from "react-icons/go"; | ||
|
||
type Props = { | ||
dependency: RouterOutput["table"]["findDependencies"][number]; | ||
onAddDependency: () => void; | ||
canAddDependency: boolean; | ||
}; | ||
|
||
export function CompareVersionsDialog({ | ||
dependency, | ||
onAddDependency, | ||
canAddDependency, | ||
}: Props) { | ||
const modal = useModal(); | ||
|
||
return ( | ||
<Drawer | ||
open={modal.visible} | ||
onClose={() => modal.hide()} | ||
onAnimationEnd={() => modal.remove()} | ||
shouldScaleBackground | ||
// eslint-disable-next-line jsx-a11y/no-autofocus | ||
autoFocus | ||
> | ||
<DrawerContent> | ||
<div className="w-full flex-1 overflow-y-auto"> | ||
<div className="mx-auto w-full max-w-xl"> | ||
<DrawerHeader> | ||
<DrawerTitle className="my-16"> | ||
<TableIdentifier tableIdentifier={dependency.tableIdentifier} /> | ||
</DrawerTitle> | ||
|
||
<DrawerDescription className="sr-only"> | ||
{dependency.table?.description || "No table description"} | ||
</DrawerDescription> | ||
</DrawerHeader> | ||
|
||
<section className="px-16"> | ||
<dl className="mb-16 grid grid-cols-[min-content,_1fr] border-l border-t text-sm"> | ||
<dt className="border-b border-r px-10 py-8 font-semibold text-muted-foreground"> | ||
Description | ||
</dt> | ||
<dd className="border-b border-r px-10 py-8"> | ||
{dependency.table?.description || ( | ||
<em className="text-muted-foreground"> | ||
No table description | ||
</em> | ||
)} | ||
</dd> | ||
|
||
<dt className="border-b border-r px-10 py-8 font-semibold text-muted-foreground"> | ||
Last updated | ||
</dt> | ||
<dd className="border-b border-r px-10 py-8"> | ||
{dependency.createdAt.toLocaleDateString()} | ||
</dd> | ||
|
||
<dt className="border-b border-r px-10 py-8 font-semibold text-muted-foreground"> | ||
Version | ||
</dt> | ||
<dd className="border-b border-r px-10 py-8"> | ||
{dependency.version} | ||
</dd> | ||
|
||
<dt className="border-b border-r px-10 py-8 font-semibold text-muted-foreground"> | ||
Release notes | ||
</dt> | ||
<dd className="border-b border-r px-10 py-8"> | ||
{dependency.releaseNotes || ( | ||
<em className="text-muted-foreground">No release notes</em> | ||
)} | ||
</dd> | ||
<dt className="border-b border-r px-10 py-8 font-semibold text-muted-foreground"> | ||
Available Tables | ||
</dt> | ||
<dd className="flex flex-wrap gap-4 border-b border-r px-10 py-8"> | ||
{dependency.availableTables.map((tableId) => ( | ||
<code | ||
key={tableId} | ||
className="rounded bg-secondary p-3 px-6 text-xs leading-none text-accent-foreground" | ||
> | ||
{tableId} | ||
</code> | ||
))} | ||
</dd> | ||
</dl> | ||
|
||
<div className="rounded border"> | ||
<pre className="max-h-256 overflow-auto px-16 py-12 text-xs leading-tight"> | ||
{dependency.definition} | ||
</pre> | ||
</div> | ||
</section> | ||
|
||
<DrawerFooter> | ||
<ReactiveButton | ||
onClick={() => { | ||
modal.hide(); | ||
onAddDependency(); | ||
}} | ||
disabled={!canAddDependency} | ||
> | ||
{canAddDependency | ||
? "Add this dependency" | ||
: "Dependency already added"} | ||
</ReactiveButton> | ||
</DrawerFooter> | ||
</div> | ||
</div> | ||
|
||
<DrawerClose asChild> | ||
<Button | ||
size="icon" | ||
variant="ghost" | ||
className="absolute right-16 top-16" | ||
> | ||
<span className="sr-only">Dismiss drawer</span> | ||
<GoX /> | ||
</Button> | ||
</DrawerClose> | ||
</DrawerContent> | ||
</Drawer> | ||
); | ||
} |
Oops, something went wrong.