Compare commits
18 Commits
0.4.2
...
homeview-r
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f71c76fcd3 | ||
|
|
d024db2258 | ||
|
|
b40604f8a6 | ||
|
|
436f40813c | ||
|
|
77b296b606 | ||
|
|
8f7d794962 | ||
|
|
fa7d6317b9 | ||
|
|
4a75cdf20e | ||
|
|
79fdb9e570 | ||
|
|
aa09827317 | ||
|
|
cc1780bd01 | ||
|
|
e5d9c25ad4 | ||
|
|
ef8c2e6093 | ||
| 61afba3bca | |||
| eabe2b9448 | |||
| 5eaaf32043 | |||
| 1e9c3f3101 | |||
| 2e60e2bba9 |
27
BUILDING.md
27
BUILDING.md
@@ -259,13 +259,23 @@ See `.env.*` files for configuration.
|
|||||||
|
|
||||||
## Deployment
|
## Deployment
|
||||||
|
|
||||||
|
### Version Management
|
||||||
|
1. Update CHANGELOG.md with new changes
|
||||||
|
2. Update version in package.json
|
||||||
|
3. Commit changes and tag release:
|
||||||
|
```bash
|
||||||
|
git tag <VERSION_TAG>
|
||||||
|
git push origin <VERSION_TAG>
|
||||||
|
```
|
||||||
|
4. After deployment, update package.json with next version + "-beta"
|
||||||
|
|
||||||
### Test Server
|
### Test Server
|
||||||
```bash
|
```bash
|
||||||
# Build using staging environment
|
# Build using staging environment
|
||||||
npm run build -- --mode staging
|
npm run build -- --mode staging
|
||||||
|
|
||||||
# Deploy to test server
|
# Deploy to test server
|
||||||
rsync -azvu -e "ssh -i ~/.ssh/your_key" dist ubuntutest@test.timesafari.app:time-safari/
|
rsync -azvu -e "ssh -i ~/.ssh/<YOUR_KEY>" dist ubuntutest@test.timesafari.app:time-safari/
|
||||||
```
|
```
|
||||||
|
|
||||||
### Production Server
|
### Production Server
|
||||||
@@ -274,26 +284,15 @@ rsync -azvu -e "ssh -i ~/.ssh/your_key" dist ubuntutest@test.timesafari.app:time
|
|||||||
pkgx +npm sh
|
pkgx +npm sh
|
||||||
cd crowd-funder-for-time-pwa
|
cd crowd-funder-for-time-pwa
|
||||||
git checkout master && git pull
|
git checkout master && git pull
|
||||||
git checkout <version_tag>
|
git checkout <VERSION_TAG>
|
||||||
npm install
|
npm install
|
||||||
npm run build
|
npm run build
|
||||||
cd -
|
cd -
|
||||||
|
|
||||||
# Backup and deploy
|
# Backup and deploy
|
||||||
mv time-safari/dist time-safari-dist-prev.0
|
mv time-safari/dist time-safari-dist-prev.0 && mv crowd-funder-for-time-pwa/dist time-safari/
|
||||||
mv crowd-funder-for-time-pwa/dist time-safari/
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Version Management
|
|
||||||
1. Update CHANGELOG.md with new changes
|
|
||||||
2. Update version in package.json
|
|
||||||
3. Commit changes and tag release:
|
|
||||||
```bash
|
|
||||||
git tag <version>
|
|
||||||
git push origin <version>
|
|
||||||
```
|
|
||||||
4. After deployment, update package.json with next version + "-beta"
|
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
### Common Build Issues
|
### Common Build Issues
|
||||||
|
|||||||
31
CHANGELOG.md
31
CHANGELOG.md
@@ -6,12 +6,30 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
|
||||||
== [0.4.2] - 2025.02.17
|
|
||||||
### Merged
|
## [0.4.5] - 2025.02.23
|
||||||
- Master to split_process_build
|
### Added
|
||||||
- fixed path issues
|
- Total amounts of gives on project page
|
||||||
- all tests passing
|
### Changed in DB or environment
|
||||||
- capacitor build to Android working
|
- Requires Endorser.ch version 4.2.6+
|
||||||
|
|
||||||
|
|
||||||
|
## [0.4.4] - 2025.02.17
|
||||||
|
### Fixed
|
||||||
|
- On production (due to data?) the search results would disappear after scrolling down. Now we don't show any results when going to the people map with a shortcut.
|
||||||
|
|
||||||
|
|
||||||
|
## [0.4.3] - 2025.02.17
|
||||||
|
### Added
|
||||||
|
- Discover query parameter searchPeople to go directly to the people map
|
||||||
|
|
||||||
|
|
||||||
|
## [0.4.2] - 2025.02.17
|
||||||
|
### Added
|
||||||
|
- Capacitor build to Android
|
||||||
|
### Fixed
|
||||||
|
- Path issues
|
||||||
|
|
||||||
|
|
||||||
## [0.4.1] - 2025.02.16
|
## [0.4.1] - 2025.02.16
|
||||||
### Fixed
|
### Fixed
|
||||||
@@ -23,7 +41,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Changed
|
### Changed
|
||||||
- Images in the home feed now take up the full width of the card.
|
- Images in the home feed now take up the full width of the card.
|
||||||
- Clicking the image previously, would open the image in a new tab. Now, clicking the image opens the image in a lightbox view.
|
- Clicking the image previously, would open the image in a new tab. Now, clicking the image opens the image in a lightbox view.
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- Clicking an image also now displays an in-app lightbox view of the image.
|
- Clicking an image also now displays an in-app lightbox view of the image.
|
||||||
- The lightbox view includes a download button for the image in mobile view.
|
- The lightbox view includes a download button for the image in mobile view.
|
||||||
|
|||||||
8
package-lock.json
generated
8
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "TimeSafari",
|
"name": "timesafari",
|
||||||
"version": "0.4.1",
|
"version": "0.4.4",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "TimeSafari",
|
"name": "timesafari",
|
||||||
"version": "0.4.1",
|
"version": "0.4.4",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@capacitor/android": "^6.2.0",
|
"@capacitor/android": "^6.2.0",
|
||||||
"@capacitor/cli": "^6.2.0",
|
"@capacitor/cli": "^6.2.0",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "timesafari",
|
"name": "timesafari",
|
||||||
"version": "0.4.2",
|
"version": "0.4.4",
|
||||||
"description": "TimeSafari Desktop Application",
|
"description": "TimeSafari Desktop Application",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "TimeSafari Team"
|
"name": "TimeSafari Team"
|
||||||
|
|||||||
334
src/components/ActivityListItem.vue
Normal file
334
src/components/ActivityListItem.vue
Normal file
@@ -0,0 +1,334 @@
|
|||||||
|
<template>
|
||||||
|
<li>
|
||||||
|
<!-- Last viewed separator -->
|
||||||
|
<div
|
||||||
|
class="border-b border-dashed border-slate-300 text-orange-400 mt-4 mb-6 font-bold text-sm"
|
||||||
|
v-if="record.jwtId == lastViewedClaimId"
|
||||||
|
>
|
||||||
|
<span class="block w-fit mx-auto -mb-2.5 bg-white px-2">
|
||||||
|
You've already seen all the following
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="bg-slate-100 rounded-t-md border border-slate-300 p-3 sm:p-4">
|
||||||
|
<div class="flex items-center gap-2 mb-6">
|
||||||
|
<img
|
||||||
|
src="https://a.fsdn.com/con/app/proj/identicons/screenshots/225506.jpg"
|
||||||
|
class="size-8 object-cover rounded-full"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h3 class="font-semibold">
|
||||||
|
{{
|
||||||
|
record.giver.known ? record.giver.displayName : "Anonymous Giver"
|
||||||
|
}}
|
||||||
|
</h3>
|
||||||
|
<p class="ms-auto text-xs text-slate-500 italic">
|
||||||
|
{{ friendlyDate }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Record Image -->
|
||||||
|
<div
|
||||||
|
v-if="record.image"
|
||||||
|
class="bg-cover mb-6 -mx-3 sm:-mx-4"
|
||||||
|
:style="`background-image: url(${record.image});`"
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
class="block bg-slate-100/50 backdrop-blur-md px-6 py-4 cursor-pointer"
|
||||||
|
@click="$emit('viewImage', record.image)"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
class="w-full h-auto max-w-lg max-h-96 object-contain mx-auto drop-shadow-md"
|
||||||
|
:src="record.image"
|
||||||
|
@load="$emit('cacheImage', record.image)"
|
||||||
|
alt="Activity image"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="relative flex justify-between gap-4 max-w-lg mx-auto mb-5">
|
||||||
|
<!-- Source -->
|
||||||
|
<div
|
||||||
|
class="w-28 sm:w-40 text-center bg-white border border-slate-200 rounded p-2 sm:p-3"
|
||||||
|
>
|
||||||
|
<div class="relative w-fit mx-auto">
|
||||||
|
<template v-if="record.giver.profileImageUrl">
|
||||||
|
<EntityIcon
|
||||||
|
:profile-image-url="record.giver.profileImageUrl"
|
||||||
|
:class="[
|
||||||
|
!record.providerPlanName
|
||||||
|
? 'rounded-full size-[3rem] sm:size-[4rem] object-cover'
|
||||||
|
: 'rounded size-[3rem] sm:size-[4rem] object-cover',
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<!-- Project Icon -->
|
||||||
|
<template v-if="record.providerPlanName">
|
||||||
|
<ProjectIcon
|
||||||
|
:entityId="record.providerPlanName"
|
||||||
|
:iconSize="48"
|
||||||
|
class="rounded size-[3rem] sm:size-[4rem] *:w-full *:h-full"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<!-- Identicon for DIDs -->
|
||||||
|
<template v-else-if="record.giver.did">
|
||||||
|
<img
|
||||||
|
:src="`https://a.fsdn.com/con/app/proj/identicons/screenshots/225506.jpg`"
|
||||||
|
class="rounded-full size-[3rem] sm:size-[4rem]"
|
||||||
|
alt="Identicon"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<!-- Unknown Person -->
|
||||||
|
<template v-else>
|
||||||
|
<fa
|
||||||
|
icon="person-circle-question"
|
||||||
|
class="text-slate-300 text-[3rem] sm:text-[4rem]"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
<div class="text-xs mt-2 line-clamp-3 sm:line-clamp-2">
|
||||||
|
<fa
|
||||||
|
:icon="record.providerPlanName ? 'building' : 'user'"
|
||||||
|
class="fa-fw text-slate-400"
|
||||||
|
/>
|
||||||
|
{{ record.giver.displayName }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Arrow -->
|
||||||
|
<div
|
||||||
|
class="absolute inset-x-28 sm:inset-x-40 mx-2 top-1/2 -translate-y-1/2"
|
||||||
|
>
|
||||||
|
<div class="text-sm text-center leading-none font-semibold">
|
||||||
|
{{ fetchAmount }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex items-center">
|
||||||
|
<hr
|
||||||
|
class="grow border-t-[18px] sm:border-t-[24px] border-slate-300"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="shrink-0 w-0 h-0 border border-slate-300 border-t-[20px] sm:border-t-[25px] border-t-transparent border-b-[20px] sm:border-b-[25px] border-b-transparent border-s-[27px] sm:border-s-[34px] border-e-0"
|
||||||
|
></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Destination -->
|
||||||
|
<div
|
||||||
|
class="w-28 sm:w-40 text-center bg-white border border-slate-200 rounded p-2 sm:p-3"
|
||||||
|
>
|
||||||
|
<div class="relative w-fit mx-auto">
|
||||||
|
<template v-if="record.receiver.profileImageUrl">
|
||||||
|
<EntityIcon
|
||||||
|
:profile-image-url="record.receiver.profileImageUrl"
|
||||||
|
:class="[
|
||||||
|
!record.recipientProjectName
|
||||||
|
? 'rounded-full size-[3rem] sm:size-[4rem] object-cover'
|
||||||
|
: 'rounded size-[3rem] sm:size-[4rem] object-cover',
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<!-- Project Icon -->
|
||||||
|
<template v-if="record.recipientProjectName">
|
||||||
|
<ProjectIcon
|
||||||
|
:entityId="record.recipientProjectName"
|
||||||
|
:iconSize="48"
|
||||||
|
class="rounded size-[3rem] sm:size-[4rem] *:w-full *:h-full"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<!-- Identicon for DIDs -->
|
||||||
|
<template v-else-if="record.receiver.did">
|
||||||
|
<img
|
||||||
|
:src="`https://a.fsdn.com/con/app/proj/identicons/screenshots/225506.jpg`"
|
||||||
|
class="rounded-full size-[3rem] sm:size-[4rem]"
|
||||||
|
alt="Identicon"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<!-- Unknown Person -->
|
||||||
|
<template v-else>
|
||||||
|
<fa
|
||||||
|
icon="person-circle-question"
|
||||||
|
class="text-slate-300 text-[3rem] sm:text-[4rem]"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
<div class="text-xs mt-2 line-clamp-3 sm:line-clamp-2">
|
||||||
|
<fa
|
||||||
|
:icon="record.recipientProjectName ? 'building' : 'user'"
|
||||||
|
class="fa-fw text-slate-400"
|
||||||
|
/>
|
||||||
|
{{ record.receiver.displayName }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Description -->
|
||||||
|
<p class="font-medium">
|
||||||
|
<a @click="$emit('loadClaim', record.jwtId)" class="cursor-pointer">
|
||||||
|
{{ description }}
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
<p class="text-sm">{{ subDescription }}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="flex items-center gap-2 text-lg bg-slate-300 rounded-b-md px-3 sm:px-4 py-1 sm:py-2"
|
||||||
|
>
|
||||||
|
<a @click="$emit('loadClaim', record.jwtId)" class="cursor-pointer">
|
||||||
|
<fa icon="circle-info" class="fa-fw text-slate-500" />
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { Component, Prop, Vue } from "vue-facing-decorator";
|
||||||
|
import { GiveRecordWithContactInfo } from "../types";
|
||||||
|
import EntityIcon from "./EntityIcon.vue";
|
||||||
|
import { isGiveClaimType, notifyWhyCannotConfirm } from "../libs/util";
|
||||||
|
import { containsHiddenDid } from "../libs/endorserServer";
|
||||||
|
import ProjectIcon from "./ProjectIcon.vue";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
components: {
|
||||||
|
EntityIcon,
|
||||||
|
ProjectIcon,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
export default class ActivityListItem extends Vue {
|
||||||
|
@Prop() record!: GiveRecordWithContactInfo;
|
||||||
|
@Prop() lastViewedClaimId?: string;
|
||||||
|
@Prop() isRegistered!: boolean;
|
||||||
|
@Prop() activeDid!: string;
|
||||||
|
@Prop() confirmerIdList?: string[];
|
||||||
|
|
||||||
|
get fetchAmount(): string {
|
||||||
|
const claim =
|
||||||
|
(this.record.fullClaim as unknown).claim || this.record.fullClaim;
|
||||||
|
|
||||||
|
const amount = claim.object?.amountOfThisGood
|
||||||
|
? this.displayAmount(claim.object.unitCode, claim.object.amountOfThisGood)
|
||||||
|
: "";
|
||||||
|
|
||||||
|
return amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
private formatParticipantInfo(): string {
|
||||||
|
const { giver, receiver } = this.record;
|
||||||
|
|
||||||
|
// Both participants are known contacts
|
||||||
|
if (giver.known && receiver.known) {
|
||||||
|
return `${giver.displayName} gave to ${receiver.displayName}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only giver is known
|
||||||
|
if (giver.known) {
|
||||||
|
const recipient = this.record.recipientProjectName
|
||||||
|
? `the project "${this.record.recipientProjectName}"`
|
||||||
|
: receiver.displayName;
|
||||||
|
return `${giver.displayName} gave to ${recipient}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only receiver is known
|
||||||
|
if (receiver.known) {
|
||||||
|
const provider = this.record.providerPlanName
|
||||||
|
? `the project "${this.record.providerPlanName}"`
|
||||||
|
: giver.displayName;
|
||||||
|
return `${receiver.displayName} received from ${provider}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Neither is known
|
||||||
|
return this.formatUnknownParticipants();
|
||||||
|
}
|
||||||
|
|
||||||
|
private formatUnknownParticipants(): string {
|
||||||
|
const { giver, receiver, providerPlanName, recipientProjectName } =
|
||||||
|
this.record;
|
||||||
|
|
||||||
|
if (providerPlanName || recipientProjectName) {
|
||||||
|
const from = providerPlanName
|
||||||
|
? `the project "${providerPlanName}"`
|
||||||
|
: giver.displayName;
|
||||||
|
const to = recipientProjectName
|
||||||
|
? `the project "${recipientProjectName}"`
|
||||||
|
: receiver.displayName;
|
||||||
|
return `from ${from} to ${to}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return giver.displayName === receiver.displayName
|
||||||
|
? `between two who are ${giver.displayName}`
|
||||||
|
: `from ${giver.displayName} to ${receiver.displayName}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
get description(): string {
|
||||||
|
const claim =
|
||||||
|
(this.record.fullClaim as unknown).claim || this.record.fullClaim;
|
||||||
|
|
||||||
|
if (!claim.description) {
|
||||||
|
return "something not described";
|
||||||
|
}
|
||||||
|
|
||||||
|
return `${claim.description}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
get subDescription(): string {
|
||||||
|
const participants = this.formatParticipantInfo();
|
||||||
|
|
||||||
|
return `${participants}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
private displayAmount(code: string, amt: number) {
|
||||||
|
return `${amt} ${this.currencyShortWordForCode(code, amt === 1)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
private currencyShortWordForCode(unitCode: string, single: boolean) {
|
||||||
|
return unitCode === "HUR" ? (single ? "hour" : "hours") : unitCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
get formattedTimestamp() {
|
||||||
|
// Add your timestamp formatting logic here
|
||||||
|
return this.record.timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
get canConfirm(): boolean {
|
||||||
|
if (!this.isRegistered) return false;
|
||||||
|
if (!isGiveClaimType(this.record.fullClaim?.["@type"])) return false;
|
||||||
|
if (this.confirmerIdList?.includes(this.activeDid)) return false;
|
||||||
|
if (this.record.issuerDid === this.activeDid) return false;
|
||||||
|
if (containsHiddenDid(this.record.fullClaim)) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
handleConfirmClick() {
|
||||||
|
if (!this.canConfirm) {
|
||||||
|
notifyWhyCannotConfirm(
|
||||||
|
this.$notify,
|
||||||
|
this.isRegistered,
|
||||||
|
this.record.fullClaim?.["@type"],
|
||||||
|
this.record,
|
||||||
|
this.activeDid,
|
||||||
|
this.confirmerIdList,
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$emit("confirmClaim", this.record);
|
||||||
|
}
|
||||||
|
|
||||||
|
get friendlyDate(): string {
|
||||||
|
const date = new Date(this.record.issuedAt);
|
||||||
|
return date.toLocaleDateString(undefined, {
|
||||||
|
year: "numeric",
|
||||||
|
month: "short",
|
||||||
|
day: "numeric",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -20,7 +20,7 @@ export type Settings = {
|
|||||||
// active Decentralized ID
|
// active Decentralized ID
|
||||||
activeDid?: string; // only used in the MASTER_SETTINGS_KEY entry
|
activeDid?: string; // only used in the MASTER_SETTINGS_KEY entry
|
||||||
|
|
||||||
apiServer: string; // API server URL
|
apiServer?: string; // API server URL
|
||||||
|
|
||||||
filterFeedByNearby?: boolean; // filter by nearby
|
filterFeedByNearby?: boolean; // filter by nearby
|
||||||
filterFeedByVisible?: boolean; // filter by visible users ie. anyone not hidden
|
filterFeedByVisible?: boolean; // filter by visible users ie. anyone not hidden
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ import {
|
|||||||
faHandHoldingDollar,
|
faHandHoldingDollar,
|
||||||
faHandHoldingHeart,
|
faHandHoldingHeart,
|
||||||
faHouseChimney,
|
faHouseChimney,
|
||||||
|
faImage,
|
||||||
faImagePortrait,
|
faImagePortrait,
|
||||||
faLeftRight,
|
faLeftRight,
|
||||||
faLightbulb,
|
faLightbulb,
|
||||||
@@ -87,6 +88,7 @@ import {
|
|||||||
faUser,
|
faUser,
|
||||||
faUsers,
|
faUsers,
|
||||||
faXmark,
|
faXmark,
|
||||||
|
faBuilding,
|
||||||
} from "@fortawesome/free-solid-svg-icons";
|
} from "@fortawesome/free-solid-svg-icons";
|
||||||
|
|
||||||
library.add(
|
library.add(
|
||||||
@@ -137,6 +139,7 @@ library.add(
|
|||||||
faHandHoldingDollar,
|
faHandHoldingDollar,
|
||||||
faHandHoldingHeart,
|
faHandHoldingHeart,
|
||||||
faHouseChimney,
|
faHouseChimney,
|
||||||
|
faImage,
|
||||||
faImagePortrait,
|
faImagePortrait,
|
||||||
faLeftRight,
|
faLeftRight,
|
||||||
faLightbulb,
|
faLightbulb,
|
||||||
@@ -166,6 +169,7 @@ library.add(
|
|||||||
faUser,
|
faUser,
|
||||||
faUsers,
|
faUsers,
|
||||||
faXmark,
|
faXmark,
|
||||||
|
faBuilding,
|
||||||
);
|
);
|
||||||
|
|
||||||
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
|
||||||
|
|||||||
20
src/types/index.ts
Normal file
20
src/types/index.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
export interface GiveRecordWithContactInfo {
|
||||||
|
jwtId: string;
|
||||||
|
fullClaim: unknown; // Replace with proper type
|
||||||
|
giver: {
|
||||||
|
known: boolean;
|
||||||
|
displayName: string;
|
||||||
|
profileImageUrl?: string;
|
||||||
|
};
|
||||||
|
receiver: {
|
||||||
|
known: boolean;
|
||||||
|
displayName: string;
|
||||||
|
profileImageUrl?: string;
|
||||||
|
};
|
||||||
|
providerPlanName?: string;
|
||||||
|
recipientProjectName?: string;
|
||||||
|
description?: string;
|
||||||
|
subDescription?: string;
|
||||||
|
image?: string;
|
||||||
|
timestamp: string;
|
||||||
|
}
|
||||||
@@ -352,9 +352,9 @@ export default class DiscoverView extends Vue {
|
|||||||
allMyDids: Array<string> = [];
|
allMyDids: Array<string> = [];
|
||||||
apiServer = "";
|
apiServer = "";
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
isLocalActive = true;
|
isLocalActive = false;
|
||||||
isMappedActive = false;
|
isMappedActive = false;
|
||||||
isAnywhereActive = false;
|
isAnywhereActive = true;
|
||||||
isProjectsActive = true;
|
isProjectsActive = true;
|
||||||
isPeopleActive = false;
|
isPeopleActive = false;
|
||||||
isSearchVisible = true;
|
isSearchVisible = true;
|
||||||
@@ -375,6 +375,11 @@ export default class DiscoverView extends Vue {
|
|||||||
didInfo = didInfo;
|
didInfo = didInfo;
|
||||||
|
|
||||||
async mounted() {
|
async mounted() {
|
||||||
|
|
||||||
|
this.searchTerms = this.$route.query["searchText"]?.toString() || "";
|
||||||
|
|
||||||
|
const searchPeople = !!this.$route.query["searchPeople"];
|
||||||
|
|
||||||
const settings = await retrieveSettingsForActiveAccount();
|
const settings = await retrieveSettingsForActiveAccount();
|
||||||
this.activeDid = (settings.activeDid as string) || "";
|
this.activeDid = (settings.activeDid as string) || "";
|
||||||
this.apiServer = (settings.apiServer as string) || "";
|
this.apiServer = (settings.apiServer as string) || "";
|
||||||
@@ -386,25 +391,35 @@ export default class DiscoverView extends Vue {
|
|||||||
|
|
||||||
this.allMyDids = await retrieveAccountDids();
|
this.allMyDids = await retrieveAccountDids();
|
||||||
|
|
||||||
this.searchTerms = this.$route.query["searchText"]?.toString() || "";
|
|
||||||
|
|
||||||
if (!settings.finishedOnboarding) {
|
if (!settings.finishedOnboarding) {
|
||||||
(this.$refs.onboardingDialog as OnboardingDialog).open(
|
(this.$refs.onboardingDialog as OnboardingDialog).open(
|
||||||
OnboardPage.Discover,
|
OnboardPage.Discover,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.searchBox) {
|
// Someday we'll have enough people that we can default to their local area.
|
||||||
await this.searchLocal();
|
// if (this.searchBox) {
|
||||||
|
// this.isLocalActive = true;
|
||||||
|
// this.isAnywhereActive = false;
|
||||||
|
// await this.searchLocal();
|
||||||
|
//
|
||||||
|
// const bbox = this.searchBox.bbox;
|
||||||
|
// this.localCenterLat = (bbox.maxLat + bbox.minLat) / 2;
|
||||||
|
// this.localCenterLong = (bbox.eastLong + bbox.westLong) / 2;
|
||||||
|
// } else {
|
||||||
|
|
||||||
const bbox = this.searchBox.bbox;
|
if (searchPeople) {
|
||||||
this.localCenterLat = (bbox.maxLat + bbox.minLat) / 2;
|
this.isPeopleActive = true;
|
||||||
this.localCenterLong = (bbox.eastLong + bbox.westLong) / 2;
|
this.isProjectsActive = false;
|
||||||
|
this.isMappedActive = true;
|
||||||
|
this.isAnywhereActive = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.isMappedActive) {
|
||||||
|
// The map will be loaded when it's ready
|
||||||
|
// and if we try to do it here before the map is ready then we get errors.
|
||||||
} else {
|
} else {
|
||||||
this.isLocalActive = false;
|
await this.searchSelected();
|
||||||
this.isMappedActive = false;
|
|
||||||
this.isAnywhereActive = true;
|
|
||||||
await this.searchAll();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -466,7 +481,7 @@ export default class DiscoverView extends Vue {
|
|||||||
} else {
|
} else {
|
||||||
throw JSON.stringify(results);
|
throw JSON.stringify(results);
|
||||||
}
|
}
|
||||||
} else {
|
} else { // people search must be active
|
||||||
this.projects = [];
|
this.projects = [];
|
||||||
const profiles: UserProfile[] = results.data;
|
const profiles: UserProfile[] = results.data;
|
||||||
if (profiles) {
|
if (profiles) {
|
||||||
|
|||||||
@@ -186,23 +186,23 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Results List -->
|
<!-- Results List -->
|
||||||
<div class="bg-slate-100 rounded-md px-4 py-3 mt-4 mb-4">
|
<div class="mt-4 mb-4">
|
||||||
<div class="flex items-center mb-4">
|
<div class="flex items-center mb-4">
|
||||||
<h2 class="text-xl font-bold">
|
<h2 class="text-xl font-bold flex items-center gap-4">
|
||||||
Latest Activity
|
Latest Activity
|
||||||
<button @click="openFeedFilters()">
|
<button
|
||||||
<span class="text-xs text-white">
|
v-if="resultsAreFiltered()"
|
||||||
<fa
|
class="bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] px-3 py-1.5 rounded-md text-xs text-white"
|
||||||
v-if="resultsAreFiltered()"
|
@click="openFeedFilters()"
|
||||||
icon="filter"
|
>
|
||||||
class="bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] px-1 py-1.5 rounded-md"
|
<fa icon="filter" class="fa-fw" />
|
||||||
/>
|
</button>
|
||||||
<fa
|
<button
|
||||||
v-else
|
v-else
|
||||||
icon="filter"
|
class="bg-gradient-to-b from-slate-400 to-slate-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] px-3 py-1.5 rounded-md text-xs text-white"
|
||||||
class="bg-gradient-to-b from-slate-400 to-slate-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] px-1 py-1.5 rounded-md"
|
@click="openFeedFilters()"
|
||||||
/>
|
>
|
||||||
</span>
|
<fa icon="filter" class="fa-fw" />
|
||||||
</button>
|
</button>
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
@@ -249,117 +249,20 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<InfiniteScroll @reached-bottom="loadMoreGives">
|
<InfiniteScroll @reached-bottom="loadMoreGives">
|
||||||
<ul id="listLatestActivity" class="border-t border-slate-300">
|
<ul id="listLatestActivity" class="space-y-4">
|
||||||
<li
|
<ActivityListItem
|
||||||
class="border-b border-slate-300 py-2"
|
|
||||||
v-for="record in feedData"
|
v-for="record in feedData"
|
||||||
:key="record.jwtId"
|
:key="record.jwtId"
|
||||||
>
|
:record="record"
|
||||||
<div
|
:lastViewedClaimId="feedLastViewedClaimId"
|
||||||
class="border-b border-slate-300 text-orange-400 pb-2 mb-2 font-bold text-sm"
|
:isRegistered="isRegistered"
|
||||||
v-if="record.jwtId == feedLastViewedClaimId"
|
:activeDid="activeDid"
|
||||||
>
|
:confirmerIdList="record.confirmerIdList"
|
||||||
You've already seen all the following
|
@loadClaim="onClickLoadClaim"
|
||||||
</div>
|
@viewImage="openImageViewer"
|
||||||
|
@cacheImage="cacheImageData"
|
||||||
<div class="grid grid-cols-12">
|
@confirmClaim="confirmClaim"
|
||||||
<span class="pt-1 col-span-1 justify-self-start">
|
/>
|
||||||
<span>
|
|
||||||
<fa
|
|
||||||
icon="circle-user"
|
|
||||||
:class="
|
|
||||||
computeKnownPersonIconStyleClassNames(
|
|
||||||
record.giver.known || record.receiver.known,
|
|
||||||
)
|
|
||||||
"
|
|
||||||
@click="toastUser('This involves your contacts.')"
|
|
||||||
/>
|
|
||||||
<fa
|
|
||||||
icon="gift"
|
|
||||||
class="pl-3 text-slate-500"
|
|
||||||
@click="toastUser('This is a gift.')"
|
|
||||||
/>
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
<span class="col-span-10 justify-self-stretch overflow-hidden">
|
|
||||||
<!-- show giver and/or receiver profiles... which seemed like a good idea but actually adds clutter
|
|
||||||
<span
|
|
||||||
v-if="
|
|
||||||
record.giver.profileImageUrl ||
|
|
||||||
record.receiver.profileImageUrl
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<EntityIcon
|
|
||||||
v-if="record.agentDid !== activeDid"
|
|
||||||
:icon-size="32"
|
|
||||||
:profile-image-url="record.giver.profileImageUrl"
|
|
||||||
class="inline-block align-middle border border-slate-300 rounded-md mr-1"
|
|
||||||
/>
|
|
||||||
<fa
|
|
||||||
v-if="
|
|
||||||
record.agentDid !== activeDid &&
|
|
||||||
record.recipientDid !== activeDid &&
|
|
||||||
!record.fulfillsPlanHandleId
|
|
||||||
"
|
|
||||||
icon="ellipsis"
|
|
||||||
class="text-slate"
|
|
||||||
/>
|
|
||||||
<EntityIcon
|
|
||||||
v-if="
|
|
||||||
record.recipientDid !== activeDid &&
|
|
||||||
!record.fulfillsPlanHandleId
|
|
||||||
"
|
|
||||||
:iconSize="32"
|
|
||||||
:profile-image-url="record.receiver.profileImageUrl"
|
|
||||||
class="inline-block align-middle border border-slate-300 rounded-md ml-1"
|
|
||||||
/>
|
|
||||||
</span>
|
|
||||||
-->
|
|
||||||
<span class="pl-2 block break-words">
|
|
||||||
{{ giveDescription(record) }}
|
|
||||||
</span>
|
|
||||||
<a @click="onClickLoadClaim(record.jwtId)">
|
|
||||||
<fa
|
|
||||||
icon="file-lines"
|
|
||||||
class="pl-2 text-slate-500 cursor-pointer"
|
|
||||||
/>
|
|
||||||
</a>
|
|
||||||
</span>
|
|
||||||
<span class="col-span-1 justify-self-end">
|
|
||||||
<router-link
|
|
||||||
v-if="record.fulfillsPlanHandleId"
|
|
||||||
:to="
|
|
||||||
'/project/' +
|
|
||||||
encodeURIComponent(record.fulfillsPlanHandleId)
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<fa icon="hammer" class="text-blue-500" />
|
|
||||||
</router-link>
|
|
||||||
<router-link
|
|
||||||
v-if="record.providerPlanHandleId"
|
|
||||||
:to="
|
|
||||||
'/project/' +
|
|
||||||
encodeURIComponent(record.providerPlanHandleId)
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<fa icon="hammer" class="text-blue-500" />
|
|
||||||
</router-link>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div v-if="record.image" class="w-full">
|
|
||||||
<div
|
|
||||||
class="cursor-pointer"
|
|
||||||
@click="openImageViewer(record.image)"
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
:src="record.image"
|
|
||||||
class="w-full aspect-[3/2] object-cover rounded-xl mt-2"
|
|
||||||
alt="shared content"
|
|
||||||
@load="cacheImageData($event, record.image)"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</InfiniteScroll>
|
</InfiniteScroll>
|
||||||
<div v-if="isFeedLoading">
|
<div v-if="isFeedLoading">
|
||||||
@@ -401,6 +304,7 @@ import TopMessage from "../components/TopMessage.vue";
|
|||||||
import UserNameDialog from "../components/UserNameDialog.vue";
|
import UserNameDialog from "../components/UserNameDialog.vue";
|
||||||
import ChoiceButtonDialog from "../components/ChoiceButtonDialog.vue";
|
import ChoiceButtonDialog from "../components/ChoiceButtonDialog.vue";
|
||||||
import ImageViewer from "../components/ImageViewer.vue";
|
import ImageViewer from "../components/ImageViewer.vue";
|
||||||
|
import ActivityListItem from "../components/ActivityListItem.vue";
|
||||||
import {
|
import {
|
||||||
AppString,
|
AppString,
|
||||||
NotificationIface,
|
NotificationIface,
|
||||||
@@ -436,6 +340,8 @@ import {
|
|||||||
OnboardPage,
|
OnboardPage,
|
||||||
registerSaveAndActivatePasskey,
|
registerSaveAndActivatePasskey,
|
||||||
} from "../libs/util";
|
} from "../libs/util";
|
||||||
|
import * as serverUtil from "../libs/endorserServer";
|
||||||
|
// import { fa0 } from "@fortawesome/free-solid-svg-icons";
|
||||||
|
|
||||||
interface GiveRecordWithContactInfo extends GiveSummaryRecord {
|
interface GiveRecordWithContactInfo extends GiveSummaryRecord {
|
||||||
giver: {
|
giver: {
|
||||||
@@ -466,6 +372,7 @@ interface GiveRecordWithContactInfo extends GiveSummaryRecord {
|
|||||||
TopMessage,
|
TopMessage,
|
||||||
UserNameDialog,
|
UserNameDialog,
|
||||||
ImageViewer,
|
ImageViewer,
|
||||||
|
ActivityListItem,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
export default class HomeView extends Vue {
|
export default class HomeView extends Vue {
|
||||||
@@ -559,6 +466,7 @@ export default class HomeView extends Vue {
|
|||||||
if (resp.status === 200) {
|
if (resp.status === 200) {
|
||||||
await updateAccountSettings(this.activeDid, {
|
await updateAccountSettings(this.activeDid, {
|
||||||
isRegistered: true,
|
isRegistered: true,
|
||||||
|
...(await retrieveSettingsForActiveAccount()),
|
||||||
});
|
});
|
||||||
this.isRegistered = true;
|
this.isRegistered = true;
|
||||||
}
|
}
|
||||||
@@ -1002,5 +910,67 @@ export default class HomeView extends Vue {
|
|||||||
this.selectedImage = imageUrl;
|
this.selectedImage = imageUrl;
|
||||||
this.isImageViewerOpen = true;
|
this.isImageViewerOpen = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async confirmClaim(record: GiveRecordWithContactInfo) {
|
||||||
|
this.$notify(
|
||||||
|
{
|
||||||
|
group: "modal",
|
||||||
|
type: "confirm",
|
||||||
|
title: "Confirm",
|
||||||
|
text: "Do you personally confirm that this is true?",
|
||||||
|
onYes: async () => {
|
||||||
|
const goodClaim = serverUtil.removeSchemaContext(
|
||||||
|
serverUtil.removeVisibleToDids(
|
||||||
|
serverUtil.addLastClaimOrHandleAsIdIfMissing(
|
||||||
|
record.fullClaim,
|
||||||
|
record.jwtId,
|
||||||
|
record.handleId,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
const confirmationClaim = {
|
||||||
|
"@context": "https://schema.org",
|
||||||
|
"@type": "AgreeAction",
|
||||||
|
object: goodClaim,
|
||||||
|
};
|
||||||
|
|
||||||
|
const result = await serverUtil.createAndSubmitClaim(
|
||||||
|
confirmationClaim,
|
||||||
|
this.activeDid,
|
||||||
|
this.apiServer,
|
||||||
|
this.axios,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result.type === "success") {
|
||||||
|
this.$notify(
|
||||||
|
{
|
||||||
|
group: "alert",
|
||||||
|
type: "success",
|
||||||
|
title: "Success",
|
||||||
|
text: "Confirmation submitted.",
|
||||||
|
},
|
||||||
|
3000,
|
||||||
|
);
|
||||||
|
|
||||||
|
// Refresh the feed to show updated confirmation status
|
||||||
|
await this.updateAllFeed();
|
||||||
|
} else {
|
||||||
|
console.error("Error submitting confirmation:", result);
|
||||||
|
this.$notify(
|
||||||
|
{
|
||||||
|
group: "alert",
|
||||||
|
type: "danger",
|
||||||
|
title: "Error",
|
||||||
|
text: "There was a problem submitting the confirmation.",
|
||||||
|
},
|
||||||
|
5000,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-1,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -325,74 +325,139 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h3 class="text-lg font-bold mb-3 mt-4">Given To This Idea</h3>
|
<h3 class="text-lg font-bold mt-4">Given To This Idea</h3>
|
||||||
|
|
||||||
<div v-if="givesToThis.length === 0">
|
<div v-if="givesToThis.length === 0" class="text-sm">
|
||||||
(None yet. If you've seen something, say something by clicking a
|
(None yet. If you've seen something, say something by clicking a
|
||||||
contact above.)
|
contact above.)
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul v-else class="text-sm border-t border-slate-300">
|
<div v-else class="mt-1 text-sm">
|
||||||
<li
|
<!-- Totals section -->
|
||||||
v-for="give in givesToThis"
|
<div class="mt-1 flex items-center min-h-[1.5rem]">
|
||||||
:key="give.id"
|
<div v-if="loadingTotals" class="flex-1">
|
||||||
class="py-1.5 border-b border-slate-300"
|
<fa icon="spinner" class="fa-spin-pulse text-blue-500" />
|
||||||
>
|
</div>
|
||||||
<div class="flex justify-between gap-4">
|
<div v-else-if="givesTotalsByUnit.length > 0" class="flex-1">
|
||||||
<span>
|
<span class="font-semibold mr-2 shrink-0">Totals</span>
|
||||||
<fa icon="user" class="fa-fw text-slate-400" />
|
<span class="whitespace-nowrap overflow-hidden text-ellipsis">
|
||||||
{{
|
<a
|
||||||
serverUtil.didInfo(
|
@click="totalsExpanded = !totalsExpanded"
|
||||||
give.agentDid,
|
class="cursor-pointer text-blue-500"
|
||||||
activeDid,
|
>
|
||||||
allMyDids,
|
<!-- just show the hours, or alternatively whatever is first -->
|
||||||
allContacts,
|
<span v-if="givenTotalHours() > 0">
|
||||||
)
|
{{ givenTotalHours() }} {{ libsUtil.UNIT_SHORT["HUR"] }}
|
||||||
|
</span>
|
||||||
|
<span v-else>
|
||||||
|
{{ givesTotalsByUnit[0].amount }}
|
||||||
|
{{ libsUtil.UNIT_SHORT[givesTotalsByUnit[0].unit] }}
|
||||||
|
</span>
|
||||||
|
<span v-if="givesTotalsByUnit.length > 1">...</span>
|
||||||
|
<span>
|
||||||
|
<fa
|
||||||
|
:icon="totalsExpanded ? 'chevron-up' : 'chevron-right'"
|
||||||
|
class="fa-fw text-xs ml-1"
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
<!-- show the full list when expanded -->
|
||||||
|
<div v-if="totalsExpanded">
|
||||||
|
<div
|
||||||
|
v-for="total in givesTotalsByUnit"
|
||||||
|
:key="total.unit"
|
||||||
|
class="ml-2"
|
||||||
|
>
|
||||||
|
<fa
|
||||||
|
:icon="libsUtil.iconForUnitCode(total.unit)"
|
||||||
|
class="fa-fw text-slate-400 mr-1"
|
||||||
|
/>
|
||||||
|
{{ total.amount }} {{ libsUtil.UNIT_LONG[total.unit] }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
<span class="font-semibold mr-2 shrink-0">
|
||||||
|
{{ givesToThis.length }}{{ givesHitLimit ? "+" : "" }} record{{
|
||||||
|
givesToThis.length === 1 ? "" : "s"
|
||||||
}}
|
}}
|
||||||
</span>
|
</span>
|
||||||
<span v-if="give.amount" class="whitespace-nowrap">
|
|
||||||
<fa
|
|
||||||
:icon="libsUtil.iconForUnitCode(give.unit)"
|
|
||||||
class="fa-fw text-slate-400"
|
|
||||||
/>{{ give.amount }}
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="text-slate-500">
|
</div>
|
||||||
<fa icon="calendar" class="fa-fw text-slate-400" />
|
|
||||||
{{ give.issuedAt?.substring(0, 10) }}
|
|
||||||
</div>
|
|
||||||
<div v-if="give.description" class="text-slate-500">
|
|
||||||
<fa icon="comment" class="fa-fw text-slate-400" />
|
|
||||||
{{ give.description }}
|
|
||||||
</div>
|
|
||||||
<div class="flex justify-between">
|
|
||||||
<a @click="onClickLoadClaim(give.jwtId)">
|
|
||||||
<fa icon="file-lines" class="text-blue-500 cursor-pointer" />
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<a
|
<!-- List of gives -->
|
||||||
v-if="
|
<ul class="mt-2 text-sm border-t border-slate-300">
|
||||||
checkIsConfirmable(give) &&
|
<li
|
||||||
!recentlyCheckedAndUnconfirmableJwts.includes(give.jwtId)
|
v-for="give in givesToThis"
|
||||||
"
|
:key="give.id"
|
||||||
@click="deepCheckConfirmable(give)"
|
class="py-1.5 border-b border-slate-300"
|
||||||
>
|
>
|
||||||
<fa icon="circle-check" class="text-blue-500 cursor-pointer" />
|
<div class="flex justify-between gap-4">
|
||||||
</a>
|
<span>
|
||||||
<a v-else-if="checkingConfirmationForJwtId === give.jwtId">
|
<fa icon="user" class="fa-fw text-slate-400" />
|
||||||
<fa icon="spinner" class="fa-spin-pulse" />
|
{{
|
||||||
</a>
|
serverUtil.didInfo(
|
||||||
<a v-else @click="shallowNotifyWhyCannotConfirm(give)">
|
give.agentDid,
|
||||||
<fa icon="circle-check" class="text-slate-500 cursor-pointer" />
|
activeDid,
|
||||||
</a>
|
allMyDids,
|
||||||
</div>
|
allContacts,
|
||||||
<div v-if="give.fullClaim.image" class="flex justify-center">
|
)
|
||||||
<a :href="give.fullClaim.image" target="_blank">
|
}}
|
||||||
<img :src="give.fullClaim.image" class="h-24 mt-2 rounded-xl" />
|
</span>
|
||||||
</a>
|
<span v-if="give.amount" class="whitespace-nowrap">
|
||||||
</div>
|
<fa
|
||||||
</li>
|
:icon="libsUtil.iconForUnitCode(give.unit)"
|
||||||
</ul>
|
class="fa-fw text-slate-400"
|
||||||
|
/>{{ give.amount }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="text-slate-500">
|
||||||
|
<fa icon="calendar" class="fa-fw text-slate-400" />
|
||||||
|
{{ give.issuedAt?.substring(0, 10) }}
|
||||||
|
</div>
|
||||||
|
<div v-if="give.description" class="text-slate-500">
|
||||||
|
<fa icon="comment" class="fa-fw text-slate-400" />
|
||||||
|
{{ give.description }}
|
||||||
|
</div>
|
||||||
|
<div class="flex justify-between">
|
||||||
|
<a @click="onClickLoadClaim(give.jwtId)">
|
||||||
|
<fa icon="file-lines" class="text-blue-500 cursor-pointer" />
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a
|
||||||
|
v-if="
|
||||||
|
checkIsConfirmable(give) &&
|
||||||
|
!recentlyCheckedAndUnconfirmableJwts.includes(give.jwtId)
|
||||||
|
"
|
||||||
|
@click="deepCheckConfirmable(give)"
|
||||||
|
>
|
||||||
|
<fa
|
||||||
|
icon="circle-check"
|
||||||
|
class="text-blue-500 cursor-pointer"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
|
<a v-else-if="checkingConfirmationForJwtId === give.jwtId">
|
||||||
|
<fa icon="spinner" class="fa-spin-pulse" />
|
||||||
|
</a>
|
||||||
|
<a v-else @click="shallowNotifyWhyCannotConfirm(give)">
|
||||||
|
<fa
|
||||||
|
icon="circle-check"
|
||||||
|
class="text-slate-500 cursor-pointer"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div v-if="give.fullClaim.image" class="flex justify-center">
|
||||||
|
<a :href="give.fullClaim.image" target="_blank">
|
||||||
|
<img
|
||||||
|
:src="give.fullClaim.image"
|
||||||
|
class="h-24 mt-2 rounded-xl"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
<div v-if="givesHitLimit" class="text-center text-blue-500">
|
<div v-if="givesHitLimit" class="text-center text-blue-500">
|
||||||
<button @click="loadGives()">Load More</button>
|
<button @click="loadGives()">Load More</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -554,6 +619,7 @@ export default class ProjectViewView extends Vue {
|
|||||||
givesHitLimit = false;
|
givesHitLimit = false;
|
||||||
givesProvidedByThis: Array<GiveSummaryRecord> = [];
|
givesProvidedByThis: Array<GiveSummaryRecord> = [];
|
||||||
givesProvidedByHitLimit = false;
|
givesProvidedByHitLimit = false;
|
||||||
|
givesTotalsByUnit: Array<{ unit: string; amount: number }> = [];
|
||||||
imageUrl = "";
|
imageUrl = "";
|
||||||
isRegistered = false;
|
isRegistered = false;
|
||||||
issuer = "";
|
issuer = "";
|
||||||
@@ -564,6 +630,7 @@ export default class ProjectViewView extends Vue {
|
|||||||
} | null = null;
|
} | null = null;
|
||||||
issuerVisibleToDids: Array<string> = [];
|
issuerVisibleToDids: Array<string> = [];
|
||||||
latitude = 0;
|
latitude = 0;
|
||||||
|
loadingTotals = false;
|
||||||
longitude = 0;
|
longitude = 0;
|
||||||
name = "";
|
name = "";
|
||||||
offersToThis: Array<OfferSummaryRecord> = [];
|
offersToThis: Array<OfferSummaryRecord> = [];
|
||||||
@@ -571,6 +638,7 @@ export default class ProjectViewView extends Vue {
|
|||||||
projectId = ""; // handle ID
|
projectId = ""; // handle ID
|
||||||
recentlyCheckedAndUnconfirmableJwts: string[] = [];
|
recentlyCheckedAndUnconfirmableJwts: string[] = [];
|
||||||
startTime = "";
|
startTime = "";
|
||||||
|
totalsExpanded = false;
|
||||||
truncatedDesc = "";
|
truncatedDesc = "";
|
||||||
truncateLength = 40;
|
truncateLength = 40;
|
||||||
url = "";
|
url = "";
|
||||||
@@ -609,6 +677,7 @@ export default class ProjectViewView extends Vue {
|
|||||||
this.projectId = decodeURIComponent(pathParam);
|
this.projectId = decodeURIComponent(pathParam);
|
||||||
}
|
}
|
||||||
this.loadProject(this.projectId, this.activeDid);
|
this.loadProject(this.projectId, this.activeDid);
|
||||||
|
this.loadTotals();
|
||||||
}
|
}
|
||||||
|
|
||||||
onEditClick() {
|
onEditClick() {
|
||||||
@@ -1207,5 +1276,56 @@ export default class ProjectViewView extends Vue {
|
|||||||
this.allMyDids,
|
this.allMyDids,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async loadTotals() {
|
||||||
|
this.loadingTotals = true;
|
||||||
|
const url =
|
||||||
|
this.apiServer +
|
||||||
|
"/api/v2/report/givesToPlans?planIds=" +
|
||||||
|
encodeURIComponent(JSON.stringify([this.projectId]));
|
||||||
|
const headers = await serverUtil.getHeaders(this.activeDid);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const resp = await this.axios.get(url, { headers });
|
||||||
|
if (resp.status === 200 && resp.data.data) {
|
||||||
|
// Calculate totals by unit
|
||||||
|
const totals: { [key: string]: number } = {};
|
||||||
|
resp.data.data.forEach((give: GiveSummaryRecord) => {
|
||||||
|
const amount = give.fullClaim.object?.amountOfThisGood;
|
||||||
|
const unit = give.fullClaim.object?.unitCode;
|
||||||
|
if (amount && unit) {
|
||||||
|
totals[unit] = (totals[unit] || 0) + amount;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Convert totals object to array format
|
||||||
|
this.givesTotalsByUnit = Object.entries(totals).map(
|
||||||
|
([unit, amount]) => ({
|
||||||
|
unit,
|
||||||
|
amount,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error loading totals:", error);
|
||||||
|
this.$notify(
|
||||||
|
{
|
||||||
|
group: "alert",
|
||||||
|
type: "danger",
|
||||||
|
title: "Error",
|
||||||
|
text: "Failed to load totals for this project.",
|
||||||
|
},
|
||||||
|
5000,
|
||||||
|
);
|
||||||
|
} finally {
|
||||||
|
this.loadingTotals = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
givenTotalHours(): number {
|
||||||
|
return (
|
||||||
|
this.givesTotalsByUnit.find((total) => total.unit === "HUR")?.amount || 0
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user