diff --git a/app/api/agent/[agentId]/backup/route.ts b/app/api/agent/[agentId]/backup/route.ts index c2a8f323..5cade3d3 100644 --- a/app/api/agent/[agentId]/backup/route.ts +++ b/app/api/agent/[agentId]/backup/route.ts @@ -20,6 +20,7 @@ export async function POST( { status: 400 } ); } + eventEmitter.emit('modification', { update: true }); const agentId = (await params).agentId; const formData = await request.formData(); diff --git a/app/api/agent/[agentId]/restore/route.ts b/app/api/agent/[agentId]/restore/route.ts index da8b0856..d8f8412e 100644 --- a/app/api/agent/[agentId]/restore/route.ts +++ b/app/api/agent/[agentId]/restore/route.ts @@ -17,6 +17,8 @@ export async function POST( ) { try { + eventEmitter.emit('modification', { update: true }); + const agentId = (await params).agentId const body: BodyResultRestore = await request.json(); diff --git a/app/middleware.ts b/app/middleware.ts deleted file mode 100644 index 7e54a7c4..00000000 --- a/app/middleware.ts +++ /dev/null @@ -1,11 +0,0 @@ -// import {NextResponse} from "next/server"; -// import {useStore} from "@/state-management/store"; -// -// export function middleware(req) { -// // const organizationId = req.cookies.get("organizationId") || "default"; // Retrieve from cookies -// const url = req.nextUrl.clone(); -// const {organizationId, moveToAnotherOrganization} = useStore((state) => state); -// console.log("middlewaressss", organizationId); -// // url.searchParams.set("organizationId", organizationId); // Append to query string -// return NextResponse.rewrite(url); -// } \ No newline at end of file diff --git a/src/components/wrappers/Dashboard/SideBar/SideBarFooterCredit/SideBarFooterCredit.tsx b/src/components/wrappers/Dashboard/SideBar/SideBarFooterCredit/SideBarFooterCredit.tsx new file mode 100644 index 00000000..04d54476 --- /dev/null +++ b/src/components/wrappers/Dashboard/SideBar/SideBarFooterCredit/SideBarFooterCredit.tsx @@ -0,0 +1,18 @@ +"use client" +import {useSidebar} from "@/components/ui/sidebar"; + +export type SideBarFooterCreditProps = {} + +export const SideBarFooterCredit = (props: SideBarFooterCreditProps) => { + const {state, isMobile} = useSidebar(); + + return ( + <> + {state === 'expanded' && ( +
+

Portabase Community Edition

+
+ )} + + ) +} \ No newline at end of file diff --git a/src/components/wrappers/Dashboard/SideBar/SideBarLogo/SideBarLogo.tsx b/src/components/wrappers/Dashboard/SideBar/SideBarLogo/SideBarLogo.tsx new file mode 100644 index 00000000..ad8b9134 --- /dev/null +++ b/src/components/wrappers/Dashboard/SideBar/SideBarLogo/SideBarLogo.tsx @@ -0,0 +1,15 @@ +"use client" +import {useSidebar} from "@/components/ui/sidebar"; + +export type SideBarLogoProps = {} + +export const SideBarLogo = (props: SideBarLogoProps) => { + const { state, isMobile } = useSidebar(); + return ( +
+

+ {state === 'collapsed' && !isMobile ? "P" : "Portabase"} +

+
+ ) +} \ No newline at end of file diff --git a/src/components/wrappers/Dashboard/SideBar/app-sidebar.tsx b/src/components/wrappers/Dashboard/SideBar/app-sidebar.tsx index b78f0cba..586d1633 100644 --- a/src/components/wrappers/Dashboard/SideBar/app-sidebar.tsx +++ b/src/components/wrappers/Dashboard/SideBar/app-sidebar.tsx @@ -3,7 +3,7 @@ import { SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, - SidebarMenu, SidebarMenuButton, + SidebarMenu, SidebarMenuItem, } from "@/components/ui/sidebar" import {LoggedInButton} from "@/components/wrappers/Dashboard/LoggedInButton/LoggedInButton"; @@ -11,6 +11,8 @@ import {SidebarMenuCustom} from "@/components/wrappers/Dashboard/SideBar/SideBar import {OrganizationComboBox} from "@/components/wrappers/Organization/OrganizationCombobox"; import {prisma} from "@/prisma"; import {requiredCurrentUser} from "@/auth/current-user"; +import {SideBarLogo} from "@/components/wrappers/Dashboard/SideBar/SideBarLogo/SideBarLogo"; +import {SideBarFooterCredit} from "@/components/wrappers/Dashboard/SideBar/SideBarFooterCredit/SideBarFooterCredit"; export async function AppSidebar() { @@ -34,9 +36,7 @@ export async function AppSidebar() { return ( -
-

Portabase

-
+ + +
@@ -60,9 +62,7 @@ export async function AppSidebar() { -
-

Portabase Community Edition 1.0.0

-
+
) diff --git a/src/components/wrappers/Dashboard/admin/admin-user-table.tsx b/src/components/wrappers/Dashboard/admin/admin-user-table.tsx index 229482af..465fab0e 100644 --- a/src/components/wrappers/Dashboard/admin/admin-user-table.tsx +++ b/src/components/wrappers/Dashboard/admin/admin-user-table.tsx @@ -65,7 +65,7 @@ export const UsersDataTable = ({currentUser, table}: usersDataTableProps) => { {table.getRowModel().rows?.length ? ( table.getRowModel().rows.map((row: Row) => ( diff --git a/src/components/wrappers/Organization/OrganizationCombobox.tsx b/src/components/wrappers/Organization/OrganizationCombobox.tsx index 4ed5dd47..02f49fee 100644 --- a/src/components/wrappers/Organization/OrganizationCombobox.tsx +++ b/src/components/wrappers/Organization/OrganizationCombobox.tsx @@ -6,6 +6,7 @@ import {ComboBox} from "@/components/wrappers/combobox"; import {Organization} from "@prisma/client"; import {useStore} from "@/state-management/store"; import {getCurrentOrganizationSlug, setCurrentOrganizationSlug} from "@/features/dashboard/organization"; +import {useSidebar} from "@/components/ui/sidebar"; export type organizationComboBoxProps = { organizations: Organization[] @@ -24,7 +25,6 @@ export function OrganizationComboBox(props: organizationComboBoxProps) { useEffect(() => { getCurrentOrganizationSlug().then(slug => { - console.log("sssssss", slug) if (slug == "") { setOrganizationSlug(defaultOrganization.slug) setCurrentOrganizationSlug(defaultOrganization.slug) @@ -53,12 +53,20 @@ export function OrganizationComboBox(props: organizationComboBoxProps) { setCurrentOrganizationSlug(slug) } } + const { state, isMobile } = useSidebar(); + return ( - + <> + {state === 'expanded' && ( + + )} + + + ) } \ No newline at end of file