1. Go to this page and download the library: Download jaocero/activity-timeline library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jaocero / activity-timeline example snippets
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use JaOcero\ActivityTimeline\Components\ActivityDate;
use JaOcero\ActivityTimeline\Components\ActivityDescription;
use JaOcero\ActivityTimeline\Components\ActivityIcon;
use JaOcero\ActivityTimeline\Components\ActivitySection;
use JaOcero\ActivityTimeline\Components\ActivityTitle;
public function infolist(Schema $schema): Schema
{
return $schema
->state([
'activities' => [
['title' => 'Published article', 'description' => 'Live on the blog.', 'status' => 'published', 'created_at' => now()],
['title' => 'Drafting article', 'description' => 'Writing the first draft.', 'status' => 'drafting', 'created_at' => now()->subDays(2)],
],
])
->components([
ActivitySection::make('activities')
->label('My activities')
->description('These are the activities that have been recorded.')
->schema([
ActivityTitle::make('title'),
ActivityDescription::make('description'),
ActivityDate::make('created_at')->date('F j, Y'),
ActivityIcon::make('status')
->icon(fn (?string $state): ?Heroicon => match ($state) {
'drafting' => Heroicon::OutlinedPencil,
'published' => Heroicon::OutlinedRocketLaunch,
default => null,
})
->color(fn (?string $state): string => $state === 'published' ? 'success' : 'gray'),
]),
]);
}
ActivitySection::make('activities')
->aside() // Heading on the side, like an aside section
->contained(false) // No card
->compact() // Smaller nodes and tighter spacing
->headingVisible(false)
->groupByDate() // "Today", "Yesterday" and date separators
->reverse() // Oldest first
->showItemsCount(5) // Reveal 5 items at a time, in the browser
->showItemsLabel('View older')
->showItemsIcon(Heroicon::ChevronDown)
->showItemsColor('primary')
->scrollOnShowMore(false) // Revealed items scroll into view by default
->loadMore('loadMoreActivities', hasMoreItems: fn (): bool => $this->hasMore) // Calls a Livewire method
->emptyStateHeading('No activities yet')
->emptyStateDescription('Check back later.')
->emptyStateIcon(Heroicon::OutlinedBoltSlash);
use JaOcero\ActivityTimeline\Components\ActivityLogSection;
public static function infolist(Schema $schema): Schema
{
return $schema->components([
// ...
ActivityLogSection::make()
->limit(25)
->groupByDate(),
]);
}