Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions app/Enum/AlbumLayoutType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

/**
* SPDX-License-Identifier: MIT
* Copyright (c) 2017-2018 Tobias Reich
* Copyright (c) 2018-2026 LycheeOrg.
*/

namespace App\Enum;

/**
* Enum AlbumLayoutType.
*
* All the allowed layout possibilities on Album
*/
enum AlbumLayoutType: string
{
case LIST = 'list';
case GRID = 'grid';
}
5 changes: 5 additions & 0 deletions app/Http/Resources/GalleryConfigs/InitConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use App\Enum\AlbumDecorationOrientation;
use App\Enum\AlbumDecorationType;
use App\Enum\AlbumLayoutType;
use App\Enum\ImageOverlayType;
use App\Enum\PhotoThumbInfoType;
use App\Enum\SmallLargeType;
Expand Down Expand Up @@ -60,6 +61,9 @@ class InitConfig extends Data
public PhotoThumbInfoType $photo_thumb_info;
public bool $is_photo_thumb_tags_enabled;

// Album view mode
public AlbumLayoutType $album_layout;

// Download configuration
public bool $is_thumb_download_enabled;
public bool $is_thum2x_download_enabled;
Expand Down Expand Up @@ -152,6 +156,7 @@ public function __construct()
$this->number_albums_per_row_mobile = request()->configs()->getValueAsInt('number_albums_per_row_mobile');
$this->photo_thumb_info = request()->configs()->getValueAsEnum('photo_thumb_info', PhotoThumbInfoType::class);
$this->is_photo_thumb_tags_enabled = request()->configs()->getValueAsBool('photo_thumb_tags_enabled');
$this->album_layout = request()->configs()->getValueAsEnum('album_layout', AlbumLayoutType::class);

// Download configuration
$this->is_thumb_download_enabled = request()->configs()->getValueAsBool('disable_thumb_download') === false;
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Resources/Models/Utils/TimelineData.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private static function fromAlbum(ThumbAlbumResource $album, ColumnSortingType $
ColumnSortingType::MAX_TAKEN_AT => $album->max_taken_at_carbon(),
ColumnSortingType::MIN_TAKEN_AT => $album->min_taken_at_carbon(),
// Parse the title as date (e.g. "2020 something" or "2020-03 something" or "2020-03-25 something")
ColumnSortingType::TITLE => self::parseDateFromTitle($album->title),
ColumnSortingType::TITLE => self::parseDateFromTitle(trim($album->title)),
default => null,
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

/**
* SPDX-License-Identifier: MIT
* Copyright (c) 2017-2018 Tobias Reich
* Copyright (c) 2018-2026 LycheeOrg.
*/

use App\Models\Extensions\BaseConfigMigration;

return new class() extends BaseConfigMigration {
public const MOD_GALLERY = 'Gallery';

/**
* @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}>
*/
public function getConfigs(): array
{
return [
[
'key' => 'album_layout',
'value' => 'grid',
'cat' => self::MOD_GALLERY,
'type_range' => 'grid|list',
'description' => 'Default album view layout.',
'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.',
'is_secret' => false,
'is_expert' => false,
'order' => 50,
'not_on_docker' => false,
'level' => 0,
],
];
}
};
Loading
Loading