Add frontend pages for music and books
Some checks failed
Rebuild Issue Index / build-index (push) Has been cancelled
Some checks failed
Rebuild Issue Index / build-index (push) Has been cancelled
- Create MusicDetails component with artist info, albums, stats, request button - Create BookDetails component with cover, overview, request button - Create music/[artistId] and book/[bookId] pages - Update Search component with tabbed interface (Movies & TV, Music, Books) - Music/Book search results with card grid and cover art - Link to detail pages from search results
This commit is contained in:
33
src/pages/book/[bookId]/index.tsx
Normal file
33
src/pages/book/[bookId]/index.tsx
Normal file
@@ -0,0 +1,33 @@
|
||||
import BookDetails from '@app/components/BookDetails';
|
||||
import axios from 'axios';
|
||||
import type { GetServerSideProps, NextPage } from 'next';
|
||||
|
||||
interface BookPageProps {
|
||||
book?: any;
|
||||
}
|
||||
|
||||
const BookPage: NextPage<BookPageProps> = ({ book }) => {
|
||||
return <BookDetails book={book} />;
|
||||
};
|
||||
|
||||
export const getServerSideProps: GetServerSideProps<BookPageProps> = async (
|
||||
ctx
|
||||
) => {
|
||||
try {
|
||||
const response = await axios.get(
|
||||
`http://${process.env.HOST || 'localhost'}:${
|
||||
process.env.PORT || 5055
|
||||
}/api/v1/book/search?query=${ctx.query.bookId}`,
|
||||
{
|
||||
headers: ctx.req?.headers?.cookie
|
||||
? { cookie: ctx.req.headers.cookie }
|
||||
: undefined,
|
||||
}
|
||||
);
|
||||
return { props: { book: response.data?.results?.[0] } };
|
||||
} catch {
|
||||
return { props: {} };
|
||||
}
|
||||
};
|
||||
|
||||
export default BookPage;
|
||||
33
src/pages/music/[artistId]/index.tsx
Normal file
33
src/pages/music/[artistId]/index.tsx
Normal file
@@ -0,0 +1,33 @@
|
||||
import MusicDetails from '@app/components/MusicDetails';
|
||||
import axios from 'axios';
|
||||
import type { GetServerSideProps, NextPage } from 'next';
|
||||
|
||||
interface MusicPageProps {
|
||||
artist?: any;
|
||||
}
|
||||
|
||||
const MusicPage: NextPage<MusicPageProps> = ({ artist }) => {
|
||||
return <MusicDetails artist={artist} />;
|
||||
};
|
||||
|
||||
export const getServerSideProps: GetServerSideProps<MusicPageProps> = async (
|
||||
ctx
|
||||
) => {
|
||||
try {
|
||||
const response = await axios.get(
|
||||
`http://${process.env.HOST || 'localhost'}:${
|
||||
process.env.PORT || 5055
|
||||
}/api/v1/music/artist/${ctx.query.artistId}`,
|
||||
{
|
||||
headers: ctx.req?.headers?.cookie
|
||||
? { cookie: ctx.req.headers.cookie }
|
||||
: undefined,
|
||||
}
|
||||
);
|
||||
return { props: { artist: response.data } };
|
||||
} catch {
|
||||
return { props: {} };
|
||||
}
|
||||
};
|
||||
|
||||
export default MusicPage;
|
||||
Reference in New Issue
Block a user