Skip to content

Refresh UI#580

Merged
MakinoharaShoko merged 9 commits intodevfrom
refresh-ui
Apr 1, 2026
Merged

Refresh UI#580
MakinoharaShoko merged 9 commits intodevfrom
refresh-ui

Conversation

@MakinoharaShoko
Copy link
Copy Markdown
Member

关联 OpenWebGAL/WebGAL#911

要测试此 PR,需要在 OpenWebGAL/WebGAL#911 运行 release-terre,让 Terre 使用新的引擎。

变更:
1、使用新的 WebGAL Refine 2026 作为默认模板和模板编辑初始值
2、WebGAL Classic 作为模板保留在预制的模板目录
3、修改了创建游戏时传入要使用的模板的逻辑

注意:在 OpenWebGAL/WebGAL#911 合并后,该 PR 才能合并。

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the default template to 'WebGAL Refine 2026', introducing significant CSS changes to the text box and title buttons, while moving the previous default to a standalone 'WebGAL Classic' template. It also updates localization files and the game creation service to ensure a template is always applied. Feedback suggests internationalizing the new template name and improving the template selection dropdown to display friendly names instead of directory paths and to use more robust sentinel values for logic.

});

const defaultDerivativeValue = 'WebGAL Standard';
const defaultTemplateValue = 'WebGAL Refine 2026';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

硬编码的字符串 'WebGAL Refine 2026' 没有被国际化,这会影响多语言支持。建议使用 t 宏进行翻译(例如 t\WebGAL Refine 2026`),并将其添加到 .po` 文件中,以确保在不同语言环境下能正确显示。

Comment on lines 64 to 73
const selectorTemplate = <Dropdown value={templateName ?? defaultTemplateValue}
selectedOptions={[templateName ?? defaultTemplateValue]}
onOptionSelect={(_, elem) => {
setTemplateName(elem.optionValue);
setTemplateName(elem.optionValue === defaultTemplateValue ? undefined : elem.optionValue);
}}>
<Option key="__standard" value="__STANDARD__WG__">{t`WebGAL Classic`}</Option>
<Option key="default-template" value={defaultTemplateValue}>{defaultTemplateValue}</Option>
{(templatesResp.data ?? []).map(e =>
<Option key={e.name} value={e.name}>{e.name}</Option>
<Option key={e.dir} value={e.dir}>{e.name}</Option>
)}
</Dropdown>;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

这段代码存在两个可以改进的地方:

  1. 显示问题: 当用户选择一个非默认模板时,下拉菜单会显示该模板的目录名(例如 WebGAL_Classic),而不是更友好的显示名称(例如 WebGAL Classic)。这是因为 value 属性直接使用了 templateName 状态,而该状态存储的是目录。
  2. 健壮性问题: onOptionSelect 回调中使用显示名称 defaultTemplateValue ('WebGAL Refine 2026') 作为特殊值来判断是否选择了默认模板。如果未来有一个模板的目录名也叫 'WebGAL Refine 2026',将会导致逻辑判断错误。

建议重构此部分,以解决上述问题。例如,可以为默认选项使用一个唯一的内部值(如 '__DEFAULT__'),并始终根据模板目录从 templatesResp.data 中查找并显示正确的模板名称。

@MakinoharaShoko MakinoharaShoko merged commit 6763f82 into dev Apr 1, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants