ActivityFeed Component — sgcHTML | eSeGeCe

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

Push activities with AddActivity, read HTML for the first render, then push new items live with a WebSocket fragment.

Component class

TsgcHTMLComponent_ActivityFeed

Renders

Bootstrap 5 list + scoped CSS + live relative-time script

Family

Data & Tables

Languages

Delphi, C++ Builder, .NET

Add activities, render it, push new ones live

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());

Key properties & methods

The members you reach for most often.

Items / AddActivity

AddActivity(aActor, aAction, aTarget, aColor, aIcon, aActorAvatarURL) appends one entry and returns the TsgcHTMLActivityItem.

Ring buffer

MaxItems caps how many entries are kept; the oldest item is dropped automatically once the limit is reached.

Relative time

ShowRelativeTime renders "3 min ago"-style timestamps kept live client-side; TimeFormat is the fallback when it's off.

Live push

GetItemFragmentHTML / GetLastItemFragmentHTML build an out-of-band htmx fragment for PushFragment / BroadcastFragment, so a new activity appears without a reload.

Empty state

EmptyText is the placeholder shown while Items is empty; GetEmptyFragmentHTML re-renders it as a push fragment.

Layout

Title labels the feed, Compact tightens row spacing, and HTML returns the feed plus its scoped CSS and script.

Keep exploring

Online HelpFull API reference and usage guide for this component.
All sgcHTML ComponentsBrowse the full feature matrix of 80+ components.
Download Free TrialThe 30-day trial ships the 60.HTML demo projects.
PricingSingle, Team and Site licenses with full source code.

Ready to Get Started?

Download the free trial and start building web UIs in Delphi, C++ Builder and .NET.