Skip to content

Commit 3934715

Browse files
committed
wip: book entity
1 parent cff9d1f commit 3934715

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+383
-407
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Autogenerated file, DO NOT MODIFY or it will be overwritten;
2+
import * as React from 'react';
3+
import type { SVGProps } from 'react';
4+
const Svg = (props: SVGProps<SVGSVGElement>) => (
5+
<svg
6+
xmlns="http://www.w3.org/2000/svg"
7+
width="1em"
8+
height="1em"
9+
viewBox="0 0 256 256"
10+
{...props}
11+
>
12+
<path d="M232 48h-72a40 40 0 0 0-32 16 40 40 0 0 0-32-16H24a8 8 0 0 0-8 8v144a8 8 0 0 0 8 8h72a24 24 0 0 1 24 24 8 8 0 0 0 16 0 24 24 0 0 1 24-24h72a8 8 0 0 0 8-8V56a8 8 0 0 0-8-8M96 192H32V64h64a24 24 0 0 1 24 24v112a39.8 39.8 0 0 0-24-8m128 0h-64a39.8 39.8 0 0 0-24 8V88a24 24 0 0 1 24-24h64Z" />
13+
</svg>
14+
);
15+
const IconBookOpen = (props: SVGProps<SVGSVGElement>) => {
16+
return <Svg fill="currentColor" {...props} width="1em" height="1em" />;
17+
};
18+
export default IconBookOpen;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Autogenerated file, DO NOT MODIFY or it will be overwritten;
2+
import * as React from 'react';
3+
import type { SVGProps } from 'react';
4+
const Svg = (props: SVGProps<SVGSVGElement>) => (
5+
<svg
6+
xmlns="http://www.w3.org/2000/svg"
7+
width="1em"
8+
height="1em"
9+
viewBox="0 0 256 256"
10+
{...props}
11+
>
12+
<path
13+
d="M232 56v144h-72a32 32 0 0 0-32 32 32 32 0 0 0-32-32H24V56h72a32 32 0 0 1 32 32 32 32 0 0 1 32-32Z"
14+
opacity={0.2}
15+
/>
16+
<path d="M232 48h-72a40 40 0 0 0-32 16 40 40 0 0 0-32-16H24a8 8 0 0 0-8 8v144a8 8 0 0 0 8 8h72a24 24 0 0 1 24 24 8 8 0 0 0 16 0 24 24 0 0 1 24-24h72a8 8 0 0 0 8-8V56a8 8 0 0 0-8-8M96 192H32V64h64a24 24 0 0 1 24 24v112a39.8 39.8 0 0 0-24-8m128 0h-64a39.8 39.8 0 0 0-24 8V88a24 24 0 0 1 24-24h64Z" />
17+
</svg>
18+
);
19+
const IconBookOpenDuotone = (props: SVGProps<SVGSVGElement>) => {
20+
return <Svg fill="currentColor" {...props} width="1em" height="1em" />;
21+
};
22+
export default IconBookOpenDuotone;
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Autogenerated file, DO NOT MODIFY or it will be overwritten;
2+
import * as React from 'react';
3+
import type { SVGProps } from 'react';
4+
const Svg = (props: SVGProps<SVGSVGElement>) => (
5+
<svg
6+
xmlns="http://www.w3.org/2000/svg"
7+
width="1em"
8+
height="1em"
9+
viewBox="0 0 256 256"
10+
{...props}
11+
>
12+
<path d="M240 56v144a8 8 0 0 1-8 8h-72a24 24 0 0 0-24 23.94 7.9 7.9 0 0 1-5.12 7.55A8 8 0 0 1 120 232a24 24 0 0 0-24-24H24a8 8 0 0 1-8-8V56a8 8 0 0 1 8-8h64a32 32 0 0 1 32 32v87.73a8.17 8.17 0 0 0 7.47 8.25 8 8 0 0 0 8.53-8V80a32 32 0 0 1 32-32h64a8 8 0 0 1 8 8" />
13+
</svg>
14+
);
15+
const IconBookOpenFill = (props: SVGProps<SVGSVGElement>) => {
16+
return <Svg fill="currentColor" {...props} width="1em" height="1em" />;
17+
};
18+
export default IconBookOpenFill;

