forked from trent_larson/crowd-funder-for-time-pwa
- Add logger import across multiple view components - Replace console.error/warn/log with logger methods - Update error handling to use structured logging - Improve type safety for error objects - Add crypto-browserify polyfill for browser environment The changes improve logging by: 1. Using consistent logging interface 2. Adding structured error logging 3. Improving error type safety 4. Centralizing logging configuration 5. Fixing browser compatibility issues Affected files: - Multiple view components - vite.config.ts - Build configuration
52 lines
1.1 KiB
Vue
52 lines
1.1 KiB
Vue
<!-- eslint-disable vue/no-v-html -->
|
|
<template>
|
|
<a
|
|
v-if="linkToFull && imageUrl"
|
|
:href="imageUrl"
|
|
target="_blank"
|
|
class="h-full w-full object-contain"
|
|
>
|
|
<div class="h-full w-full object-contain" v-html="generateIdenticon()" />
|
|
</a>
|
|
<div
|
|
v-else
|
|
class="h-full w-full object-contain"
|
|
v-html="generateIdenticon()"
|
|
/>
|
|
</template>
|
|
<script lang="ts">
|
|
import { toSvg } from "jdenticon";
|
|
import { Vue, Component, Prop } from "vue-facing-decorator";
|
|
|
|
const BLANK_CONFIG = {
|
|
lightness: {
|
|
color: [1.0, 1.0],
|
|
grayscale: [1.0, 1.0],
|
|
},
|
|
saturation: {
|
|
color: 0.0,
|
|
grayscale: 0.0,
|
|
},
|
|
backColor: "#0000",
|
|
};
|
|
|
|
@Component
|
|
export default class ProjectIcon extends Vue {
|
|
@Prop entityId = "";
|
|
@Prop iconSize = 0;
|
|
@Prop imageUrl = "";
|
|
@Prop linkToFull = false;
|
|
|
|
generateIdenticon() {
|
|
if (this.imageUrl) {
|
|
return `<img src="${this.imageUrl}" class="w-full h-full object-contain" />`;
|
|
} else {
|
|
const config = this.entityId ? undefined : BLANK_CONFIG;
|
|
const svgString = toSvg(this.entityId, this.iconSize, config);
|
|
return svgString;
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
<style scoped></style>
|