ActivityFeed
TsgcHTMLComponent_ActivityFeed — render a live, newest-first activity feed with relative timestamps and out-of-band WebSocket push, in Delphi, C++ Builder and .NET.
TsgcHTMLComponent_ActivityFeed — render a live, newest-first activity feed with relative timestamps and out-of-band WebSocket push, in Delphi, C++ Builder and .NET.
Push activities with AddActivity, read HTML for the first render, then push new items live with a WebSocket fragment.
TsgcHTMLComponent_ActivityFeed
Bootstrap 5 list + scoped CSS + live relative-time script
Delphi, C++ Builder, .NET
Call AddActivity for each entry, read HTML for the initial page, then push a new item as an out-of-band fragment over WebSockets with GetLastItemFragmentHTML.
uses
sgcHTML_Enums, sgcHTML_Component_ActivityFeed;
var
oFeed: TsgcHTMLComponent_ActivityFeed;
begin
oFeed := TsgcHTMLComponent_ActivityFeed.Create(nil);
try
oFeed.FeedID := 'timeline';
oFeed.Title := 'Recent Activity';
oFeed.MaxItems := 30;
oFeed.AddActivity('Ana', 'closed', 'ticket #482', hcSuccess, 'bi bi-check-circle');
oFeed.AddActivity('Marc', 'commented on', 'invoice #1190', hcPrimary);
WebModule.Response := oFeed.HTML; // feed list + scoped CSS + live relative-time script
finally
oFeed.Free;
end;
end;
// Push a new item live to connected clients (out-of-band htmx fragment):
oFeed.AddActivity('Ana', 'approved', 'purchase order #77', hcSuccess);
Engine.BroadcastFragment(oFeed.GetLastItemFragmentHTML);
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_ActivityFeed.hpp
TsgcHTMLComponent_ActivityFeed *oFeed = new TsgcHTMLComponent_ActivityFeed(NULL);
try
{
oFeed->FeedID = "timeline";
oFeed->Title = "Recent Activity";
oFeed->MaxItems = 30;
oFeed->AddActivity("Ana", "closed", "ticket #482", hcSuccess, "bi bi-check-circle");
oFeed->AddActivity("Marc", "commented on", "invoice #1190", hcPrimary);
String html = oFeed->HTML; // feed list + scoped CSS + live relative-time script
}
__finally
{
delete oFeed;
}
using esegece.sgcWebSockets;
var feed = new TsgcHTMLComponent_ActivityFeed();
feed.FeedID = "timeline";
feed.Title = "Recent Activity";
feed.MaxItems = 30;
feed.AddActivity("Ana", "closed", "ticket #482", TsgcHTMLColor.hcSuccess, "bi bi-check-circle");
feed.AddActivity("Marc", "commented on", "invoice #1190", TsgcHTMLColor.hcPrimary);
string html = feed.HTML; // feed list + scoped CSS + live relative-time script
// Push a new item live to connected clients (out-of-band htmx fragment):
feed.AddActivity("Ana", "approved", "purchase order #77", TsgcHTMLColor.hcSuccess);
engine.BroadcastFragment(feed.GetLastItemFragmentHTML());
The members you reach for most often.
AddActivity(aActor, aAction, aTarget, aColor, aIcon, aActorAvatarURL) appends one entry and returns the TsgcHTMLActivityItem.
MaxItems caps how many entries are kept; the oldest item is dropped automatically once the limit is reached.
ShowRelativeTime renders "3 min ago"-style timestamps kept live client-side; TimeFormat is the fallback when it's off.
GetItemFragmentHTML / GetLastItemFragmentHTML build an out-of-band htmx fragment for PushFragment / BroadcastFragment, so a new activity appears without a reload.
EmptyText is the placeholder shown while Items is empty; GetEmptyFragmentHTML re-renders it as a push fragment.
Title labels the feed, Compact tightens row spacing, and HTML returns the feed plus its scoped CSS and script.
| Online HelpFull API reference and usage guide for this component. | Open | |
| All sgcHTML ComponentsBrowse the full feature matrix of 80+ components. | Open | |
| Download Free TrialThe 30-day trial ships the 60.HTML demo projects. | Open | |
| PricingSingle, Team and Site licenses with full source code. | Open |