-
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
Showing
33 changed files
with
392 additions
and
313 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
20 changes: 20 additions & 0 deletions
20
...ple-app/app-vite-react/src/app/components/BoundarySuspenseGroup/BoundarySuspenseGroup.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,20 @@ | ||
import type { NavigationRouteProtectParam } from "@org/app-vite-react/server/route-typings"; | ||
|
||
import { LoaderSuspense } from "../LoaderSuspense"; | ||
import { Protect } from "../Protect"; | ||
import { QueryErrorBoundary } from "../QueryErrorBoundary"; | ||
|
||
export type BoundarySuspenseGroupProps = { | ||
protect?: NavigationRouteProtectParam; | ||
children: React.ReactNode; | ||
}; | ||
|
||
export function BoundarySuspenseGroup({ protect, children }: BoundarySuspenseGroupProps) { | ||
return ( | ||
<QueryErrorBoundary> | ||
<LoaderSuspense> | ||
<Protect protect={protect}>{children}</Protect> | ||
</LoaderSuspense> | ||
</QueryErrorBoundary> | ||
); | ||
} |
1 change: 1 addition & 0 deletions
1
packages/mern-sample-app/app-vite-react/src/app/components/BoundarySuspenseGroup/index.ts
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 @@ | ||
export * from "./BoundarySuspenseGroup"; |
13 changes: 13 additions & 0 deletions
13
packages/mern-sample-app/app-vite-react/src/app/components/Datatable/Datatable.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,13 @@ | ||
import { | ||
type ServerDatatableProps, | ||
type ClientDatatableProps, | ||
ClientDatatable, | ||
ServerDatatable, | ||
} from "./impl"; | ||
|
||
export type DatatableProps<T> = ServerDatatableProps<T> | ClientDatatableProps<T>; | ||
|
||
export function Datatable<T>(props: DatatableProps<T>) { | ||
if (props.sync) return <ClientDatatable {...props} />; | ||
return <ServerDatatable {...props} />; | ||
} |
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
14 changes: 3 additions & 11 deletions
14
...mern-sample-app/app-vite-react/src/app/components/Datatable/impl/ClientDatatable/types.ts
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,14 +1,6 @@ | ||
import type { DtBaseColumn } from "@org/app-vite-react/app/components/Datatable/types"; | ||
import type { DtBaseProps } from "@org/app-vite-react/app/components/Datatable/types"; | ||
|
||
export type DtClientColumnSort<T> = (o1: T, o2: T) => number; | ||
|
||
export type DtClientColumn<T> = DtBaseColumn<T> & { | ||
sort?: DtClientColumnSort<T>; | ||
}; | ||
|
||
export type ClientDatatableProps<T> = { | ||
data: T[]; | ||
columns: DtClientColumn<T>[]; | ||
export type ClientDatatableProps<T> = DtBaseProps<T, (o1: T, o2: T) => number> & { | ||
sync: true; | ||
disablePagination?: boolean; | ||
renderMobileRow: (item: T) => React.ReactNode; | ||
}; |
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
16 changes: 3 additions & 13 deletions
16
...mern-sample-app/app-vite-react/src/app/components/Datatable/impl/ServerDatatable/types.ts
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,16 +1,6 @@ | ||
import type { DtBaseColumn } from "@org/app-vite-react/app/components/Datatable/types"; | ||
import type { DtBaseProps } from "@org/app-vite-react/app/components/Datatable/types"; | ||
|
||
import { type PaginationOptions } from "@org/lib-api-client"; | ||
|
||
export type DtServerColumn<T> = DtBaseColumn<T> & { | ||
sort?: string; | ||
}; | ||
|
||
export type ServerDatatableProps<T> = { | ||
data: T[]; | ||
columns: DtServerColumn<T>[]; | ||
keyMapper: (value: T) => string; | ||
export type ServerDatatableProps<T> = DtBaseProps<T, string> & { | ||
sync?: false; | ||
count: number; | ||
paginationOptions: PaginationOptions; | ||
onPaginationOptionsChange: (paginationOptions: PaginationOptions) => void; | ||
}; |
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
16 changes: 16 additions & 0 deletions
16
packages/mern-sample-app/app-vite-react/src/app/components/LoaderSuspense/LoaderSuspense.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,16 @@ | ||
import * as mui from "@mui/material"; | ||
import { Suspense } from "react"; | ||
|
||
export function LoaderSuspense({ children }: React.PropsWithChildren) { | ||
return ( | ||
<Suspense | ||
fallback={ | ||
<mui.Box sx={{ textAlign: "center", padding: 3 }}> | ||
<mui.CircularProgress /> | ||
</mui.Box> | ||
} | ||
> | ||
{children} | ||
</Suspense> | ||
); | ||
} |
1 change: 1 addition & 0 deletions
1
packages/mern-sample-app/app-vite-react/src/app/components/LoaderSuspense/index.ts
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 @@ | ||
export * from "./LoaderSuspense"; |
Oops, something went wrong.