fix (dashboard): disable settings in the header when self-hosting (#3402)

### **PR Type**
Bug fix


___

### **Description**
- Disable settings in header for self-hosted environments

- Implement `useSettingsDisabled` hook for conditional rendering

- Update project pages array with new disabled logic

- Add changeset for patch version bump


___

### Diagram Walkthrough


```mermaid
flowchart LR
  A["useSettingsDisabled Hook"] --> B["ProjectPagesComboBox"]
  B --> C["Settings Option"]
  C --> D{"isSettingsDisabled?"}
  D -->|Yes| E["Disabled"]
  D -->|No| F["Enabled"]
```



<details> <summary><h3> File Walkthrough</h3></summary>

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>ProjectPagesComboBox.tsx</strong><dd><code>Implement
settings disabling logic in ProjectPagesComboBox</code></dd></summary>
<hr>

dashboard/src/components/layout/Header/ProjectPagesComboBox.tsx

<ul><li>Import <code>useSettingsDisabled</code> hook<br> <li> Add
<code>isSettingsDisabled</code> state<br> <li> Update
<code>Settings</code> option in <code>projectPages</code> array<br> <li>
Add <code>isSettingsDisabled</code> to dependency array</ul>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/3402/files#diff-70b3af41358f0a22b83e502409a70a0df15e8946d958dbaee4c32b6ebdb38cf6">+5/-2</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>
</table></td></tr><tr><td><strong>Documentation</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>strange-lamps-compare.md</strong><dd><code>Add
changeset for dashboard patch update</code>&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

.changeset/strange-lamps-compare.md

<ul><li>Add changeset file for patch version bump<br> <li> Include fix
description for dashboard</ul>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/3402/files#diff-2d8ba8119648f723ea41f6aea003922f65ebe43b604902bbe2f3697bf91aebcf">+5/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>
</table></td></tr></tr></tbody></table>

</details>

___
This commit is contained in:
robertkasza
2025-07-25 15:21:58 +02:00
committed by GitHub
parent 4ffff86752
commit cffa161da7
2 changed files with 10 additions and 2 deletions

View File

@@ -0,0 +1,5 @@
---
'@nhost/dashboard': patch
---
fix (dashboard): disable settings in the header when self-hosting

View File

@@ -33,6 +33,7 @@ import {
PopoverTrigger,
} from '@/components/ui/v3/popover';
import { useIsPlatform } from '@/features/orgs/projects/common/hooks/useIsPlatform';
import { useSettingsDisabled } from '@/hooks/useSettingsDisabled';
import { cn } from '@/lib/utils';
import { useRouter } from 'next/router';
import { useEffect, useMemo, useState, type ReactElement } from 'react';
@@ -55,6 +56,8 @@ export default function ProjectPagesComboBox() {
const isPlatform = useIsPlatform();
const isSettingsDisabled = useSettingsDisabled();
const projectPages = useMemo(
() => [
{
@@ -146,10 +149,10 @@ export default function ProjectPagesComboBox() {
value: 'settings',
icon: <CogIcon className="h-4 w-4" />,
slug: 'settings',
disabled: false,
disabled: isSettingsDisabled,
},
],
[isPlatform],
[isPlatform, isSettingsDisabled],
);
const pathSegments = useMemo(() => asPath.split('/'), [asPath]);