mirror of
https://github.com/allankoechke/mantisbase-admin.git
synced 2026-12-01 01:15:36 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dfe21d4163 | |||
| f9a6c77259 |
@@ -1,5 +1,5 @@
|
||||
# Mantis Admin Dashboard
|
||||
This is the admin dashboard for [mantis](https://github.com/allankoechke/mantis), a BaaS written in C++.
|
||||
# MantisBase Admin Dashboard
|
||||
This is the admin dashboard for [mantis](https://github.com/allankoechke/mantisbase), a BaaS written in C++.
|
||||
> Still in development, some features may be broken!
|
||||
|
||||

|
||||
@@ -18,24 +18,24 @@ const ROUTE_CHANGE_EVENT = "custom-route-change"
|
||||
let currentRoute: ParsedRoute = { path: "/entities", pathParams: {}, queryParams: {} }
|
||||
|
||||
// Get the base path for the application
|
||||
// In production, this should be '/mb-admin', in development it might be empty
|
||||
// In production, this should be '/mb', in development it might be empty
|
||||
export function getBasePath(): string {
|
||||
if (typeof window === "undefined") {
|
||||
// Server-side: use env var or default to /mb-admin for production
|
||||
return process.env.NEXT_PUBLIC_BASE_PATH || (process.env.NODE_ENV === 'production' ? '/mb-admin' : '')
|
||||
// Server-side: use env var or default to /mb for production
|
||||
return process.env.NEXT_PUBLIC_BASE_PATH || (process.env.NODE_ENV === 'production' ? '/mb' : '')
|
||||
}
|
||||
|
||||
// Client-side: try to detect base path from current location
|
||||
// If we're at /mb-admin/*, the base path is /mb-admin
|
||||
// If we're at /mb/* or exactly /mb, the base path is /mb
|
||||
const pathname = window.location.pathname
|
||||
if (pathname.startsWith("/mb-admin")) {
|
||||
return "/mb-admin"
|
||||
if (pathname === "/mb" || pathname.startsWith("/mb/")) {
|
||||
return "/mb"
|
||||
}
|
||||
|
||||
// Fallback: check if we're in production mode
|
||||
// In development, base path might be empty
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
return process.env.NEXT_PUBLIC_BASE_PATH || "/mb-admin"
|
||||
return process.env.NEXT_PUBLIC_BASE_PATH || "/mb"
|
||||
}
|
||||
|
||||
// Development: no base path
|
||||
|
||||
@@ -5,7 +5,7 @@ const { version } = require('./package.json');
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
// Use basePath in production, or if explicitly set via env var
|
||||
basePath: process.env.NEXT_PUBLIC_BASE_PATH || (process.env.NODE_ENV === 'production' ? '/mb-admin' : ''),
|
||||
basePath: process.env.NEXT_PUBLIC_BASE_PATH || (process.env.NODE_ENV === 'production' ? '/mb' : ''),
|
||||
env: {
|
||||
MANTIS_ADMIN_VERSION: version,
|
||||
},
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "mantis-admin",
|
||||
"version": "0.3.0",
|
||||
"version": "0.3.3",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "mantis-admin",
|
||||
"version": "0.3.0",
|
||||
"version": "0.3.3",
|
||||
"dependencies": {
|
||||
"@hookform/resolvers": "^3.9.1",
|
||||
"@radix-ui/react-accordion": "1.2.2",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "mantis-admin",
|
||||
"version": "0.3.0",
|
||||
"version": "0.3.4",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"export": "next build && next export",
|
||||
|
||||
Reference in New Issue
Block a user