Skip to content

Conversation

@ErikPre
Copy link
Collaborator

@ErikPre ErikPre commented Nov 4, 2025

Merging into Importer Rework branch

@ErikPre ErikPre requested review from Copilot and tpurschke November 4, 2025 15:02
@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 4, 2025

@ErikPre
Copy link
Collaborator Author

ErikPre commented Nov 4, 2025

@tpurschke Ich habe die update sql erstmal 9.1.1.sql genannt, ich bin mir da nicht sicher in welche version und datei die kommt

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request adds a customizable color scheme feature to the UI, allowing users to select from predefined color schemes (blue, green, red, purple). The changes enable dynamic theming of the navigation bar and headings through CSS variables.

  • Introduced ColorScheme class with predefined color schemes and properties for gradient colors
  • Added color scheme selection UI in settings with persistence to configuration
  • Updated CSS to use CSS variables for dynamic color theming

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
roles/lib/files/FWO.Config.Api/Data/ColorScheme.cs New class defining available color schemes with hex values and a lookup method
roles/lib/files/FWO.Config.Api/Data/ConfigData.cs Added ColorScheme property to persist user's color scheme selection
roles/ui/files/FWO.UI/Services/ColorThemeService.cs New service for managing user color mode state (appears unused in this PR)
roles/ui/files/FWO.UI/Shared/NavigationMenu.razor Applied color scheme CSS variables to navigation bar for dynamic theming
roles/ui/files/FWO.UI/Pages/Settings/SettingsDefaults.razor Added UI dropdown for color scheme selection with save functionality
roles/ui/files/FWO.UI/wwwroot/css/site.css Updated gradient and heading styles to support CSS variables with fallbacks
roles/database/files/upgrade/8.8.11.sql Database migration adding localized text entries for color schemes
roles/database/files/sql/idempotent/fworch-texts.sql Added localized text entries for color scheme UI labels

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +3 to +4
using Org.BouncyCastle.Crypto.Engines;

Copy link

Copilot AI Nov 4, 2025

Choose a reason for hiding this comment

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

The import Org.BouncyCastle.Crypto.Engines is unused in this file. This class only defines color scheme data structures and doesn't use any cryptographic functionality. Remove this unnecessary import.

Suggested change
using Org.BouncyCastle.Crypto.Engines;

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

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

yes, should be removed here

Comment on lines +3 to +4
INSERT INTO txt VALUES ('color_scheme_standard', 'German', 'Standard Farbschema');
INSERT INTO txt VALUES ('color_scheme_standard', 'English', 'Standard Color Scheme');
Copy link

Copilot AI Nov 4, 2025

Choose a reason for hiding this comment

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

The database migration includes text entries for 'color_scheme_standard', but this color scheme name doesn't exist in the ColorScheme.AvailableSchemes list. The actual default scheme is named 'color_scheme_blue'. Either add 'color_scheme_standard' as an available scheme or remove these unused text entries.

Suggested change
INSERT INTO txt VALUES ('color_scheme_standard', 'German', 'Standard Farbschema');
INSERT INTO txt VALUES ('color_scheme_standard', 'English', 'Standard Color Scheme');

Copilot uses AI. Check for mistakes.
Comment on lines +2669 to +2674
INSERT INTO txt VALUES ('notification', 'German', 'Benachrichtigung');
INSERT INTO txt VALUES ('notification', 'English', 'Notification');
INSERT INTO txt VALUES ('edit_notification', 'German', 'Benachrichtigung bearbeiten');
INSERT INTO txt VALUES ('edit_notification', 'English', 'Edit Notification');
INSERT INTO txt VALUES ('delete_notification', 'German', 'Benachrichtigung löschen');
INSERT INTO txt VALUES ('delete_notification', 'English', 'Delete Notification');
Copy link

Copilot AI Nov 4, 2025

Choose a reason for hiding this comment

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

Lines 2669-2674 are duplicates of lines 2665-2668 (notification-related entries). These duplicate INSERT statements should be removed as they don't relate to the color scheme feature and will cause database constraint violations if the txt table has a unique constraint on the key-language combination.

Suggested change
INSERT INTO txt VALUES ('notification', 'German', 'Benachrichtigung');
INSERT INTO txt VALUES ('notification', 'English', 'Notification');
INSERT INTO txt VALUES ('edit_notification', 'German', 'Benachrichtigung bearbeiten');
INSERT INTO txt VALUES ('edit_notification', 'English', 'Edit Notification');
INSERT INTO txt VALUES ('delete_notification', 'German', 'Benachrichtigung löschen');
INSERT INTO txt VALUES ('delete_notification', 'English', 'Delete Notification');

Copilot uses AI. Check for mistakes.
{
configData.DefaultLanguage = selectedLanguage.Name;
configData.ColorScheme = selectedColorScheme.Name;
StateHasChanged();
Copy link

Copilot AI Nov 4, 2025

Choose a reason for hiding this comment

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

Calling StateHasChanged() in the middle of the Save() method is unnecessary and could cause premature re-rendering before the save operation completes. If a state refresh is needed, it should be called after all data modifications are complete, or removed entirely if the framework handles it automatically after the async operation completes.

Suggested change
StateHasChanged();

Copilot uses AI. Check for mistakes.
Comment on lines +33 to +42
bool allGood = false;
if (_UserColorModes.TryAdd(key, mode))
{
allGood = true;

}
else
{
allGood = _UserColorModes.TryUpdate(key, mode, _UserColorModes[key]);
}
Copy link

Copilot AI Nov 4, 2025

Choose a reason for hiding this comment

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

Both branches of this 'if' statement write to the same variable - consider using '?' to express intent better.

Suggested change
bool allGood = false;
if (_UserColorModes.TryAdd(key, mode))
{
allGood = true;
}
else
{
allGood = _UserColorModes.TryUpdate(key, mode, _UserColorModes[key]);
}
bool allGood = _UserColorModes.TryAdd(key, mode)
? true
: _UserColorModes.TryUpdate(key, mode, _UserColorModes[key]);

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@tpurschke tpurschke left a comment

Choose a reason for hiding this comment

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

see inline comments - @Y4nnikH maybe you can also have a look at Erik's 2 PRs

Copy link
Contributor

Choose a reason for hiding this comment

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

all changes to txt table are made only in roles/database/files/sql/idempotent/fworch-texts.sql

INSERT INTO txt VALUES ('edit_notification', 'English', 'Edit Notification');
INSERT INTO txt VALUES ('delete_notification', 'German', 'Benachrichtigung löschen');
INSERT INTO txt VALUES ('delete_notification', 'English', 'Delete Notification');
INSERT INTO txt VALUES ('notification', 'German', 'Benachrichtigung');
Copy link
Contributor

Choose a reason for hiding this comment

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

remove duplicates

Comment on lines +3 to +4
using Org.BouncyCastle.Crypto.Engines;

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, should be removed here

@tpurschke
Copy link
Contributor

@tpurschke Ich habe die update sql erstmal 9.1.1.sql genannt, ich bin mir da nicht sicher in welche version und datei die kommt

I do not really see any file with that name but we do not need it anyway. Also the file 8.8.11 should be removed

@tpurschke tpurschke marked this pull request as draft November 5, 2025 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants