Skip to content

Commit

Permalink
refactor: collect app files/folders to (main) (#1009)
Browse files Browse the repository at this point in the history
  • Loading branch information
eren-ayasofyazilim authored Dec 16, 2024
2 parents f8d8c85 + 0902459 commit c753b4f
Show file tree
Hide file tree
Showing 20 changed files with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions apps/web/src/app/[lang]/(main)/(core)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
"use server";
import MainAdminLayout from "@repo/ui/theme/main-admin-layout";
import { LogOut } from "lucide-react";
import { auth } from "auth";
import { signOutServer } from "auth-action";
import unirefund from "public/unirefund.png";
import { getResourceData } from "src/language-data/core/AbpUiNavigation";
import { getBaseLink } from "src/utils";
import { getNavbarFromDB } from "../../../../utils/navbar/navbar-data";
import { getProfileMenuFromDB } from "../../../../utils/navbar/navbar-profile-data";

interface LayoutProps {
params: { lang: string };
children: JSX.Element;
}
const appName = process.env.APPLICATION_NAME || "UNIREFUND";
export default async function Layout({ children, params }: LayoutProps) {
const { lang } = params;
const { languageData } = await getResourceData(lang);
const session = await auth();
const baseURL = getBaseLink("/", true, lang);
const navbarFromDB = await getNavbarFromDB(lang, languageData, session);
const profileMenuProps = getProfileMenuFromDB(languageData);
profileMenuProps.info.name =
session?.user?.name ?? profileMenuProps.info.name;
profileMenuProps.info.email =
session?.user?.email ?? profileMenuProps.info.email;
profileMenuProps.info.image =
"https://flowbite.com/docs/images/people/profile-picture-5.jpg";

profileMenuProps.menu.secondary = [
{
href: undefined,
onClick: signOutServer,
name: languageData.LogOut,
icon: <LogOut className="mr-2 h-4 w-4" />,
},
];
const logo = appName === "UNIREFUND" ? unirefund : undefined;
return (
<div className="flex h-full flex-col bg-white">
<MainAdminLayout
appName={appName}
baseURL={baseURL}
lang={lang}
logo={logo}
navbarItems={navbarFromDB}
prefix=""
profileMenu={profileMenuProps}
/>
<div className="flex h-full flex-col overflow-hidden px-4">
{children}
</div>
</div>
);
}
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit c753b4f

Please sign in to comment.