Skip to content

Commit af8359a

Browse files
authored
Add view albums as lines instead of grid layout. (#3930)
1 parent a346e50 commit af8359a

File tree

21 files changed

+2352
-405
lines changed

21 files changed

+2352
-405
lines changed

app/Enum/AlbumLayoutType.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
/**
4+
* SPDX-License-Identifier: MIT
5+
* Copyright (c) 2017-2018 Tobias Reich
6+
* Copyright (c) 2018-2026 LycheeOrg.
7+
*/
8+
9+
namespace App\Enum;
10+
11+
/**
12+
* Enum AlbumLayoutType.
13+
*
14+
* All the allowed layout possibilities on Album
15+
*/
16+
enum AlbumLayoutType: string
17+
{
18+
case LIST = 'list';
19+
case GRID = 'grid';
20+
}

app/Http/Resources/GalleryConfigs/InitConfig.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
use App\Enum\AlbumDecorationOrientation;
1212
use App\Enum\AlbumDecorationType;
13+
use App\Enum\AlbumLayoutType;
1314
use App\Enum\ImageOverlayType;
1415
use App\Enum\PhotoThumbInfoType;
1516
use App\Enum\SmallLargeType;
@@ -60,6 +61,9 @@ class InitConfig extends Data
6061
public PhotoThumbInfoType $photo_thumb_info;
6162
public bool $is_photo_thumb_tags_enabled;
6263

64+
// Album view mode
65+
public AlbumLayoutType $album_layout;
66+
6367
// Download configuration
6468
public bool $is_thumb_download_enabled;
6569
public bool $is_thum2x_download_enabled;
@@ -152,6 +156,7 @@ public function __construct()
152156
$this->number_albums_per_row_mobile = request()->configs()->getValueAsInt('number_albums_per_row_mobile');
153157
$this->photo_thumb_info = request()->configs()->getValueAsEnum('photo_thumb_info', PhotoThumbInfoType::class);
154158
$this->is_photo_thumb_tags_enabled = request()->configs()->getValueAsBool('photo_thumb_tags_enabled');
159+
$this->album_layout = request()->configs()->getValueAsEnum('album_layout', AlbumLayoutType::class);
155160

156161
// Download configuration
157162
$this->is_thumb_download_enabled = request()->configs()->getValueAsBool('disable_thumb_download') === false;

app/Http/Resources/Models/Utils/TimelineData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private static function fromAlbum(ThumbAlbumResource $album, ColumnSortingType $
100100
ColumnSortingType::MAX_TAKEN_AT => $album->max_taken_at_carbon(),
101101
ColumnSortingType::MIN_TAKEN_AT => $album->min_taken_at_carbon(),
102102
// Parse the title as date (e.g. "2020 something" or "2020-03 something" or "2020-03-25 something")
103-
ColumnSortingType::TITLE => self::parseDateFromTitle($album->title),
103+
ColumnSortingType::TITLE => self::parseDateFromTitle(trim($album->title)),
104104
default => null,
105105
};
106106

app/Metadata/Versions/Remote/GitCommits.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
* ...
3636
* },]
3737
*/
38-
final class GitCommits extends AbstractGitRemote implements GitRemote
38+
class GitCommits extends AbstractGitRemote implements GitRemote
3939
{
4040
use Trimable;
4141

app/Metadata/Versions/Remote/GitTags.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* "node_id": "MDM6UmVmMTQzOTc1ODA0OnJlZnMvdGFncy92NC42LjMtUkMx"
2929
* },]
3030
*/
31-
final class GitTags extends AbstractGitRemote implements GitRemote
31+
class GitTags extends AbstractGitRemote implements GitRemote
3232
{
3333
use Trimable;
3434

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
/**
4+
* SPDX-License-Identifier: MIT
5+
* Copyright (c) 2017-2018 Tobias Reich
6+
* Copyright (c) 2018-2026 LycheeOrg.
7+
*/
8+
9+
use App\Models\Extensions\BaseConfigMigration;
10+
11+
return new class() extends BaseConfigMigration {
12+
public const MOD_GALLERY = 'Gallery';
13+
14+
/**
15+
* @return array<int,array{key:string,value:string,is_secret:bool,cat:string,type_range:string,description:string,details?:string,order?:int,not_on_docker?:bool,is_expert?:bool,level?:int}>
16+
*/
17+
public function getConfigs(): array
18+
{
19+
return [
20+
[
21+
'key' => 'album_layout',
22+
'value' => 'grid',
23+
'cat' => self::MOD_GALLERY,
24+
'type_range' => 'grid|list',
25+
'description' => 'Default album view layout.',
26+
'details' => 'Choose between grid (thumbnail cards) or list (detailed rows) view for albums. Users can toggle between views client-side, but preference does not persist across page reloads.',
27+
'is_secret' => false,
28+
'is_expert' => false,
29+
'order' => 50,
30+
'not_on_docker' => false,
31+
'level' => 0,
32+
],
33+
];
34+
}
35+
};

0 commit comments

Comments
 (0)