1
0
mirror of https://github.com/immich-app/immich.git synced 2025-08-09 23:17:29 +02:00

feat: people infinite scroll (#11326)

* feat: people infinite scroll

* add infinite scroll to show & hide modal

* update unit tests

* show total people count instead of currently loaded

* update personsearchdto
This commit is contained in:
Michel Heusschen
2024-07-25 21:59:28 +02:00
committed by GitHub
parent 152421e288
commit 8e6bc13540
17 changed files with 276 additions and 67 deletions

View File

@@ -66,8 +66,14 @@ class PeopleApi {
/// Performs an HTTP 'GET /people' operation and returns the [Response].
/// Parameters:
///
/// * [num] page:
/// Page number for pagination
///
/// * [num] size:
/// Number of items per page
///
/// * [bool] withHidden:
Future<Response> getAllPeopleWithHttpInfo({ bool? withHidden, }) async {
Future<Response> getAllPeopleWithHttpInfo({ num? page, num? size, bool? withHidden, }) async {
// ignore: prefer_const_declarations
final path = r'/people';
@@ -78,6 +84,12 @@ class PeopleApi {
final headerParams = <String, String>{};
final formParams = <String, String>{};
if (page != null) {
queryParams.addAll(_queryParams('', 'page', page));
}
if (size != null) {
queryParams.addAll(_queryParams('', 'size', size));
}
if (withHidden != null) {
queryParams.addAll(_queryParams('', 'withHidden', withHidden));
}
@@ -98,9 +110,15 @@ class PeopleApi {
/// Parameters:
///
/// * [num] page:
/// Page number for pagination
///
/// * [num] size:
/// Number of items per page
///
/// * [bool] withHidden:
Future<PeopleResponseDto?> getAllPeople({ bool? withHidden, }) async {
final response = await getAllPeopleWithHttpInfo( withHidden: withHidden, );
Future<PeopleResponseDto?> getAllPeople({ num? page, num? size, bool? withHidden, }) async {
final response = await getAllPeopleWithHttpInfo( page: page, size: size, withHidden: withHidden, );
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}

View File

@@ -13,11 +13,21 @@ part of openapi.api;
class PeopleResponseDto {
/// Returns a new [PeopleResponseDto] instance.
PeopleResponseDto({
this.hasNextPage,
required this.hidden,
this.people = const [],
required this.total,
});
/// This property was added in v1.110.0
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
bool? hasNextPage;
int hidden;
List<PersonResponseDto> people;
@@ -26,6 +36,7 @@ class PeopleResponseDto {
@override
bool operator ==(Object other) => identical(this, other) || other is PeopleResponseDto &&
other.hasNextPage == hasNextPage &&
other.hidden == hidden &&
_deepEquality.equals(other.people, people) &&
other.total == total;
@@ -33,15 +44,21 @@ class PeopleResponseDto {
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(hasNextPage == null ? 0 : hasNextPage!.hashCode) +
(hidden.hashCode) +
(people.hashCode) +
(total.hashCode);
@override
String toString() => 'PeopleResponseDto[hidden=$hidden, people=$people, total=$total]';
String toString() => 'PeopleResponseDto[hasNextPage=$hasNextPage, hidden=$hidden, people=$people, total=$total]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
if (this.hasNextPage != null) {
json[r'hasNextPage'] = this.hasNextPage;
} else {
// json[r'hasNextPage'] = null;
}
json[r'hidden'] = this.hidden;
json[r'people'] = this.people;
json[r'total'] = this.total;
@@ -56,6 +73,7 @@ class PeopleResponseDto {
final json = value.cast<String, dynamic>();
return PeopleResponseDto(
hasNextPage: mapValueOfType<bool>(json, r'hasNextPage'),
hidden: mapValueOfType<int>(json, r'hidden')!,
people: PersonResponseDto.listFromJson(json[r'people']),
total: mapValueOfType<int>(json, r'total')!,