ActivityFeed
TsgcHTMLComponent_ActivityFeed — renderize um feed de atividades ao vivo, mais recente primeiro, com timestamps relativos e push via WebSocket fora de banda, em Delphi, C++ Builder e .NET.
TsgcHTMLComponent_ActivityFeed — renderize um feed de atividades ao vivo, mais recente primeiro, com timestamps relativos e push via WebSocket fora de banda, em Delphi, C++ Builder e .NET.
Envie atividades com AddActivity, leia HTML para a primeira renderização e então envie novos itens ao vivo com um fragmento WebSocket.
TsgcHTMLComponent_ActivityFeed
Lista Bootstrap 5 + CSS com escopo + script de tempo relativo ao vivo
Delphi, C++ Builder, .NET
Chame AddActivity para cada entrada, leia HTML para a página inicial e então envie uma nova atividade como fragmento fora de banda via WebSockets com 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());
Os membros que você usa com mais frequência.
AddActivity(aActor, aAction, aTarget, aColor, aIcon, aActorAvatarURL) adiciona uma entrada e retorna o TsgcHTMLActivityItem.
MaxItems limita quantas entradas são mantidas; o item mais antigo é descartado automaticamente ao atingir o limite.
ShowRelativeTime renderiza timestamps no estilo "3 min atrás", mantidos ao vivo no lado do cliente; TimeFormat é o fallback quando desativado.
GetItemFragmentHTML / GetLastItemFragmentHTML constroem um fragmento htmx fora de banda para PushFragment / BroadcastFragment, de modo que uma nova atividade apareça sem recarregar a página.
EmptyText é o texto exibido enquanto Items está vazio; GetEmptyFragmentHTML o renderiza novamente como fragmento de push.
Title nomeia o feed, Compact reduz o espaçamento entre linhas, e HTML retorna o feed mais seu CSS com escopo e script.
| Ajuda onlineReferência completa da API e guia de uso para este componente. | Abrir | |
| Todos os Componentes sgcHTMLExplore a matriz completa de recursos com mais de 80 componentes. | Abrir | |
| Baixar Versão de Avaliação GratuitaA avaliação de 30 dias inclui os projetos de demonstração 60.HTML. | Abrir | |
| PreçosLicenças Single, Team e Site com código-fonte completo. | Abrir |