forked from trent_larson/crowd-funder-for-time-pwa
Compare commits
8 Commits
master
...
6fc416d759
| Author | SHA1 | Date | |
|---|---|---|---|
| 6fc416d759 | |||
| e86cf3c9f2 | |||
| f4c7805266 | |||
| 0511bbc17b | |||
| be1146c7df | |||
| 77ebd32956 | |||
| 781afd8954 | |||
| 53a06be734 |
11
package-lock.json
generated
11
package-lock.json
generated
@@ -54,7 +54,7 @@
|
|||||||
"lru-cache": "^10.2.0",
|
"lru-cache": "^10.2.0",
|
||||||
"luxon": "^3.4.4",
|
"luxon": "^3.4.4",
|
||||||
"merkletreejs": "^0.3.11",
|
"merkletreejs": "^0.3.11",
|
||||||
"nostr-tools": "^2.7.2",
|
"nostr-tools": "^2.10.4",
|
||||||
"notiwind": "^2.0.2",
|
"notiwind": "^2.0.2",
|
||||||
"papaparse": "^5.4.1",
|
"papaparse": "^5.4.1",
|
||||||
"pina": "^0.20.2204228",
|
"pina": "^0.20.2204228",
|
||||||
@@ -18905,9 +18905,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/nostr-tools": {
|
"node_modules/nostr-tools": {
|
||||||
"version": "2.7.2",
|
"version": "2.10.4",
|
||||||
"resolved": "https://registry.npmjs.org/nostr-tools/-/nostr-tools-2.7.2.tgz",
|
"resolved": "https://registry.npmjs.org/nostr-tools/-/nostr-tools-2.10.4.tgz",
|
||||||
"integrity": "sha512-Bq3Ug0SZFtgtL1+0wCnAe8AJtI7yx/00/a2nUug9SkhfOwlKS92Tef12iCK9FdwXw+oFZWMtRnSwcLayQso+xA==",
|
"integrity": "sha512-biU7sk+jxHgVASfobg2T5ttxOGGSt69wEVBC51sHHOEaKAAdzHBLV/I2l9Rf61UzClhliZwNouYhqIso4a3HYg==",
|
||||||
|
"license": "Unlicense",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@noble/ciphers": "^0.5.1",
|
"@noble/ciphers": "^0.5.1",
|
||||||
"@noble/curves": "1.2.0",
|
"@noble/curves": "1.2.0",
|
||||||
@@ -18917,7 +18918,7 @@
|
|||||||
"@scure/bip39": "1.2.1"
|
"@scure/bip39": "1.2.1"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"nostr-wasm": "v0.1.0"
|
"nostr-wasm": "0.1.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"typescript": ">=5.0.0"
|
"typescript": ">=5.0.0"
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
"lru-cache": "^10.2.0",
|
"lru-cache": "^10.2.0",
|
||||||
"luxon": "^3.4.4",
|
"luxon": "^3.4.4",
|
||||||
"merkletreejs": "^0.3.11",
|
"merkletreejs": "^0.3.11",
|
||||||
"nostr-tools": "^2.7.2",
|
"nostr-tools": "^2.10.4",
|
||||||
"notiwind": "^2.0.2",
|
"notiwind": "^2.0.2",
|
||||||
"papaparse": "^5.4.1",
|
"papaparse": "^5.4.1",
|
||||||
"pina": "^0.20.2204228",
|
"pina": "^0.20.2204228",
|
||||||
|
|||||||
97
src/components/ImageViewer.vue
Normal file
97
src/components/ImageViewer.vue
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
<template>
|
||||||
|
<Teleport to="body">
|
||||||
|
<Transition name="fade">
|
||||||
|
<div
|
||||||
|
v-if="isOpen"
|
||||||
|
class="fixed inset-0 z-50 flex flex-col bg-black/90"
|
||||||
|
>
|
||||||
|
<!-- Header bar - fixed height to prevent overlap -->
|
||||||
|
<div class="h-16 flex justify-between items-center px-4 bg-black">
|
||||||
|
<button
|
||||||
|
class="text-white text-2xl p-2 rounded-full hover:bg-white/10"
|
||||||
|
@click="close"
|
||||||
|
>
|
||||||
|
<fa icon="xmark" />
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<!-- Mobile share button -->
|
||||||
|
<button
|
||||||
|
v-if="isMobile"
|
||||||
|
class="text-white text-xl p-2 rounded-full hover:bg-white/10"
|
||||||
|
@click="handleShare"
|
||||||
|
>
|
||||||
|
<fa icon="ellipsis" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Image container - fill remaining space -->
|
||||||
|
<div class="flex-1 flex items-center justify-center p-2">
|
||||||
|
<div class="w-full h-full flex items-center justify-center">
|
||||||
|
<img
|
||||||
|
:src="imageUrl"
|
||||||
|
class="max-h-[calc(100vh-5rem)] w-full h-full object-contain"
|
||||||
|
@click.stop
|
||||||
|
alt="expanded shared content"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Transition>
|
||||||
|
</Teleport>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { Component, Vue, Prop } from "vue-facing-decorator";
|
||||||
|
import { UAParser } from "ua-parser-js";
|
||||||
|
|
||||||
|
@Component({ emits: ["update:isOpen"] })
|
||||||
|
export default class ImageViewer extends Vue {
|
||||||
|
@Prop() imageUrl!: string;
|
||||||
|
@Prop() imageData!: Blob | null;
|
||||||
|
@Prop() isOpen!: boolean;
|
||||||
|
|
||||||
|
userAgent = new UAParser();
|
||||||
|
|
||||||
|
get isMobile() {
|
||||||
|
const os = this.userAgent.getOS().name;
|
||||||
|
return os === "iOS" || os === "Android";
|
||||||
|
}
|
||||||
|
|
||||||
|
close() {
|
||||||
|
this.$emit("update:isOpen", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
async handleShare() {
|
||||||
|
const os = this.userAgent.getOS().name;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (os === "iOS" || os === "Android") {
|
||||||
|
if (navigator.share) {
|
||||||
|
// Always share the URL since it's more reliable across platforms
|
||||||
|
await navigator.share({
|
||||||
|
url: this.imageUrl
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Fallback for browsers without share API
|
||||||
|
window.open(this.imageUrl, "_blank");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.warn("Share failed, opening in new tab:", error);
|
||||||
|
window.open(this.imageUrl, "_blank");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.fade-enter-active,
|
||||||
|
.fade-leave-active {
|
||||||
|
transition: opacity 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fade-enter-from,
|
||||||
|
.fade-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -281,7 +281,7 @@
|
|||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<span class="col-span-10 justify-self-stretch">
|
<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
|
<!-- show giver and/or receiver profiles... which seemed like a good idea but actually adds clutter
|
||||||
<span
|
<span
|
||||||
v-if="
|
v-if="
|
||||||
@@ -315,7 +315,7 @@
|
|||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
-->
|
-->
|
||||||
<span class="pl-2">
|
<span class="pl-2 block break-words">
|
||||||
{{ giveDescription(record) }}
|
{{ giveDescription(record) }}
|
||||||
</span>
|
</span>
|
||||||
<a @click="onClickLoadClaim(record.jwtId)">
|
<a @click="onClickLoadClaim(record.jwtId)">
|
||||||
@@ -346,10 +346,18 @@
|
|||||||
</router-link>
|
</router-link>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="record.image" class="flex justify-center">
|
<div v-if="record.image" class="w-full">
|
||||||
<a :href="record.image" target="_blank">
|
<div
|
||||||
<img :src="record.image" class="h-48 mt-2 rounded-xl" />
|
class="cursor-pointer"
|
||||||
</a>
|
@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>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -368,6 +376,12 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<ChoiceButtonDialog ref="choiceButtonDialog" />
|
<ChoiceButtonDialog ref="choiceButtonDialog" />
|
||||||
|
|
||||||
|
<ImageViewer
|
||||||
|
:image-url="selectedImage"
|
||||||
|
:image-data="selectedImageData"
|
||||||
|
v-model:is-open="isImageViewerOpen"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
@@ -386,6 +400,7 @@ import QuickNav from "@/components/QuickNav.vue";
|
|||||||
import TopMessage from "@/components/TopMessage.vue";
|
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 {
|
import {
|
||||||
AppString,
|
AppString,
|
||||||
NotificationIface,
|
NotificationIface,
|
||||||
@@ -455,6 +470,7 @@ interface GiveRecordWithContactInfo extends GiveSummaryRecord {
|
|||||||
QuickNav,
|
QuickNav,
|
||||||
TopMessage,
|
TopMessage,
|
||||||
UserNameDialog,
|
UserNameDialog,
|
||||||
|
ImageViewer,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
export default class HomeView extends Vue {
|
export default class HomeView extends Vue {
|
||||||
@@ -489,6 +505,10 @@ export default class HomeView extends Vue {
|
|||||||
}> = [];
|
}> = [];
|
||||||
showShortcutBvc = false;
|
showShortcutBvc = false;
|
||||||
userAgentInfo = new UAParser(); // see https://docs.uaparser.js.org/v2/api/ua-parser-js/get-os.html
|
userAgentInfo = new UAParser(); // see https://docs.uaparser.js.org/v2/api/ua-parser-js/get-os.html
|
||||||
|
selectedImage = "";
|
||||||
|
selectedImageData: Blob | null = null;
|
||||||
|
isImageViewerOpen = false;
|
||||||
|
imageCache: Map<string, Blob | null> = new Map();
|
||||||
|
|
||||||
async mounted() {
|
async mounted() {
|
||||||
try {
|
try {
|
||||||
@@ -970,5 +990,21 @@ export default class HomeView extends Vue {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async cacheImageData(event: Event, imageUrl: string) {
|
||||||
|
try {
|
||||||
|
// For images that might fail CORS, just store the URL
|
||||||
|
// The Web Share API will handle sharing the URL appropriately
|
||||||
|
this.imageCache.set(imageUrl, null);
|
||||||
|
} catch (error) {
|
||||||
|
console.warn("Failed to cache image:", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async openImageViewer(imageUrl: string) {
|
||||||
|
this.selectedImageData = this.imageCache.get(imageUrl) ?? null;
|
||||||
|
this.selectedImage = imageUrl;
|
||||||
|
this.isImageViewerOpen = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -239,8 +239,8 @@ import {
|
|||||||
import {
|
import {
|
||||||
accountFromExtendedKey,
|
accountFromExtendedKey,
|
||||||
extendedKeysFromSeedWords,
|
extendedKeysFromSeedWords,
|
||||||
} from "nostr-tools/nip06";
|
} from "nostr-tools/lib/types/nip06";
|
||||||
import { finalizeEvent, serializeEvent } from "nostr-tools/pure";
|
import { finalizeEvent, serializeEvent } from "nostr-tools";
|
||||||
import { Component, Vue } from "vue-facing-decorator";
|
import { Component, Vue } from "vue-facing-decorator";
|
||||||
import { LMap, LMarker, LTileLayer } from "@vue-leaflet/vue-leaflet";
|
import { LMap, LMarker, LTileLayer } from "@vue-leaflet/vue-leaflet";
|
||||||
import { RouteLocationNormalizedLoaded, Router } from "vue-router";
|
import { RouteLocationNormalizedLoaded, Router } from "vue-router";
|
||||||
|
|||||||
Reference in New Issue
Block a user