Browse Source

feat: move mark-as-read logic from navigation to view loading

- Remove mark-as-read logic from NewActivityView navigation handlers
- Add mark-as-read logic to RecentOffersToUserView and RecentOffersToUserProjectsView after data loading
- Improve "You've already seen all the following" marker positioning
- Update marker styling with dashed border and centered text

This ensures the marker appears at the correct position in the list
instead of always at the top, providing better UX when viewing offers.
pull/198/head
Jose Olarte III 3 days ago
parent
commit
5d9f455fc8
  1. 2
      src/views/NewActivityView.vue
  2. 21
      src/views/RecentOffersToUserProjectsView.vue
  3. 20
      src/views/RecentOffersToUserView.vue

2
src/views/NewActivityView.vue

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

21
src/views/RecentOffersToUserProjectsView.vue

@ -32,20 +32,20 @@
</div> </div>
<InfiniteScroll @reached-bottom="loadMoreOffersToUserProjects"> <InfiniteScroll @reached-bottom="loadMoreOffersToUserProjects">
<ul <ul data-testId="listRecentOffersToUserProjects">
data-testId="listRecentOffersToUserProjects"
class="border-t border-slate-300"
>
<li <li
v-for="offer in newOffersToUserProjects" v-for="offer in newOffersToUserProjects"
:key="offer.jwtId" :key="offer.jwtId"
class="mt-4 relative group" class="mt-4 relative group"
> >
<!-- Last viewed separator -->
<div <div
v-if="offer.jwtId == lastAckedOfferToUserProjectsJwtId" 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> </div>
<span>{{ <span>{{
@ -142,6 +142,15 @@ export default class RecentOffersToUserView extends Vue {
this.newOffersToUserProjects = offersToUserProjectsData.data; this.newOffersToUserProjects = offersToUserProjectsData.data;
this.newOffersToUserProjectsAtEnd = !offersToUserProjectsData.hitLimit; 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 // eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (err: any) { } catch (err: any) {
logger.error("Error retrieving settings & contacts:", err); logger.error("Error retrieving settings & contacts:", err);

20
src/views/RecentOffersToUserView.vue

@ -27,20 +27,20 @@
</p> </p>
</div> </div>
<InfiniteScroll @reached-bottom="loadMoreOffersToUser"> <InfiniteScroll @reached-bottom="loadMoreOffersToUser">
<ul <ul data-testId="listRecentOffersToUser">
data-testId="listRecentOffersToUser"
class="border-t border-slate-300"
>
<li <li
v-for="offer in newOffersToUser" v-for="offer in newOffersToUser"
:key="offer.jwtId" :key="offer.jwtId"
class="mt-4 relative group" class="mt-4 relative group"
> >
<!-- Last viewed separator -->
<div <div
v-if="offer.jwtId == lastAckedOfferToUserJwtId" 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> </div>
<span>{{ <span>{{
@ -133,6 +133,14 @@ export default class RecentOffersToUserView extends Vue {
this.newOffersToUser = offersToUserData.data; this.newOffersToUser = offersToUserData.data;
this.newOffersToUserAtEnd = !offersToUserData.hitLimit; 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 // eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (err: any) { } catch (err: any) {
logger.error("Error retrieving settings & contacts:", err); logger.error("Error retrieving settings & contacts:", err);

Loading…
Cancel
Save