47 lines
1.6 KiB
JavaScript
47 lines
1.6 KiB
JavaScript
import { defineComponent, computed, ref, watch, unref, mergeProps, useSSRContext } from 'vue';
|
|
import { ssrRenderAttrs, ssrInterpolate } from 'vue/server-renderer';
|
|
import { a as useConfigStore } from './server.mjs';
|
|
|
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
__name: "Logo",
|
|
__ssrInlineRender: true,
|
|
setup(__props) {
|
|
const config = useConfigStore();
|
|
const logoSrc = computed(() => {
|
|
if (!config.STORAGE_LOGO) {
|
|
console.warn("⚠️ STORAGE_LOGO is empty");
|
|
return "";
|
|
}
|
|
const logo = config.isNightStore ? "logo_full_white.png" : "logo_full.png";
|
|
const fullPath = config.useLogo(logo);
|
|
console.log("🖼️ Logo computed:", fullPath);
|
|
return fullPath;
|
|
});
|
|
ref(false);
|
|
watch(() => config.STORAGE_LOGO, (newVal) => {
|
|
console.log("🔄 STORAGE_LOGO changed:", newVal);
|
|
});
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
if (!logoSrc.value) {
|
|
_push(`<span${ssrRenderAttrs(_attrs)}>${ssrInterpolate(unref(config).appName.en)}</span>`);
|
|
} else {
|
|
_push(`<img${ssrRenderAttrs(mergeProps({
|
|
key: logoSrc.value,
|
|
src: logoSrc.value,
|
|
alt: unref(config).appName.en,
|
|
class: "inline"
|
|
}, _attrs))}>`);
|
|
}
|
|
};
|
|
}
|
|
});
|
|
const _sfc_setup = _sfc_main.setup;
|
|
_sfc_main.setup = (props, ctx) => {
|
|
const ssrContext = useSSRContext();
|
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/Logo.vue");
|
|
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
|
};
|
|
const Logo = Object.assign(_sfc_main, { __name: "Logo" });
|
|
|
|
export { Logo as L };
|