diff --git a/app/Actions/RemoveTagFromActivitiesAction.php b/app/Actions/RemoveTagFromActivitiesAction.php deleted file mode 100644 index e6623626..00000000 --- a/app/Actions/RemoveTagFromActivitiesAction.php +++ /dev/null @@ -1,19 +0,0 @@ -whereJsonContains("tags", $tagId)->get() - ->each(function (Activity $activity) use ($tagId): void { - $activity->tags = array_values(array_diff($activity->tags, [$tagId])); - $activity->save(); - }); - } -} diff --git a/app/Actions/RemoveTagFromNewsAction.php b/app/Actions/RemoveTagFromNewsAction.php new file mode 100644 index 00000000..b25b152b --- /dev/null +++ b/app/Actions/RemoveTagFromNewsAction.php @@ -0,0 +1,19 @@ +whereJsonContains("tags", $tagId)->get() + ->each(function (News $news) use ($tagId): void { + $news->tags = array_values(array_diff($news->tags, [$tagId])); + $news->save(); + }); + } +} diff --git a/app/Enums/DateFormats.php b/app/Enums/DateFormats.php index 5b10d9e4..39bda59f 100644 --- a/app/Enums/DateFormats.php +++ b/app/Enums/DateFormats.php @@ -7,5 +7,5 @@ class DateFormats { public const string DATE_DISPLAY = "j.m.Y"; - public const string ACTIVITY_DATE_DISPLAY = "j/m Y"; + public const string NEWS_DATE_DISPLAY = "j F Y"; } diff --git a/app/Filament/Resources/ActivityResource/Pages/CreateActivity.php b/app/Filament/Resources/ActivityResource/Pages/CreateActivity.php deleted file mode 100644 index 4d8ae202..00000000 --- a/app/Filament/Resources/ActivityResource/Pages/CreateActivity.php +++ /dev/null @@ -1,13 +0,0 @@ - Pages\ListActivities::route("/"), - "edit" => Pages\EditActivity::route("/{record}/edit"), + "index" => Pages\ListNews::route("/"), + "edit" => Pages\EditNews::route("/{record}/edit"), ]; } diff --git a/app/Filament/Resources/ContactFormResource/Pages/EditActivity.php b/app/Filament/Resources/ContactFormResource/Pages/EditNews.php similarity index 93% rename from app/Filament/Resources/ContactFormResource/Pages/EditActivity.php rename to app/Filament/Resources/ContactFormResource/Pages/EditNews.php index 0be1709b..bdb106a7 100644 --- a/app/Filament/Resources/ContactFormResource/Pages/EditActivity.php +++ b/app/Filament/Resources/ContactFormResource/Pages/EditNews.php @@ -9,7 +9,7 @@ use Blumilk\Website\Filament\Resources\ContactFormResource; use Filament\Actions; -class EditActivity extends BaseEditRecord +class EditNews extends BaseEditRecord { protected static string $resource = ContactFormResource::class; diff --git a/app/Filament/Resources/ContactFormResource/Pages/ListActivities.php b/app/Filament/Resources/ContactFormResource/Pages/ListNews.php similarity index 87% rename from app/Filament/Resources/ContactFormResource/Pages/ListActivities.php rename to app/Filament/Resources/ContactFormResource/Pages/ListNews.php index 8613b032..0274b638 100644 --- a/app/Filament/Resources/ContactFormResource/Pages/ListActivities.php +++ b/app/Filament/Resources/ContactFormResource/Pages/ListNews.php @@ -7,7 +7,7 @@ use Blumilk\Website\Filament\Resources\BaseResource\Pages\BaseListRecord; use Blumilk\Website\Filament\Resources\ContactFormResource; -class ListActivities extends BaseListRecord +class ListNews extends BaseListRecord { protected static string $resource = ContactFormResource::class; } diff --git a/app/Filament/Resources/ActivityResource.php b/app/Filament/Resources/NewsResource.php similarity index 88% rename from app/Filament/Resources/ActivityResource.php rename to app/Filament/Resources/NewsResource.php index 9f6b316f..6a909962 100644 --- a/app/Filament/Resources/ActivityResource.php +++ b/app/Filament/Resources/NewsResource.php @@ -5,8 +5,8 @@ namespace Blumilk\Website\Filament\Resources; use Blumilk\Website\Enums\DateFormats; -use Blumilk\Website\Filament\Resources\ActivityResource\Pages; -use Blumilk\Website\Models\Activity; +use Blumilk\Website\Filament\Resources\NewsResource\Pages; +use Blumilk\Website\Models\News; use Blumilk\Website\Models\Tag; use Exception; use Filament\Forms; @@ -22,11 +22,11 @@ use Illuminate\Database\Eloquent\Builder; use Mvenghaus\FilamentPluginTranslatableInline\Forms\Components\TranslatableContainer; -class ActivityResource extends Resource +class NewsResource extends Resource { use Translatable; - protected static ?string $model = Activity::class; + protected static ?string $model = News::class; protected static ?string $label = "aktualność"; protected static ?string $pluralLabel = "Aktualności"; protected static ?string $navigationIcon = "heroicon-o-rectangle-stack"; @@ -44,11 +44,6 @@ public static function form(Form $form): Form ->required() ->maxLength(255), )->requiredLocales(config("app.translatable_locales")), - TranslatableContainer::make( - Forms\Components\TextInput::make("subtitle") - ->label("Podtytuł") - ->maxLength(255), - )->requiredLocales(config("app.translatable_locales")), Forms\Components\TextInput::make("slug") ->label("Slug") ->required() @@ -81,7 +76,7 @@ public static function form(Form $form): Form Forms\Components\FileUpload::make("photo") ->label("Zdjęcie") ->required() - ->directory(Activity::PHOTOS_DIRECTORY) + ->directory(News::PHOTOS_DIRECTORY) ->multiple(false) ->maxSize(1000), ]), @@ -147,9 +142,9 @@ public static function table(Table $table): Table public static function getPages(): array { return [ - "index" => Pages\ListActivities::route("/"), - "create" => Pages\CreateActivity::route("/create"), - "edit" => Pages\EditActivity::route("/{record}/edit"), + "index" => Pages\ListNews::route("/"), + "create" => Pages\CreateNews::route("/create"), + "edit" => Pages\EditNews::route("/{record}/edit"), ]; } diff --git a/app/Filament/Resources/NewsResource/Pages/CreateNews.php b/app/Filament/Resources/NewsResource/Pages/CreateNews.php new file mode 100644 index 00000000..e50ff775 --- /dev/null +++ b/app/Filament/Resources/NewsResource/Pages/CreateNews.php @@ -0,0 +1,13 @@ +get("tag"); - $tag = $tagFromQuery - ? Tag::query() - ->where("title->pl", "LIKE", $tagFromQuery) - ->orWhere("title->en", "LIKE", $tagFromQuery) - ->firstOrFail() - : null; - $activities = Activity::query() - ->where("published", true) - ->when($tag, fn($query, $tag) => $query->whereJsonContains("tags", $tag->id)) - ->latest("published_at") - ->paginate(9); - $tags = Tag::query() - ->where("is_primary", true) - ->get() - ->pluck("title"); - - return $factory->make("activities") - ->with("activities", ActivityResource::collection($activities)) - ->with("tags", $tags) - ->with("selectedTag", $tag?->title); - } - - public function get(Request $request, Factory $factory, string $slug): View - { - $urlPath = $request->getRequestUri(); - $articleUrl = config("app.url") . $urlPath; - - $activity = Activity::query()->where("slug", $slug)->firstOrFail(); - $activityTags = $activity->getRelatedTagModels(); - - $nextActivities = Activity::query()->where("id", ">", $activity->id)->where("published", true)->orderBy("id", "asc")->take(2)->get(); - $previousActivities = Activity::query()->where("id", "<", $activity->id)->where("published", true)->orderBy("id", "desc")->take(2)->get(); - - if (!$previousActivities->first()) { - $recommendedActivities = $nextActivities; - } elseif (!$nextActivities->first()) { - $recommendedActivities = $previousActivities; - } else { - $recommendedActivities = [$previousActivities->first(), $nextActivities->first()]; - } - - return $factory->make("activity") - ->with("activity", new ActivityResource($activity)) - ->with("tags", TagResource::collection($activityTags->where("as_person", false))->resolve()) - ->with("peopleTags", TagResource::collection($activityTags->where("as_person", true))->resolve()) - ->with("recommendedActivities", ActivityResource::collection($recommendedActivities)->resolve()) - ->with("articleUrl", $articleUrl); - } -} diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 4bbbb7a0..7be516ac 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -4,8 +4,6 @@ namespace Blumilk\Website\Http\Controllers; -use Blumilk\Website\Http\Resources\ActivityResource; -use Blumilk\Website\Models\Activity; use Blumilk\Website\Models\Reference; use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\View\View; @@ -15,19 +13,11 @@ class HomeController extends Controller { public function __invoke(Request $request, Factory $factory): View { - $locale = $request->getLocale(); $clients = config("clients"); - $caseStudy = json_decode(file_get_contents(public_path("main_case_study.json")), true)[$locale]; - $activities = Activity::query()->where("published", true)->latest("published_at")->get(); $references = Reference::query()->where("published", true)->get(); - $referencesCount = $references->count(); - return $factory->make("home") - ->with("activities", ActivityResource::collection($activities)->resolve()) ->with("references", $references) - ->with("caseStudy", $caseStudy) - ->with("referencesCount", $referencesCount) ->with("clients", $clients); } } diff --git a/app/Http/Controllers/NewsController.php b/app/Http/Controllers/NewsController.php new file mode 100644 index 00000000..6632e5c0 --- /dev/null +++ b/app/Http/Controllers/NewsController.php @@ -0,0 +1,90 @@ +get("tag"); + $tag = $tagFromQuery + ? Tag::query() + ->where("title->pl", "LIKE", $tagFromQuery) + ->orWhere("title->en", "LIKE", $tagFromQuery) + ->firstOrFail() + : null; + $allNewsCount = News::query() + ->where("published", true) + ->count(); + $news = News::query() + ->where("published", true) + ->when($tag, fn($query, $tag) => $query->whereJsonContains("tags", $tag->id)) + ->latest("published_at") + ->paginate(7) + ->appends(["tag" => $tagFromQuery]); + $tags = Tag::query() + ->where("is_primary", true) + ->get(); + + $tagsNewsCount = []; + + foreach ($tags as $singleTag) { + $tagsNewsCount[$singleTag->title] = $singleTag->newsCount(); + } + + $filteredTags = $tags->filter(fn($tag): bool => $tagsNewsCount[$tag->title] > 0); + + return $factory->make("news") + ->with("news", NewsResource::collection($news)) + ->with("tags", $filteredTags->pluck("title")) + ->with("tagsNewsCount", $tagsNewsCount) + ->with("selectedTag", $tag?->title) + ->with("allNewsCount", $allNewsCount); + } + + public function get(Request $request, Factory $factory, string $slug): View + { + $urlPath = $request->getRequestUri(); + $articleUrl = config("app.url") . $urlPath; + + $news = News::query()->where("slug", $slug)->firstOrFail(); + $newsTags = $news->getRelatedTagModels(); + + $nextNews = News::query()->where("id", ">", $news->id)->where("published", true)->orderBy("id", "asc")->take(2)->get(); + $previousNews = News::query()->where("id", "<", $news->id)->where("published", true)->orderBy("id", "desc")->take(2)->get(); + + if (!$previousNews->first()) { + $recommendedNews = $nextNews; + } elseif (!$nextNews->first()) { + $recommendedNews = $previousNews; + } else { + $recommendedNews = [$previousNews->first(), $nextNews->first()]; + } + + $tagsNewsCount = []; + + foreach ($newsTags as $singleTag) { + $tagsNewsCount[$singleTag->title] = $singleTag->newsCount(); + } + + $news = new NewsResource($news); + + return $factory->make("single-news") + ->with("news", $news->resolve()) + ->with("tags", TagResource::collection($newsTags->where("as_person", false))->resolve()) + ->with("tagsNewsCount", $tagsNewsCount) + ->with("peopleTags", TagResource::collection($newsTags->where("as_person", true))->resolve()) + ->with("recommendedNews", NewsResource::collection($recommendedNews)->resolve()) + ->with("articleUrl", $articleUrl); + } +} diff --git a/app/Http/Resources/ActivityResource.php b/app/Http/Resources/ActivityResource.php deleted file mode 100644 index ac8ad6a5..00000000 --- a/app/Http/Resources/ActivityResource.php +++ /dev/null @@ -1,43 +0,0 @@ - $activity->id, - "title" => $activity->title, - "subtitle" => $activity->subtitle, - "description" => $activity->description, - "slug" => $activity->slug, - "photo" => $activity->photo, - "published" => $activity->published, - "published_at" => $activity->published_at?->format(DateFormats::ACTIVITY_DATE_DISPLAY), - "url" => $activity->url, - ]; - } -} diff --git a/app/Http/Resources/NewsResource.php b/app/Http/Resources/NewsResource.php new file mode 100644 index 00000000..a6825c2f --- /dev/null +++ b/app/Http/Resources/NewsResource.php @@ -0,0 +1,43 @@ + $news->id, + "title" => $news->title, + "subtitle" => $news->subtitle, + "description" => $news->description, + "slug" => $news->slug, + "photo" => $news->photo, + "published" => $news->published, + "published_at" => $news->published_at?->translatedFormat(DateFormats::NEWS_DATE_DISPLAY), + "url" => $news->url, + ]; + } +} diff --git a/app/Models/Activity.php b/app/Models/News.php similarity index 80% rename from app/Models/Activity.php rename to app/Models/News.php index e2968085..1d3b8853 100644 --- a/app/Models/Activity.php +++ b/app/Models/News.php @@ -4,7 +4,7 @@ namespace Blumilk\Website\Models; -use Blumilk\Website\Observers\ActivityObserver; +use Blumilk\Website\Observers\NewsObserver; use Carbon\Carbon; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; @@ -13,7 +13,6 @@ /** * @property array $title - * @property array $subtitle * @property array $description * @property string $slug * @property string $photo @@ -22,22 +21,20 @@ * @property string $url * @property array $tags */ -class Activity extends Model +class News extends Model { use HasTranslations; use HasFactory; - public const string PHOTOS_DIRECTORY = "activities"; + public const string PHOTOS_DIRECTORY = "news"; public $translatable = [ "title", - "subtitle", "description", ]; protected $fillable = [ "photo", "title", - "subtitle", "description", "slug", "published", @@ -47,7 +44,6 @@ class Activity extends Model ]; protected $casts = [ "title" => "array", - "subtitle" => "array", "description" => "array", "published" => "boolean", "published_at" => "datetime", @@ -62,6 +58,6 @@ public function getRelatedTagModels(): Collection public static function boot(): void { parent::boot(); - static::observe(ActivityObserver::class); + static::observe(NewsObserver::class); } } diff --git a/app/Models/Tag.php b/app/Models/Tag.php index 4c5e259c..8c6ae9a7 100644 --- a/app/Models/Tag.php +++ b/app/Models/Tag.php @@ -38,4 +38,12 @@ public static function boot(): void parent::boot(); static::observe(TagObserver::class); } + + public function newsCount(): int + { + return News::query() + ->where("published", true) + ->whereJsonContains("tags", $this->id) + ->count(); + } } diff --git a/app/Observers/ActivityObserver.php b/app/Observers/ActivityObserver.php deleted file mode 100644 index 44f49ba8..00000000 --- a/app/Observers/ActivityObserver.php +++ /dev/null @@ -1,28 +0,0 @@ -tags = $this->prepareTags($activity->tags); - } - - public function updating(Activity $activity): void - { - $activity->tags = $this->prepareTags($activity->tags); - } - - private function prepareTags(array $tags): array - { - return array_map( - fn(string $tag): int => (int)$tag, - $tags, - ); - } -} diff --git a/app/Observers/NewsObserver.php b/app/Observers/NewsObserver.php new file mode 100644 index 00000000..9f357d45 --- /dev/null +++ b/app/Observers/NewsObserver.php @@ -0,0 +1,28 @@ +tags = $this->prepareTags($news->tags); + } + + public function updating(News $news): void + { + $news->tags = $this->prepareTags($news->tags); + } + + private function prepareTags(array $tags): array + { + return array_map( + fn(string $tag): int => (int)$tag, + $tags, + ); + } +} diff --git a/app/Observers/TagObserver.php b/app/Observers/TagObserver.php index bb2fc859..1795999d 100644 --- a/app/Observers/TagObserver.php +++ b/app/Observers/TagObserver.php @@ -4,17 +4,17 @@ namespace Blumilk\Website\Observers; -use Blumilk\Website\Actions\RemoveTagFromActivitiesAction; +use Blumilk\Website\Actions\RemoveTagFromNewsAction; use Blumilk\Website\Models\Tag; class TagObserver { public function __construct( - protected RemoveTagFromActivitiesAction $removeTagFromActivitiesAction, + protected RemoveTagFromNewsAction $removeTagFromNewsAction, ) {} public function deleted(Tag $tag): void { - $this->removeTagFromActivitiesAction->execute($tag->id); + $this->removeTagFromNewsAction->execute($tag->id); } } diff --git a/composer.lock b/composer.lock index daa2ac78..74a293e6 100644 --- a/composer.lock +++ b/composer.lock @@ -1592,16 +1592,16 @@ }, { "name": "filament/actions", - "version": "v3.2.96", + "version": "v3.2.97", "source": { "type": "git", "url": "https://github.com/filamentphp/actions.git", - "reference": "c8b71f18d28a2f9e23ade2631f3f80907ffe6946" + "reference": "aff18fda397dbf3e9f449f9a9360f3359b154c0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/actions/zipball/c8b71f18d28a2f9e23ade2631f3f80907ffe6946", - "reference": "c8b71f18d28a2f9e23ade2631f3f80907ffe6946", + "url": "https://api.github.com/repos/filamentphp/actions/zipball/aff18fda397dbf3e9f449f9a9360f3359b154c0e", + "reference": "aff18fda397dbf3e9f449f9a9360f3359b154c0e", "shasum": "" }, "require": { @@ -1641,20 +1641,20 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2024-07-24T12:10:05+00:00" + "time": "2024-07-31T11:53:04+00:00" }, { "name": "filament/filament", - "version": "v3.2.96", + "version": "v3.2.97", "source": { "type": "git", "url": "https://github.com/filamentphp/panels.git", - "reference": "06a66eb3874d9942e2c926fb4cea7166115fb6ae" + "reference": "9e0b750546a51fdbc67b1232f2399385587dcc9a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/panels/zipball/06a66eb3874d9942e2c926fb4cea7166115fb6ae", - "reference": "06a66eb3874d9942e2c926fb4cea7166115fb6ae", + "url": "https://api.github.com/repos/filamentphp/panels/zipball/9e0b750546a51fdbc67b1232f2399385587dcc9a", + "reference": "9e0b750546a51fdbc67b1232f2399385587dcc9a", "shasum": "" }, "require": { @@ -1706,20 +1706,20 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2024-07-24T12:10:23+00:00" + "time": "2024-07-31T11:53:12+00:00" }, { "name": "filament/forms", - "version": "v3.2.96", + "version": "v3.2.97", "source": { "type": "git", "url": "https://github.com/filamentphp/forms.git", - "reference": "a2169e69650aad55c5110b6132c05ef18dea6d4e" + "reference": "d679d30ae1c345740920e45b0334b5eacc76f7aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/forms/zipball/a2169e69650aad55c5110b6132c05ef18dea6d4e", - "reference": "a2169e69650aad55c5110b6132c05ef18dea6d4e", + "url": "https://api.github.com/repos/filamentphp/forms/zipball/d679d30ae1c345740920e45b0334b5eacc76f7aa", + "reference": "d679d30ae1c345740920e45b0334b5eacc76f7aa", "shasum": "" }, "require": { @@ -1762,20 +1762,20 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2024-07-24T12:10:06+00:00" + "time": "2024-07-31T11:53:08+00:00" }, { "name": "filament/infolists", - "version": "v3.2.96", + "version": "v3.2.97", "source": { "type": "git", "url": "https://github.com/filamentphp/infolists.git", - "reference": "8b9b8cd3d4fd2ace6deac224eb646a0228b9f053" + "reference": "af2266e0cf9d26e88ea6153d608f11aa9cebb59e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/infolists/zipball/8b9b8cd3d4fd2ace6deac224eb646a0228b9f053", - "reference": "8b9b8cd3d4fd2ace6deac224eb646a0228b9f053", + "url": "https://api.github.com/repos/filamentphp/infolists/zipball/af2266e0cf9d26e88ea6153d608f11aa9cebb59e", + "reference": "af2266e0cf9d26e88ea6153d608f11aa9cebb59e", "shasum": "" }, "require": { @@ -1813,20 +1813,20 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2024-07-24T12:10:10+00:00" + "time": "2024-07-31T11:53:07+00:00" }, { "name": "filament/notifications", - "version": "v3.2.96", + "version": "v3.2.97", "source": { "type": "git", "url": "https://github.com/filamentphp/notifications.git", - "reference": "df0aa8997e90fb9409ea6baf5b4c9bf10c592563" + "reference": "03ea56e0729c98c65831ab0215285a7cb1c4117f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/notifications/zipball/df0aa8997e90fb9409ea6baf5b4c9bf10c592563", - "reference": "df0aa8997e90fb9409ea6baf5b4c9bf10c592563", + "url": "https://api.github.com/repos/filamentphp/notifications/zipball/03ea56e0729c98c65831ab0215285a7cb1c4117f", + "reference": "03ea56e0729c98c65831ab0215285a7cb1c4117f", "shasum": "" }, "require": { @@ -1865,20 +1865,20 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2024-07-10T17:10:55+00:00" + "time": "2024-07-31T11:53:11+00:00" }, { "name": "filament/spatie-laravel-translatable-plugin", - "version": "v3.2.96", + "version": "v3.2.97", "source": { "type": "git", "url": "https://github.com/filamentphp/spatie-laravel-translatable-plugin.git", - "reference": "dfe38886717c983ff3ddc81abe371a145cb365b5" + "reference": "4e606068ebf93d6bcabb07214db13b70707113e6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/spatie-laravel-translatable-plugin/zipball/dfe38886717c983ff3ddc81abe371a145cb365b5", - "reference": "dfe38886717c983ff3ddc81abe371a145cb365b5", + "url": "https://api.github.com/repos/filamentphp/spatie-laravel-translatable-plugin/zipball/4e606068ebf93d6bcabb07214db13b70707113e6", + "reference": "4e606068ebf93d6bcabb07214db13b70707113e6", "shasum": "" }, "require": { @@ -1910,20 +1910,20 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2024-07-10T17:11:09+00:00" + "time": "2024-07-31T11:53:26+00:00" }, { "name": "filament/support", - "version": "v3.2.96", + "version": "v3.2.97", "source": { "type": "git", "url": "https://github.com/filamentphp/support.git", - "reference": "4cec1377278853882103a09cafdc1b258f995ee4" + "reference": "94c5349b8fed252499314bd2149fadf96ddaf6d6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/support/zipball/4cec1377278853882103a09cafdc1b258f995ee4", - "reference": "4cec1377278853882103a09cafdc1b258f995ee4", + "url": "https://api.github.com/repos/filamentphp/support/zipball/94c5349b8fed252499314bd2149fadf96ddaf6d6", + "reference": "94c5349b8fed252499314bd2149fadf96ddaf6d6", "shasum": "" }, "require": { @@ -1968,20 +1968,20 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2024-07-24T12:10:41+00:00" + "time": "2024-07-31T11:53:25+00:00" }, { "name": "filament/tables", - "version": "v3.2.96", + "version": "v3.2.97", "source": { "type": "git", "url": "https://github.com/filamentphp/tables.git", - "reference": "5e39c8c37beea164d1c48d95550346471e56361c" + "reference": "0e6e96bde5337b26944ce3a657ae6755bef82d1e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/tables/zipball/5e39c8c37beea164d1c48d95550346471e56361c", - "reference": "5e39c8c37beea164d1c48d95550346471e56361c", + "url": "https://api.github.com/repos/filamentphp/tables/zipball/0e6e96bde5337b26944ce3a657ae6755bef82d1e", + "reference": "0e6e96bde5337b26944ce3a657ae6755bef82d1e", "shasum": "" }, "require": { @@ -2021,20 +2021,20 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2024-07-24T12:10:45+00:00" + "time": "2024-07-31T11:53:24+00:00" }, { "name": "filament/widgets", - "version": "v3.2.96", + "version": "v3.2.97", "source": { "type": "git", "url": "https://github.com/filamentphp/widgets.git", - "reference": "7e35fdb24c576d83518606ef1aa0f0e4bda22e0f" + "reference": "909fc82bae2cf41d70b3cd7dda8982245b2ea723" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filamentphp/widgets/zipball/7e35fdb24c576d83518606ef1aa0f0e4bda22e0f", - "reference": "7e35fdb24c576d83518606ef1aa0f0e4bda22e0f", + "url": "https://api.github.com/repos/filamentphp/widgets/zipball/909fc82bae2cf41d70b3cd7dda8982245b2ea723", + "reference": "909fc82bae2cf41d70b3cd7dda8982245b2ea723", "shasum": "" }, "require": { @@ -2065,7 +2065,7 @@ "issues": "https://github.com/filamentphp/filament/issues", "source": "https://github.com/filamentphp/filament" }, - "time": "2024-07-24T12:10:48+00:00" + "time": "2024-07-31T11:53:30+00:00" }, { "name": "fruitcake/php-cors", @@ -2675,16 +2675,16 @@ }, { "name": "laravel/framework", - "version": "v11.18.1", + "version": "v11.19.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "b19ba518c56852567e99fbae9321bc436c2cc5a8" + "reference": "5e103d499e9ee5bcfc184412d034c4e516b87085" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/b19ba518c56852567e99fbae9321bc436c2cc5a8", - "reference": "b19ba518c56852567e99fbae9321bc436c2cc5a8", + "url": "https://api.github.com/repos/laravel/framework/zipball/5e103d499e9ee5bcfc184412d034c4e516b87085", + "reference": "5e103d499e9ee5bcfc184412d034c4e516b87085", "shasum": "" }, "require": { @@ -2877,7 +2877,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2024-07-26T10:39:29+00:00" + "time": "2024-07-30T15:22:41+00:00" }, { "name": "laravel/prompts", @@ -8381,16 +8381,16 @@ "packages-dev": [ { "name": "blumilksoftware/codestyle", - "version": "v3.2.1", + "version": "v3.3", "source": { "type": "git", "url": "https://github.com/blumilksoftware/codestyle.git", - "reference": "fc0410154c4976bff5e46c5308edd68059c548ac" + "reference": "aecc480cd600c91da459999685e54ba0f9821507" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/blumilksoftware/codestyle/zipball/fc0410154c4976bff5e46c5308edd68059c548ac", - "reference": "fc0410154c4976bff5e46c5308edd68059c548ac", + "url": "https://api.github.com/repos/blumilksoftware/codestyle/zipball/aecc480cd600c91da459999685e54ba0f9821507", + "reference": "aecc480cd600c91da459999685e54ba0f9821507", "shasum": "" }, "require": { @@ -8425,9 +8425,9 @@ "description": "Blumilk codestyle configurator", "support": { "issues": "https://github.com/blumilksoftware/codestyle/issues", - "source": "https://github.com/blumilksoftware/codestyle/tree/v3.2.1" + "source": "https://github.com/blumilksoftware/codestyle/tree/v3.3" }, - "time": "2024-06-20T08:15:33+00:00" + "time": "2024-08-02T05:18:46+00:00" }, { "name": "clue/ndjson-react", @@ -10092,16 +10092,16 @@ }, { "name": "phpunit/phpunit", - "version": "11.2.8", + "version": "11.3.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a7a29e8d3113806f18f99d670f580a30e8ffff39" + "reference": "a8dce73a8938dfec7ac0daa91bdbcaae7d7188a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a7a29e8d3113806f18f99d670f580a30e8ffff39", - "reference": "a7a29e8d3113806f18f99d670f580a30e8ffff39", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a8dce73a8938dfec7ac0daa91bdbcaae7d7188a3", + "reference": "a8dce73a8938dfec7ac0daa91bdbcaae7d7188a3", "shasum": "" }, "require": { @@ -10140,7 +10140,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "11.2-dev" + "dev-main": "11.3-dev" } }, "autoload": { @@ -10172,7 +10172,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/11.2.8" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.3.0" }, "funding": [ { @@ -10188,7 +10188,7 @@ "type": "tidelift" } ], - "time": "2024-07-18T14:56:37+00:00" + "time": "2024-08-02T03:56:43+00:00" }, { "name": "react/cache", diff --git a/database/factories/ActivityFactory.php b/database/factories/NewsFactory.php similarity index 81% rename from database/factories/ActivityFactory.php rename to database/factories/NewsFactory.php index 94a926d1..b035338e 100644 --- a/database/factories/ActivityFactory.php +++ b/database/factories/NewsFactory.php @@ -4,14 +4,14 @@ namespace Database\Factories; -use Blumilk\Website\Models\Activity; +use Blumilk\Website\Models\News; use Blumilk\Website\Models\Tag; use Illuminate\Database\Eloquent\Factories\Factory; /** - * @extends Factory + * @extends Factory */ -class ActivityFactory extends Factory +class NewsFactory extends Factory { public function definition(): array { @@ -19,7 +19,6 @@ public function definition(): array return [ "title" => $this->translations($locales, $this->faker->sentence), - "subtitle" => $this->translations($locales, $this->faker->sentence), "description" => $this->translations($locales, $this->faker->paragraph), "slug" => $this->faker->slug, "photo" => sprintf("%s/%s", "factory", "activity.jpg"), diff --git a/database/migrations/2024_08_05_111133_remove_subtitle_in_activities_table.php b/database/migrations/2024_08_05_111133_remove_subtitle_in_activities_table.php new file mode 100644 index 00000000..9c14ea74 --- /dev/null +++ b/database/migrations/2024_08_05_111133_remove_subtitle_in_activities_table.php @@ -0,0 +1,23 @@ +dropColumn("subtitle"); + }); + } + + public function down(): void + { + Schema::table("activities", function (Blueprint $table): void { + $table->json("subtitle"); + }); + } +}; diff --git a/database/migrations/2024_08_13_110416_rename_activities_table.php b/database/migrations/2024_08_13_110416_rename_activities_table.php new file mode 100644 index 00000000..ccd34383 --- /dev/null +++ b/database/migrations/2024_08_13_110416_rename_activities_table.php @@ -0,0 +1,23 @@ +rename("news"); + }); + } + + public function down(): void + { + Schema::table("news", function (Blueprint $table): void { + $table->rename("activities"); + }); + } +}; diff --git a/database/seeders/LocalEnvironmentSeeder.php b/database/seeders/LocalEnvironmentSeeder.php index bf4b73b9..793da06d 100644 --- a/database/seeders/LocalEnvironmentSeeder.php +++ b/database/seeders/LocalEnvironmentSeeder.php @@ -4,9 +4,9 @@ namespace Database\Seeders; -use Blumilk\Website\Models\Activity; use Blumilk\Website\Models\CaseStudy; use Blumilk\Website\Models\ContactForm; +use Blumilk\Website\Models\News; use Blumilk\Website\Models\Reference; use Blumilk\Website\Models\Tag; use Illuminate\Database\Seeder; @@ -22,7 +22,7 @@ public function run(): void $this->call(UsersSeeder::class); Tag::factory()->count(12)->create(); - Activity::factory()->count(12)->create(); + News::factory()->count(12)->create(); CaseStudy::factory()->count(12)->create(); ContactForm::factory()->count(12)->create(); Reference::factory()->count(12)->create(); diff --git a/lang/en/content.php b/lang/en/content.php index 63f90968..c97610b4 100644 --- a/lang/en/content.php +++ b/lang/en/content.php @@ -7,7 +7,7 @@ "about" => "About", "case_study" => "Case Study", "career" => "Career", - "activities" => "Activities", + "news" => "News", "contact" => "Contact", ], "home" => [ @@ -213,14 +213,15 @@ ], "activities" => [ "section_1" => [ - "title_1" => "Our activities", + "title_1" => "Our", + "title_2" => "news", ], ], "activity" => [ "section_1" => [ - "title_1" => "You might find this interesting:", - "title_2" => "Tags", - "title_3" => "People", + "title_1" => "You might find this interesting", + "title_2" => "Categories", + "title_3" => "Related people", ], ], "contact" => [ diff --git a/lang/en/meta.php b/lang/en/meta.php index 4bfad6ef..ec4a5314 100644 --- a/lang/en/meta.php +++ b/lang/en/meta.php @@ -28,7 +28,7 @@ "description" => "If you are looking for a solution perfectly tailored to your needs, we are here for you! We are waiting for your message!", ], "activities" => [ - "title" => "Activities", + "title" => "News", "description" => "See what's going on with us!", ], "privacy-policy" => [ diff --git a/lang/pl/content.php b/lang/pl/content.php index 47adb431..8a08194f 100644 --- a/lang/pl/content.php +++ b/lang/pl/content.php @@ -7,7 +7,7 @@ "about" => "O firmie", "case_study" => "Case Study", "career" => "Kariera", - "activities" => "Aktywności", + "news" => "Aktualności", "contact" => "Kontakt", ], "home" => [ @@ -210,14 +210,15 @@ ], "activities" => [ "section_1" => [ - "title_1" => "Nasze aktywności", + "title_1" => "Nasze", + "title_2" => "aktualności", ], ], "activity" => [ "section_1" => [ - "title_1" => "Może Cię zainteresować:", - "title_2" => "Tagi", - "title_3" => "Osoby", + "title_1" => "Mogą Cię zainteresować", + "title_2" => "Kategorie", + "title_3" => "Powiązane osoby", ], ], "contact" => [ diff --git a/lang/pl/meta.php b/lang/pl/meta.php index e350df79..3bb20e82 100644 --- a/lang/pl/meta.php +++ b/lang/pl/meta.php @@ -28,7 +28,7 @@ "description" => "Jeśli szukasz rozwiązania idealnie dostosowanego do Twoich potrzeb, jesteśmy dla Ciebie! Czekamy na Twoją wiadomość!", ], "activities" => [ - "title" => "Aktywności", + "title" => "Aktualności", "description" => "Zobacz, co u nas słychać!", ], "privacy-policy" => [ diff --git a/lang/pl/routes.php b/lang/pl/routes.php index aa1b2fb4..f7f773a4 100644 --- a/lang/pl/routes.php +++ b/lang/pl/routes.php @@ -9,8 +9,8 @@ "career" => "kariera", "contact" => "kontakt", "legal" => "prawne", - "activities" => "aktywnosci", - "activities/{slug}" => "aktywnosci/{slug}", + "news" => "aktualnosci", + "news/{slug}" => "aktualnosci/{slug}", "software-engineer" => "inzynier-oprogramowania", "privacy-policy" => "polityka-prywatnosci", "company-data" => "dane-firmy", diff --git a/resources/views/activities.blade.php b/resources/views/activities.blade.php deleted file mode 100644 index 4ecf9d7a..00000000 --- a/resources/views/activities.blade.php +++ /dev/null @@ -1,73 +0,0 @@ -@extends("layout.public") - -@section("title", __("meta.activities.title")) -@section("description", __("meta.activities.description")) - -@section("content") -
-
- -
-
- -
-
- -
-
-
- -
-
-
- -
-
-
-
-

- {{ __("content.activities.section_1.title_1") }} -

-
-
- - $selectedTag === null - ]) - > {{ __("tags.all") }} - - @foreach($tags as $tag) - $tag]) }}"> - $selectedTag && $tag === $selectedTag - ]) - >{{ $tag }} - - @endforeach - @if($selectedTag && $tags->contains($selectedTag) === false) - - {{ $selectedTag }} - - @endif -
-
- @foreach($activities as $activity) - - @endforeach -
-
-
- {{ $activities->onEachSide(1)->links() }} -
-@endsection diff --git a/resources/views/activity.blade.php b/resources/views/activity.blade.php deleted file mode 100644 index 71347518..00000000 --- a/resources/views/activity.blade.php +++ /dev/null @@ -1,111 +0,0 @@ -@extends("layout.public") - -@section("title", $activity->title) -@section("description", $activity->subtitle) - -@section("content") - - - - - - -
-
- -
-
- -
-
- -
-
-
- -
-
-
- - - -
-
- -
-
-
- photo) }}" - alt="" - class="inset-0 -z-10 size-full object-cover"> -
-
-
-
-

{{ $activity->title }}

-

{{ $activity->subtitle }}

-
-
-
-
-
{!! $activity->description !!}
- @if(!empty($activity->url)) - - ▶ {{ $activity->url }} - @endif -
-
-
-
-

{{ __("content.activity.section_1.title_1") }}

-
- @foreach($recommendedActivities as $recommendedActivity) -
-
-
- -
-
- -
- @endforeach -
-
-
count($tags) === 0])> -

{{ __("content.activity.section_1.title_2") }}

-
- @foreach($tags as $tag) - $tag['title']]) }}"> - {{ $tag['title'] }} - - @endforeach -
-
-
count($peopleTags) === 0])> -

{{ __("content.activity.section_1.title_3") }}

-
- @foreach($peopleTags as $tag) - $tag['title']]) }}"> - {{ $tag['title'] }} - - @endforeach -
-
-
-
-@endsection diff --git a/resources/views/components/activity-card.blade.php b/resources/views/components/activity-card.blade.php deleted file mode 100644 index 2c8a4e71..00000000 --- a/resources/views/components/activity-card.blade.php +++ /dev/null @@ -1,20 +0,0 @@ -@props(['activity', 'class' => '']) - -
class([$class, 'relative isolate flex flex-col justify-end overflow-hidden pb-8 aspect-square']) }}> - - -
- -
-
- {{ $activity['title'] }} -
-

