hidden resource

This commit is contained in:
2026-04-24 14:55:29 +05:30
parent 922d05ae37
commit 3fd20f11ab
4 changed files with 12 additions and 2 deletions

View File

@@ -24,6 +24,10 @@ export const ConfigContext = React.createContext<AppConfig | null>(null);
function Dashboard({ basePath }: { basePath: string }) {
const config = React.useContext(ConfigContext);
const navigate = useNavigate();
const resources = config?.resources || [];
const visibleResources = resources.filter((res) => !res.hidden);
return (
<Box>
<Typography variant="h4" gutterBottom>
@@ -41,7 +45,7 @@ function Dashboard({ basePath }: { basePath: string }) {
mt: 4,
}}
>
{config?.resources.map((res) => (
{visibleResources.map((res) => (
<Paper
key={res.name}
sx={{
@@ -69,6 +73,9 @@ function AdminApp({ basePath }: { basePath: string }) {
const config = React.useContext(ConfigContext);
const navigate = useNavigate();
const resources = config?.resources || [];
const visibleResources = resources.filter((res) => !res.hidden);
if (!currentUser) {
return (
<AuthPage
@@ -89,7 +96,7 @@ function AdminApp({ basePath }: { basePath: string }) {
username={currentUser.username}
onLogout={logout}
onSelectResource={(name) => navigate(`/admin/${name}`)}
resources={config?.resources || []}
resources={visibleResources}
>
<Routes>
<Route path="/" element={<Dashboard basePath={basePath} />} />