Skip to content

Commit

Permalink
fix: some style adjust and text adjust
Browse files Browse the repository at this point in the history
  • Loading branch information
mlhiter committed Jan 9, 2025
1 parent 9920c7b commit a877df5
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 28 deletions.
17 changes: 13 additions & 4 deletions frontend/providers/devbox/components/ScriptCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@ import MyIcon from './Icon'
import Code from './Code'
import { useCopyData } from '@/utils/tools'

const ScriptCode = ({ platform, script }: { platform: string; script: string }) => {
const [onOpenScripts, setOnOpenScripts] = useState(false)
const ScriptCode = ({
platform,
script,
defaultOpen = false
}: {
platform: string
script: string
defaultOpen?: boolean
}) => {
const [onOpenScripts, setOnOpenScripts] = useState(defaultOpen)

const { copyData } = useCopyData()

Expand All @@ -18,7 +26,8 @@ const ScriptCode = ({ platform, script }: { platform: string; script: string })
border={'1px solid'}
borderColor={'grayModern.200'}
flexDirection={'column'}
w={'585px'}>
w={'585px'}
maxH={'400px'}>
<Flex justifyContent={'space-between'} alignItems={'center'} w={'full'}>
<Box>
<Button
Expand Down Expand Up @@ -66,7 +75,7 @@ const ScriptCode = ({ platform, script }: { platform: string; script: string })
</Button>
</Flex>
<Collapse in={onOpenScripts} animateOpacity>
<Box pt={2} pl={3}>
<Box pt={2} pl={3} overflowY={'auto'} h={'100%'}>
<Code content={script} language={platform === 'Windows' ? 'powershell' : 'bash'} />
</Box>
</Collapse>
Expand Down
58 changes: 43 additions & 15 deletions frontend/providers/devbox/components/modals/SshConnectModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,21 +154,37 @@ const SshConnectModal = ({
color={'grayModern.900'}
fontWeight={400}
lineHeight={'20px'}>
{t.rich('jetbrains_guide_one_click_setup_desc', {
blue: (chunks) => (
<Text
fontWeight={'bold'}
display={'inline-block'}
color={'brightBlue.600'}>
{chunks}
</Text>
),
lightColor: (chunks) => (
<Text color={'grayModern.600'} display={'inline-block'}>
{chunks}
</Text>
)
})}
{script.platform === 'Windows'
? t.rich('jetbrains_guide_one_click_setup_desc_windows', {
blue: (chunks) => (
<Text
fontWeight={'bold'}
display={'inline-block'}
color={'brightBlue.600'}>
{chunks}
</Text>
),
lightColor: (chunks) => (
<Text color={'grayModern.600'} display={'inline-block'}>
{chunks}
</Text>
)
})
: t.rich('jetbrains_guide_one_click_setup_desc', {
blue: (chunks) => (
<Text
fontWeight={'bold'}
display={'inline-block'}
color={'brightBlue.600'}>
{chunks}
</Text>
),
lightColor: (chunks) => (
<Text color={'grayModern.600'} display={'inline-block'}>
{chunks}
</Text>
)
})}
</Box>
<Button
leftIcon={<MyIcon name="download" color={'grayModern.500'} w={'16px'} />}
Expand Down Expand Up @@ -217,6 +233,7 @@ const SshConnectModal = ({
<Flex mt={1} ml={2} mb={5} flexDirection={'column'} gap={4} flex={1}>
<Box fontSize={'14px'}>{t('jetbrains_guide_command')}</Box>
<ScriptCode
defaultOpen={true}
platform={script.platform}
script={sshConnectCommand(jetbrainsGuideData.configHost)}
/>
Expand All @@ -229,6 +246,16 @@ const SshConnectModal = ({
<Circle size="10px" bg="grayModern.100" top={-3} left={2.5} position={'absolute'} />
</Step>
</Stepper>
<Box position={'relative'} w={'100%'} h={'30px'} mt={4}>
<Button
onClick={() => onSuccess()}
position={'absolute'}
right={0}
size={'sm'}
p={'12px'}>
{t('jetbrains_guide_confirm')}
</Button>
</Box>

<Divider my={6} />
{/* step-by-step */}
Expand Down Expand Up @@ -363,6 +390,7 @@ const SshConnectModal = ({
<Flex mt={1} ml={2} mb={5} flexDirection={'column'} gap={4} flex={1}>
<Box fontSize={'14px'}>{t('jetbrains_guide_command')}</Box>
<ScriptCode
defaultOpen={true}
platform={script.platform}
script={sshConnectCommand(jetbrainsGuideData.configHost)}
/>
Expand Down
10 changes: 6 additions & 4 deletions frontend/providers/devbox/message/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,14 @@
"input_template_name_placeholder": "Enter template name",
"input_template_version_placeholder": "Enter version (e.g. 1.0.0)",
"internal_address": "Internal Address",
"invalide_template_name": "Please enter a valid template name",
"invalide_template_version": "Please enter a valid version number",
"jetbrains_guide_cancel": "Click to Cancel",
"jetbrains_guide_check_ssh_connection": "Connection Verification",
"jetbrains_guide_click_to_config": "Click the button below to <blue>configure SSH connection </blue>.",
"jetbrains_guide_command": "Open a terminal and type the following command to verify connection:",
"jetbrains_guide_config_ssh": "Configure SSH Connection",
"jetbrains_guide_confirm": "Config Success",
"jetbrains_guide_connecting": "Connecting ({process}%) ...",
"jetbrains_guide_connecting_info": "The initial connection may take 3-5 minutes. Please be patient.",
"jetbrains_guide_documentation": "User Guide",
Expand All @@ -116,7 +119,8 @@
"jetbrains_guide_move_to_path": "Make sure the private key is in the following directory: <blue>~/.ssh/sealos/</blue>.",
"jetbrains_guide_one_click_setup": "One-Click Setup",
"jetbrains_guide_one_click_setup_desc": "Click the button below to download <blue>the bat/sh script</blue>. After downloading, <blue>simply double-click to run it</blue> to complete the SSH connection setup.<lightColor>(Alternatively, you can copy the script to a local file and execute it with a single click).</lightColor>",
"jetbrains_guide_post_connection": "How to connect to the service?You can click the button below to view the user guide.",
"jetbrains_guide_one_click_setup_desc_windows": "Click the button below to download <blue>the bat/sh script</blue>. After downloading, <blue>right click the file > Run with PowerShell</blue> to complete the SSH connection setup.<lightColor>(Alternatively, you can copy the script to a local file and execute it with a single click).</lightColor>",
"jetbrains_guide_post_connection": "You can click the button below to view the user guide.",
"jetbrains_guide_post_use": "Learn More",
"jetbrains_guide_prepare": "Prerequiste(s)",
"jetbrains_guide_prepare_install": "You need to download <blue>JetBrains Gateway</blue> in advance.",
Expand All @@ -134,8 +138,6 @@
"jetbrains_guide_step_3_5": "Check if local <blue>{ide}</blue> is automatically invoked.",
"jetbrains_guide_step_by_step": "Step-By-Step",
"jetbrains_guide_three_steps": "(3 steps)",
"invalide_template_name": "Please enter a valid template name",
"invalide_template_version": "Please enter a valid version number",
"jump_prompt": "Jump prompt",
"jump_terminal_error": "Jump terminal failed",
"language": "Language",
Expand Down Expand Up @@ -243,11 +245,11 @@
"update_failed": "Update failed",
"update_matched_apps_notes": "Or you can update application: ",
"update_success": "Update succeeded",
"use_jetbrains": "Develop with JetBrains IDEs",
"update_template": "Update Template",
"update_template_success": "Template updated successfully!",
"update_time": "Last Modified",
"use_case": "Use Case",
"use_jetbrains": "Develop with JetBrains IDEs",
"used": "Used",
"version": "Release",
"version_config": "Configuration",
Expand Down
12 changes: 7 additions & 5 deletions frontend/providers/devbox/message/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,20 +105,24 @@
"input_template_version_placeholder": "请输入版本号,如 v1.0.0",
"internal_address": "内网地址",
"intranet_address": "内网地址",
"invalide_template_name": "输入的模板名称不符合规则",
"invalide_template_version": "输入的版本号不符合规则",
"jetbrains_guide_cancel": "点击取消",
"jetbrains_guide_check_ssh_connection": "连接验证",
"jetbrains_guide_click_to_config": "点击下方按钮,<blue>配置 SSH 连接信息</blue>。",
"jetbrains_guide_command": "打开命令行,输入以下命令来检测SSH连接是否正常:",
"jetbrains_guide_config_ssh": "配置 SSH 连接信息",
"jetbrains_guide_confirm": "配置完成",
"jetbrains_guide_connecting": "正在连接({process}%)...",
"jetbrains_guide_connecting_info": "第一次连接需要 3-5 min,请耐心等待",
"jetbrains_guide_documentation": "使用文档",
"jetbrains_guide_download_private_key": "下载 <blue>私钥</blue>。",
"jetbrains_guide_modified_file": "<blue>修改 ~/.ssh/sealos/devbox_config 文件</blue>(如果不存在需要新建一个文件),内容为",
"jetbrains_guide_modified_file": "修改<blue> ~/.ssh/sealos/devbox_config</blue> 文件(如果不存在需要新建一个文件),在文件末尾追加",
"jetbrains_guide_move_to_path": "将下载好的私钥移动到目录:<blue>~/.ssh/sealos/</blue> 。",
"jetbrains_guide_one_click_setup": "一键配置",
"jetbrains_guide_one_click_setup_desc": "点击下方按钮 <blue>下载 bat/sh 脚本</blue>,下载到本地后<blue>直接双击运行</blue>即可完成 SSH 连接信息的配置<lightColor>(或者您也可以复制脚本到本地一个文件,然后一键执行)</lightColor>。",
"jetbrains_guide_post_connection": "如何连接服务?后续使用可点击下方按钮进行查看。",
"jetbrains_guide_one_click_setup_desc_windows": "点击下方按钮 <blue>下载 bat/sh 脚本</blue>,下载到本地后<blue>右键点击文件 > 使用 PowerShell 运行</blue> 即可完成 SSH 连接信息的配置<lightColor>(或者您也可以复制脚本到本地一个文件,然后一键执行)</lightColor>。",
"jetbrains_guide_post_connection": "后续使用可点击下方按钮进行查看。",
"jetbrains_guide_post_use": "后续使用",
"jetbrains_guide_prepare": "前置准备",
"jetbrains_guide_prepare_install": "需要提前下载好 <blue>JetBrains Gateway</blue> 应用。",
Expand All @@ -136,8 +140,6 @@
"jetbrains_guide_step_3_5": "自动唤起本地的<blue>{ide}</blue>。",
"jetbrains_guide_step_by_step": "手把手",
"jetbrains_guide_three_steps": "(共 3 步)",
"invalide_template_name": "输入的模板名称不符合规则",
"invalide_template_version": "输入的版本号不符合规则",
"jump_prompt": "跳转提示",
"jump_terminal_error": "跳转终端失败",
"language": "语言",
Expand Down Expand Up @@ -244,11 +246,11 @@
"update_failed": "变更失败",
"update_matched_apps_notes": "或者你可以更新已有应用:",
"update_success": "变更成功",
"use_jetbrains": "使用 JetBrains IDE 开发",
"update_template": "更新模板",
"update_template_success": "更新模板成功!",
"update_time": "更新时间",
"use_case": "用例",
"use_jetbrains": "使用 JetBrains IDE 开发",
"used": "已用",
"version": "版本",
"version_config": "版本配置",
Expand Down

0 comments on commit a877df5

Please sign in to comment.