- - - {{ $activity['subtitle'] }} - -

-
diff --git a/resources/views/components/icons/arrow-up-right.blade.php b/resources/views/components/icons/arrow-up-right.blade.php new file mode 100644 index 00000000..1d28c3f8 --- /dev/null +++ b/resources/views/components/icons/arrow-up-right.blade.php @@ -0,0 +1,7 @@ + + + + + diff --git a/resources/views/components/news-card.blade.php b/resources/views/components/news-card.blade.php new file mode 100644 index 00000000..e7f8e099 --- /dev/null +++ b/resources/views/components/news-card.blade.php @@ -0,0 +1,40 @@ +@props(['news', 'class' => '', 'isFirst' => false]) + +
class([$class, 'relative isolate flex flex-col overflow-hidden gap-3']) }}> +
$isFirst, + 'lg:h-[340px]' => !$isFirst, + ])> + + + + +
+
$isFirst, + 'flex flex-col gap-2' => !$isFirst, + + ])> +
+ + @if($isFirst)@endif +
+
+

$isFirst])> + + + {{ $news['title'] }} + +

+
+
+ {!! $news['description'] !!} +
+
+
diff --git a/resources/views/components/tag.blade.php b/resources/views/components/tag.blade.php index c6048595..63d6cec1 100644 --- a/resources/views/components/tag.blade.php +++ b/resources/views/components/tag.blade.php @@ -1,3 +1,7 @@ -merge(['class' => "rounded-full bg-bubble w-auto uppercase text-black font-semibold text-xs"]) }}> +merge(['class' => "w-full sm:w-auto flex place-content-center sm:border-b-[3px] border-gray-200 px-1 pt-1 text-sm font-medium hover:border-website-normal hover:text-black"]) }}> {{ $slot }} - + @if( isset($articlesCount) && $articlesCount != 0 ) + {{ $articlesCount }} + @endif + diff --git a/resources/views/layout/navigation.blade.php b/resources/views/layout/navigation.blade.php index 42026a8e..e10d3b47 100644 --- a/resources/views/layout/navigation.blade.php +++ b/resources/views/layout/navigation.blade.php @@ -19,27 +19,27 @@ class="flex items-center justify-between px-14 md:px-6 2xl:px-0 py-8 relative mx @@ -119,9 +119,9 @@ class="fa-solid fa-xmark text-2xl text-brand hidden">
Str::contains($current, 'activities')])> - - {{ __("content.pages.activities") }} + 'text-website-normal' => Str::contains($current, 'news')])> + + {{ __("content.pages.news") }}
@include('layout.navigation')
-