Merged
Conversation
Contributor
There was a problem hiding this comment.
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'; |
Contributor
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>; |
Contributor
There was a problem hiding this comment.
这段代码存在两个可以改进的地方:
- 显示问题: 当用户选择一个非默认模板时,下拉菜单会显示该模板的目录名(例如
WebGAL_Classic),而不是更友好的显示名称(例如WebGAL Classic)。这是因为value属性直接使用了templateName状态,而该状态存储的是目录。 - 健壮性问题:
onOptionSelect回调中使用显示名称defaultTemplateValue('WebGAL Refine 2026') 作为特殊值来判断是否选择了默认模板。如果未来有一个模板的目录名也叫'WebGAL Refine 2026',将会导致逻辑判断错误。
建议重构此部分,以解决上述问题。例如,可以为默认选项使用一个唯一的内部值(如 '__DEFAULT__'),并始终根据模板目录从 templatesResp.data 中查找并显示正确的模板名称。
HardyNLee
approved these changes
Mar 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
关联 OpenWebGAL/WebGAL#911
要测试此 PR,需要在 OpenWebGAL/WebGAL#911 运行
release-terre,让 Terre 使用新的引擎。变更:
1、使用新的 WebGAL Refine 2026 作为默认模板和模板编辑初始值
2、WebGAL Classic 作为模板保留在预制的模板目录
3、修改了创建游戏时传入要使用的模板的逻辑
注意:在 OpenWebGAL/WebGAL#911 合并后,该 PR 才能合并。