Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions NoteBookmark.BlazorApp/Components/Pages/Posts.razor
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@
</FluentSwitch>
</FluentStack>

<FluentDataGrid Id="postgrid" Items="@filteredUrlList" Pagination="@pagination">
<FluentDataGrid Id="postgrid" Items="@filteredUrlList" Pagination="@pagination" Class="posts-grid compact">
<ChildContent>
<TemplateColumn Width="150px">
<FluentButton OnClick="@(async () => await OpenUrlInNewWindow(context!.Url))" IconEnd="@(new Icons.Regular.Size20.Open())" />
<FluentButton OnClick="@(() => EditNote(context!.RowKey))" IconEnd="@(new Icons.Regular.Size20.Edit())" />
<FluentButton Appearance="Appearance.Stealth" Size="ControlSize.Small" Title="Open" Class="icon-btn" OnClick="@(async () => await OpenUrlInNewWindow(context!.Url))" IconEnd="@(new Icons.Regular.Size20.Open())" />
<FluentButton Appearance="Appearance.Stealth" Size="ControlSize.Small" Title="Edit" Class="icon-btn" OnClick="@(() => EditNote(context!.RowKey))" IconEnd="@(new Icons.Regular.Size20.Edit())" />
@if (String.IsNullOrEmpty(context!.NoteId))
{
<FluentButton OnClick="@(async () => await CreateNoteForPost(context!.RowKey))" IconEnd="@(new Icons.Regular.Size20.NoteAdd())" />
<FluentButton Appearance="Appearance.Stealth" Size="ControlSize.Small" Title="Create note" Class="icon-btn" OnClick="@(async () => await CreateNoteForPost(context!.RowKey))" IconEnd="@(new Icons.Regular.Size20.NoteAdd())" />
}
else
{
<FluentButton IconEnd="@(new Icons.Filled.Size20.NoteEdit())" />
<FluentButton Appearance="Appearance.Stealth" Disabled Size="ControlSize.Small" Title="Note exists" Class="icon-btn" IconEnd="@(new Icons.Filled.Size20.NoteEdit())" />
}
</TemplateColumn>
<PropertyColumn Title="Title" Property="@(c => c!.Title)" Sortable="true" Filtered="!string.IsNullOrWhiteSpace(titleFilter)" >
Expand All @@ -51,7 +51,7 @@
IsDefaultSortColumn="true"
Width="125px"/>
<TemplateColumn Width="60px">
<FluentButton OnClick="@(async () => await DeletePost(context!.RowKey))" IconEnd="@(new Icons.Regular.Size20.Delete())" />
<FluentButton Appearance="Appearance.Stealth" Size="ControlSize.Small" Title="Delete" Class="icon-btn danger" OnClick="@(async () => await DeletePost(context!.RowKey))" IconEnd="@(new Icons.Regular.Size20.Delete())" />
</TemplateColumn>
</ChildContent>
<EmptyContent>
Expand Down
9 changes: 7 additions & 2 deletions NoteBookmark.BlazorApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@

builder.AddServiceDefaults();

builder.Services.AddHttpClient<PostNoteClient>(client =>
// Resolve the API base URL from configuration or environment for local runs without Aspire
var apiBaseUrl = builder.Configuration["Services:ApiBaseUrl"]
?? Environment.GetEnvironmentVariable("API_BASE_URL")
?? "http://localhost:5003";

builder.Services.AddHttpClient<PostNoteClient>(client =>
{
client.BaseAddress = new Uri("https+http://api");
client.BaseAddress = new Uri(apiBaseUrl);
});

builder.Services.AddHttpClient<SummaryService>(client =>
Expand Down
5 changes: 4 additions & 1 deletion NoteBookmark.BlazorApp/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
"AllowedHosts": "*",
"Services": {
"ApiBaseUrl": "http://localhost:5003"
}
}
20 changes: 20 additions & 0 deletions NoteBookmark.BlazorApp/wwwroot/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,26 @@ body {
background: var(--neutral-fill-layer-rest);
}

/* Compact data grid for posts list */
.posts-grid.compact .fluent-grid-row,
.posts-grid.compact .fluent-grid-cell {
height: 36px;
min-height: 36px;
}

.posts-grid.compact .icon-btn {
padding: 2px 6px;
margin-right: 4px;
}

.posts-grid.compact .icon-btn.danger {
color: var(--accent-foreground-rest);
}

.search-box {
padding: 4px;
}

.navmenu-icon {
display: none;
}
Expand Down