Skip to content

Commit 6a6ec43

Browse files
committed
feat(deps): update monaco-editor to version 0.55.1 and add new dependencies
1 parent ef979c7 commit 6a6ec43

File tree

9 files changed

+56
-9
lines changed

9 files changed

+56
-9
lines changed

dashboard/bun.lock

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dashboard/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
"lodash.debounce": "^4.0.8",
6464
"lucide-react": "^0.465.0",
6565
"mlkem": "^2.7.0",
66+
"monaco-editor": "^0.55.1",
6667
"next-themes": "^0.4.6",
6768
"ofetch": "^1.5.1",
6869
"qrcode.react": "^3.2.0",
@@ -111,4 +112,4 @@
111112
"wait-port": "^1.1.0"
112113
},
113114
"packageManager": "bun@1.0.0"
114-
}
115+
}

dashboard/src/components/charts/area-costume-chart.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
PeriodOption,
2222
toChartQueryEndDate,
2323
} from '@/utils/chart-period-utils'
24+
import useDirDetection from '@/hooks/use-dir-detection'
2425

2526
type DataPoint = {
2627
time: string
@@ -76,7 +77,7 @@ const isNodeRealtimeStats = (stats: SystemStats | NodeRealtimeStats): stats is N
7677
export function AreaCostumeChart({ nodeId, currentStats, realtimeStats }: AreaCostumeChartProps) {
7778
const { t, i18n } = useTranslation()
7879
const { resolvedTheme } = useTheme()
79-
80+
const dir = useDirDetection()
8081
const [realtimeHistory, setRealtimeHistory] = useState<DataPoint[]>([])
8182
const [realtimeError, setRealtimeError] = useState<Error | null>(null)
8283
const [viewMode, setViewMode] = useState<'realtime' | 'historical'>('realtime')
@@ -309,10 +310,10 @@ export function AreaCostumeChart({ nodeId, currentStats, realtimeStats }: AreaCo
309310
}
310311
}}
311312
>
312-
<SelectTrigger className="h-9 w-full text-xs sm:w-32">
313+
<SelectTrigger className="h-9 w-full text-xs sm:w-32" dir={dir}>
313314
<SelectValue>{periodOption.label}</SelectValue>
314315
</SelectTrigger>
315-
<SelectContent>
316+
<SelectContent dir={dir}>
316317
{PERIOD_OPTIONS.map(option => (
317318
<SelectItem key={option.value} value={option.value}>
318319
{option.label}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import '@/lib/configure-monaco'
2+
3+
export { default, DiffEditor, loader, useMonaco } from '@monaco-editor/react'

dashboard/src/components/dialogs/client-template-modal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { UseFormReturn } from 'react-hook-form'
1919
import { useTranslation } from 'react-i18next'
2020
import { toast } from 'sonner'
2121

22-
const MonacoEditor = lazy(() => import('@monaco-editor/react'))
22+
const MonacoEditor = lazy(() => import('@/components/common/monaco-editor'))
2323
const MobileJsonAceEditor = lazy(() => import('@/components/common/mobile-json-ace-editor'))
2424
const MobileYamlAceEditor = lazy(() => import('@/components/common/mobile-yaml-ace-editor'))
2525

dashboard/src/components/dialogs/core-config-modal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ const createWireGuardCoreConfigJson = (keyPair: { privateKey: string; publicKey:
146146
2,
147147
)
148148

149-
const MonacoEditor = lazy(() => import('@monaco-editor/react'))
149+
const MonacoEditor = lazy(() => import('@/components/common/monaco-editor'))
150150
const MobileJsonAceEditor = lazy(() => import('@/components/common/mobile-json-ace-editor'))
151151

152152
export default function CoreConfigModal({ isDialogOpen, onOpenChange, form, editingCore, editingCoreId }: CoreConfigModalProps) {

dashboard/src/components/users/users-statistics.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import useDirDetection from '@/hooks/use-dir-detection'
22
import { cn } from '@/lib/utils'
33
import { useGetSystemStats } from '@/service/api'
4-
import { Users, Wifi } from 'lucide-react'
4+
import { UserCheck, Users } from 'lucide-react'
55
import { useEffect, useState } from 'react'
66
import { useTranslation } from 'react-i18next'
77
import { Card, CardTitle } from '@/components/ui/card'
@@ -73,7 +73,7 @@ const UsersStatistics = () => {
7373
/>
7474
<CardTitle className="relative z-10 flex min-w-0 items-center justify-between gap-x-4 overflow-hidden">
7575
<div className="flex min-w-0 flex-1 items-center gap-x-4 overflow-hidden min-h-8">
76-
<Wifi className="h-5 w-5 shrink-0" />
76+
<UserCheck className="h-5 w-5 shrink-0" />
7777
<span>{t('statistics.activeUsers')}</span>
7878
</div>
7979
<span className={cn('mx-2 shrink-0 text-3xl transition-all duration-500', isIncreased.active_users ? 'animate-zoom-out' : '')} style={{ animationDuration: '400ms' }}>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { loader } from '@monaco-editor/react'
2+
import * as monaco from 'monaco-editor'
3+
import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker'
4+
import jsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker'
5+
6+
type MonacoInstance = NonNullable<Parameters<typeof loader.config>[0]['monaco']>
7+
8+
type MonacoWorkerFactory = (workerId: string, label: string) => Worker
9+
10+
type MonacoEnvironmentShape = {
11+
getWorker?: MonacoWorkerFactory
12+
}
13+
14+
type MonacoGlobal = typeof globalThis & {
15+
MonacoEnvironment?: MonacoEnvironmentShape
16+
}
17+
18+
const monacoGlobal = typeof self === 'undefined' ? null : (self as MonacoGlobal)
19+
20+
if (monacoGlobal && !monacoGlobal.MonacoEnvironment?.getWorker) {
21+
monacoGlobal.MonacoEnvironment = {
22+
...monacoGlobal.MonacoEnvironment,
23+
getWorker(_, label) {
24+
if (label === 'json') {
25+
return new jsonWorker()
26+
}
27+
28+
return new editorWorker()
29+
},
30+
}
31+
}
32+
33+
// Bun exposes Monaco through a symlinked package path, which makes the loader's
34+
// Monaco type and the imported Monaco value look different to TypeScript even
35+
// though they are the same runtime module.
36+
loader.config({ monaco: monaco as unknown as MonacoInstance })

dashboard/vite.config.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ export default defineConfig({
148148
workbox: {
149149
navigateFallback: '/index.html',
150150
globPatterns: ['**/*.{js,css,html,ico,png,svg,woff2}'],
151+
maximumFileSizeToCacheInBytes: 4 * 1024 * 1024,
151152
skipWaiting: true,
152153
clientsClaim: true,
153154
runtimeCaching: [

0 commit comments

Comments
 (0)