mirror of
https://github.com/immich-app/immich.git
synced 2025-06-02 13:14:54 -04:00
feat(web): shared link filters (#15948)
This commit is contained in:
parent
23014c263b
commit
c5360e78c5
@ -436,6 +436,7 @@
|
|||||||
"back_close_deselect": "Back, close, or deselect",
|
"back_close_deselect": "Back, close, or deselect",
|
||||||
"backward": "Backward",
|
"backward": "Backward",
|
||||||
"birthdate_saved": "Date of birth saved successfully",
|
"birthdate_saved": "Date of birth saved successfully",
|
||||||
|
"show_shared_links": "Show shared links",
|
||||||
"birthdate_set_description": "Date of birth is used to calculate the age of this person at the time of a photo.",
|
"birthdate_set_description": "Date of birth is used to calculate the age of this person at the time of a photo.",
|
||||||
"blurred_background": "Blurred background",
|
"blurred_background": "Blurred background",
|
||||||
"bugs_and_feature_requests": "Bugs & Feature Requests",
|
"bugs_and_feature_requests": "Bugs & Feature Requests",
|
||||||
@ -804,6 +805,7 @@
|
|||||||
"include_shared_albums": "Include shared albums",
|
"include_shared_albums": "Include shared albums",
|
||||||
"include_shared_partner_assets": "Include shared partner assets",
|
"include_shared_partner_assets": "Include shared partner assets",
|
||||||
"individual_share": "Individual share",
|
"individual_share": "Individual share",
|
||||||
|
"individual_shares": "Individual shares",
|
||||||
"info": "Info",
|
"info": "Info",
|
||||||
"interval": {
|
"interval": {
|
||||||
"day_at_onepm": "Every day at 1pm",
|
"day_at_onepm": "Every day at 1pm",
|
||||||
@ -1172,6 +1174,7 @@
|
|||||||
"shared_from_partner": "Photos from {partner}",
|
"shared_from_partner": "Photos from {partner}",
|
||||||
"shared_link_options": "Shared link options",
|
"shared_link_options": "Shared link options",
|
||||||
"shared_links": "Shared links",
|
"shared_links": "Shared links",
|
||||||
|
"shared_links_description": "Share photos and videos with a link",
|
||||||
"shared_photos_and_videos_count": "{assetCount, plural, other {# shared photos & videos.}}",
|
"shared_photos_and_videos_count": "{assetCount, plural, other {# shared photos & videos.}}",
|
||||||
"shared_with_partner": "Shared with {partner}",
|
"shared_with_partner": "Shared with {partner}",
|
||||||
"sharing": "Sharing",
|
"sharing": "Sharing",
|
||||||
|
2
mobile/openapi/README.md
generated
2
mobile/openapi/README.md
generated
@ -408,6 +408,8 @@ Class | Method | HTTP request | Description
|
|||||||
- [SharedLinkEditDto](doc//SharedLinkEditDto.md)
|
- [SharedLinkEditDto](doc//SharedLinkEditDto.md)
|
||||||
- [SharedLinkResponseDto](doc//SharedLinkResponseDto.md)
|
- [SharedLinkResponseDto](doc//SharedLinkResponseDto.md)
|
||||||
- [SharedLinkType](doc//SharedLinkType.md)
|
- [SharedLinkType](doc//SharedLinkType.md)
|
||||||
|
- [SharedLinksResponse](doc//SharedLinksResponse.md)
|
||||||
|
- [SharedLinksUpdate](doc//SharedLinksUpdate.md)
|
||||||
- [SignUpDto](doc//SignUpDto.md)
|
- [SignUpDto](doc//SignUpDto.md)
|
||||||
- [SmartSearchDto](doc//SmartSearchDto.md)
|
- [SmartSearchDto](doc//SmartSearchDto.md)
|
||||||
- [SourceType](doc//SourceType.md)
|
- [SourceType](doc//SourceType.md)
|
||||||
|
2
mobile/openapi/lib/api.dart
generated
2
mobile/openapi/lib/api.dart
generated
@ -221,6 +221,8 @@ part 'model/shared_link_create_dto.dart';
|
|||||||
part 'model/shared_link_edit_dto.dart';
|
part 'model/shared_link_edit_dto.dart';
|
||||||
part 'model/shared_link_response_dto.dart';
|
part 'model/shared_link_response_dto.dart';
|
||||||
part 'model/shared_link_type.dart';
|
part 'model/shared_link_type.dart';
|
||||||
|
part 'model/shared_links_response.dart';
|
||||||
|
part 'model/shared_links_update.dart';
|
||||||
part 'model/sign_up_dto.dart';
|
part 'model/sign_up_dto.dart';
|
||||||
part 'model/smart_search_dto.dart';
|
part 'model/smart_search_dto.dart';
|
||||||
part 'model/source_type.dart';
|
part 'model/source_type.dart';
|
||||||
|
4
mobile/openapi/lib/api_client.dart
generated
4
mobile/openapi/lib/api_client.dart
generated
@ -496,6 +496,10 @@ class ApiClient {
|
|||||||
return SharedLinkResponseDto.fromJson(value);
|
return SharedLinkResponseDto.fromJson(value);
|
||||||
case 'SharedLinkType':
|
case 'SharedLinkType':
|
||||||
return SharedLinkTypeTypeTransformer().decode(value);
|
return SharedLinkTypeTypeTransformer().decode(value);
|
||||||
|
case 'SharedLinksResponse':
|
||||||
|
return SharedLinksResponse.fromJson(value);
|
||||||
|
case 'SharedLinksUpdate':
|
||||||
|
return SharedLinksUpdate.fromJson(value);
|
||||||
case 'SignUpDto':
|
case 'SignUpDto':
|
||||||
return SignUpDto.fromJson(value);
|
return SignUpDto.fromJson(value);
|
||||||
case 'SmartSearchDto':
|
case 'SmartSearchDto':
|
||||||
|
107
mobile/openapi/lib/model/shared_links_response.dart
generated
Normal file
107
mobile/openapi/lib/model/shared_links_response.dart
generated
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
// @dart=2.18
|
||||||
|
|
||||||
|
// ignore_for_file: unused_element, unused_import
|
||||||
|
// ignore_for_file: always_put_required_named_parameters_first
|
||||||
|
// ignore_for_file: constant_identifier_names
|
||||||
|
// ignore_for_file: lines_longer_than_80_chars
|
||||||
|
|
||||||
|
part of openapi.api;
|
||||||
|
|
||||||
|
class SharedLinksResponse {
|
||||||
|
/// Returns a new [SharedLinksResponse] instance.
|
||||||
|
SharedLinksResponse({
|
||||||
|
this.enabled = true,
|
||||||
|
this.sidebarWeb = false,
|
||||||
|
});
|
||||||
|
|
||||||
|
bool enabled;
|
||||||
|
|
||||||
|
bool sidebarWeb;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) => identical(this, other) || other is SharedLinksResponse &&
|
||||||
|
other.enabled == enabled &&
|
||||||
|
other.sidebarWeb == sidebarWeb;
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode =>
|
||||||
|
// ignore: unnecessary_parenthesis
|
||||||
|
(enabled.hashCode) +
|
||||||
|
(sidebarWeb.hashCode);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => 'SharedLinksResponse[enabled=$enabled, sidebarWeb=$sidebarWeb]';
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final json = <String, dynamic>{};
|
||||||
|
json[r'enabled'] = this.enabled;
|
||||||
|
json[r'sidebarWeb'] = this.sidebarWeb;
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns a new [SharedLinksResponse] instance and imports its values from
|
||||||
|
/// [value] if it's a [Map], null otherwise.
|
||||||
|
// ignore: prefer_constructors_over_static_methods
|
||||||
|
static SharedLinksResponse? fromJson(dynamic value) {
|
||||||
|
upgradeDto(value, "SharedLinksResponse");
|
||||||
|
if (value is Map) {
|
||||||
|
final json = value.cast<String, dynamic>();
|
||||||
|
|
||||||
|
return SharedLinksResponse(
|
||||||
|
enabled: mapValueOfType<bool>(json, r'enabled')!,
|
||||||
|
sidebarWeb: mapValueOfType<bool>(json, r'sidebarWeb')!,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
static List<SharedLinksResponse> listFromJson(dynamic json, {bool growable = false,}) {
|
||||||
|
final result = <SharedLinksResponse>[];
|
||||||
|
if (json is List && json.isNotEmpty) {
|
||||||
|
for (final row in json) {
|
||||||
|
final value = SharedLinksResponse.fromJson(row);
|
||||||
|
if (value != null) {
|
||||||
|
result.add(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result.toList(growable: growable);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Map<String, SharedLinksResponse> mapFromJson(dynamic json) {
|
||||||
|
final map = <String, SharedLinksResponse>{};
|
||||||
|
if (json is Map && json.isNotEmpty) {
|
||||||
|
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||||
|
for (final entry in json.entries) {
|
||||||
|
final value = SharedLinksResponse.fromJson(entry.value);
|
||||||
|
if (value != null) {
|
||||||
|
map[entry.key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
// maps a json object with a list of SharedLinksResponse-objects as value to a dart map
|
||||||
|
static Map<String, List<SharedLinksResponse>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||||
|
final map = <String, List<SharedLinksResponse>>{};
|
||||||
|
if (json is Map && json.isNotEmpty) {
|
||||||
|
// ignore: parameter_assignments
|
||||||
|
json = json.cast<String, dynamic>();
|
||||||
|
for (final entry in json.entries) {
|
||||||
|
map[entry.key] = SharedLinksResponse.listFromJson(entry.value, growable: growable,);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The list of required keys that must be present in a JSON.
|
||||||
|
static const requiredKeys = <String>{
|
||||||
|
'enabled',
|
||||||
|
'sidebarWeb',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
125
mobile/openapi/lib/model/shared_links_update.dart
generated
Normal file
125
mobile/openapi/lib/model/shared_links_update.dart
generated
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
// @dart=2.18
|
||||||
|
|
||||||
|
// ignore_for_file: unused_element, unused_import
|
||||||
|
// ignore_for_file: always_put_required_named_parameters_first
|
||||||
|
// ignore_for_file: constant_identifier_names
|
||||||
|
// ignore_for_file: lines_longer_than_80_chars
|
||||||
|
|
||||||
|
part of openapi.api;
|
||||||
|
|
||||||
|
class SharedLinksUpdate {
|
||||||
|
/// Returns a new [SharedLinksUpdate] instance.
|
||||||
|
SharedLinksUpdate({
|
||||||
|
this.enabled,
|
||||||
|
this.sidebarWeb,
|
||||||
|
});
|
||||||
|
|
||||||
|
///
|
||||||
|
/// 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? enabled;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// 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? sidebarWeb;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) => identical(this, other) || other is SharedLinksUpdate &&
|
||||||
|
other.enabled == enabled &&
|
||||||
|
other.sidebarWeb == sidebarWeb;
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode =>
|
||||||
|
// ignore: unnecessary_parenthesis
|
||||||
|
(enabled == null ? 0 : enabled!.hashCode) +
|
||||||
|
(sidebarWeb == null ? 0 : sidebarWeb!.hashCode);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() => 'SharedLinksUpdate[enabled=$enabled, sidebarWeb=$sidebarWeb]';
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final json = <String, dynamic>{};
|
||||||
|
if (this.enabled != null) {
|
||||||
|
json[r'enabled'] = this.enabled;
|
||||||
|
} else {
|
||||||
|
// json[r'enabled'] = null;
|
||||||
|
}
|
||||||
|
if (this.sidebarWeb != null) {
|
||||||
|
json[r'sidebarWeb'] = this.sidebarWeb;
|
||||||
|
} else {
|
||||||
|
// json[r'sidebarWeb'] = null;
|
||||||
|
}
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns a new [SharedLinksUpdate] instance and imports its values from
|
||||||
|
/// [value] if it's a [Map], null otherwise.
|
||||||
|
// ignore: prefer_constructors_over_static_methods
|
||||||
|
static SharedLinksUpdate? fromJson(dynamic value) {
|
||||||
|
upgradeDto(value, "SharedLinksUpdate");
|
||||||
|
if (value is Map) {
|
||||||
|
final json = value.cast<String, dynamic>();
|
||||||
|
|
||||||
|
return SharedLinksUpdate(
|
||||||
|
enabled: mapValueOfType<bool>(json, r'enabled'),
|
||||||
|
sidebarWeb: mapValueOfType<bool>(json, r'sidebarWeb'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
static List<SharedLinksUpdate> listFromJson(dynamic json, {bool growable = false,}) {
|
||||||
|
final result = <SharedLinksUpdate>[];
|
||||||
|
if (json is List && json.isNotEmpty) {
|
||||||
|
for (final row in json) {
|
||||||
|
final value = SharedLinksUpdate.fromJson(row);
|
||||||
|
if (value != null) {
|
||||||
|
result.add(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result.toList(growable: growable);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Map<String, SharedLinksUpdate> mapFromJson(dynamic json) {
|
||||||
|
final map = <String, SharedLinksUpdate>{};
|
||||||
|
if (json is Map && json.isNotEmpty) {
|
||||||
|
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||||
|
for (final entry in json.entries) {
|
||||||
|
final value = SharedLinksUpdate.fromJson(entry.value);
|
||||||
|
if (value != null) {
|
||||||
|
map[entry.key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
// maps a json object with a list of SharedLinksUpdate-objects as value to a dart map
|
||||||
|
static Map<String, List<SharedLinksUpdate>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||||
|
final map = <String, List<SharedLinksUpdate>>{};
|
||||||
|
if (json is Map && json.isNotEmpty) {
|
||||||
|
// ignore: parameter_assignments
|
||||||
|
json = json.cast<String, dynamic>();
|
||||||
|
for (final entry in json.entries) {
|
||||||
|
map[entry.key] = SharedLinksUpdate.listFromJson(entry.value, growable: growable,);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The list of required keys that must be present in a JSON.
|
||||||
|
static const requiredKeys = <String>{
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -21,6 +21,7 @@ class UserPreferencesResponseDto {
|
|||||||
required this.people,
|
required this.people,
|
||||||
required this.purchase,
|
required this.purchase,
|
||||||
required this.ratings,
|
required this.ratings,
|
||||||
|
required this.sharedLinks,
|
||||||
required this.tags,
|
required this.tags,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -40,6 +41,8 @@ class UserPreferencesResponseDto {
|
|||||||
|
|
||||||
RatingsResponse ratings;
|
RatingsResponse ratings;
|
||||||
|
|
||||||
|
SharedLinksResponse sharedLinks;
|
||||||
|
|
||||||
TagsResponse tags;
|
TagsResponse tags;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -52,6 +55,7 @@ class UserPreferencesResponseDto {
|
|||||||
other.people == people &&
|
other.people == people &&
|
||||||
other.purchase == purchase &&
|
other.purchase == purchase &&
|
||||||
other.ratings == ratings &&
|
other.ratings == ratings &&
|
||||||
|
other.sharedLinks == sharedLinks &&
|
||||||
other.tags == tags;
|
other.tags == tags;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -65,10 +69,11 @@ class UserPreferencesResponseDto {
|
|||||||
(people.hashCode) +
|
(people.hashCode) +
|
||||||
(purchase.hashCode) +
|
(purchase.hashCode) +
|
||||||
(ratings.hashCode) +
|
(ratings.hashCode) +
|
||||||
|
(sharedLinks.hashCode) +
|
||||||
(tags.hashCode);
|
(tags.hashCode);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => 'UserPreferencesResponseDto[avatar=$avatar, download=$download, emailNotifications=$emailNotifications, folders=$folders, memories=$memories, people=$people, purchase=$purchase, ratings=$ratings, tags=$tags]';
|
String toString() => 'UserPreferencesResponseDto[avatar=$avatar, download=$download, emailNotifications=$emailNotifications, folders=$folders, memories=$memories, people=$people, purchase=$purchase, ratings=$ratings, sharedLinks=$sharedLinks, tags=$tags]';
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final json = <String, dynamic>{};
|
final json = <String, dynamic>{};
|
||||||
@ -80,6 +85,7 @@ class UserPreferencesResponseDto {
|
|||||||
json[r'people'] = this.people;
|
json[r'people'] = this.people;
|
||||||
json[r'purchase'] = this.purchase;
|
json[r'purchase'] = this.purchase;
|
||||||
json[r'ratings'] = this.ratings;
|
json[r'ratings'] = this.ratings;
|
||||||
|
json[r'sharedLinks'] = this.sharedLinks;
|
||||||
json[r'tags'] = this.tags;
|
json[r'tags'] = this.tags;
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
@ -101,6 +107,7 @@ class UserPreferencesResponseDto {
|
|||||||
people: PeopleResponse.fromJson(json[r'people'])!,
|
people: PeopleResponse.fromJson(json[r'people'])!,
|
||||||
purchase: PurchaseResponse.fromJson(json[r'purchase'])!,
|
purchase: PurchaseResponse.fromJson(json[r'purchase'])!,
|
||||||
ratings: RatingsResponse.fromJson(json[r'ratings'])!,
|
ratings: RatingsResponse.fromJson(json[r'ratings'])!,
|
||||||
|
sharedLinks: SharedLinksResponse.fromJson(json[r'sharedLinks'])!,
|
||||||
tags: TagsResponse.fromJson(json[r'tags'])!,
|
tags: TagsResponse.fromJson(json[r'tags'])!,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -157,6 +164,7 @@ class UserPreferencesResponseDto {
|
|||||||
'people',
|
'people',
|
||||||
'purchase',
|
'purchase',
|
||||||
'ratings',
|
'ratings',
|
||||||
|
'sharedLinks',
|
||||||
'tags',
|
'tags',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ class UserPreferencesUpdateDto {
|
|||||||
this.people,
|
this.people,
|
||||||
this.purchase,
|
this.purchase,
|
||||||
this.ratings,
|
this.ratings,
|
||||||
|
this.sharedLinks,
|
||||||
this.tags,
|
this.tags,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -88,6 +89,14 @@ class UserPreferencesUpdateDto {
|
|||||||
///
|
///
|
||||||
RatingsUpdate? ratings;
|
RatingsUpdate? ratings;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// 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.
|
||||||
|
///
|
||||||
|
SharedLinksUpdate? sharedLinks;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Please note: This property should have been non-nullable! Since the specification file
|
/// 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
|
/// does not include a default value (using the "default:" property), however, the generated
|
||||||
@ -106,6 +115,7 @@ class UserPreferencesUpdateDto {
|
|||||||
other.people == people &&
|
other.people == people &&
|
||||||
other.purchase == purchase &&
|
other.purchase == purchase &&
|
||||||
other.ratings == ratings &&
|
other.ratings == ratings &&
|
||||||
|
other.sharedLinks == sharedLinks &&
|
||||||
other.tags == tags;
|
other.tags == tags;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -119,10 +129,11 @@ class UserPreferencesUpdateDto {
|
|||||||
(people == null ? 0 : people!.hashCode) +
|
(people == null ? 0 : people!.hashCode) +
|
||||||
(purchase == null ? 0 : purchase!.hashCode) +
|
(purchase == null ? 0 : purchase!.hashCode) +
|
||||||
(ratings == null ? 0 : ratings!.hashCode) +
|
(ratings == null ? 0 : ratings!.hashCode) +
|
||||||
|
(sharedLinks == null ? 0 : sharedLinks!.hashCode) +
|
||||||
(tags == null ? 0 : tags!.hashCode);
|
(tags == null ? 0 : tags!.hashCode);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => 'UserPreferencesUpdateDto[avatar=$avatar, download=$download, emailNotifications=$emailNotifications, folders=$folders, memories=$memories, people=$people, purchase=$purchase, ratings=$ratings, tags=$tags]';
|
String toString() => 'UserPreferencesUpdateDto[avatar=$avatar, download=$download, emailNotifications=$emailNotifications, folders=$folders, memories=$memories, people=$people, purchase=$purchase, ratings=$ratings, sharedLinks=$sharedLinks, tags=$tags]';
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final json = <String, dynamic>{};
|
final json = <String, dynamic>{};
|
||||||
@ -166,6 +177,11 @@ class UserPreferencesUpdateDto {
|
|||||||
} else {
|
} else {
|
||||||
// json[r'ratings'] = null;
|
// json[r'ratings'] = null;
|
||||||
}
|
}
|
||||||
|
if (this.sharedLinks != null) {
|
||||||
|
json[r'sharedLinks'] = this.sharedLinks;
|
||||||
|
} else {
|
||||||
|
// json[r'sharedLinks'] = null;
|
||||||
|
}
|
||||||
if (this.tags != null) {
|
if (this.tags != null) {
|
||||||
json[r'tags'] = this.tags;
|
json[r'tags'] = this.tags;
|
||||||
} else {
|
} else {
|
||||||
@ -191,6 +207,7 @@ class UserPreferencesUpdateDto {
|
|||||||
people: PeopleUpdate.fromJson(json[r'people']),
|
people: PeopleUpdate.fromJson(json[r'people']),
|
||||||
purchase: PurchaseUpdate.fromJson(json[r'purchase']),
|
purchase: PurchaseUpdate.fromJson(json[r'purchase']),
|
||||||
ratings: RatingsUpdate.fromJson(json[r'ratings']),
|
ratings: RatingsUpdate.fromJson(json[r'ratings']),
|
||||||
|
sharedLinks: SharedLinksUpdate.fromJson(json[r'sharedLinks']),
|
||||||
tags: TagsUpdate.fromJson(json[r'tags']),
|
tags: TagsUpdate.fromJson(json[r'tags']),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -11514,6 +11514,34 @@
|
|||||||
],
|
],
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"SharedLinksResponse": {
|
||||||
|
"properties": {
|
||||||
|
"enabled": {
|
||||||
|
"default": true,
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"sidebarWeb": {
|
||||||
|
"default": false,
|
||||||
|
"type": "boolean"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"enabled",
|
||||||
|
"sidebarWeb"
|
||||||
|
],
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"SharedLinksUpdate": {
|
||||||
|
"properties": {
|
||||||
|
"enabled": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"sidebarWeb": {
|
||||||
|
"type": "boolean"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
"SignUpDto": {
|
"SignUpDto": {
|
||||||
"properties": {
|
"properties": {
|
||||||
"email": {
|
"email": {
|
||||||
@ -13160,6 +13188,9 @@
|
|||||||
"ratings": {
|
"ratings": {
|
||||||
"$ref": "#/components/schemas/RatingsResponse"
|
"$ref": "#/components/schemas/RatingsResponse"
|
||||||
},
|
},
|
||||||
|
"sharedLinks": {
|
||||||
|
"$ref": "#/components/schemas/SharedLinksResponse"
|
||||||
|
},
|
||||||
"tags": {
|
"tags": {
|
||||||
"$ref": "#/components/schemas/TagsResponse"
|
"$ref": "#/components/schemas/TagsResponse"
|
||||||
}
|
}
|
||||||
@ -13173,6 +13204,7 @@
|
|||||||
"people",
|
"people",
|
||||||
"purchase",
|
"purchase",
|
||||||
"ratings",
|
"ratings",
|
||||||
|
"sharedLinks",
|
||||||
"tags"
|
"tags"
|
||||||
],
|
],
|
||||||
"type": "object"
|
"type": "object"
|
||||||
@ -13203,6 +13235,9 @@
|
|||||||
"ratings": {
|
"ratings": {
|
||||||
"$ref": "#/components/schemas/RatingsUpdate"
|
"$ref": "#/components/schemas/RatingsUpdate"
|
||||||
},
|
},
|
||||||
|
"sharedLinks": {
|
||||||
|
"$ref": "#/components/schemas/SharedLinksUpdate"
|
||||||
|
},
|
||||||
"tags": {
|
"tags": {
|
||||||
"$ref": "#/components/schemas/TagsUpdate"
|
"$ref": "#/components/schemas/TagsUpdate"
|
||||||
}
|
}
|
||||||
|
@ -113,6 +113,10 @@ export type PurchaseResponse = {
|
|||||||
export type RatingsResponse = {
|
export type RatingsResponse = {
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
};
|
};
|
||||||
|
export type SharedLinksResponse = {
|
||||||
|
enabled: boolean;
|
||||||
|
sidebarWeb: boolean;
|
||||||
|
};
|
||||||
export type TagsResponse = {
|
export type TagsResponse = {
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
sidebarWeb: boolean;
|
sidebarWeb: boolean;
|
||||||
@ -126,6 +130,7 @@ export type UserPreferencesResponseDto = {
|
|||||||
people: PeopleResponse;
|
people: PeopleResponse;
|
||||||
purchase: PurchaseResponse;
|
purchase: PurchaseResponse;
|
||||||
ratings: RatingsResponse;
|
ratings: RatingsResponse;
|
||||||
|
sharedLinks: SharedLinksResponse;
|
||||||
tags: TagsResponse;
|
tags: TagsResponse;
|
||||||
};
|
};
|
||||||
export type AvatarUpdate = {
|
export type AvatarUpdate = {
|
||||||
@ -158,6 +163,10 @@ export type PurchaseUpdate = {
|
|||||||
export type RatingsUpdate = {
|
export type RatingsUpdate = {
|
||||||
enabled?: boolean;
|
enabled?: boolean;
|
||||||
};
|
};
|
||||||
|
export type SharedLinksUpdate = {
|
||||||
|
enabled?: boolean;
|
||||||
|
sidebarWeb?: boolean;
|
||||||
|
};
|
||||||
export type TagsUpdate = {
|
export type TagsUpdate = {
|
||||||
enabled?: boolean;
|
enabled?: boolean;
|
||||||
sidebarWeb?: boolean;
|
sidebarWeb?: boolean;
|
||||||
@ -171,6 +180,7 @@ export type UserPreferencesUpdateDto = {
|
|||||||
people?: PeopleUpdate;
|
people?: PeopleUpdate;
|
||||||
purchase?: PurchaseUpdate;
|
purchase?: PurchaseUpdate;
|
||||||
ratings?: RatingsUpdate;
|
ratings?: RatingsUpdate;
|
||||||
|
sharedLinks?: SharedLinksUpdate;
|
||||||
tags?: TagsUpdate;
|
tags?: TagsUpdate;
|
||||||
};
|
};
|
||||||
export type AlbumUserResponseDto = {
|
export type AlbumUserResponseDto = {
|
||||||
|
@ -38,6 +38,14 @@ class PeopleUpdate {
|
|||||||
sidebarWeb?: boolean;
|
sidebarWeb?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SharedLinksUpdate {
|
||||||
|
@ValidateBoolean({ optional: true })
|
||||||
|
enabled?: boolean;
|
||||||
|
|
||||||
|
@ValidateBoolean({ optional: true })
|
||||||
|
sidebarWeb?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
class TagsUpdate {
|
class TagsUpdate {
|
||||||
@ValidateBoolean({ optional: true })
|
@ValidateBoolean({ optional: true })
|
||||||
enabled?: boolean;
|
enabled?: boolean;
|
||||||
@ -98,6 +106,11 @@ export class UserPreferencesUpdateDto {
|
|||||||
@Type(() => RatingsUpdate)
|
@Type(() => RatingsUpdate)
|
||||||
ratings?: RatingsUpdate;
|
ratings?: RatingsUpdate;
|
||||||
|
|
||||||
|
@Optional()
|
||||||
|
@ValidateNested()
|
||||||
|
@Type(() => SharedLinksUpdate)
|
||||||
|
sharedLinks?: SharedLinksUpdate;
|
||||||
|
|
||||||
@Optional()
|
@Optional()
|
||||||
@ValidateNested()
|
@ValidateNested()
|
||||||
@Type(() => TagsUpdate)
|
@Type(() => TagsUpdate)
|
||||||
@ -152,6 +165,11 @@ class TagsResponse {
|
|||||||
sidebarWeb: boolean = true;
|
sidebarWeb: boolean = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SharedLinksResponse {
|
||||||
|
enabled: boolean = true;
|
||||||
|
sidebarWeb: boolean = false;
|
||||||
|
}
|
||||||
|
|
||||||
class EmailNotificationsResponse {
|
class EmailNotificationsResponse {
|
||||||
enabled!: boolean;
|
enabled!: boolean;
|
||||||
albumInvite!: boolean;
|
albumInvite!: boolean;
|
||||||
@ -175,6 +193,7 @@ export class UserPreferencesResponseDto implements UserPreferences {
|
|||||||
memories!: MemoriesResponse;
|
memories!: MemoriesResponse;
|
||||||
people!: PeopleResponse;
|
people!: PeopleResponse;
|
||||||
ratings!: RatingsResponse;
|
ratings!: RatingsResponse;
|
||||||
|
sharedLinks!: SharedLinksResponse;
|
||||||
tags!: TagsResponse;
|
tags!: TagsResponse;
|
||||||
avatar!: AvatarResponse;
|
avatar!: AvatarResponse;
|
||||||
emailNotifications!: EmailNotificationsResponse;
|
emailNotifications!: EmailNotificationsResponse;
|
||||||
|
@ -34,6 +34,10 @@ export interface UserPreferences {
|
|||||||
ratings: {
|
ratings: {
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
};
|
};
|
||||||
|
sharedLinks: {
|
||||||
|
enabled: boolean;
|
||||||
|
sidebarWeb: boolean;
|
||||||
|
};
|
||||||
tags: {
|
tags: {
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
sidebarWeb: boolean;
|
sidebarWeb: boolean;
|
||||||
@ -74,6 +78,10 @@ export const getDefaultPreferences = (user: { email: string }): UserPreferences
|
|||||||
enabled: true,
|
enabled: true,
|
||||||
sidebarWeb: false,
|
sidebarWeb: false,
|
||||||
},
|
},
|
||||||
|
sharedLinks: {
|
||||||
|
enabled: true,
|
||||||
|
sidebarWeb: false,
|
||||||
|
},
|
||||||
ratings: {
|
ratings: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
},
|
},
|
||||||
|
@ -3,12 +3,13 @@
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
filters: string[];
|
filters: string[];
|
||||||
|
labels?: string[];
|
||||||
selected: string;
|
selected: string;
|
||||||
label: string;
|
label: string;
|
||||||
onSelect: (selected: string) => void;
|
onSelect: (selected: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
let { filters, selected, label, onSelect }: Props = $props();
|
let { filters, selected, label, labels, onSelect }: Props = $props();
|
||||||
|
|
||||||
const id = `group-tab-${generateId()}`;
|
const id = `group-tab-${generateId()}`;
|
||||||
</script>
|
</script>
|
||||||
@ -32,7 +33,7 @@
|
|||||||
for="{id}-{index}"
|
for="{id}-{index}"
|
||||||
class="flex h-full cursor-pointer items-center px-4 text-sm hover:bg-gray-300 group-first-of-type:rounded-s-2xl group-last-of-type:rounded-e-2xl peer-checked:bg-gray-300 dark:hover:bg-gray-800 peer-checked:dark:bg-gray-700"
|
class="flex h-full cursor-pointer items-center px-4 text-sm hover:bg-gray-300 group-first-of-type:rounded-s-2xl group-last-of-type:rounded-e-2xl peer-checked:bg-gray-300 dark:hover:bg-gray-800 peer-checked:dark:bg-gray-700"
|
||||||
>
|
>
|
||||||
{filter}
|
{labels?.[index] ?? filter}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
mdiToolboxOutline,
|
mdiToolboxOutline,
|
||||||
mdiFolderOutline,
|
mdiFolderOutline,
|
||||||
mdiTagMultipleOutline,
|
mdiTagMultipleOutline,
|
||||||
|
mdiLink,
|
||||||
} from '@mdi/js';
|
} from '@mdi/js';
|
||||||
import SideBarSection from './side-bar-section.svelte';
|
import SideBarSection from './side-bar-section.svelte';
|
||||||
import SideBarLink from './side-bar-link.svelte';
|
import SideBarLink from './side-bar-link.svelte';
|
||||||
@ -72,6 +73,10 @@
|
|||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
{#if $preferences.sharedLinks.enabled && $preferences.sharedLinks.sidebarWeb}
|
||||||
|
<SideBarLink title={$t('shared_links')} routeId="/(user)/shared-links" icon={mdiLink} />
|
||||||
|
{/if}
|
||||||
|
|
||||||
<SideBarLink
|
<SideBarLink
|
||||||
title={$t('sharing')}
|
title={$t('sharing')}
|
||||||
routeId="/(user)/sharing"
|
routeId="/(user)/sharing"
|
||||||
|
@ -1,15 +1,22 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { goto } from '$app/navigation';
|
||||||
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
|
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
|
||||||
import MenuOption from '$lib/components/shared-components/context-menu/menu-option.svelte';
|
import MenuOption from '$lib/components/shared-components/context-menu/menu-option.svelte';
|
||||||
|
import { AppRoute } from '$lib/constants';
|
||||||
|
import type { SharedLinkResponseDto } from '@immich/sdk';
|
||||||
import { mdiCircleEditOutline } from '@mdi/js';
|
import { mdiCircleEditOutline } from '@mdi/js';
|
||||||
import { t } from 'svelte-i18n';
|
import { t } from 'svelte-i18n';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
menuItem?: boolean;
|
menuItem?: boolean;
|
||||||
onEdit: () => void;
|
sharedLink: SharedLinkResponseDto;
|
||||||
}
|
}
|
||||||
|
|
||||||
let { menuItem = false, onEdit }: Props = $props();
|
let { sharedLink, menuItem = false }: Props = $props();
|
||||||
|
|
||||||
|
const onEdit = async () => {
|
||||||
|
await goto(`${AppRoute.SHARED_LINKS}/${sharedLink.id}`);
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if menuItem}
|
{#if menuItem}
|
||||||
|
@ -15,10 +15,9 @@
|
|||||||
interface Props {
|
interface Props {
|
||||||
link: SharedLinkResponseDto;
|
link: SharedLinkResponseDto;
|
||||||
onDelete: () => void;
|
onDelete: () => void;
|
||||||
onEdit: () => void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let { link, onDelete, onEdit }: Props = $props();
|
let { link, onDelete }: Props = $props();
|
||||||
|
|
||||||
let now = DateTime.now();
|
let now = DateTime.now();
|
||||||
let expiresAt = $derived(link.expiresAt ? DateTime.fromISO(link.expiresAt) : undefined);
|
let expiresAt = $derived(link.expiresAt ? DateTime.fromISO(link.expiresAt) : undefined);
|
||||||
@ -95,10 +94,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</svelte:element>
|
</svelte:element>
|
||||||
|
|
||||||
<div class="flex flex-auto flex-col place-content-center place-items-end text-end ms-4">
|
<div class="flex flex-auto flex-col place-content-center place-items-end text-end ms-4">
|
||||||
<div class="sm:flex hidden">
|
<div class="sm:flex hidden">
|
||||||
<SharedLinkEdit {onEdit} />
|
<SharedLinkEdit sharedLink={link} />
|
||||||
<SharedLinkCopy {link} />
|
<SharedLinkCopy {link} />
|
||||||
<SharedLinkDelete {onDelete} />
|
<SharedLinkDelete {onDelete} />
|
||||||
</div>
|
</div>
|
||||||
@ -112,7 +110,7 @@
|
|||||||
padding="3"
|
padding="3"
|
||||||
hideContent
|
hideContent
|
||||||
>
|
>
|
||||||
<SharedLinkEdit menuItem {onEdit} />
|
<SharedLinkEdit menuItem sharedLink={link} />
|
||||||
<SharedLinkCopy menuItem {link} />
|
<SharedLinkCopy menuItem {link} />
|
||||||
<SharedLinkDelete menuItem {onDelete} />
|
<SharedLinkDelete menuItem {onDelete} />
|
||||||
</ButtonContextMenu>
|
</ButtonContextMenu>
|
||||||
|
@ -27,6 +27,10 @@
|
|||||||
// Ratings
|
// Ratings
|
||||||
let ratingsEnabled = $state($preferences?.ratings?.enabled ?? false);
|
let ratingsEnabled = $state($preferences?.ratings?.enabled ?? false);
|
||||||
|
|
||||||
|
// Shared links
|
||||||
|
let sharedLinksEnabled = $state($preferences?.sharedLinks?.enabled ?? true);
|
||||||
|
let sharedLinkSidebar = $state($preferences?.sharedLinks?.sidebarWeb ?? false);
|
||||||
|
|
||||||
// Tags
|
// Tags
|
||||||
let tagsEnabled = $state($preferences?.tags?.enabled ?? false);
|
let tagsEnabled = $state($preferences?.tags?.enabled ?? false);
|
||||||
let tagsSidebar = $state($preferences?.tags?.sidebarWeb ?? false);
|
let tagsSidebar = $state($preferences?.tags?.sidebarWeb ?? false);
|
||||||
@ -39,6 +43,7 @@
|
|||||||
memories: { enabled: memoriesEnabled },
|
memories: { enabled: memoriesEnabled },
|
||||||
people: { enabled: peopleEnabled, sidebarWeb: peopleSidebar },
|
people: { enabled: peopleEnabled, sidebarWeb: peopleSidebar },
|
||||||
ratings: { enabled: ratingsEnabled },
|
ratings: { enabled: ratingsEnabled },
|
||||||
|
sharedLinks: { enabled: sharedLinksEnabled, sidebarWeb: sharedLinkSidebar },
|
||||||
tags: { enabled: tagsEnabled, sidebarWeb: tagsSidebar },
|
tags: { enabled: tagsEnabled, sidebarWeb: tagsSidebar },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -104,6 +109,21 @@
|
|||||||
</div>
|
</div>
|
||||||
</SettingAccordion>
|
</SettingAccordion>
|
||||||
|
|
||||||
|
<SettingAccordion key="shared-links" title={$t('shared_links')} subtitle={$t('shared_links_description')}>
|
||||||
|
<div class="ml-4 mt-6">
|
||||||
|
<SettingSwitch title={$t('enable')} bind:checked={sharedLinksEnabled} />
|
||||||
|
</div>
|
||||||
|
{#if sharedLinksEnabled}
|
||||||
|
<div class="ml-4 mt-6">
|
||||||
|
<SettingSwitch
|
||||||
|
title={$t('sidebar')}
|
||||||
|
subtitle={$t('sidebar_display_description')}
|
||||||
|
bind:checked={sharedLinkSidebar}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</SettingAccordion>
|
||||||
|
|
||||||
<SettingAccordion key="tags" title={$t('tags')} subtitle={$t('tag_feature_description')}>
|
<SettingAccordion key="tags" title={$t('tags')} subtitle={$t('tag_feature_description')}>
|
||||||
<div class="ml-4 mt-6">
|
<div class="ml-4 mt-6">
|
||||||
<SettingSwitch title={$t('enable')} bind:checked={tagsEnabled} />
|
<SettingSwitch title={$t('enable')} bind:checked={tagsEnabled} />
|
||||||
|
@ -30,7 +30,7 @@ export enum AppRoute {
|
|||||||
EXPLORE = '/explore',
|
EXPLORE = '/explore',
|
||||||
SHARE = '/share',
|
SHARE = '/share',
|
||||||
SHARING = '/sharing',
|
SHARING = '/sharing',
|
||||||
SHARED_LINKS = '/sharing/sharedlinks',
|
SHARED_LINKS = '/shared-links',
|
||||||
SEARCH = '/search',
|
SEARCH = '/search',
|
||||||
MAP = '/map',
|
MAP = '/map',
|
||||||
USER_SETTINGS = '/user-settings',
|
USER_SETTINGS = '/user-settings',
|
||||||
|
119
web/src/routes/(user)/shared-links/[[id=id]]/+page.svelte
Normal file
119
web/src/routes/(user)/shared-links/[[id=id]]/+page.svelte
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { goto } from '$app/navigation';
|
||||||
|
import { page } from '$app/state';
|
||||||
|
import GroupTab from '$lib/components/elements/group-tab.svelte';
|
||||||
|
import UserPageLayout from '$lib/components/layouts/user-page-layout.svelte';
|
||||||
|
import CreateSharedLinkModal from '$lib/components/shared-components/create-share-link-modal/create-shared-link-modal.svelte';
|
||||||
|
import { dialogController } from '$lib/components/shared-components/dialog/dialog';
|
||||||
|
import {
|
||||||
|
notificationController,
|
||||||
|
NotificationType,
|
||||||
|
} from '$lib/components/shared-components/notification/notification';
|
||||||
|
import SharedLinkCard from '$lib/components/sharedlinks-page/shared-link-card.svelte';
|
||||||
|
import { AppRoute } from '$lib/constants';
|
||||||
|
import { handleError } from '$lib/utils/handle-error';
|
||||||
|
import { getAllSharedLinks, removeSharedLink, SharedLinkType, type SharedLinkResponseDto } from '@immich/sdk';
|
||||||
|
import { onMount } from 'svelte';
|
||||||
|
import { t } from 'svelte-i18n';
|
||||||
|
import type { PageData } from './$types';
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
data: PageData;
|
||||||
|
};
|
||||||
|
|
||||||
|
const { data }: Props = $props();
|
||||||
|
|
||||||
|
let sharedLinks: SharedLinkResponseDto[] = $state([]);
|
||||||
|
let sharedLink = $derived(sharedLinks.find(({ id }) => id === page.params.id));
|
||||||
|
|
||||||
|
const refresh = async () => {
|
||||||
|
sharedLinks = await getAllSharedLinks();
|
||||||
|
};
|
||||||
|
|
||||||
|
onMount(async () => {
|
||||||
|
await refresh();
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleDeleteLink = async (id: string) => {
|
||||||
|
const isConfirmed = await dialogController.show({
|
||||||
|
title: $t('delete_shared_link'),
|
||||||
|
prompt: $t('confirm_delete_shared_link'),
|
||||||
|
confirmText: $t('delete'),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!isConfirmed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await removeSharedLink({ id });
|
||||||
|
notificationController.show({ message: $t('deleted_shared_link'), type: NotificationType.Info });
|
||||||
|
await refresh();
|
||||||
|
} catch (error) {
|
||||||
|
handleError(error, $t('errors.unable_to_delete_shared_link'));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleEditDone = async () => {
|
||||||
|
await refresh();
|
||||||
|
await goto(AppRoute.SHARED_LINKS);
|
||||||
|
};
|
||||||
|
|
||||||
|
type Filter = 'all' | 'album' | 'individual';
|
||||||
|
|
||||||
|
const filterMap: Record<Filter, string> = {
|
||||||
|
all: $t('all'),
|
||||||
|
album: $t('albums'),
|
||||||
|
individual: $t('individual_shares'),
|
||||||
|
};
|
||||||
|
|
||||||
|
let filters = Object.keys(filterMap);
|
||||||
|
let labels = Object.values(filterMap);
|
||||||
|
|
||||||
|
const getActiveTab = (url: URL) => {
|
||||||
|
const filter = url.searchParams.get('filter');
|
||||||
|
return filter && filters.includes(filter) ? filter : 'all';
|
||||||
|
};
|
||||||
|
|
||||||
|
let selectedTab = $derived(getActiveTab(page.url));
|
||||||
|
const handleSelectTab = async (value: string) => {
|
||||||
|
await goto(`${AppRoute.SHARED_LINKS}?filter=${value}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
let filteredSharedLinks = $derived(
|
||||||
|
sharedLinks.filter(
|
||||||
|
({ type }) =>
|
||||||
|
selectedTab === 'all' ||
|
||||||
|
(type === SharedLinkType.Album && selectedTab === 'album') ||
|
||||||
|
(type === SharedLinkType.Individual && selectedTab === 'individual'),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<UserPageLayout title={data.meta.title}>
|
||||||
|
{#snippet buttons()}
|
||||||
|
<div class="hidden xl:block h-10">
|
||||||
|
<GroupTab label={$t('show_shared_links')} {filters} {labels} selected={selectedTab} onSelect={handleSelectTab} />
|
||||||
|
</div>
|
||||||
|
{/snippet}
|
||||||
|
|
||||||
|
<div>
|
||||||
|
{#if sharedLinks.length === 0}
|
||||||
|
<div
|
||||||
|
class="flex place-content-center place-items-center rounded-lg bg-gray-100 dark:bg-immich-dark-gray dark:text-immich-gray p-12"
|
||||||
|
>
|
||||||
|
<p>{$t('you_dont_have_any_shared_links')}</p>
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<div class="flex flex-col gap-2">
|
||||||
|
{#each filteredSharedLinks as link (link.id)}
|
||||||
|
<SharedLinkCard {link} onDelete={() => handleDeleteLink(link.id)} />
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if sharedLink}
|
||||||
|
<CreateSharedLinkModal editingLink={sharedLink} onClose={handleEditDone} />
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</UserPageLayout>
|
14
web/src/routes/(user)/shared-links/[[id=id]]/+page.ts
Normal file
14
web/src/routes/(user)/shared-links/[[id=id]]/+page.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { authenticate } from '$lib/utils/auth';
|
||||||
|
import { getFormatter } from '$lib/utils/i18n';
|
||||||
|
import type { PageLoad } from './$types';
|
||||||
|
|
||||||
|
export const load = (async () => {
|
||||||
|
await authenticate();
|
||||||
|
const $t = await getFormatter();
|
||||||
|
|
||||||
|
return {
|
||||||
|
meta: {
|
||||||
|
title: $t('shared_links'),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}) satisfies PageLoad;
|
@ -1,89 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
import { goto, afterNavigate } from '$app/navigation';
|
|
||||||
import ControlAppBar from '$lib/components/shared-components/control-app-bar.svelte';
|
|
||||||
import CreateSharedLinkModal from '$lib/components/shared-components/create-share-link-modal/create-shared-link-modal.svelte';
|
|
||||||
import {
|
|
||||||
notificationController,
|
|
||||||
NotificationType,
|
|
||||||
} from '$lib/components/shared-components/notification/notification';
|
|
||||||
import SharedLinkCard from '$lib/components/sharedlinks-page/shared-link-card.svelte';
|
|
||||||
import { AppRoute } from '$lib/constants';
|
|
||||||
import { handleError } from '$lib/utils/handle-error';
|
|
||||||
import { getAllSharedLinks, removeSharedLink, type SharedLinkResponseDto } from '@immich/sdk';
|
|
||||||
import { mdiArrowLeft } from '@mdi/js';
|
|
||||||
import { onMount } from 'svelte';
|
|
||||||
import { dialogController } from '$lib/components/shared-components/dialog/dialog';
|
|
||||||
import { t } from 'svelte-i18n';
|
|
||||||
|
|
||||||
let sharedLinks: SharedLinkResponseDto[] = $state([]);
|
|
||||||
let editSharedLink: SharedLinkResponseDto | null = $state(null);
|
|
||||||
|
|
||||||
const refresh = async () => {
|
|
||||||
sharedLinks = await getAllSharedLinks();
|
|
||||||
};
|
|
||||||
|
|
||||||
onMount(async () => {
|
|
||||||
await refresh();
|
|
||||||
});
|
|
||||||
|
|
||||||
const handleDeleteLink = async (id: string) => {
|
|
||||||
const isConfirmed = await dialogController.show({
|
|
||||||
title: $t('delete_shared_link'),
|
|
||||||
prompt: $t('confirm_delete_shared_link'),
|
|
||||||
confirmText: $t('delete'),
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!isConfirmed) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
await removeSharedLink({ id });
|
|
||||||
notificationController.show({ message: $t('deleted_shared_link'), type: NotificationType.Info });
|
|
||||||
await refresh();
|
|
||||||
} catch (error) {
|
|
||||||
handleError(error, $t('errors.unable_to_delete_shared_link'));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleEditDone = async () => {
|
|
||||||
await refresh();
|
|
||||||
editSharedLink = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
let backUrl: string = AppRoute.SHARING;
|
|
||||||
|
|
||||||
afterNavigate(({ from }) => {
|
|
||||||
let url: string | undefined = from?.url?.pathname;
|
|
||||||
backUrl = url || AppRoute.SHARING;
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<ControlAppBar backIcon={mdiArrowLeft} onClose={() => goto(backUrl)}>
|
|
||||||
{#snippet leading()}
|
|
||||||
{$t('shared_links')}
|
|
||||||
{/snippet}
|
|
||||||
</ControlAppBar>
|
|
||||||
|
|
||||||
<section class="mt-[120px] flex flex-col pb-[120px] container max-w-screen-lg mx-auto px-3">
|
|
||||||
<div class="mb-4 dark:text-immich-gray">
|
|
||||||
<p>{$t('manage_shared_links')}</p>
|
|
||||||
</div>
|
|
||||||
{#if sharedLinks.length === 0}
|
|
||||||
<div
|
|
||||||
class="flex place-content-center place-items-center rounded-lg bg-gray-100 dark:bg-immich-dark-gray dark:text-immich-gray p-12"
|
|
||||||
>
|
|
||||||
<p>{$t('you_dont_have_any_shared_links')}</p>
|
|
||||||
</div>
|
|
||||||
{:else}
|
|
||||||
<div class="flex flex-col">
|
|
||||||
{#each sharedLinks as link (link.id)}
|
|
||||||
<SharedLinkCard {link} onDelete={() => handleDeleteLink(link.id)} onEdit={() => (editSharedLink = link)} />
|
|
||||||
{/each}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</section>
|
|
||||||
|
|
||||||
{#if editSharedLink}
|
|
||||||
<CreateSharedLinkModal editingLink={editSharedLink} onClose={handleEditDone} />
|
|
||||||
{/if}
|
|
@ -1,14 +1,7 @@
|
|||||||
import { authenticate } from '$lib/utils/auth';
|
import { AppRoute } from '$lib/constants';
|
||||||
import { getFormatter } from '$lib/utils/i18n';
|
import { redirect } from '@sveltejs/kit';
|
||||||
import type { PageLoad } from './$types';
|
import type { PageLoad } from './$types';
|
||||||
|
|
||||||
export const load = (async () => {
|
export const load = (() => {
|
||||||
await authenticate();
|
redirect(307, AppRoute.SHARED_LINKS);
|
||||||
const $t = await getFormatter();
|
|
||||||
|
|
||||||
return {
|
|
||||||
meta: {
|
|
||||||
title: $t('shared_links'),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}) satisfies PageLoad;
|
}) satisfies PageLoad;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user