feat(NewActivityView): enhance "See all" links to mark offers as read before navigation #198

Merged
jose merged 6 commits from new-activity-mark-read into master 2025-09-19 07:14:24 +00:00
3 changed files with 29 additions and 14 deletions
Showing only changes of commit 5d9f455fc8 - Show all commits

View File

@@ -322,12 +322,10 @@ export default class NewActivityView extends Vue {
}
async handleSeeAllOffersToUser() {
await this.expandOffersToUserAndMarkRead(true);
this.$router.push("/recent-offers-to-user");
}
async handleSeeAllOffersToUserProjects() {
await this.expandOffersToUserProjectsAndMarkRead(true);
this.$router.push("/recent-offers-to-user-projects");
}
}

View File

@@ -32,20 +32,20 @@
</div>
<InfiniteScroll @reached-bottom="loadMoreOffersToUserProjects">
<ul
data-testId="listRecentOffersToUserProjects"
class="border-t border-slate-300"
>
<ul data-testId="listRecentOffersToUserProjects">
<li
v-for="offer in newOffersToUserProjects"
:key="offer.jwtId"
class="mt-4 relative group"
>
<!-- Last viewed separator -->
<div
v-if="offer.jwtId == lastAckedOfferToUserProjectsJwtId"
class="border-b border-slate-300 text-orange-400 pb-2 mb-2 font-bold text-sm"
class="border-b border-dashed border-slate-300 text-orange-400 mt-4 mb-6 font-bold text-sm"
>
You've already seen all the following
<span class="block w-fit mx-auto -mb-2.5 bg-white px-2">
You've already seen all the following
</span>
</div>
<span>{{
@@ -142,6 +142,15 @@ export default class RecentOffersToUserView extends Vue {
this.newOffersToUserProjects = offersToUserProjectsData.data;
this.newOffersToUserProjectsAtEnd = !offersToUserProjectsData.hitLimit;
// Mark offers as read after data is loaded
if (this.newOffersToUserProjects.length > 0) {
await this.$updateSettings({
lastAckedOfferToUserProjectsJwtId:
this.newOffersToUserProjects[0].jwtId,
});
this.notify.info("The offers are marked as viewed.", TIMEOUTS.LONG);
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (err: any) {
logger.error("Error retrieving settings & contacts:", err);

View File

@@ -27,20 +27,20 @@
</p>
</div>
<InfiniteScroll @reached-bottom="loadMoreOffersToUser">
<ul
data-testId="listRecentOffersToUser"
class="border-t border-slate-300"
>
<ul data-testId="listRecentOffersToUser">
<li
v-for="offer in newOffersToUser"
:key="offer.jwtId"
class="mt-4 relative group"
>
<!-- Last viewed separator -->
<div
v-if="offer.jwtId == lastAckedOfferToUserJwtId"
class="border-b border-slate-300 text-orange-400 pb-2 mb-2 font-bold text-sm"
class="border-b border-dashed border-slate-300 text-orange-400 mt-4 mb-6 font-bold text-sm"
>
You've already seen all the following
<span class="block w-fit mx-auto -mb-2.5 bg-white px-2">
You've already seen all the following
</span>
</div>
<span>{{
@@ -133,6 +133,14 @@ export default class RecentOffersToUserView extends Vue {
this.newOffersToUser = offersToUserData.data;
this.newOffersToUserAtEnd = !offersToUserData.hitLimit;
// Mark offers as read after data is loaded
if (this.newOffersToUser.length > 0) {
await this.$updateSettings({
lastAckedOfferToUserJwtId: this.newOffersToUser[0].jwtId,
});
this.notify.info("The offers are marked as viewed.", TIMEOUTS.LONG);
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (err: any) {
logger.error("Error retrieving settings & contacts:", err);