|
@ -45,8 +45,13 @@ |
|
|
:href="getOpenStreetMapUrl()" |
|
|
:href="getOpenStreetMapUrl()" |
|
|
target="_blank" |
|
|
target="_blank" |
|
|
class="underline" |
|
|
class="underline" |
|
|
> |
|
|
>Map View |
|
|
Map View |
|
|
</a> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div v-if="url"> |
|
|
|
|
|
<fa icon="globe" class="fa-fw text-slate-400"></fa> |
|
|
|
|
|
<a :href="addScheme(url)" target="_blank" class="underline" |
|
|
|
|
|
>{{ domainForWebsite(this.url) }} |
|
|
</a> |
|
|
</a> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
@ -272,6 +277,7 @@ import { accountsDB, db } from "@/db/index"; |
|
|
import { Contact } from "@/db/tables/contacts"; |
|
|
import { Contact } from "@/db/tables/contacts"; |
|
|
import { MASTER_SETTINGS_KEY, Settings } from "@/db/tables/settings"; |
|
|
import { MASTER_SETTINGS_KEY, Settings } from "@/db/tables/settings"; |
|
|
import { accessToken } from "@/libs/crypto"; |
|
|
import { accessToken } from "@/libs/crypto"; |
|
|
|
|
|
import { isGlobalUri } from "@/libs/util"; |
|
|
import { |
|
|
import { |
|
|
didInfo, |
|
|
didInfo, |
|
|
GiverInputInfo, |
|
|
GiverInputInfo, |
|
@ -314,6 +320,7 @@ export default class ProjectViewView extends Vue { |
|
|
timeSince = ""; |
|
|
timeSince = ""; |
|
|
truncatedDesc = ""; |
|
|
truncatedDesc = ""; |
|
|
truncateLength = 40; |
|
|
truncateLength = 40; |
|
|
|
|
|
url = ""; |
|
|
|
|
|
|
|
|
async created() { |
|
|
async created() { |
|
|
await db.open(); |
|
|
await db.open(); |
|
@ -415,6 +422,7 @@ export default class ProjectViewView extends Vue { |
|
|
this.truncatedDesc = this.description.slice(0, this.truncateLength); |
|
|
this.truncatedDesc = this.description.slice(0, this.truncateLength); |
|
|
this.latitude = resp.data.claim?.location?.geo?.latitude || 0; |
|
|
this.latitude = resp.data.claim?.location?.geo?.latitude || 0; |
|
|
this.longitude = resp.data.claim?.location?.geo?.longitude || 0; |
|
|
this.longitude = resp.data.claim?.location?.geo?.longitude || 0; |
|
|
|
|
|
this.url = resp.data.claim?.url || ""; |
|
|
} else if (resp.status === 404) { |
|
|
} else if (resp.status === 404) { |
|
|
// actually, axios throws an error so we never get here |
|
|
// actually, axios throws an error so we never get here |
|
|
this.$notify( |
|
|
this.$notify( |
|
@ -651,5 +659,34 @@ export default class ProjectViewView extends Vue { |
|
|
iconForUnitCode(unitCode: string) { |
|
|
iconForUnitCode(unitCode: string) { |
|
|
return this.UNIT_CODES[unitCode]?.faIcon || "question"; |
|
|
return this.UNIT_CODES[unitCode]?.faIcon || "question"; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// return an HTTPS URL if it's not a global URL |
|
|
|
|
|
addScheme(url: string) { |
|
|
|
|
|
if (!isGlobalUri(url)) { |
|
|
|
|
|
return "https://" + url; |
|
|
|
|
|
} |
|
|
|
|
|
return url; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// return just the domain for display, if possible |
|
|
|
|
|
domainForWebsite(url: string) { |
|
|
|
|
|
try { |
|
|
|
|
|
const hostname = new URL(url).hostname; |
|
|
|
|
|
console.log("hostname", hostname); |
|
|
|
|
|
if (!hostname) { |
|
|
|
|
|
// happens for non-http URLs |
|
|
|
|
|
return url; |
|
|
|
|
|
} else if (url.endsWith(hostname)) { |
|
|
|
|
|
// it's just the domain |
|
|
|
|
|
return hostname; |
|
|
|
|
|
} else { |
|
|
|
|
|
// there's more, but don't bother displaying the whole thing |
|
|
|
|
|
return hostname + "..."; |
|
|
|
|
|
} |
|
|
|
|
|
} catch (error: unknown) { |
|
|
|
|
|
// must not be a valid URL |
|
|
|
|
|
return url; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
|