parent
9ffaf614f1
commit
5d0f8e7ea4
@ -1,12 +1,16 @@
|
|||||||
import { h } from "../jsx.ts";
|
import { h } from "../jsx.ts";
|
||||||
|
import { Context } from "../oak.ts";
|
||||||
|
|
||||||
import Base from "../templates/Base.tsx";
|
import Base from "../templates/Base.tsx";
|
||||||
|
|
||||||
export default () => (
|
export default (_: unknown, ctx: Context) => {
|
||||||
<Base title="Home" description="The homepage." stylepath="css/index.scss">
|
ctx.response.status = 404;
|
||||||
<div style="text-align:center;">
|
return (
|
||||||
<h1>404</h1>
|
<Base title="404" description="L bozo" stylepath="css/index.scss">
|
||||||
<p>Page not found.</p>
|
<div style="text-align:center;">
|
||||||
</div>
|
<h1>404</h1>
|
||||||
</Base>
|
<p>Page not found.</p>
|
||||||
);
|
</div>
|
||||||
|
</Base>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
@ -0,0 +1,53 @@
|
|||||||
|
import { h } from "../jsx.ts";
|
||||||
|
import watt, { watt as originalWatt } from "../wattpad.ts";
|
||||||
|
import { User } from "../wattpad.ts";
|
||||||
|
import { Context } from "../oak.ts";
|
||||||
|
|
||||||
|
import Base from "../templates/Base.tsx";
|
||||||
|
|
||||||
|
import FourOhFour from "./404.tsx";
|
||||||
|
|
||||||
|
export default async (params: URLSearchParams, ctx: Context) => {
|
||||||
|
const name = params.get("name");
|
||||||
|
if (!name) {
|
||||||
|
throw "deez";
|
||||||
|
}
|
||||||
|
|
||||||
|
const user = new User(originalWatt.session, name);
|
||||||
|
try {
|
||||||
|
await user.init();
|
||||||
|
} catch {
|
||||||
|
return FourOhFour(undefined, ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Base
|
||||||
|
title={user.displayName as string}
|
||||||
|
description={user.description as string}
|
||||||
|
stylepath="css/index.scss"
|
||||||
|
>
|
||||||
|
<div style="display:flex;align-items:center;justify-content:center;flex-direction:column;">
|
||||||
|
<div class="userprofile">
|
||||||
|
<div>
|
||||||
|
<img id="storycover" src={user.userJSON.avatar} />
|
||||||
|
<div>
|
||||||
|
<h3 id="storyname">
|
||||||
|
{user.displayName === ""
|
||||||
|
? user.username
|
||||||
|
: user.displayName}
|
||||||
|
</h3>
|
||||||
|
{user.displayName === ""
|
||||||
|
? undefined
|
||||||
|
: user.username}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p>
|
||||||
|
{user.description
|
||||||
|
? user.description.replaceAll("\n", "<br>")
|
||||||
|
: undefined}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Base>
|
||||||
|
);
|
||||||
|
};
|
Loading…
Reference in new issue