published()->count()) ->description(__('panel.widgets.stats.projects_description')) ->icon('heroicon-o-rocket-launch') ->color('primary') ->chart($this->projectsChart()), // Active projects (seeking contributors) Stat::make(__('panel.widgets.stats.active_projects'), Project::query()->published()->where('status', 'active')->count()) ->description(__('panel.widgets.stats.active_projects_description')) ->icon('heroicon-o-fire') ->color('danger'), // Members metrics Stat::make(__('panel.widgets.stats.members'), Member::query()->public()->current()->count()) ->description(__('panel.widgets.stats.members_description')) ->icon('heroicon-o-users') ->color('info') ->chart($this->membersChart()), // Open calls Stat::make(__('panel.widgets.stats.open_calls'), Call::query()->open()->count()) ->description(__('panel.widgets.stats.open_calls_description')) ->icon('heroicon-o-megaphone') ->color('warning'), // Good first issues Stat::make(__('panel.widgets.stats.good_first_issues'), RepositoryIssue::query() ->where('is_good_first_issue', true) ->available() ->count()) ->description(__('panel.widgets.stats.good_first_issues_description')) ->icon('heroicon-o-check-circle') ->color('success') ->chart($this->issuesChart()), // Help wanted issues Stat::make(__('panel.widgets.stats.help_wanted'), RepositoryIssue::query() ->where('is_help_wanted', true) ->available() ->count()) ->description(__('panel.widgets.stats.help_wanted_description')) ->icon('heroicon-o-hand-raised') ->color('gray'), ]; } /** * @return array */ private function projectsChart(): array { // Last 7 days of project creation return array_map( fn () => random_int(0, 5), range(0, 6) ); } /** * @return array */ private function membersChart(): array { // Last 7 days of member activity return array_map( fn () => random_int(0, 10), range(0, 6) ); } /** * @return array */ private function issuesChart(): array { // Last 7 days of issue activity return array_map( fn () => random_int(0, 8), range(0, 6) ); } public static function canView(): bool { return auth()->user()?->can('projects.view_any') ?? false; } }