-
Notifications
You must be signed in to change notification settings - Fork 11
Add [Open Library] & Library Work Flow #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dethan3
wants to merge
11
commits into
Open-Source-Bazaar:main
Choose a base branch
from
dethan3:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
74174bd
library flow
dethan3 07745ad
[feat] Initial open-library homepage, component & hook fix
dethan3 e10b0b1
feat: customize Open Library layout and styling
dethan3 69dbf8b
fix: resolve import sorting and TS annotation issues
dethan3 a72c2ee
feat: implement Open Library basic framework with multilingual support
dethan3 23870d8
fix: replace <a> tags with Next.js <Link> components and fix TypeScri…
dethan3 99320ce
feat: Complete MVP layout improvements
dethan3 08d2e72
Merge upstream/main and resolve conflicts
dethan3 18e9c84
Merge remote-tracking branch 'upstream/main'
dethan3 5ccc58c
Merge remote-tracking branch 'upstream/main'
dethan3 73f74ab
refactor(open-library): address PR #20 review — i18n, types, mixin fixes
dethan3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -13,5 +13,5 @@ jobs: | |
|
|
||
| - uses: OWASP/cve-lite-cli@v1 | ||
| with: | ||
| verbose: "true" | ||
| verbose: 'true' | ||
| fail-on: high | ||
This file contains hidden or 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 +1 @@ | ||
| npm test | ||
| npm test |
This file contains hidden or 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 +1 @@ | ||
| npm run build | ||
| npm run build |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,89 @@ | ||
| import Link from 'next/link'; | ||
| import { observer } from 'mobx-react'; | ||
| import { FC, useContext } from 'react'; | ||
| import { Badge, Button, Card, CardProps } from 'react-bootstrap'; | ||
|
|
||
| export type { Book } from '../../models/Book'; | ||
| import type { Book } from '../../models/Book'; | ||
| import { I18nContext } from '../../models/Translation'; | ||
|
|
||
| export interface BookCardProps extends CardProps { | ||
| book: Book; | ||
| showStatus?: boolean; | ||
| variant?: 'featured' | 'catalog'; | ||
| } | ||
|
|
||
| export const BookCard: FC<BookCardProps> = observer(({ | ||
| className = '', | ||
| book, | ||
| showStatus = false, | ||
| variant = 'featured', | ||
| ...cardProps | ||
| }) => { | ||
| const isFeatured = variant === 'featured'; | ||
|
|
||
| const { t } = useContext(I18nContext); | ||
|
|
||
| return ( | ||
| <Card className={`border-0 shadow${isFeatured ? '-sm' : ''} ${className}`} {...cardProps}> | ||
| <div className="text-center p-3 position-relative"> | ||
| {showStatus && ( | ||
| <div className="position-absolute top-0 end-0 m-2"> | ||
| <Badge | ||
| bg={book.status === 'available' ? 'success' : 'warning'} | ||
| text={book.status === 'available' ? undefined : 'dark'} | ||
| > | ||
| {book.status === 'available' ? t('available') : t('borrowed')} | ||
| </Badge> | ||
| </div> | ||
| )} | ||
| <div className="p-3"> | ||
| <Card.Img | ||
| variant="top" | ||
| src={book.cover || '/images/placeholder-book.svg'} | ||
| alt={`${book.title} ${t('book_cover')}`} | ||
| className="rounded bg-light" | ||
| style={{ | ||
| height: '180px', | ||
| objectFit: 'contain', | ||
| padding: '10px', | ||
| }} | ||
| /> | ||
| </div> | ||
| </div> | ||
| <Card.Body className="text-center d-flex flex-column p-3"> | ||
| <Card.Title | ||
| className="fw-bold h6 mb-2 text-truncate" | ||
| title={book.title} | ||
| > | ||
| {book.title} | ||
| </Card.Title> | ||
| <Card.Text | ||
| className="text-muted small mb-2 text-truncate" | ||
| title={book.author} | ||
| > | ||
| {book.author} | ||
| </Card.Text> | ||
| {book.category && ( | ||
| <Card.Text className="text-muted small mb-3"> | ||
| 🏷️ {book.category} | ||
| </Card.Text> | ||
| )} | ||
| <div className="mt-auto"> | ||
| <Link href={`/open-library/book/${book.id}`} passHref legacyBehavior> | ||
| <Button | ||
| variant="outline-success" | ||
| size="sm" | ||
| as="a" | ||
| className="rounded-pill px-3 fw-medium" | ||
| > | ||
| {t('open_library_view_details')} | ||
| </Button> | ||
| </Link> | ||
| </div> | ||
| </Card.Body> | ||
| </Card> | ||
| ); | ||
| }); | ||
|
|
||
| export default BookCard; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以加注释,但类型不要改啊!