DiscoverView searches almost done.

Contact fixes
ContactAmounts fix quick-nav
Cleaning up ProjectView still more to do
Hide advanced by default on StatisticsView
project.task updated
This commit is contained in:
Matthew Raymer
2023-07-10 18:03:51 +08:00
parent 3f8be3b4de
commit b6b7c56157
8 changed files with 258 additions and 251 deletions

View File

@@ -23,16 +23,15 @@
</h1>
</div>
<div class="text-red-500">
{{ errorMessage }}
</div>
<!-- Project Details -->
<div class="bg-slate-100 rounded-md overflow-hidden px-4 py-3 mb-4">
<div>
<h2 class="text-xl font-semibold">{{ name }}</h2>
<div class="flex justify-between gap-4 text-sm mb-3">
<span><fa icon="user" class="fa-fw text-slate-400"></fa> Rotary</span>
<span
><fa icon="user" class="fa-fw text-slate-400"></fa>
{{ issuer }}</span
>
<span
><fa icon="calendar" class="fa-fw text-slate-400"></fa
>{{ timeSince }}
@@ -187,11 +186,11 @@ export default class ProjectViewView extends Vue {
allContacts: Array<Contact> = [];
apiServer = "";
description = "";
errorMessage = "";
expanded = false;
givesToThis: Array<GiveServerRecord> = [];
givesByThis: Array<GiveServerRecord> = [];
name = "";
issuer = "";
numAccounts = 0;
projectId = localStorage.getItem("projectId") || ""; // handle ID
timeSince = "";
@@ -280,30 +279,29 @@ export default class ProjectViewView extends Vue {
try {
const resp = await this.axios.get(url, { headers });
if (resp.status === 200) {
// feel free to remove this; I haven't yet because it's helpful
console.log('Loaded project: ', resp.data);
const startTime = resp.data.startTime;
if (startTime != null) {
const eventDate = new Date(startTime);
const now = moment.now();
this.timeSince = moment.utc(now).to(eventDate);
}
this.issuer = resp.data.issuer;
this.name = resp.data.claim?.name || "(no name)";
this.description = resp.data.claim?.description || "(no description)";
this.truncatedDesc = this.description.slice(0, this.truncateLength);
} else if (resp.status === 404) {
// actually, axios throws an error so we never get here
this.errorMessage = "That project does not exist.";
this.alertMessage = "That project does not exist.";
}
} catch (error: unknown) {
const serverError = error as AxiosError;
if (serverError.response?.status === 404) {
this.errorMessage = "That project does not exist.";
this.alertMessage = "That project does not exist.";
} else {
this.errorMessage =
this.alertMessage =
"Something went wrong retrieving that project." +
" See logs for more info.";
console.error("Error retrieving project:", error);
console.error("Error retrieving project:", serverError.message);
}
}
@@ -316,13 +314,16 @@ export default class ProjectViewView extends Vue {
if (resp.status === 200 && resp.data.data) {
this.givesToThis = resp.data.data;
} else {
this.errorMessage = "Failed to retrieve gives to this project.";
this.alertMessage = "Failed to retrieve gives to this project.";
}
} catch (error: unknown) {
console.error("Error retrieving gives to this project:", error);
const serverError = error as AxiosError;
this.errorMessage =
this.alertMessage =
"Something went wrong retrieving gives to this project.";
console.error(
"Error retrieving gives to this project:",
serverError.message,
);
}
const givesOutUrl =
@@ -334,13 +335,15 @@ export default class ProjectViewView extends Vue {
if (resp.status === 200 && resp.data.data) {
this.givesByThis = resp.data.data;
} else {
this.errorMessage = "Failed to retrieve gives by this project.";
this.alertMessage = "Failed to retrieve gives by this project.";
}
} catch (error: unknown) {
console.error("Error retrieving gives by this project:", error);
const serverError = error as AxiosError;
this.errorMessage =
"Something went wrong retrieving gives by project.";
this.alertMessage = "Something went wrong retrieving gives by project.";
console.error(
"Error retrieving gives by this project:",
serverError.message,
);
}
}