Skip to content

Commit

Permalink
style: added prettier, formating the code
Browse files Browse the repository at this point in the history
  • Loading branch information
vwh committed Nov 21, 2024
1 parent da2fba8 commit b5aa27d
Show file tree
Hide file tree
Showing 27 changed files with 240 additions and 124 deletions.
Binary file added bun.lockb
Binary file not shown.
97 changes: 97 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"build": "next build",
"start": "next start -p 9169",
"lint": "next lint",
"test": "tsx ./tests/test.ts"
"test": "tsx ./tests/test.ts",
"format": "prettier --write 'src/**/*.{js,jsx,ts,tsx}'"
},
"dependencies": {
"@radix-ui/react-slot": "^1.1.0",
Expand Down Expand Up @@ -35,6 +36,8 @@
"eslint": "^8",
"eslint-config-next": "15.0.1",
"postcss": "^8",
"prettier": "^3.3.3",
"prettier-plugin-tailwindcss": "^0.6.9",
"tailwindcss": "^3.4.1",
"tsx": "^4.19.2",
"typescript": "^5"
Expand Down
13 changes: 13 additions & 0 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/** @type {import('prettier').Config & import('prettier-plugin-tailwindcss').PluginOptions} */
const config = {
plugins: ["prettier-plugin-tailwindcss"],
arrowParens: "always",
printWidth: 80,
singleQuote: false,
jsxSingleQuote: false,
semi: true,
trailingComma: "none",
tabWidth: 2,
};

export default config;
4 changes: 2 additions & 2 deletions src/app/api/delete/[inboxid]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ export async function GET(request: NextRequest) {
return NextResponse.json(
{ error: deleteResult.error.message },
{
status: 400,
status: 400
}
);
}

return NextResponse.json(
{ error: getResult.error.message },
{
status: 400,
status: 400
}
);
}
4 changes: 2 additions & 2 deletions src/app/api/email/[email]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export async function GET(request: NextRequest) {
return NextResponse.json(
{ error: "Invalid email address" },
{
status: 400,
status: 400
}
);

Expand All @@ -20,7 +20,7 @@ export async function GET(request: NextRequest) {
return NextResponse.json(
{ error: result.error.message },
{
status: 400,
status: 400
}
);
}
2 changes: 1 addition & 1 deletion src/app/api/inbox/[inboxid]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export async function GET(request: NextRequest) {
return NextResponse.json(
{ error: result.error.message },
{
status: 400,
status: 400
}
);
}
64 changes: 32 additions & 32 deletions src/app/api/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,32 @@ export default function Component() {
return (
<div className="mx-auto mb-4 flex w-full max-w-3xl flex-col items-center space-y-6">
<section className="text-center">
<h1 className="text-primary mb-1 text-4xl font-bold">VWH Email API</h1>
<p className="text-foreground/80 text-xl">REST API Documentation</p>
<h1 className="mb-1 text-4xl font-bold text-primary">VWH Email API</h1>
<p className="text-xl text-foreground/80">REST API Documentation</p>
</section>
<section className="w-full space-y-8">
{/* Email Endpoint */}
<div className="bg-primary/10 group relative w-full overflow-hidden rounded border p-4 transition-all duration-300 ease-in-out hover:shadow-md">
<div className="group relative w-full overflow-hidden rounded border bg-primary/10 p-4 transition-all duration-300 ease-in-out hover:shadow-md">
<div className="flex flex-col space-y-2">
<div className="flex items-center justify-between">
<div className="flex items-center space-x-2">
<MailIcon className="h-5 w-5 text-gray-400" />
<h2 className="text-primary text-lg font-semibold">
<h2 className="text-lg font-semibold text-primary">
Get Email Messages
</h2>
</div>
<span className="text-foreground/80 text-sm font-medium">
<span className="text-sm font-medium text-foreground/80">
GET
</span>
</div>
<p className="text-foreground/80">
Retrieve all messages for a specific email address
</p>
<div className="mt-2 space-y-2">
<h2 className="text-primary text-md font-semibold">Endpoint</h2>
<h2 className="text-md font-semibold text-primary">Endpoint</h2>
<section className="flex items-center gap-2">
<div className="bg-primary/5 rounded p-2 flex-grow min-w-0">
<code className="text-sm block truncate">
<div className="min-w-0 flex-grow rounded bg-primary/5 p-2">
<code className="block truncate text-sm">
https://email.vwh.sh/api/email/{"{email}"}
</code>
</div>
Expand All @@ -40,12 +40,12 @@ export default function Component() {
className="flex-shrink-0"
/>
</section>
<h2 className="text-primary text-md font-semibold">Parameters</h2>
<ul className="list-disc list-inside text-sm text-foreground/80">
<h2 className="text-md font-semibold text-primary">Parameters</h2>
<ul className="list-inside list-disc text-sm text-foreground/80">
<li>email (string): The email address to fetch messages for</li>
</ul>
<h2 className="text-primary text-md font-semibold">Response</h2>
<div className="bg-primary/5 rounded p-2 overflow-x-auto">
<h2 className="text-md font-semibold text-primary">Response</h2>
<div className="overflow-x-auto rounded bg-primary/5 p-2">
<pre className="text-sm text-foreground/80">
{`[
{
Expand All @@ -65,27 +65,27 @@ export default function Component() {
</div>
</div>
{/* Inbox Endpoint */}
<div className="bg-primary/10 group relative w-full overflow-hidden rounded border p-4 transition-all duration-300 ease-in-out hover:shadow-md">
<div className="group relative w-full overflow-hidden rounded border bg-primary/10 p-4 transition-all duration-300 ease-in-out hover:shadow-md">
<div className="flex flex-col space-y-2">
<div className="flex items-center justify-between">
<div className="flex items-center space-x-2">
<MailIcon className="h-5 w-5 text-gray-400" />
<h2 className="text-primary text-lg font-semibold">
<h2 className="text-lg font-semibold text-primary">
Get Inbox Message
</h2>
</div>
<span className="text-foreground/80 text-sm font-medium">
<span className="text-sm font-medium text-foreground/80">
GET
</span>
</div>
<p className="text-foreground/80">
Retrieve a specific message by its ID
</p>
<div className="mt-2 space-y-2">
<h2 className="text-primary text-md font-semibold">Endpoint</h2>
<h2 className="text-md font-semibold text-primary">Endpoint</h2>
<section className="flex items-center gap-2">
<div className="bg-primary/5 rounded p-2 flex-grow min-w-0">
<code className="text-sm block truncate">
<div className="min-w-0 flex-grow rounded bg-primary/5 p-2">
<code className="block truncate text-sm">
https://email.vwh.sh/api/inbox/{"{inboxId}"}
</code>
</div>
Expand All @@ -95,12 +95,12 @@ export default function Component() {
className="flex-shrink-0"
/>
</section>
<h2 className="text-primary text-md font-semibold">Parameters</h2>
<ul className="list-disc list-inside text-sm text-foreground/80">
<h2 className="text-md font-semibold text-primary">Parameters</h2>
<ul className="list-inside list-disc text-sm text-foreground/80">
<li>inboxId (string): The unique identifier of the message</li>
</ul>
<h2 className="text-primary text-md font-semibold">Response</h2>
<div className="bg-primary/5 rounded p-2 overflow-x-auto">
<h2 className="text-md font-semibold text-primary">Response</h2>
<div className="overflow-x-auto rounded bg-primary/5 p-2">
<pre className="text-sm text-foreground/80">
{`{
"id": "{inboxId}",
Expand All @@ -118,27 +118,27 @@ export default function Component() {
</div>
</div>
{/* Delete Endpoint */}
<div className="bg-primary/10 group relative w-full overflow-hidden rounded border p-4 transition-all duration-300 ease-in-out hover:shadow-md">
<div className="group relative w-full overflow-hidden rounded border bg-primary/10 p-4 transition-all duration-300 ease-in-out hover:shadow-md">
<div className="flex flex-col space-y-2">
<div className="flex items-center justify-between">
<div className="flex items-center space-x-2">
<Trash2Icon className="h-5 w-5 text-gray-400" />
<h2 className="text-primary text-lg font-semibold">
<h2 className="text-lg font-semibold text-primary">
Delete Inbox Message
</h2>
</div>
<span className="text-foreground/80 text-sm font-medium">
<span className="text-sm font-medium text-foreground/80">
GET
</span>
</div>
<p className="text-foreground/80">
Delete a specific message by its ID
</p>
<div className="mt-2 space-y-2">
<h2 className="text-primary text-md font-semibold">Endpoint</h2>
<h2 className="text-md font-semibold text-primary">Endpoint</h2>
<section className="flex items-center gap-2">
<div className="bg-primary/5 rounded p-2 flex-grow min-w-0">
<code className="text-sm block truncate">
<div className="min-w-0 flex-grow rounded bg-primary/5 p-2">
<code className="block truncate text-sm">
https://email.vwh.sh/api/delete/{"{inboxId}"}
</code>
</div>
Expand All @@ -148,12 +148,12 @@ export default function Component() {
className="flex-shrink-0"
/>
</section>
<h2 className="text-primary text-md font-semibold">Parameters</h2>
<ul className="list-disc list-inside text-sm text-foreground/80">
<h2 className="text-md font-semibold text-primary">Parameters</h2>
<ul className="list-inside list-disc text-sm text-foreground/80">
<li>inboxId (string): The unique identifier of the message</li>
</ul>
<h2 className="text-primary text-md font-semibold">Response</h2>
<div className="bg-primary/5 rounded p-2 overflow-x-auto">
<h2 className="text-md font-semibold text-primary">Response</h2>
<div className="overflow-x-auto rounded bg-primary/5 p-2">
<pre className="text-sm text-foreground/80">true</pre>
</div>
</div>
Expand Down
Loading

0 comments on commit b5aa27d

Please sign in to comment.