Skip to content

Add personalization features: Favorites and Recently Viewed Samples#1875

Merged
niels9001 merged 81 commits intomicrosoft:mainfrom
Zakariathr22:feature/sample-personalization
Jun 4, 2025
Merged

Add personalization features: Favorites and Recently Viewed Samples#1875
niels9001 merged 81 commits intomicrosoft:mainfrom
Zakariathr22:feature/sample-personalization

Conversation

@Zakariathr22
Copy link
Copy Markdown
Contributor

@Zakariathr22 Zakariathr22 commented May 9, 2025

Description

This PR introduces Favorites and Recently Viewed Samples to enhance personalization. These features aim to improve navigation efficiency and user engagement.
Main changes are:

  • Added StringListSettingsHelper class to manage storing/retrieving recently viewed and favorite samples.
  • Integrated favorite button in page headers with full persistence logic.
  • Introduced HorizontalScrollContainer control (adapted from AI Dev Gallery's TileGallery).
  • Refactored HomePage layout to include recent/favorite tabs using the new components.
  • Created and applied new styles: SingleRowGridViewItemStyle, TokenViewSelectorBarStyle, and TokenViewSelectorBarItemStyle. (SelectorBar styles was adapted from AI Dev Gallery)
  • Moved sample click logic into the ItemTemplate for better reuse and separation of concerns.
  • Removed obsolete click-handling logic from all pages now using the updated template.
  • Redesigned ItemTemplate layout to align visually with the HorizontalScrollContainer.
  • Added new settings card to SettingsPage with options to clear recently visited samples and unfavorite all items.
  • Design tweaks.

Motivation and Context

How Has This Been Tested?

Manually tested.

Screenshots (if appropriate)

image
image
image
image
image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

References

Zakariathr22 and others added 2 commits May 9, 2025 23:19
- Implement new AdaptiveSelectorBar control for responsive tab-like navigation
- Add AdaptiveSelectorBarItem class to represent selectable items
- Create styles for selected/unselected AdaptiveSelectorBarItems
- Update Home page to include SampleFilterBar using AdaptiveSelectorBar
@Zakariathr22
Copy link
Copy Markdown
Contributor Author

@niels9001 @marcelwgn
This PR introduces significant logic and design updates and will require some time to complete.
Before proceeding, could you please confirm whether the proposed plan is approved or not?
I look forward to your decision.

- Implement StringListSettingsHelper for managing string lists in app settings
- Add constants for Favorites and RecentlyVisited keys
- Add Favorite button with tooltip and icon toggle to PageHeader
- Manage favorite state handling and persist it using helper
- Implemented filtering for Recently Added, Recently Updated, Recently Visited, Favorites, and All Samples
- Hooked up ItemsRepeater to dynamically update based on selected filter
- Ensured data consistency with cleanup for invalid favorites and recently visited
@Zakariathr22 Zakariathr22 marked this pull request as ready for review May 12, 2025 21:24
@Zakariathr22
Copy link
Copy Markdown
Contributor Author

Zakariathr22 commented May 12, 2025

@niels9001 @marcelwgn This PR introduces significant logic and design updates and will require some time to complete. Before proceeding, could you please confirm whether the proposed plan is approved or not? I look forward to your decision.

Couldn't stop overthinking about this, so I pushed a PR with breaking changes just to shut my brain up.
Now I’ve replaced overthinking with regret 😂, I wish it will be merged.
gif

@niels9001
Copy link
Copy Markdown
Collaborator

niels9001 commented May 13, 2025

Hey @Zakariathr22, thanks for opening this PR!

We discussed this PR internally and we believe the recent/favorite tabs brings additional value (can't wait to use it myself😁!). We just need to ensure that we are not overcomplicating things, therefore we are suggesting a few changes:

Tabs

Would it make sense to just have 2 tabs?

Tab 1: Recent

  • horizontal scroller with the last (5? 6? 7?) recent samples you've visited. (See AI Dev Gallery for an example)
  • gridview with 'recently and new samples'

Tab 2: favorites

  • gridview of favorite items

This keeps things simple, without providing too many options. Since we have the "All samples" tab already in the main menu, we probably don't need it on the homepage.

Tab controller

Creating custom controls can always introduce potential a11y issues - so I was wondering if we could use a simple SelectorBar, with a custom style? We've used this custom style in AI Dev Gallery that we could consider to bring over? https://github.com/microsoft/ai-dev-gallery/blob/main/AIDevGallery/Styles/SelectorBar.xaml

Other changes

  • We were wondering if there's a lot of value in having the "send feedback" button in the PageHeader. Would it make sense to replace it with the favorite button? Thoughts?
  • These changes on the homepage might trigger additional styling tweaks to the cards carousel and the items itself. I'll sync with the design team to figure out if any tweaks are needed, and we can help with those :)!

All and all, super appreciative of the work! It's awesome 🚀

@Zakariathr22
Copy link
Copy Markdown
Contributor Author

Would it make sense to just have 2 tabs?

I think the data about the recently added and recently updated samples is also important.
Maybe we can change the order to: recently visited, favorite samples, recently added, recently updated.
Also, if we remove the recently added and recently updated samples, what should we do with their data in the JSON file?


  • last (5? 6? 7?) recent samples

It already retrieves the last 15 visited samples. We can simply edit it in PageHeader.xaml.cs.

private const int _maxRecentlyVisitedPages = 15;

Creating custom controls can always introduce potential a11y issues

But it does solve the overflow issue, and we’ll need it if we keep the list as I initially suggested.
Can we discuss these a11y issues first? Maybe I can fix it.


We've used this custom style in AI Dev Gallery that we could consider to bring over?

Yes, it makes sense only if we're going to remove the recently added and recently updated data.
If we agree on that, I’ll be happy to handle it.


  • We were wondering if there's a lot of value in having the "send feedback" button in the PageHeader.

Personally, it was the first thing that guided me to this repo 😂.
Maybe we’re not using it as developers, but from a user’s perspective, I think it’s important.


  • I'll sync with the design team to figure out if any tweaks are needed, and we can help with those :)!

Could you also take a look at the CriticalButtonStyle? I used SystemFillColorCriticalBrush as the background and created the other theme resources, but I’m not sure if it follows the best design practices.


Generally, the implemented design was inspired by the Windows File Explorer, which adds familiarity and aligns with the overall Windows design language.
I was also thinking, can we move all the samples to the home page (as they’re already shown in this PR) and remove that extra page, so all navigation stays on the home page?

These my thoughts, so if what you're proposing is just a suggestion, I might disagree on a few things 😅.
But if it's a final decision, I’ll be happy to implement it.

Zakariathr22 and others added 4 commits May 13, 2025 19:37
Changed the constant `_maxRecentlyVisitedPages` in the
`PageHeader` class from 15 to 7, limiting the number of
recently visited pages that can be tracked or displayed.
Renamed `SettingsExpander` to `SamplesSettingsExpander` and updated its header to "Sample preferences". Adjusted `SettingsCard` headers for consistency by changing them to lowercase. Enhanced the logic in `SettingsPage.xaml.cs` to expand the `SamplesSettingsExpander` based on the presence of items in the recently visited samples or favorites list.
@niels9001
Copy link
Copy Markdown
Collaborator

The proposal was to have 2 tabs. The default tab (Recent - or if we have a better name for it) would combine these 3 into a single view:

  • Recently visited (new)
  • Recently or new samples

The reason for this is having 5 tabs with kind of similiar things make the UX more complex. We want the landingspage to be as calm as possible and reduce the number of ways to navigate to similar content.

@Zakariathr22
Copy link
Copy Markdown
Contributor Author

The proposal was to have 2 tabs. The default tab (Recent - or if we have a better name for it) would combine these 3 into a single view:

  • Recently visited (new)
  • Recently or new samples

The reason for this is having 5 tabs with kind of similiar things make the UX more complex. We want the landingspage to be as calm as possible and reduce the number of ways to navigate to similar content.

@niels9001, do you mean something like this?
Recent


Fav

@niels9001
Copy link
Copy Markdown
Collaborator

Exactly!

@Zakariathr22
Copy link
Copy Markdown
Contributor Author

Exactly!

🤝 Got it
It might just take a bit of time to get done.

@Zakariathr22 Zakariathr22 marked this pull request as draft May 14, 2025 09:54
- Replaced custom tab implementation with a styled SelectorBar for better accessibility and consistency.
- Reduced tabs to only "Recent" and "Favorites".
- "Recent" tab now includes a horizontal scroller for the last visited samples (up to 7), followed by 2 ItemRepeaters of recently added and updated a samples.
- "Favorites" tab displays an ItemsRepeater of favorite items.
- Removed redundant "All samples" section from homepage, aligning with navigation structure.
- Applied visual style from AI Dev Gallery for SelectorBar to maintain design consistency.
- Redesign item template to align the new design and prevent hovering border issue in GridView.
@Zakariathr22 Zakariathr22 marked this pull request as ready for review May 14, 2025 21:47
@niels9001 niels9001 requested a review from marcelwgn May 27, 2025 16:05
@niels9001
Copy link
Copy Markdown
Collaborator

/azp run

@niels9001
Copy link
Copy Markdown
Collaborator

/azp run

@marcelwgn
Copy link
Copy Markdown
Contributor

/azp run

@marcelwgn marcelwgn enabled auto-merge (squash) June 2, 2025 09:12
@marcelwgn
Copy link
Copy Markdown
Contributor

/azp run

1 similar comment
@niels9001
Copy link
Copy Markdown
Collaborator

/azp run

auto-merge was automatically disabled June 4, 2025 02:36

Head branch was pushed to by a user without write access

@ayushjai30
Copy link
Copy Markdown

/azp run

Copy link
Copy Markdown
Collaborator

@niels9001 niels9001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Zakariathr22 LGTM! Again.. AMAZING work!!!!

@niels9001 niels9001 merged commit b68128f into microsoft:main Jun 4, 2025
2 checks passed
@niels9001 niels9001 deleted the feature/sample-personalization branch June 4, 2025 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: Adding Favorites and Recently Viewed Samples

5 participants