🐛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 { useTranslation } from 'react-i18next'
import { useModelProvider } from '@/hooks/useModelProvider'
import { isProd } from '@/lib/version'
const menuSettings = [
{
@ -24,10 +25,15 @@ const menuSettings = [
title: 'Hardware',
route: route.settings.hardware,
},
// Only show MCP Servers in non-production environment
...(!isProd
? [
{
title: 'MCP Servers',
route: route.settings.mcp_servers,
},
]
: []),
{
title: '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 { RenderMarkdown } from '../RenderMarkdown'
import { cn, isDev } from '@/lib/utils'
import { isNightly, isBeta } from '@/lib/version'
const DialogAppUpdater = () => {
const {
@ -22,16 +23,13 @@ const DialogAppUpdater = () => {
setRemindMeLater(true)
}
const nightly = VERSION.includes('-')
const beta = VERSION.includes('beta')
const { release, fetchLatestRelease } = useReleaseNotes()
useEffect(() => {
if (!isDev()) {
fetchLatestRelease(beta ? true : false)
fetchLatestRelease(isBeta)
}
}, [beta, fetchLatestRelease])
}, [fetchLatestRelease])
// Check for updates when component mounts
useEffect(() => {
@ -71,7 +69,7 @@ const DialogAppUpdater = () => {
<div className="text-base font-medium">
New Version: Jan {updateState.updateInfo?.version}
</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.
</div>
</div>
@ -79,9 +77,9 @@ const DialogAppUpdater = () => {
</div>
{showReleaseNotes && (
<div className="max-h-[500px] py-2 overflow-y-scroll px-4 text-sm font-normal leading-relaxed">
{nightly ? (
<p className="mt-2 text-sm font-normal">
<div className="max-h-[500px] p-4 w-[400px] overflow-y-scroll text-sm font-normal leading-relaxed">
{isNightly && !isBeta ? (
<p className="text-sm font-normal">
You are using a nightly build. This version is built from
the latest development branch and may not have release
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