From f11d60782fc0e9627a91c4100cfd38f36e777cf7 Mon Sep 17 00:00:00 2001 From: jingyang <72259332+zjy365@users.noreply.github.com> Date: Tue, 3 Jun 2025 12:02:46 +0800 Subject: [PATCH] fix: template evaluate expression (#5628) * feat: template add scripts * dev * update annotations * fix evaluateExpression * update --- .../providers/template/.vscode/settings.json | 2 +- .../providers/template/src/constants/theme.ts | 38 ++++++++++++++++++- .../template/src/pages/_document.tsx | 4 ++ .../src/pages/instance/components/header.tsx | 34 +++++++++++++---- frontend/providers/template/src/types/app.ts | 1 + .../providers/template/src/utils/adapt.ts | 5 ++- .../providers/template/src/utils/json-yaml.ts | 14 ++++++- 7 files changed, 86 insertions(+), 12 deletions(-) diff --git a/frontend/providers/template/.vscode/settings.json b/frontend/providers/template/.vscode/settings.json index 19c487510..dac22bfae 100644 --- a/frontend/providers/template/.vscode/settings.json +++ b/frontend/providers/template/.vscode/settings.json @@ -11,7 +11,7 @@ "i18n-ally.keystyle": "nested", "i18n-ally.sortKeys": true, "i18n-ally.keepFulfilled": false, - "i18n-ally.sourceLanguage": "zh", + "i18n-ally.sourceLanguage": "en", "i18n-ally.displayLanguage": "zh", "i18n-ally.pathMatcher": "{locale}/{namespaces}.json", "i18n-ally.extract.targetPickingStrategy": "most-similar-by-key" diff --git a/frontend/providers/template/src/constants/theme.ts b/frontend/providers/template/src/constants/theme.ts index 83dafd742..946750ce3 100644 --- a/frontend/providers/template/src/constants/theme.ts +++ b/frontend/providers/template/src/constants/theme.ts @@ -7,12 +7,48 @@ import { } from '@chakra-ui/react'; import { theme as sealosTheme } from '@sealos/ui'; // @ts-ignore -import { selectAnatomy, switchAnatomy } from '@chakra-ui/anatomy'; +import { modalAnatomy, selectAnatomy, switchAnatomy } from '@chakra-ui/anatomy'; const { definePartsStyle: selectPart, defineMultiStyleConfig: selectMultiStyle } = createMultiStyleConfigHelpers(selectAnatomy.keys); const { definePartsStyle: switchPart, defineMultiStyleConfig: switchMultiStyle } = createMultiStyleConfigHelpers(switchAnatomy.keys); +const ModalHelper = createMultiStyleConfigHelpers(modalAnatomy.keys); + +export const Modal = ModalHelper.defineMultiStyleConfig({ + baseStyle: { + header: { + bg: '#fff', + borderTopRadius: '16px', + fontSize: '16px', + borderBottom: 'none', + color: 'grayModern.900', + fontWeight: '500', + py: '11.5px', + lineHeight: '24px' + }, + closeButton: { + fill: '#111824', + svg: { + width: '12px', + height: '12px' + } + }, + dialog: { + borderRadius: '16px' + }, + body: { + px: '36px', + py: '24px' + }, + footer: { + px: '36px', + pb: '24px', + pt: '0px' + } + } +}); + const Button = defineStyleConfig({ baseStyle: { _active: { diff --git a/frontend/providers/template/src/pages/_document.tsx b/frontend/providers/template/src/pages/_document.tsx index 80715dd59..555dd760b 100644 --- a/frontend/providers/template/src/pages/_document.tsx +++ b/frontend/providers/template/src/pages/_document.tsx @@ -2,6 +2,7 @@ import { Html, Head, Main, NextScript } from 'next/document'; export default function Document() { const brandName = process.env.NEXT_PUBLIC_BRAND_NAME; + const scripts: { [key: string]: string }[] = JSON.parse(process.env.CUSTOM_SCRIPTS ?? '[]'); return ( @@ -17,6 +18,9 @@ export default function Document() {
+ {scripts.map((script, i) => ( +