feat: refactor whole bunch of stuff
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
import { Handlers, PageProps } from "$fresh/server.ts";
|
||||
import { MainLayout } from "@components/layouts/main.tsx";
|
||||
import { HashTags } from "@components/HashTags.tsx";
|
||||
import { removeImage, renderMarkdown } from "@lib/documents.ts";
|
||||
import { Series } from "@lib/resource/series.ts";
|
||||
import { removeImage, renderMarkdown } from "@lib/markdown.ts";
|
||||
import { RedirectSearchHandler } from "@islands/Search.tsx";
|
||||
import { KMenu } from "@islands/KMenu.tsx";
|
||||
import PageHero from "@components/PageHero.tsx";
|
||||
import { Star } from "@components/Stars.tsx";
|
||||
import { MetaTags } from "@components/MetaTags.tsx";
|
||||
import { parseRating } from "@lib/helpers.ts";
|
||||
import { fetchResource } from "@lib/marka.ts";
|
||||
import { fetchResource } from "@lib/marka/index.ts";
|
||||
import { ReviewResource } from "@lib/marka/schema.ts";
|
||||
|
||||
export const handler: Handlers<{ serie: Series; session: unknown }> = {
|
||||
export const handler: Handlers<{ serie: ReviewResource; session: unknown }> = {
|
||||
async GET(_, ctx) {
|
||||
const serie = await fetchResource(`series/${ctx.params.name}.md`);
|
||||
|
||||
@@ -44,8 +44,8 @@ export default function Greet(
|
||||
|
||||
<MetaTags resource={serie} />
|
||||
<PageHero
|
||||
image={serie.content?.image}
|
||||
thumbnail={serie.content?.thumbnail}
|
||||
image={serie.image?.url}
|
||||
thumbhash={serie.image?.thumbhash}
|
||||
>
|
||||
<PageHero.Header>
|
||||
<PageHero.BackLink href="/series" />
|
||||
|
||||
@@ -2,19 +2,18 @@ import { Handlers, PageProps } from "$fresh/server.ts";
|
||||
import { MainLayout } from "@components/layouts/main.tsx";
|
||||
import { Grid } from "@components/Grid.tsx";
|
||||
import { IconArrowLeft } from "@components/icons.tsx";
|
||||
import { Series } from "@lib/resource/series.ts";
|
||||
import { RedirectSearchHandler } from "@islands/Search.tsx";
|
||||
import { KMenu } from "@islands/KMenu.tsx";
|
||||
import { ResourceCard } from "@components/Card.tsx";
|
||||
import { GenericResource } from "@lib/types.ts";
|
||||
import { fetchResource } from "@lib/marka.ts";
|
||||
import { listResources } from "@lib/marka/index.ts";
|
||||
import { parseResourceUrl, searchResource } from "@lib/search.ts";
|
||||
import { GenericResource, ReviewResource } from "@lib/marka/schema.ts";
|
||||
|
||||
export const handler: Handlers<
|
||||
{ series: Series[] | null; searchResults?: GenericResource[] }
|
||||
{ series: ReviewResource[] | null; searchResults?: GenericResource[] }
|
||||
> = {
|
||||
async GET(req, ctx) {
|
||||
const { content: series } = await fetchResource("series");
|
||||
const series = await listResources("series");
|
||||
const searchParams = parseResourceUrl(req.url);
|
||||
const searchResults = searchParams &&
|
||||
await searchResource({ ...searchParams, types: ["series"] });
|
||||
@@ -24,7 +23,7 @@ export const handler: Handlers<
|
||||
|
||||
export default function Greet(
|
||||
props: PageProps<
|
||||
{ series: Series[] | null; searchResults: GenericResource[] }
|
||||
{ series: ReviewResource[] | null; searchResults: GenericResource[] }
|
||||
>,
|
||||
) {
|
||||
const { series, searchResults } = props.data;
|
||||
@@ -50,8 +49,8 @@ export default function Greet(
|
||||
<h3 class="text-2xl text-white font-light">🎥 Series</h3>
|
||||
</header>
|
||||
<Grid>
|
||||
{series?.map((doc) => {
|
||||
return <ResourceCard sublink="series" res={doc} />;
|
||||
{series?.map((doc, i) => {
|
||||
return <ResourceCard key={i} sublink="series" res={doc} />;
|
||||
})}
|
||||
</Grid>
|
||||
</MainLayout>
|
||||
|
||||
Reference in New Issue
Block a user