Skip to content

Conversation

@tzi
Copy link
Contributor

@tzi tzi commented Nov 12, 2025

Description

New “Star” Feature: each segment can be "starred" by clicking on a star icon.
Starred segments are highlighted at the top of the list.

What happen when a segment star is clicked :

  • Move the segment immediately at the top of the list
  • The Star icon is filled in
  • A API called is made to store this change

Screenshots

before / after
before after
tooltips
tooltip unstarred tooltip starred
Screenshot 2025-11-18 at 18 25 24 Screenshot 2025-11-18 at 18 25 37
Animation
star unstar error
star-star star-unstar star-error

Checklist

  • [NA] I have understood, reviewed, and tested all AI outputs before use
  • [NA] All AI instructions respect security, IP, and privacy rules

Review

@tzi tzi added the Pull Request WIP Indicates the current pull request is still work in progress and not ready yet for a review. label Nov 12, 2025
@tzi tzi changed the title Allow to start/unstar stored segment Allow to star and unstar stored segment Nov 14, 2025
@tzi tzi force-pushed the ux-326 branch 10 times, most recently from 24a8707 to cb064c5 Compare November 17, 2025 17:41
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ℹ️ The new tests changed the visible focused element on this screenshot.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ℹ️ The starred segment comes at the top of the list

Comment on lines +898 to +921
self.target.find('[title]').each(function () {
addTooltip(this, this.getAttribute('title'));
});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ℹ️ Fix tooltip for all actions in the SegmentList

Comment on lines +236 to +241
display: flex;
flex-direction: column;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ℹ️ Use flexbox to be able to reorder starred segment easily.

Comment on lines +255 to +261
.segmentationContainer .submenu ul li[data-idsegment=""] {
order: 0;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ℹ️ First line is always "All visitors"

@tzi tzi force-pushed the ux-326 branch 2 times, most recently from d004753 to 5c02c19 Compare November 17, 2025 23:55
@tzi tzi marked this pull request as ready for review November 18, 2025 01:03
@tzi tzi added Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. c: Design / UI For issues that impact Matomo's user interface or the design overall. Needs Review PRs that need a code review c: Segments Segmentation and Segment editor related improvements and fixes. and removed Pull Request WIP Indicates the current pull request is still work in progress and not ready yet for a review. c: Design / UI For issues that impact Matomo's user interface or the design overall. labels Nov 18, 2025
@tzi tzi requested a review from a team November 18, 2025 01:03
@tzi tzi requested a review from michalkleiner November 18, 2025 15:46
Copy link
Contributor

@michalkleiner michalkleiner left a comment

Choose a reason for hiding this comment

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

Some inline comments.

With the addition of who marked the segment as favourite, I wonder whether there was a discussion that each use might want to save different segments as favourite, no having it global.

@tzi
Copy link
Contributor Author

tzi commented Nov 19, 2025

@michalkleiner : With the addition of who marked the segment as favourite, I wonder whether there was a discussion that each use might want to save different segments as favourite, no having it global.

Yes, that was discussed and decided by Matt.

Copy link
Contributor

@chippison chippison left a comment

Choose a reason for hiding this comment

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

I think I found a small issue with the UI
This seems to happen only in Chrome and can confirm this looks correct in both Safari and Firefox

The SegmentEditor seems to show a vertical scrollbar when I add a new Segment

Image

It also just seems to grow as I add new Segments

Image

Screenshots above are from my tests in Chrome Browser


$(self.target).find(".segmentList li").each(function () {
curTitle = $(this).prop('title');
curTitle = $(this).find('.segname').prop('title');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ℹ️ Fix search, since I moved the title from the li to segname (li child) so I can have another title on star icon.

Comment on lines +506 to +516
clearTimeout(self.filterTimer);
self.filterTimer = false;
if (search.length >= 2) {
clearTimeout(self.filterTimer);
self.filterAllowed = true;
self.filterTimer = setTimeout(function () {
filterSegmentList(search);
}, 500);
}
else {
self.filterTimer = false;
clearFilterSegmentList();
} else {
self.filterTimer = setTimeout(clearFilterSegmentList, 500);
Copy link
Contributor Author

@tzi tzi Nov 24, 2025

Choose a reason for hiding this comment

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

ℹ️ I add a clearTimeout even if there is less than 2 characters to avoid a bug when we are typing too fast.

For example:

explanation  video
1. I am selecting every content (Ctrl+A)
2. It does nothing but trigger an update with 500ms delay
3. I’m removing all (Del) before the 500ms of delay
4. All the segments are visible since the search is empty
5. The search result came back once the 500ms delay is ended.
bug-segment-search

I also added a timer when there is 0 or 1 character since it does a lot of DOM modifications.

span.compareSegment,
.starSegment {
flex: none;
display: flex;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ℹ️ Force children to not place them-self inside a baseline.

Otherwise, it will cause vertical scrolling:
image

@tzi
Copy link
Contributor Author

tzi commented Nov 24, 2025

@chippison The SegmentEditor seems to show a vertical scrollbar when I add a new Segment

✅ Done!

Comment on lines +170 to +172
const className = 'compareSegment allVisitsCompareSegment ' + (self.segmentAccess === 'write' ? 'allVisitsCompareSegment--write' : '');
const title = _pk_translate('SegmentEditor_CompareThisSegment');
listHtml += '<span class="' + className + '" title="' + title + '"></span>';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ℹ️ Make sure the compare button is always align

anonymous connected
Screenshot 2025-11-24 at 15 37 31 Screenshot 2025-11-24 at 15 34 21

Comment on lines +235 to +237
.segmentationContainer hr {
margin: 10px 0;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ℹ️ Review vertical rythm

before after
Screenshot 2025-11-24 at 15 35 48 Screenshot 2025-11-24 at 15 36 21

@tzi tzi force-pushed the ux-326 branch 2 times, most recently from 8065736 to 38cae01 Compare November 24, 2025 20:04
@tzi tzi force-pushed the ux-326 branch 2 times, most recently from 15fa35e to a303458 Compare November 24, 2025 20:46
function updateStarredSegment($segment, segment, isError = false) {
updateStarSegmentTooltip($segment, segment);
$segment.toggleClass('segmentStarred', segment.starred);
$segment.one('animationend', function avoidAnimationRepetition() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be $segment.on?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is intended.
$segment.one() is the same than $segment.on() but it only triggered one time.

It is the same than element.addEventListener(callback, { once: true });

@chippison
Copy link
Contributor

Functional Testing is done with different users. Can see the correct user shown that 'starred' the segment.
Also tested that anonymous user cannot add/see star for segments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c: Segments Segmentation and Segment editor related improvements and fixes. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Needs Review PRs that need a code review

Development

Successfully merging this pull request may close these issues.

4 participants