minor fixes
This commit is contained in:
@@ -407,6 +407,7 @@ final class CreatorStudioContentService
|
||||
{
|
||||
$now = Carbon::now();
|
||||
$updatedAt = Carbon::parse((string) ($item['updated_at'] ?? $item['created_at'] ?? $now->toIso8601String()));
|
||||
$status = (string) ($item['status'] ?? '');
|
||||
$isDraft = ($item['status'] ?? null) === 'draft';
|
||||
$missing = [];
|
||||
$score = 0;
|
||||
@@ -441,6 +442,16 @@ final class CreatorStudioContentService
|
||||
default => 'Needs more work',
|
||||
};
|
||||
|
||||
$readiness = $status === 'published'
|
||||
? null
|
||||
: [
|
||||
'score' => $score,
|
||||
'max' => 4,
|
||||
'label' => $label,
|
||||
'can_publish' => $score >= 3,
|
||||
'missing' => $missing,
|
||||
];
|
||||
|
||||
$workflowActions = match ((string) ($item['module'] ?? '')) {
|
||||
'artworks' => [
|
||||
['label' => 'Create card', 'href' => route('studio.cards.create'), 'icon' => 'fa-solid fa-id-card'],
|
||||
@@ -466,13 +477,7 @@ final class CreatorStudioContentService
|
||||
'is_stale_draft' => $isDraft && $updatedAt->lte($now->copy()->subDays(3)),
|
||||
'last_touched_days' => max(0, $updatedAt->diffInDays($now)),
|
||||
'resume_label' => $isDraft ? 'Resume draft' : 'Open item',
|
||||
'readiness' => [
|
||||
'score' => $score,
|
||||
'max' => 4,
|
||||
'label' => $label,
|
||||
'can_publish' => $score >= 3,
|
||||
'missing' => $missing,
|
||||
],
|
||||
'readiness' => $readiness,
|
||||
'cross_module_actions' => $workflowActions,
|
||||
];
|
||||
|
||||
|
||||
@@ -50,9 +50,10 @@ final class ArtworkStudioProvider implements CreatorStudioProvider
|
||||
$draftCount = (clone $baseQuery)
|
||||
->whereNull('deleted_at')
|
||||
->where(function (Builder $query): void {
|
||||
$query->where('is_public', false)
|
||||
->orWhere('artwork_status', 'draft');
|
||||
$query->whereNull('artwork_status')
|
||||
->orWhere('artwork_status', '!=', 'scheduled');
|
||||
})
|
||||
->where('is_public', false)
|
||||
->count();
|
||||
|
||||
$publishedCount = (clone $baseQuery)
|
||||
@@ -92,16 +93,29 @@ final class ArtworkStudioProvider implements CreatorStudioProvider
|
||||
$query = Artwork::query()
|
||||
->withTrashed()
|
||||
->where('user_id', $user->id)
|
||||
->with(['stats', 'categories', 'tags'])
|
||||
->with([
|
||||
'stats',
|
||||
'categories',
|
||||
'tags',
|
||||
'features' => function ($query): void {
|
||||
$query->where('is_active', true)
|
||||
->whereNull('deleted_at')
|
||||
->where(function (Builder $builder): void {
|
||||
$builder->whereNull('expires_at')
|
||||
->orWhere('expires_at', '>', now());
|
||||
});
|
||||
},
|
||||
])
|
||||
->orderByDesc('updated_at')
|
||||
->limit($limit);
|
||||
|
||||
if ($bucket === 'drafts') {
|
||||
$query->whereNull('deleted_at')
|
||||
->where(function (Builder $builder): void {
|
||||
$builder->where('is_public', false)
|
||||
->orWhere('artwork_status', 'draft');
|
||||
});
|
||||
$builder->whereNull('artwork_status')
|
||||
->orWhere('artwork_status', '!=', 'scheduled');
|
||||
})
|
||||
->where('is_public', false);
|
||||
} elseif ($bucket === 'scheduled') {
|
||||
$query->whereNull('deleted_at')
|
||||
->where('artwork_status', 'scheduled');
|
||||
@@ -199,7 +213,7 @@ final class ArtworkStudioProvider implements CreatorStudioProvider
|
||||
'published_at' => $artwork->published_at?->toIso8601String(),
|
||||
'scheduled_at' => $artwork->publish_at?->toIso8601String(),
|
||||
'schedule_timezone' => $artwork->artwork_timezone,
|
||||
'featured' => false,
|
||||
'featured' => $artwork->features->isNotEmpty(),
|
||||
'metrics' => [
|
||||
'views' => (int) ($stats?->views ?? 0),
|
||||
'appreciation' => (int) ($stats?->favorites ?? 0),
|
||||
|
||||
@@ -31,6 +31,8 @@ final class StudioBulkActionService
|
||||
$query = Artwork::where('user_id', $userId);
|
||||
if ($action === 'unarchive') {
|
||||
$query->onlyTrashed();
|
||||
} elseif ($action === 'delete') {
|
||||
$query->withTrashed();
|
||||
}
|
||||
$artworks = $query->whereIn('id', $artworkIds)->get();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user