feat(SelectCity): support polyphonetic characters#626
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR adds polyphonic pinyin support to the SelectCity component by changing PinYin properties to sets of strings, introducing a case-insensitive matching helper, updating search and filter logic, and cleaning up related service registration and CSS. Class diagram for updated CityItem and ProvinceItem polyphonic PinYin supportclassDiagram
class CityItem {
+string Name
+HashSet<string> PinYin
}
class ProvinceItem {
+string Name
+HashSet<string> PinYin
+HashSet<CityItem> Cities
}
ProvinceItem "1" -- "*" CityItem : contains
Flow diagram for updated SelectCity search and filter logic with polyphonic PinYinflowchart TD
A[User enters search text] --> B[SelectCity component receives input]
B --> C{Is search text Chinese?}
C -- Yes --> D[Filter provinces/cities by Chinese text]
C -- No --> E[Get PinYin set for each item]
E --> F[Use StartsWith helper for case-insensitive match]
F --> G[Filter provinces/cities by PinYin set]
D --> H[Display filtered results]
G --> H[Display filtered results]
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for polyphonetic characters in the SelectCity component by allowing multiple pinyin representations for provinces and cities. The implementation changes PinYin properties from storing a single string to a HashSet<string>, enabling support for Chinese characters with multiple pronunciations (e.g., "重庆" can be "chongqing" or "zhongqing").
Key changes:
- Modified data structures to support multiple pinyin representations per city/province
- Updated filtering logic to check against all possible pinyin variations
- Removed dependency on BootstrapBlazor.Pinyin service registration
- Updated project versioning for Visual Studio 17.0 and 18.0 compatibility
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| ServiceCollectionExtension.cs | Removed AddPinyinService() registration call |
| ProvinceItem.cs | Changed PinYin property from string to HashSet |
| CityItem.cs | Changed PinYin property from string to HashSet |
| SelectCity.razor.css | Removed uppercase text transformation styling |
| SelectCity.razor.cs | Updated filtering logic with new StartsWith helper method for HashSet matching |
| BootstrapBlazor.Region.csproj | Added conditional versioning based on Visual Studio version and updated package references |
| Frameworks.props | Added conditional target frameworks based on Visual Studio version |
| BootstrapBlazor.Extensions.slnx | Removed BootstrapBlazor.OCR project reference |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Hey there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `src/components/BootstrapBlazor.Region/Components/SelectCity.razor.css:89-90` </location>
<code_context>
display: none;
}
-.dropdown-menu-search .search-text {
- text-transform: uppercase;
-}
-
</code_context>
<issue_to_address>
**question:** Removing text-transform: uppercase may affect UI consistency.
If mixed-case display is desired, this is appropriate. Otherwise, please confirm this won't negatively affect user experience or search consistency.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Link issues
fixes #625
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Enable multi-pronunciation support in the SelectCity component by storing multiple pinyin variants per item and updating its search, filter, and styling logic accordingly
New Features:
Enhancements:
Chores: