Skip to content

Commit

Permalink
Move saved page to new system
Browse files Browse the repository at this point in the history
  • Loading branch information
jcgurango committed Aug 16, 2023
1 parent 69f7403 commit c4a9d7b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion lib/pages/profile_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class UserProfileTab extends HookWidget {

final actions = [
IconButton(
onPressed: () => goTo(context, (context) => const SavedPage()),
onPressed: () => goTo(
context, (context) => SavedPage(accountsStore.defaultUserData!)),
icon: const Icon(Icons.bookmark),
),
IconButton(
Expand Down
12 changes: 8 additions & 4 deletions lib/pages/saved_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ import 'package:lemmy_api_client/v3.dart';

import '../hooks/stores.dart';
import '../l10n/l10n.dart';
import '../stores/accounts_store.dart';
import '../widgets/post/post_store.dart';
import '../widgets/sortable_infinite_list.dart';

/// Page with saved posts/comments. Fetches such saved data from the default user
/// Assumes there is at least one logged in user
class SavedPage extends HookWidget {
const SavedPage({super.key});
final UserData userData;

const SavedPage(this.userData, {super.key});

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -50,10 +53,10 @@ class SavedPage extends HookWidget {
savedOnly: true,
page: page,
limit: batchSize,
auth: accountStore.defaultUserData!.jwt.raw,
auth: userData.jwt.raw,
),
)
.toPostStores(accountStore.defaultUserData),
.toPostStores(userData),
),
InfiniteCommentList(
fetcher: (page, batchSize, sortType) =>
Expand All @@ -64,9 +67,10 @@ class SavedPage extends HookWidget {
savedOnly: true,
page: page,
limit: batchSize,
auth: accountStore.defaultUserData!.jwt.raw,
auth: userData.jwt.raw,
),
),
userData: userData,
),
],
),
Expand Down

0 comments on commit c4a9d7b

Please sign in to comment.