🐛fix: showing release notes for beta and prod (#5292)

* 🐛fix: showing release notes for beta and prod

* ♻️refactor: make an utils env

* ♻️refactor: hide MCP for production

* ♻️refactor: simplify the boolean expression fetch release note
This commit is contained in:
Faisal Amir 2025-06-16 17:14:38 +07:00 committed by GitHub
parent 8e921ab521
commit 9b1f206cc6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 22 additions and 13 deletions

View File

@ -2,6 +2,7 @@ import { Link, useMatches } from '@tanstack/react-router'
import { route } from '@/constants/routes' import { route } from '@/constants/routes'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { useModelProvider } from '@/hooks/useModelProvider' import { useModelProvider } from '@/hooks/useModelProvider'
import { isProd } from '@/lib/version'
const menuSettings = [ const menuSettings = [
{ {
@ -24,10 +25,15 @@ const menuSettings = [
title: 'Hardware', title: 'Hardware',
route: route.settings.hardware, route: route.settings.hardware,
}, },
{ // Only show MCP Servers in non-production environment
title: 'MCP Servers', ...(!isProd
route: route.settings.mcp_servers, ? [
}, {
title: 'MCP Servers',
route: route.settings.mcp_servers,
},
]
: []),
{ {
title: 'Local API Server', title: 'Local API Server',
route: route.settings.local_api_server, route: route.settings.local_api_server,

View File

@ -7,6 +7,7 @@ import { useState, useEffect } from 'react'
import { useReleaseNotes } from '@/hooks/useReleaseNotes' import { useReleaseNotes } from '@/hooks/useReleaseNotes'
import { RenderMarkdown } from '../RenderMarkdown' import { RenderMarkdown } from '../RenderMarkdown'
import { cn, isDev } from '@/lib/utils' import { cn, isDev } from '@/lib/utils'
import { isNightly, isBeta } from '@/lib/version'
const DialogAppUpdater = () => { const DialogAppUpdater = () => {
const { const {
@ -22,16 +23,13 @@ const DialogAppUpdater = () => {
setRemindMeLater(true) setRemindMeLater(true)
} }
const nightly = VERSION.includes('-')
const beta = VERSION.includes('beta')
const { release, fetchLatestRelease } = useReleaseNotes() const { release, fetchLatestRelease } = useReleaseNotes()
useEffect(() => { useEffect(() => {
if (!isDev()) { if (!isDev()) {
fetchLatestRelease(beta ? true : false) fetchLatestRelease(isBeta)
} }
}, [beta, fetchLatestRelease]) }, [fetchLatestRelease])
// Check for updates when component mounts // Check for updates when component mounts
useEffect(() => { useEffect(() => {
@ -71,7 +69,7 @@ const DialogAppUpdater = () => {
<div className="text-base font-medium"> <div className="text-base font-medium">
New Version: Jan {updateState.updateInfo?.version} New Version: Jan {updateState.updateInfo?.version}
</div> </div>
<div className="mt-1 text-main-view-fg/70 font-normal"> <div className="mt-1 text-main-view-fg/70 font-normal mb-2">
There's a new app update available to download. There's a new app update available to download.
</div> </div>
</div> </div>
@ -79,9 +77,9 @@ const DialogAppUpdater = () => {
</div> </div>
{showReleaseNotes && ( {showReleaseNotes && (
<div className="max-h-[500px] py-2 overflow-y-scroll px-4 text-sm font-normal leading-relaxed"> <div className="max-h-[500px] p-4 w-[400px] overflow-y-scroll text-sm font-normal leading-relaxed">
{nightly ? ( {isNightly && !isBeta ? (
<p className="mt-2 text-sm font-normal"> <p className="text-sm font-normal">
You are using a nightly build. This version is built from You are using a nightly build. This version is built from
the latest development branch and may not have release the latest development branch and may not have release
notes. notes.

View File

@ -0,0 +1,5 @@
import { isDev } from './utils'
export const isNightly = VERSION.includes('-')
export const isBeta = VERSION.includes('beta')
export const isProd = !isNightly && !isBeta && !isDev