app/components/icons/generated/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
export { default as IconBookOpenDuotone } from './IconBookOpenDuotone';
2+
export { default as IconBookOpenFill } from './IconBookOpenFill';
3+
export { default as IconBookOpen } from './IconBookOpen';
14
export { default as IconGitBranchDuotone } from './IconGitBranchDuotone';
25
export { default as IconGitBranchFill } from './IconGitBranchFill';
36
export { default as IconGitBranch } from './IconGitBranch';
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading

app/features/repository/app/page-repository.tsx renamed to app/features/book/app/page-book.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@ import {
1818
PageLayoutTopBarTitle,
1919
} from '@/layout/app/page-layout';
2020

21-
export const PageRepository = (props: { params: { id: string } }) => {
22-
const repository = useQuery(
23-
orpc.repository.getById.queryOptions({ input: { id: props.params.id } })
21+
export const PageBook = (props: { params: { id: string } }) => {
22+
const bookQuery = useQuery(
23+
orpc.book.getById.queryOptions({ input: { id: props.params.id } })
2424
);
2525

2626
const ui = getUiState((set) => {
27-
if (repository.status === 'pending') return set('pending');
27+
if (bookQuery.status === 'pending') return set('pending');
2828
if (
29-
repository.status === 'error' &&
30-
repository.error instanceof ORPCError &&
31-
repository.error.code === 'NOT_FOUND'
29+
bookQuery.status === 'error' &&
30+
bookQuery.error instanceof ORPCError &&
31+
bookQuery.error.code === 'NOT_FOUND'
3232
)
3333
return set('not-found');
34-
if (repository.status === 'error') return set('error');
35-
return set('default', { repository: repository.data });
34+
if (bookQuery.status === 'error') return set('error');
35+
return set('default', { book: bookQuery.data });
3636
});
3737

3838
return (
@@ -53,7 +53,7 @@ export const PageRepository = (props: { params: { id: string } }) => {
5353
.match(['not-found', 'error'], () => (
5454
<AlertCircleIcon className="size-4 text-muted-foreground" />
5555
))
56-
.match('default', ({ repository }) => <>{repository.name}</>)
56+
.match('default', ({ book }) => <>{book.title}</>)
5757
.exhaustive()}
5858
</PageLayoutTopBarTitle>
5959
</PageLayoutTopBar>
@@ -62,7 +62,7 @@ export const PageRepository = (props: { params: { id: string } }) => {
6262
.match('pending', () => <Spinner full />)
6363
.match('not-found', () => <PageError error="404" />)
6464
.match('error', () => <PageError />)
65-
.match('default', ({ repository }) => <>{repository.name}</>)
65+
.match('default', ({ book }) => <>{book.title}</>)
6666
.exhaustive()}
6767
</PageLayoutContent>
6868
</PageLayout>

app/features/repository/app/page-repositories.tsx renamed to app/features/book/app/page-books.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import {
1414
PageLayoutTopBarTitle,
1515
} from '@/layout/app/page-layout';
1616

17-
export const PageRepositories = () => {
18-
const repositoriesQuery = useInfiniteQuery(
19-
orpc.repository.getAll.infiniteOptions({
17+
export const PageBooks = () => {
18+
const booksQuery = useInfiniteQuery(
19+
orpc.book.getAll.infiniteOptions({
2020
input: (cursor: string | undefined) => ({
2121
cursor,
2222
}),
@@ -27,41 +27,41 @@ export const PageRepositories = () => {
2727
);
2828

2929
const ui = getUiState((set) => {
30-
if (repositoriesQuery.status === 'pending') return set('pending');
31-
if (repositoriesQuery.status === 'error') return set('error');
30+
if (booksQuery.status === 'pending') return set('pending');
31+
if (booksQuery.status === 'error') return set('error');
3232

33-
const items = repositoriesQuery.data?.pages.flatMap((p) => p.items) ?? [];
33+
const items = booksQuery.data?.pages.flatMap((p) => p.items) ?? [];
3434
if (!items.length) return set('empty');
3535
return set('default', { items });
3636
});
3737

3838
return (
3939
<PageLayout>
4040
<PageLayoutTopBar>
41-
<PageLayoutTopBarTitle>Repositories</PageLayoutTopBarTitle>
41+
<PageLayoutTopBarTitle>Books</PageLayoutTopBarTitle>
4242
</PageLayoutTopBar>
4343
<PageLayoutContent>
4444
{ui
4545
.match('pending', () => <>Loading...</>)
4646
.match('error', () => <PageError />)
47-
.match('empty', () => <>No repo</>)
47+
.match('empty', () => <>No books</>)
4848
.match('default', ({ items }) => (
4949
<>
5050
{items.map((item) => (
5151
<Link
5252
key={item.id}
53-
to="/app/repositories/$id"
53+
to="/app/books/$id"
5454
params={{ id: item.id }}
5555
>
56-
Repo: {item.name}
56+
Repo: {item.title}
5757
</Link>
5858
))}
59-
{repositoriesQuery.hasNextPage && (
59+
{booksQuery.hasNextPage && (
6060
<Button
6161
size="sm"
6262
variant="link"
63-
onClick={() => repositoriesQuery.fetchNextPage()}
64-
loading={repositoriesQuery.isFetchingNextPage}
63+
onClick={() => booksQuery.fetchNextPage()}
64+
loading={booksQuery.isFetchingNextPage}
6565
>
6666
Load more
6767
</Button>

app/features/repository/manager/page-repository.tsx renamed to app/features/book/manager/page-book.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,21 @@ import {
1919
PageLayoutTopBarTitle,
2020
} from '@/layout/manager/page-layout';
2121

22-
export const PageRepository = (props: { params: { id: string } }) => {
23-
const repositoryQuery = useQuery(
24-
orpc.repository.getById.queryOptions({ input: { id: props.params.id } })
22+
export const PageBook = (props: { params: { id: string } }) => {
23+
const bookQuery = useQuery(
24+
orpc.book.getById.queryOptions({ input: { id: props.params.id } })
2525
);
2626

2727
const ui = getUiState((set) => {
28-
if (repositoryQuery.status === 'pending') return set('pending');
28+
if (bookQuery.status === 'pending') return set('pending');
2929
if (
30-
repositoryQuery.status === 'error' &&
31-
repositoryQuery.error instanceof ORPCError &&
32-
repositoryQuery.error.code === 'NOT_FOUND'
30+
bookQuery.status === 'error' &&
31+
bookQuery.error instanceof ORPCError &&
32+
bookQuery.error.code === 'NOT_FOUND'
3333
)
3434
return set('not-found');
35-
if (repositoryQuery.status === 'error') return set('error');
36-
return set('default', { repository: repositoryQuery.data });
35+
if (bookQuery.status === 'error') return set('error');
36+
return set('default', { book: bookQuery.data });
3737
});
3838

3939
return (
@@ -58,7 +58,7 @@ export const PageRepository = (props: { params: { id: string } }) => {
5858
.match(['not-found', 'error'], () => (
5959
<AlertCircleIcon className="size-4 text-muted-foreground" />
6060
))
61-
.match('default', ({ repository }) => <>{repository.name}</>)
61+
.match('default', ({ book }) => <>{book.title}</>)
6262
.exhaustive()}
6363
</PageLayoutTopBarTitle>
6464
</PageLayoutTopBar>
@@ -67,7 +67,7 @@ export const PageRepository = (props: { params: { id: string } }) => {
6767
.match('pending', () => <Spinner full />)
6868
.match('not-found', () => <PageError error="404" />)
6969
.match('error', () => <PageError />)
70-
.match('default', ({ repository }) => <>{repository.name}</>)
70+
.match('default', ({ book }) => <>{book.title}</>)
7171
.exhaustive()}
7272
</PageLayoutContent>
7373
</PageLayout>

0 commit comments

Comments
 (0)