Skip to content

feat: docs tab in main menu #642

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jun 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/components/dashboard/MainMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import Tab from '@mui/material/Tab';
import Box from '@mui/material/Box';
import { useNavigate } from 'react-router-dom';
import { Paper, Button, useTheme } from "@mui/material";
import { AutoAwesome, FormatListBulleted, VpnKey, Usb, CloudQueue, Code, } from "@mui/icons-material";
import { apiUrl } from "../../apiConfig";
import { AutoAwesome, FormatListBulleted, VpnKey, Usb, CloudQueue, Description } from "@mui/icons-material";
import { useTranslation } from 'react-i18next';
import i18n from '../../i18n';

Expand Down Expand Up @@ -112,6 +111,9 @@ export const MainMenu = ({ value = 'robots', handleChangeContent }: MainMenuProp
{/* <Button href={`${apiUrl}/api-docs/`} target="_blank" rel="noopener noreferrer" sx={buttonStyles} startIcon={<Code />}>
{t('mainmenu.apidocs')}
</Button> */}
<Button href='https://docs.maxun.dev' target="_blank" rel="noopener noreferrer" sx={buttonStyles} startIcon={<Description />}>
Documentation
</Button>
Comment on lines +114 to +116
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Hard-coded label and URL bypass i18n & environment configuration

The new “Documentation” button is helpful, but:

• The label is not run through t(…), breaking translation consistency.
• A fixed URL forces code changes for staging/enterprise deployments.

-  <Button href='https://docs.maxun.dev' target="_blank" rel="noopener noreferrer" sx={buttonStyles} startIcon={<Description />}>
-    Documentation
-  </Button>
+  <Button
+    href={process.env.REACT_APP_DOCS_URL ?? 'https://docs.maxun.dev'}
+    target="_blank"
+    rel="noopener noreferrer"
+    sx={buttonStyles}
+    startIcon={<Description />}
+  >
+    {t('mainmenu.documentation')}
+  </Button>

Add mainmenu.documentation to your i18n resource files and expose REACT_APP_DOCS_URL (or equivalent) via CI/CD to keep the link configurable.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<Button href='https://docs.maxun.dev' target="_blank" rel="noopener noreferrer" sx={buttonStyles} startIcon={<Description />}>
Documentation
</Button>
<Button
href={process.env.REACT_APP_DOCS_URL ?? 'https://docs.maxun.dev'}
target="_blank"
rel="noopener noreferrer"
sx={buttonStyles}
startIcon={<Description />}
>
{t('mainmenu.documentation')}
</Button>
🤖 Prompt for AI Agents
In src/components/dashboard/MainMenu.tsx around lines 114 to 116, the
"Documentation" button label is hard-coded and not internationalized, and the
URL is fixed, which prevents translation and environment-specific configuration.
To fix this, replace the label string with a call to the translation function
t('mainmenu.documentation') and replace the hard-coded URL with a configurable
environment variable like process.env.REACT_APP_DOCS_URL. Ensure the environment
variable is exposed via CI/CD and add the key mainmenu.documentation to the i18n
resource files.

<Button href="https://app.maxun.dev/login" target="_blank" rel="noopener noreferrer" sx={buttonStyles} startIcon={<CloudQueue />}>
{t('mainmenu.feedback')}
</Button>
Expand Down
5 changes: 0 additions & 5 deletions src/components/dashboard/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -390,11 +390,6 @@ export const NavBar: React.FC<NavBarProps> = ({
<Language sx={{ marginRight: '5px' }} /> {t('navbar.menu_items.language')}
</MenuItem>
<hr />
<MenuItem onClick={() => {
window.open('https://docs.maxun.dev', '_blank');
}}>
<Description sx={{ marginRight: '5px' }} /> Docs
</MenuItem>
<MenuItem onClick={() => {
window.open('https://github.com/getmaxun/maxun', '_blank');
}}>
Expand Down