This PR implements the feature suggested in #71, auto-updating the page title for trade searches to include:
A ⚡ icon to indicate whether it's a live search or not
The title of the active bookmark, if the current trade is bookmarked
An inferred trade title using the existing bookmark title recommender from SearchPanel.recommendTitle(), if the current trade is not bookmarked
Fall back to the original page title (in English, Trade - Path of Exile) if we don't know how to recommend a title for an unbookmarked trade
It implements this by:
adding a new PageTitle service to contain the high level logic, maintain state about the title we're enforcing, and maintain a MutationObserver to counteract the base site's attempts to occasionally reset the page to its own default title
updating the TradeLocation service to include info about whether the current trade is a live search or not
updating the Bookmarks service to:
emit a change event when bookmarks are updated (this is imperfect since it won't catch a user renaming one tab's bookmark in a different tab, but we already don't catch this and update the bookmarks list itself when this happens, I think it's fine for this to require a refresh)
support a new fetchTradeByLocation operation
updates tsconfig to target es2019 (to enable the use of flatMap in the fetchTradeByLocation implementation)
This isn't super efficient; it refetches every trade every time the trade location changes or any bookmark changes. My expectation is that this should be efficient-enough, since both of those events should only happen in response to direct user interaction, but it might be preferable to move the in-memory state of trades out of the BookmarksFolder component and into a service (either the Bookmarks service or a new one) to avoid the round trips to storage...
This PR implements the feature suggested in #71, auto-updating the page title for trade searches to include:
SearchPanel.recommendTitle()
, if the current trade is not bookmarkedTrade - Path of Exile
) if we don't know how to recommend a title for an unbookmarked tradeIt implements this by:
PageTitle
service to contain the high level logic, maintain state about the title we're enforcing, and maintain aMutationObserver
to counteract the base site's attempts to occasionally reset the page to its own default titleTradeLocation
service to include info about whether the current trade is a live search or notBookmarks
service to:change
event when bookmarks are updated (this is imperfect since it won't catch a user renaming one tab's bookmark in a different tab, but we already don't catch this and update the bookmarks list itself when this happens, I think it's fine for this to require a refresh)fetchTradeByLocation
operationflatMap
in thefetchTradeByLocation
implementation)This isn't super efficient; it refetches every trade every time the trade location changes or any bookmark changes. My expectation is that this should be efficient-enough, since both of those events should only happen in response to direct user interaction, but it might be preferable to move the in-memory state of trades out of the
BookmarksFolder
component and into a service (either theBookmarks
service or a new one) to avoid the round trips to storage...closes #71