Skip to content

Commit

Permalink
chore(mobile): search page minor enhancements (immich-app#13403)
Browse files Browse the repository at this point in the history
* chore(mobile): search page retouched

* add placeholder photos

* remove unused page

* focus the search input when tapping on the search controller button

* detail fixed

* remove print statements

* disable scrolling of empty content
  • Loading branch information
alextran1502 authored Oct 14, 2024
1 parent 1193adf commit f59b813
Show file tree
Hide file tree
Showing 14 changed files with 821 additions and 847 deletions.
Binary file added mobile/assets/polaroid-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mobile/assets/polaroid-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions mobile/lib/models/search/search_filter.model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ class SearchFilter {
AssetType? mediaType,
}) {
return SearchFilter(
context: context ?? this.context,
filename: filename ?? this.filename,
context: context,
filename: filename,
people: people ?? this.people,
location: location ?? this.location,
camera: camera ?? this.camera,
Expand Down
44 changes: 22 additions & 22 deletions mobile/lib/pages/common/tab_controller.page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:immich_mobile/extensions/build_context_extensions.dart';
import 'package:immich_mobile/providers/album/album.provider.dart';
import 'package:immich_mobile/providers/asset_viewer/scroll_notifier.provider.dart';
import 'package:immich_mobile/providers/multiselect.provider.dart';
import 'package:immich_mobile/providers/search/search_input_focus.provider.dart';
import 'package:immich_mobile/routing/router.dart';
import 'package:immich_mobile/providers/asset.provider.dart';
import 'package:immich_mobile/providers/haptic_feedback.provider.dart';
Expand Down Expand Up @@ -44,21 +45,28 @@ class TabControllerPage extends HookConsumerWidget {
);
}

onNavigationSelected(TabsRouter router, int index) {
// On Photos page menu tapped
if (router.activeIndex == 0 && index == 0) {
scrollToTopNotifierProvider.scrollToTop();
}

// On Search page tapped
if (router.activeIndex == 1 && index == 1) {
ref.read(searchInputFocusProvider).requestFocus();
}

ref.read(hapticFeedbackProvider.notifier).selectionClick();
router.setActiveIndex(index);
ref.read(tabProvider.notifier).state = TabEnum.values[index];
}

navigationRail(TabsRouter tabsRouter) {
return NavigationRail(
labelType: NavigationRailLabelType.all,
selectedIndex: tabsRouter.activeIndex,
onDestinationSelected: (index) {
// Selected Photos while it is active
if (tabsRouter.activeIndex == 0 && index == 0) {
// Scroll to top
scrollToTopNotifierProvider.scrollToTop();
}

ref.read(hapticFeedbackProvider.notifier).selectionClick();
tabsRouter.setActiveIndex(index);
ref.read(tabProvider.notifier).state = TabEnum.values[index];
},
onDestinationSelected: (index) =>
onNavigationSelected(tabsRouter, index),
selectedIconTheme: IconThemeData(
color: context.primaryColor,
),
Expand Down Expand Up @@ -103,16 +111,8 @@ class TabControllerPage extends HookConsumerWidget {
bottomNavigationBar(TabsRouter tabsRouter) {
return NavigationBar(
selectedIndex: tabsRouter.activeIndex,
onDestinationSelected: (index) {
if (tabsRouter.activeIndex == 0 && index == 0) {
// Scroll to top
scrollToTopNotifierProvider.scrollToTop();
}

ref.read(hapticFeedbackProvider.notifier).selectionClick();
tabsRouter.setActiveIndex(index);
ref.read(tabProvider.notifier).state = TabEnum.values[index];
},
onDestinationSelected: (index) =>
onNavigationSelected(tabsRouter, index),
destinations: [
NavigationDestination(
label: 'tab_controller_nav_photos'.tr(),
Expand Down Expand Up @@ -171,7 +171,7 @@ class TabControllerPage extends HookConsumerWidget {
return AutoTabsRouter(
routes: [
const PhotosRoute(),
SearchInputRoute(),
SearchRoute(),
const AlbumsRoute(),
const LibraryRoute(),
],
Expand Down
1 change: 1 addition & 0 deletions mobile/lib/pages/library/library.page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class QuickAccessButtons extends ConsumerWidget {
colors: [
context.colorScheme.primary.withAlpha(10),
context.colorScheme.primary.withAlpha(15),
context.colorScheme.primary.withAlpha(20),
],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class PlaceTile extends StatelessWidget {

void navigateToPlace() {
context.pushRoute(
SearchInputRoute(
SearchRoute(
prefilter: SearchFilter(
people: {},
location: SearchLocationFilter(
Expand Down
Loading

0 comments on commit f59b813

Please sign in to comment.