Skip to content

Commit

Permalink
Updated and lint-fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
LobeTia committed Apr 13, 2024
1 parent 2639846 commit 4f3e240
Show file tree
Hide file tree
Showing 13 changed files with 127 additions and 126 deletions.
3 changes: 2 additions & 1 deletion prettier.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/** @type {import('prettier').Config & import('prettier-plugin-tailwindcss').PluginOptions} */
const config = {
plugins: ["prettier-plugin-tailwindcss"],
plugins: ["prettier-plugin-tailwindcss"],
semi: false
};

export default config;
12 changes: 6 additions & 6 deletions src/app/actions/types.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
export interface ErrorItem {
code?: number;
message: string;
code?: number
message: string
}

export interface ServerActionState {
status: ServerActionStatus;
payload?: object;
nextStep?: string;
errors?: ErrorItem[];
status: ServerActionStatus
payload?: object
nextStep?: string
errors?: ErrorItem[]
}

export enum ServerActionStatus {
Expand Down
2 changes: 1 addition & 1 deletion src/app/admin/@authenticated/membership/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ export default async function AdminMembershipPage() {
<h1 className="text-3xl font-semibold">Membership</h1>
</div>
</>
);
)
}
8 changes: 4 additions & 4 deletions src/app/admin/@unauthenticated/components/discordSignIn.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";
"use client"

import Image from "next/image";
import { signIn } from "next-auth/react";
import Image from "next/image"
import { signIn } from "next-auth/react"

export function DiscordSignIn() {
return (
Expand All @@ -20,5 +20,5 @@ export function DiscordSignIn() {
/>
<span className={"text-sm font-semibold"}>Sign in with Discord</span>
</button>
);
)
}
10 changes: 5 additions & 5 deletions src/app/admin/const.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export interface MenuItem {
url: string;
label: string;
id: string;
children?: MenuItem[];
url: string
label: string
id: string
children?: MenuItem[]
}

export const adminMenuTreeConfig: MenuItem[] = [
Expand Down Expand Up @@ -43,4 +43,4 @@ export const adminMenuTreeConfig: MenuItem[] = [
label: "Settings",
url: "/admin/settings",
},
];
]
44 changes: 22 additions & 22 deletions src/app/admin/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
import { UserRole } from "@prisma/client";
import Image from "next/image";
import Link from "next/link";
import { UserRole } from "@prisma/client"
import Image from "next/image"
import Link from "next/link"

import { Logout } from "@/app/admin/@unauthenticated/components/logout";
import { adminMenuTreeConfig } from "@/app/admin/const";
import { LogoutButton } from "@/components/molecules/logoutButton";
import { Button } from "@/components/ui/button";
import { Logout } from "@/app/admin/@unauthenticated/components/logout"
import { adminMenuTreeConfig } from "@/app/admin/const"
import { LogoutButton } from "@/components/molecules/logoutButton"
import { Button } from "@/components/ui/button"
import {
Card,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card";
} from "@/components/ui/card"
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { Sheet, SheetContent, SheetTrigger } from "@/components/ui/sheet";
import logo from "@/images/logo.svg";
import { hasRequiredRole } from "@/lib/permissions";
import { usernameToInitials } from "@/lib/utils";
import { getServerAuthSession } from "@/server/auth";
} from "@/components/ui/dropdown-menu"
import { Sheet, SheetContent, SheetTrigger } from "@/components/ui/sheet"
import logo from "@/images/logo.svg"
import { hasRequiredRole } from "@/lib/permissions"
import { usernameToInitials } from "@/lib/utils"
import { getServerAuthSession } from "@/server/auth"

interface LayoutInterface {
children: React.ReactNode;
authenticated: React.ReactNode;
unauthenticated: React.ReactNode;
children: React.ReactNode
authenticated: React.ReactNode
unauthenticated: React.ReactNode
}

export default async function Layout({
authenticated,
unauthenticated,
}: LayoutInterface) {
const session = await getServerAuthSession();
const isLoggedIn = session !== null;
const session = await getServerAuthSession()
const isLoggedIn = session !== null

if (!isLoggedIn) {
return (
<main className="flex h-screen items-center justify-center bg-zinc-900">
{unauthenticated}
</main>
);
)
}

if (!hasRequiredRole(UserRole.admin, session)) {
Expand All @@ -69,7 +69,7 @@ export default async function Layout({
</CardFooter>
</Card>
</main>
);
)
}

return (
Expand Down Expand Up @@ -157,5 +157,5 @@ export default async function Layout({
{authenticated}
</main>
</div>
);
)
}
14 changes: 7 additions & 7 deletions src/app/devPage.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { toPlainObject } from "lodash";
import Link from "next/link";
import { toPlainObject } from "lodash"
import Link from "next/link"

import { Debug } from "@/components/devtool/debug";
import { Button } from "@/components/ui/button";
import { getServerAuthSession } from "@/server/auth";
import { Debug } from "@/components/devtool/debug"
import { Button } from "@/components/ui/button"
import { getServerAuthSession } from "@/server/auth"

export async function DevPage() {
const session = await getServerAuthSession();
const session = await getServerAuthSession()

return (
<div className={"h-dvh bg-gray-200 p-4"}>
Expand Down Expand Up @@ -42,5 +42,5 @@ export async function DevPage() {
</div>
</div>
</div>
);
)
}
10 changes: 5 additions & 5 deletions src/app/members/@authenticated/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import {
MembershipCard,
PricePeriod,
PriceUnit,
} from "@/app/signup/components/membershipCard";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { getServerAuthSession } from "@/server/auth";
} from "@/app/signup/components/membershipCard"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { getServerAuthSession } from "@/server/auth"

export default async function MembershipPortalHomePage() {
const session = await getServerAuthSession();
const session = await getServerAuthSession()

return (
<>
Expand Down Expand Up @@ -76,5 +76,5 @@ export default async function MembershipPortalHomePage() {
</div>
</div>
</>
);
)
}
10 changes: 5 additions & 5 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { redirect } from "next/navigation";
import { redirect } from "next/navigation"

import { DevPage } from "@/app/devPage";
import { inDevEnvironment } from "@/lib/envs";
import { DevPage } from "@/app/devPage"
import { inDevEnvironment } from "@/lib/envs"

export default async function HomePage() {
if (inDevEnvironment) return <DevPage />;
else redirect("/members");
if (inDevEnvironment) return <DevPage />
else redirect("/members")
}
22 changes: 11 additions & 11 deletions src/app/signup/components/membershipCard.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Card, CardContent } from "@/components/ui/card";
import { Card, CardContent } from "@/components/ui/card"

interface Price {
value: number;
period: PricePeriod;
unit: PriceUnit;
value: number
period: PricePeriod
unit: PriceUnit
}

export enum PriceUnit {
Expand All @@ -17,11 +17,11 @@ export enum PricePeriod {
}

interface Membership {
showPrice?: boolean;
title: string;
features: string[];
description?: string;
price: Price;
showPrice?: boolean
title: string
features: string[]
description?: string
price: Price
}

export function MembershipCard({
Expand All @@ -35,7 +35,7 @@ export function MembershipCard({
currency: price.unit,
minimumFractionDigits: 0,
style: "currency",
});
})

return (
<Card>
Expand Down Expand Up @@ -63,5 +63,5 @@ export function MembershipCard({
)}
</CardContent>
</Card>
);
)
}
Loading

0 comments on commit 4f3e240

Please sign in to comment.