add page for user profile view and update endpoints; rename any "rowid" to "rowId"

This commit is contained in:
2025-01-20 12:43:05 -07:00
parent f3f8aeefc3
commit 5763fe4e49
7 changed files with 356 additions and 76 deletions

View File

@@ -184,7 +184,10 @@
>
<fa icon="spinner" class="fa-spin-pulse"></fa>
</div>
<div v-else-if="projects.length === 0 && userProfiles.length === 0" class="text-center mt-8">
<div
v-else-if="projects.length === 0 && userProfiles.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>
@@ -224,7 +227,12 @@
<div class="text-sm">
<fa icon="user" class="fa-fw text-slate-400"></fa>
{{
didInfo(project.issuerDid, activeDid, allMyDids, allContacts)
didInfo(
project.issuerDid,
activeDid,
allMyDids,
allContacts,
)
}}
</div>
</div>
@@ -240,22 +248,38 @@
:key="profile.issuerDid"
>
<a
@click="onClickLoadItem(profile.issuerDid)"
@click="onClickLoadItem(profile?.rowId || '')"
class="block py-4 flex gap-4 cursor-pointer"
>
<div class="grow">
<div class="text-sm">
<fa icon="user" class="fa-fw text-slate-400"></fa>
{{
didInfo(profile.issuerDid, activeDid, allMyDids, allContacts)
didInfo(
profile.issuerDid,
activeDid,
allMyDids,
allContacts,
)
}}
</div>
<p v-if="profile.description" class="mt-1 text-sm text-slate-600">
<p
v-if="profile.description"
class="mt-1 text-sm text-slate-600"
>
{{ profile.description }}
</p>
<div v-if="profile.locLat && profile.locLon" class="mt-1 text-xs text-slate-500">
<div
v-if="isAnywhereActive && profile.locLat && profile.locLon"
class="mt-1 text-xs text-slate-500"
>
<fa icon="location-dot" class="fa-fw"></fa>
{{ profile.locLat.toFixed(2) }}, {{ profile.locLon.toFixed(2) }}
{{
(profile.locLat > 0 ? "North" : "South") +
" in " +
(profile.locLon > 0 ? "Eastern" : "Western") +
" Hemisphere"
}}
</div>
</div>
</a>
@@ -432,17 +456,19 @@ export default class DiscoverView extends Vue {
const results = await response.json();
if (this.isProjectsActive) {
this.userProfiles = [];
const plans: PlanData[] = results.data;
if (plans) {
for (const plan of plans) {
const { name, description, handleId, image, issuerDid, rowid } = plan;
const { name, description, handleId, image, issuerDid, rowId } =
plan;
this.projects.push({
name,
description,
handleId,
image,
issuerDid,
rowid,
rowId,
});
}
this.remoteCount = this.projects.length;
@@ -450,6 +476,7 @@ export default class DiscoverView extends Vue {
throw JSON.stringify(results);
}
} else {
this.projects = [];
const profiles: UserProfile[] = results.data;
if (profiles) {
this.userProfiles.push(...profiles);
@@ -468,7 +495,11 @@ export default class DiscoverView extends Vue {
group: "alert",
type: "danger",
title: "Error Searching",
text: e.userMessage || "There was a problem retrieving " + (this.isProjectsActive ? "projects" : "profiles") + ".",
text:
e.userMessage ||
"There was a problem retrieving " +
(this.isProjectsActive ? "projects" : "profiles") +
".",
},
5000,
);
@@ -530,17 +561,18 @@ export default class DiscoverView extends Vue {
const results = await response.json();
if (this.isProjectsActive) {
this.userProfiles = [];
if (results.data) {
if (beforeId) {
const plans: PlanData[] = results.data;
for (const plan of plans) {
const { name, description, handleId, issuerDid, rowid } = plan;
const { name, description, handleId, issuerDid, rowId } = plan;
this.projects.push({
name,
description,
handleId,
issuerDid,
rowid,
rowId,
});
}
} else {
@@ -551,6 +583,7 @@ export default class DiscoverView extends Vue {
throw JSON.stringify(results);
}
} else {
this.projects = [];
const profiles: UserProfile[] = results.data;
if (profiles) {
this.userProfiles.push(...profiles);
@@ -567,7 +600,11 @@ export default class DiscoverView extends Vue {
group: "alert",
type: "danger",
title: "Error",
text: e.userMessage || "There was a problem retrieving " + (this.isProjectsActive ? "projects" : "profiles") + ".",
text:
e.userMessage ||
"There was a problem retrieving " +
(this.isProjectsActive ? "projects" : "profiles") +
".",
},
5000,
);
@@ -585,16 +622,16 @@ export default class DiscoverView extends Vue {
if (this.isProjectsActive && this.projects.length > 0) {
const latestProject = this.projects[this.projects.length - 1];
if (this.isLocalActive || this.isMappedActive) {
this.searchLocal(latestProject.rowid);
this.searchLocal(latestProject.rowId);
} else if (this.isAnywhereActive) {
this.searchAll(latestProject.rowid);
this.searchAll(latestProject.rowId);
}
} else if (!this.isProjectsActive && this.userProfiles.length > 0) {
const latestProfile = this.userProfiles[this.userProfiles.length - 1];
if (this.isLocalActive || this.isMappedActive) {
this.searchLocal(latestProfile.rowid || "");
this.searchLocal(latestProfile.rowId || "");
} else if (this.isAnywhereActive) {
this.searchAll(latestProfile.rowid || "");
this.searchAll(latestProfile.rowId || "");
}
}
}
@@ -653,7 +690,7 @@ export default class DiscoverView extends Vue {
this.markers = {};
const results = await response.json();
if (results.data?.tiles?.length > 0) {
for (const tile of results.data.tiles) {
for (const tile: Tile of results.data.tiles) {
const pinLat = (tile.minFoundLat + tile.maxFoundLat) / 2;
const pinLon = (tile.minFoundLon + tile.maxFoundLon) / 2;
const numberIcon = L.divIcon({
@@ -711,7 +748,7 @@ export default class DiscoverView extends Vue {
**/
onClickLoadItem(id: string) {
const route = {
path: this.isProjectsActive
path: this.isProjectsActive
? "/project/" + encodeURIComponent(id)
: "/userProfile/" + encodeURIComponent(id),
};