-
-
Notifications
You must be signed in to change notification settings - Fork 309
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add layout setting for timeline and search
- Loading branch information
Showing
17 changed files
with
141 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,8 @@ | |
|
||
use App\Actions\Photo\Timeline; | ||
use App\Http\Requests\Photo\GetTimelineRequest; | ||
use App\Http\Resources\Collections\TimelineResource; | ||
use App\Http\Resources\Timeline\InitResource; | ||
use App\Http\Resources\Timeline\TimelineResource; | ||
use App\Models\Configs; | ||
use App\Models\Photo; | ||
use Illuminate\Contracts\Pagination\LengthAwarePaginator; | ||
|
@@ -25,7 +26,15 @@ public function __invoke(GetTimelineRequest $request, Timeline $timeline): Data | |
return TimelineResource::fromData($photoResults); | ||
} | ||
|
||
public function getLayout(): void | ||
/** | ||
* Return init Search. | ||
* | ||
* @param InitSearchRequest $request | ||
* | ||
* @return InitResource | ||
*/ | ||
public function init(GetTimelineRequest $request): Data | ||
Check failure on line 36 in app/Http/Controllers/Gallery/TimelineController.php GitHub Actions / 2️⃣ PHP 8.2 - PHPStan
Check failure on line 36 in app/Http/Controllers/Gallery/TimelineController.php GitHub Actions / 2️⃣ PHP 8.2 - PHPStan
Check failure on line 36 in app/Http/Controllers/Gallery/TimelineController.php GitHub Actions / 2️⃣ PHP 8.2 - PHPStan
Check failure on line 36 in app/Http/Controllers/Gallery/TimelineController.php GitHub Actions / 2️⃣ PHP 8.2 - PHPStan
|
||
{ | ||
return new InitResource(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace App\Http\Resources\Timeline; | ||
|
||
use App\Enum\PhotoLayoutType; | ||
use App\Models\Configs; | ||
use Spatie\LaravelData\Data; | ||
use Spatie\TypeScriptTransformer\Attributes\TypeScript; | ||
|
||
/** | ||
* Initialization resource for the search. | ||
*/ | ||
#[TypeScript()] | ||
class InitResource extends Data | ||
{ | ||
public PhotoLayoutType $photo_layout; | ||
|
||
public function __construct() | ||
{ | ||
$this->photo_layout = Configs::getValueAsEnum('timeline_photos_layout', PhotoLayoutType::class); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...esources/Collections/TimelineResource.php → ...p/Resources/Timeline/TimelineResource.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import axios, { type AxiosResponse } from "axios"; | ||
import Constants from "./constants"; | ||
|
||
const TimelineService = { | ||
timeline(page: number = 1): Promise<AxiosResponse<App.Http.Resources.Timeline.TimelineResource>> { | ||
return axios.get(`${Constants.getApiUrl()}Timeline`, { params: { page: page }, data: {} }); | ||
}, | ||
|
||
init(): Promise<AxiosResponse<App.Http.Resources.Timeline.InitResource>> { | ||
return axios.get(`${Constants.getApiUrl()}Timeline::init`, { data: {} }); | ||
}, | ||
}; | ||
|
||
export default TimelineService; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.