fix tests (from project-page switch 4 commits ago) and fix linting
This commit is contained in:
@@ -587,7 +587,12 @@ export async function setPlanInCache(
|
||||
planCache.set(handleId, planSummary);
|
||||
}
|
||||
|
||||
export async function getNewOffersToUser(axios: Axios, apiServer: string, activeDid: string, lastAckedOfferToUserJwtId?: string) {
|
||||
export async function getNewOffersToUser(
|
||||
axios: Axios,
|
||||
apiServer: string,
|
||||
activeDid: string,
|
||||
lastAckedOfferToUserJwtId?: string,
|
||||
) {
|
||||
let url = `${apiServer}/api/v2/report/offers?recipientDid=${activeDid}`;
|
||||
if (lastAckedOfferToUserJwtId) {
|
||||
url += "&afterId=" + lastAckedOfferToUserJwtId;
|
||||
|
||||
@@ -200,7 +200,9 @@
|
||||
</div>
|
||||
<!-- Results List -->
|
||||
<div v-if="claims.length > 0" class="mt-4">
|
||||
<div class="text-l font-bold text-center">Claims That Involve {{ isMyDid ? "You" : "Them" }}</div>
|
||||
<div class="text-l font-bold text-center">
|
||||
Claims That Involve {{ isMyDid ? "You" : "Them" }}
|
||||
</div>
|
||||
</div>
|
||||
<InfiniteScroll @reached-bottom="loadMoreData">
|
||||
<ul>
|
||||
|
||||
@@ -99,9 +99,7 @@
|
||||
<div v-else-if="projects.length === 0" class="text-center mt-8">
|
||||
<p class="text-lg text-slate-500">
|
||||
<span v-if="isLocalActive">
|
||||
<span v-if="searchBox">
|
||||
None found in the selected area.
|
||||
</span>
|
||||
<span v-if="searchBox"> None found in the selected area. </span>
|
||||
<!-- Otherwise there's no search area selected so we'll just leave the search box for them to click. -->
|
||||
</span>
|
||||
<span v-else>No projects were found with that search.</span>
|
||||
|
||||
@@ -113,9 +113,7 @@
|
||||
|
||||
<!-- show the actions for recognizing a give -->
|
||||
<div class="flex">
|
||||
<h2 class="text-xl font-bold">
|
||||
What have you seen someone do?
|
||||
</h2>
|
||||
<h2 class="text-xl font-bold">What have you seen someone do?</h2>
|
||||
<button
|
||||
@click="openGiftedPrompts()"
|
||||
class="ml-2 block text-xs text-center bg-gradient-to-b from-slate-400 to-slate-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-1 rounded-md"
|
||||
@@ -179,7 +177,8 @@
|
||||
<!-- Results List -->
|
||||
<div class="bg-slate-100 rounded-md px-4 py-3 mt-4 mb-4">
|
||||
<div class="flex items-center mb-4">
|
||||
<h2 class="text-xl font-bold">Latest Activity
|
||||
<h2 class="text-xl font-bold">
|
||||
Latest Activity
|
||||
<button @click="openFeedFilters()">
|
||||
<span class="text-xs text-white">
|
||||
<fa
|
||||
@@ -210,15 +209,11 @@
|
||||
<span class="block text-center text-6xl">
|
||||
{{ numNewOffersToUser }}
|
||||
</span>
|
||||
<p>
|
||||
new offer{{ numNewOffersToUser === 1 ? "" : "s" }} to you
|
||||
</p>
|
||||
<p>new offer{{ numNewOffersToUser === 1 ? "" : "s" }} to you</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-end mt-2">
|
||||
<button class="text-blue-500">
|
||||
View All New Activity For You
|
||||
</button>
|
||||
<button class="text-blue-500">View All New Activity For You</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -511,9 +506,14 @@ export default class HomeView extends Vue {
|
||||
this.updateAllFeed();
|
||||
|
||||
if (this.activeDid) {
|
||||
this.numNewOffersToUser =
|
||||
(await getNewOffersToUser(this.axios, this.apiServer, this.activeDid, this.lastAckedOfferToUserJwtId))
|
||||
.length;
|
||||
this.numNewOffersToUser = (
|
||||
await getNewOffersToUser(
|
||||
this.axios,
|
||||
this.apiServer,
|
||||
this.activeDid,
|
||||
this.lastAckedOfferToUserJwtId,
|
||||
)
|
||||
).length;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<section id="Content" class="p-6 pb-24 max-w-3xl mx-auto">
|
||||
<!-- Breadcrumb -->
|
||||
<div id="ViewBreadcrumb" class="mb-8">
|
||||
<h1 class="text-lg text-center font-light relative px-7" >
|
||||
<h1 class="text-lg text-center font-light relative px-7">
|
||||
<!-- Back -->
|
||||
<fa
|
||||
icon="chevron-left"
|
||||
@@ -31,11 +31,18 @@
|
||||
<div v-if="showOffersDetails" class="ml-4">
|
||||
<ul>
|
||||
<li v-for="offer in newOffersToUser" :key="offer.id" class="mt-2">
|
||||
<span>{{ didInfo(offer.offeredByDid, activeDid, allMyDids, allContacts) }}</span>
|
||||
<span>{{
|
||||
didInfo(offer.offeredByDid, activeDid, allMyDids, allContacts)
|
||||
}}</span>
|
||||
offers
|
||||
<span v-if="offer.description">{{ offer.description }}</span>
|
||||
<span v-if="offer.amount">{{ displayAmount(offer.unit, offer.amount) }}</span>
|
||||
<router-link :to="{ path: '/claim/' + encodeURIComponent(offer.jwtId) }" class="text-blue-500">
|
||||
<span v-if="offer.amount">{{
|
||||
displayAmount(offer.unit, offer.amount)
|
||||
}}</span>
|
||||
<router-link
|
||||
:to="{ path: '/claim/' + encodeURIComponent(offer.jwtId) }"
|
||||
class="text-blue-500"
|
||||
>
|
||||
<fa icon="file-lines" class="pl-2 text-blue-500 cursor-pointer" />
|
||||
</router-link>
|
||||
</li>
|
||||
@@ -46,7 +53,6 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from "vue-facing-decorator";
|
||||
import { Router } from "vue-router";
|
||||
|
||||
import GiftedDialog from "@/components/GiftedDialog.vue";
|
||||
import QuickNav from "@/components/QuickNav.vue";
|
||||
@@ -54,7 +60,12 @@ import EntityIcon from "@/components/EntityIcon.vue";
|
||||
import { NotificationIface } from "@/constants/app";
|
||||
import { accountsDB, db, retrieveSettingsForActiveAccount } from "@/db/index";
|
||||
import { Contact } from "@/db/tables/contacts";
|
||||
import { didInfo,displayAmount, getNewOffersToUser, OfferSummaryRecord } from "@/libs/endorserServer";
|
||||
import {
|
||||
didInfo,
|
||||
displayAmount,
|
||||
getNewOffersToUser,
|
||||
OfferSummaryRecord,
|
||||
} from "@/libs/endorserServer";
|
||||
|
||||
@Component({
|
||||
components: { GiftedDialog, QuickNav, EntityIcon },
|
||||
@@ -88,8 +99,12 @@ export default class NewActivityView extends Vue {
|
||||
if (allAccounts.length > 0) {
|
||||
this.allMyDids = allAccounts.map((acc) => acc.did);
|
||||
}
|
||||
this.newOffersToUser =
|
||||
await getNewOffersToUser(this.axios, this.apiServer, this.activeDid, this.lastAckedOfferToUserJwtId);
|
||||
this.newOffersToUser = await getNewOffersToUser(
|
||||
this.axios,
|
||||
this.apiServer,
|
||||
this.activeDid,
|
||||
this.lastAckedOfferToUserJwtId,
|
||||
);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (err: any) {
|
||||
@@ -99,9 +114,7 @@ export default class NewActivityView extends Vue {
|
||||
group: "alert",
|
||||
type: "danger",
|
||||
title: "Error",
|
||||
text:
|
||||
err.message ||
|
||||
"There was an error retrieving your activity.",
|
||||
text: err.message || "There was an error retrieving your activity.",
|
||||
},
|
||||
5000,
|
||||
);
|
||||
|
||||
@@ -48,8 +48,8 @@ test('Create new project, then search for it', async ({ page }) => {
|
||||
|
||||
// Create new project
|
||||
await page.goto('./projects');
|
||||
await page.getByTestId('closeOnboardingAndFinish').click();
|
||||
await page.getByRole('link', { name: 'Projects', exact: true }).click();
|
||||
// close onboarding, but not with a click to go to the main screen
|
||||
await page.locator('div > svg.fa-xmark').click();
|
||||
await page.locator('button > svg.fa-plus').click();
|
||||
await page.getByPlaceholder('Idea Name').fill(finalTitle);
|
||||
await page.getByPlaceholder('Description').fill(finalDescription);
|
||||
@@ -64,8 +64,7 @@ test('Create new project, then search for it', async ({ page }) => {
|
||||
|
||||
// Search for newly-created project in /projects
|
||||
await page.goto('./projects');
|
||||
await page.getByRole('link', { name: 'Projects', exact: true }).click();
|
||||
await expect(page.locator('ul#listProjects li').filter({ hasText: finalTitle })).toBeVisible();
|
||||
await page.locator('ul#listProjects li').filter({ hasText: finalTitle });
|
||||
|
||||
// Search for newly-created project in /discover
|
||||
await page.goto('./discover');
|
||||
|
||||
@@ -43,10 +43,10 @@ test('Create 10 new projects', async ({ page }) => {
|
||||
for (let i = 0; i < projectCount; i++) {
|
||||
await page.goto('./projects');
|
||||
if (i === 0) {
|
||||
await page.getByTestId('closeOnboardingAndFinish').click();
|
||||
// close onboarding, but not with a click to go to the main screen
|
||||
await page.locator('div > svg.fa-xmark').click();
|
||||
}
|
||||
await page.getByRole('link', { name: 'Projects', exact: true }).click();
|
||||
await page.getByRole('button').click();
|
||||
await page.locator('button > svg.fa-plus').click();
|
||||
await page.getByPlaceholder('Idea Name').fill(finalTitles[i]); // Add random suffix
|
||||
await page.getByPlaceholder('Description').fill(finalDescriptions[i]);
|
||||
await page.getByPlaceholder('Website').fill(standardWebsite);
|
||||
|
||||
@@ -27,6 +27,7 @@ test('Record an offer', async ({ page }) => {
|
||||
|
||||
// go to the offer and check the values
|
||||
await page.goto('./projects');
|
||||
await page.getByRole('link', { name: 'Offers', exact: true }).click();
|
||||
await page.locator('li').filter({ hasText: description }).locator('a').first().click();
|
||||
await expect(page.getByRole('heading', { name: 'Verifiable Claim Details' })).toBeVisible();
|
||||
await expect(page.getByText(description, { exact: true })).toBeVisible();
|
||||
@@ -42,6 +43,7 @@ test('Record an offer', async ({ page }) => {
|
||||
|
||||
// find the edit page and check the old values again
|
||||
await page.goto('./projects');
|
||||
await page.getByRole('link', { name: 'Offers', exact: true }).click();
|
||||
await page.locator('li').filter({ hasText: description }).locator('a').first().click();
|
||||
await page.getByTestId('editClaimButton').click();
|
||||
await page.locator('heading', { hasText: 'What is offered' }).isVisible();
|
||||
@@ -57,6 +59,7 @@ test('Record an offer', async ({ page }) => {
|
||||
|
||||
// go to the offer claim again and check the updated values
|
||||
await page.goto('./projects');
|
||||
await page.getByRole('link', { name: 'Offers', exact: true }).click();
|
||||
await page.locator('li').filter({ hasText: description }).locator('a').first().click();
|
||||
const newItemDesc = await page.getByTestId('description');
|
||||
await expect(newItemDesc).toHaveText(updatedDescription);
|
||||
|
||||
Reference in New Issue
Block a user