Skip to content

Commit 6d67874

Browse files
authored
React changes and Application Insights configuration issue (#233)
1 parent bb664f4 commit 6d67874

5 files changed

Lines changed: 22 additions & 21 deletions

File tree

src/frontend/Sudoku.Blazor/Program.cs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using Azure.Identity;
22
using BlazorApplicationInsights;
3-
using Microsoft.ApplicationInsights.AspNetCore.Extensions;
43
using Sudoku.Blazor;
54
using Sudoku.Blazor.Components;
65

@@ -36,25 +35,15 @@
3635
builder.Services
3736
.RegisterBlazorGameServices(builder.Configuration);
3837

39-
// Only configure Application Insights if connection string is provided
38+
// Only configure client-side Application Insights if connection string is provided
39+
// Server-side telemetry is handled by Azure.Monitor.OpenTelemetry.AspNetCore via ServiceDefaults
4040
if (!string.IsNullOrEmpty(appInsightsConnectionString))
4141
{
4242
builder.Services
4343
.AddBlazorApplicationInsights(x =>
4444
{
4545
x.ConnectionString = appInsightsConnectionString;
46-
})
47-
.AddApplicationInsightsTelemetry(new ApplicationInsightsServiceOptions
48-
{
49-
ConnectionString = appInsightsConnectionString,
50-
EnableQuickPulseMetricStream = true
5146
});
52-
53-
// Configure Application Insights logging
54-
builder.Logging
55-
.AddApplicationInsights(
56-
configureTelemetryConfiguration: (config) => config.ConnectionString = appInsightsConnectionString,
57-
configureApplicationInsightsLoggerOptions: (options) => { });
5847
}
5948

6049
var app = builder.Build();

src/frontend/Sudoku.Blazor/Sudoku.Blazor.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@
1212
<PackageReference Include="Aspire.Microsoft.Azure.Cosmos" Version="13.2.2" />
1313
<PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.5.0" />
1414
<PackageReference Include="BlazorApplicationInsights" Version="3.3.0" />
15-
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="3.1.0" />
1615
<PackageReference Include="Microsoft.Extensions.Azure" Version="1.13.1" />
1716
<PackageReference Include="Microsoft.Extensions.Http" Version="10.0.6" />
18-
<PackageReference Include="Microsoft.Extensions.Logging.ApplicationInsights" Version="2.23.0" />
1917
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="10.0.6" />
2018
</ItemGroup>
2119

src/frontend/Sudoku.React/src/components/CellInput.module.css

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,18 @@
3939
background-color: #F0F8FF !important;
4040
}
4141

42-
.highlight {
43-
background-color: #F0F8F0 !important;
42+
.highlight input,
43+
.highlight label {
44+
background-color: #d8eef8 !important;
4445
}
4546

46-
.invalid {
47+
.selected input,
48+
.selected label {
49+
background-color: #b8d8f0 !important;
50+
}
51+
52+
.invalid input,
53+
.invalid label {
4754
background-color: #ffdddd !important;
4855
outline: 1px solid red;
4956
}

src/frontend/Sudoku.React/src/components/CellInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function CellInput({
2323
const getCellClass = (): string => {
2424
const classes = [styles.cell];
2525
if (isInvalid) classes.push(styles.invalid);
26-
else if (isSelected) classes.push(styles.highlight);
26+
else if (isSelected) classes.push(styles.selected);
2727
else if (isHighlighted) classes.push(styles.highlight);
2828
return classes.join(' ');
2929
};

src/frontend/Sudoku.React/src/pages/GamePage.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,19 @@ export default function GamePage() {
254254
);
255255
}
256256

257+
if (solved) {
258+
return (
259+
<Layout>
260+
<VictoryDisplay onClose={handleVictoryClose} />
261+
</Layout>
262+
);
263+
}
264+
257265
if (isGameLoading || !game) {
258266
return (
259267
<Layout>
260268
<div style={{ textAlign: 'center', marginTop: '4rem' }}>
261-
{isGameLoading ? 'Loading puzzle...' : 'Loading puzzle...'}
269+
Loading puzzle...
262270
</div>
263271
</Layout>
264272
);
@@ -291,7 +299,6 @@ export default function GamePage() {
291299
onReset={handleReset}
292300
onTogglePencil={() => setPencilMode(p => !p)}
293301
/>
294-
{solved && <VictoryDisplay onClose={handleVictoryClose} />}
295302
</div>
296303
</Layout>
297304
);

0 commit comments

Comments
 (0)