310 lines
15 KiB
JavaScript
310 lines
15 KiB
JavaScript
import { defineComponent, ref, reactive, mergeProps, unref, withCtx, createVNode, resolveDirective, createBlock, openBlock, withDirectives, Fragment, renderList, useSSRContext } from 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/vue/index.mjs';
|
|
import { ssrRenderAttrs, ssrRenderComponent, ssrRenderAttr, ssrInterpolate, ssrGetDirectiveProps, ssrRenderList, ssrRenderClass } from 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/vue/server-renderer/index.mjs';
|
|
import { e as empty_user } from './empty_user-DSxcM_ac.mjs';
|
|
import { f as formatTime } from './useDateTime-D8RCoGwW.mjs';
|
|
import { Swiper, SwiperSlide } from 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/swiper/swiper-vue.mjs';
|
|
import { Pagination } from 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/swiper/modules/index.mjs';
|
|
import { i as img_gif } from './post_loading-CMOcYm9B.mjs';
|
|
import { q as useElementSize, u as useRouter$1, a as useConfigStore, b as useUserStore } from './server.mjs';
|
|
import { B as BasicIconOld } from './BasicIconOld-93vAWohq.mjs';
|
|
import { _ as _export_sfc } from './_plugin-vue_export-helper-1tPrXgE0.mjs';
|
|
import { _ as _sfc_main$3 } from './like-B155RLSm.mjs';
|
|
import { a as _sfc_main$7, b as _sfc_main$5, e as _sfc_main$6 } from './moreOptionProduct-CCkPwsB0.mjs';
|
|
import { ContentLoader } from 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/vue-content-loader/dist/vue-content-loader.cjs.js';
|
|
|
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
__name: "Content",
|
|
__ssrInlineRender: true,
|
|
props: {
|
|
media: {},
|
|
name: {},
|
|
id: {},
|
|
scrollSave: {}
|
|
},
|
|
setup(__props) {
|
|
useRouter$1();
|
|
const config = useConfigStore();
|
|
const videos = ref([]);
|
|
const modules = [Pagination];
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
const _directive_lazy = resolveDirective("lazy");
|
|
let _temp0;
|
|
_push(`<div${ssrRenderAttrs(mergeProps({ class: "mt-.5rem" }, _attrs))} data-v-d709ac2f>`);
|
|
_push(ssrRenderComponent(unref(Swiper), {
|
|
pagination: true,
|
|
modules,
|
|
class: ["postConfig !m-unset", __props.media.length > 1 ? "!aspect-square !h-unset" : "!h-fit"]
|
|
}, {
|
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
_push2(`<!--[-->`);
|
|
ssrRenderList(__props.media, (slide) => {
|
|
_push2(ssrRenderComponent(unref(SwiperSlide), {
|
|
class: ["!w-full", __props.media.length > 1 ? "!aspect-square !h-unset" : "!h-fit"]
|
|
}, {
|
|
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
if (_push3) {
|
|
if (slide.type === "video") {
|
|
_push3(`<div class="video-container" data-v-d709ac2f${_scopeId2}><video${ssrRenderAttr("src", unref(config).useDataStorage(slide.url))} playsinline muted loop class="video" data-v-d709ac2f${_scopeId2}></video></div>`);
|
|
} else {
|
|
_push3(`<div class="${ssrRenderClass([__props.media.length > 1 ? "aspect-square" : "", "w-full flex items-center"])}" data-v-d709ac2f${_scopeId2}><img${ssrRenderAttrs(_temp0 = mergeProps({
|
|
alt: unref(config).appName.en,
|
|
class: "w-full"
|
|
}, ssrGetDirectiveProps(_ctx, _directive_lazy, { src: unref(config).useDataStorage(slide.url), loading: unref(img_gif), error: unref(img_gif) })))} data-v-d709ac2f${_scopeId2}>${"textContent" in _temp0 ? ssrInterpolate(_temp0.textContent) : _temp0.innerHTML ?? ""}</div>`);
|
|
}
|
|
} else {
|
|
return [
|
|
slide.type === "video" ? (openBlock(), createBlock("div", {
|
|
key: 0,
|
|
class: "video-container"
|
|
}, [
|
|
createVNode("video", {
|
|
ref_for: true,
|
|
ref_key: "videos",
|
|
ref: videos,
|
|
src: unref(config).useDataStorage(slide.url),
|
|
playsinline: "",
|
|
muted: "",
|
|
loop: "",
|
|
class: "video"
|
|
}, null, 8, ["src"])
|
|
])) : (openBlock(), createBlock("div", {
|
|
key: 1,
|
|
class: ["w-full flex items-center", __props.media.length > 1 ? "aspect-square" : ""]
|
|
}, [
|
|
withDirectives(createVNode("img", {
|
|
alt: unref(config).appName.en,
|
|
class: "w-full"
|
|
}, null, 8, ["alt"]), [
|
|
[_directive_lazy, { src: unref(config).useDataStorage(slide.url), loading: unref(img_gif), error: unref(img_gif) }]
|
|
])
|
|
], 2))
|
|
];
|
|
}
|
|
}),
|
|
_: 2
|
|
}, _parent2, _scopeId));
|
|
});
|
|
_push2(`<!--]-->`);
|
|
} else {
|
|
return [
|
|
(openBlock(true), createBlock(Fragment, null, renderList(__props.media, (slide) => {
|
|
return openBlock(), createBlock(unref(SwiperSlide), {
|
|
class: ["!w-full", __props.media.length > 1 ? "!aspect-square !h-unset" : "!h-fit"]
|
|
}, {
|
|
default: withCtx(() => [
|
|
slide.type === "video" ? (openBlock(), createBlock("div", {
|
|
key: 0,
|
|
class: "video-container"
|
|
}, [
|
|
createVNode("video", {
|
|
ref_for: true,
|
|
ref_key: "videos",
|
|
ref: videos,
|
|
src: unref(config).useDataStorage(slide.url),
|
|
playsinline: "",
|
|
muted: "",
|
|
loop: "",
|
|
class: "video"
|
|
}, null, 8, ["src"])
|
|
])) : (openBlock(), createBlock("div", {
|
|
key: 1,
|
|
class: ["w-full flex items-center", __props.media.length > 1 ? "aspect-square" : ""]
|
|
}, [
|
|
withDirectives(createVNode("img", {
|
|
alt: unref(config).appName.en,
|
|
class: "w-full"
|
|
}, null, 8, ["alt"]), [
|
|
[_directive_lazy, { src: unref(config).useDataStorage(slide.url), loading: unref(img_gif), error: unref(img_gif) }]
|
|
])
|
|
], 2))
|
|
]),
|
|
_: 2
|
|
}, 1032, ["class"]);
|
|
}), 256))
|
|
];
|
|
}
|
|
}),
|
|
_: 1
|
|
}, _parent));
|
|
_push(`<div class="flex bg-[#0195f7] text-white px-3 py-3 items-center justify-between" data-v-d709ac2f><div class="font-semibold text-xs" data-v-d709ac2f>${ssrInterpolate(__props.name)}</div><div class="flex items-center" data-v-d709ac2f><div class="text-xs" data-v-d709ac2f>${ssrInterpolate(unref(config).useString("viewProduct"))}</div>`);
|
|
_push(ssrRenderComponent(BasicIconOld, {
|
|
icon: unref(config).isRTL ? "vuesax-linear:arrow-left-1" : "vuesax-linear:arrow-right-1",
|
|
size: "16"
|
|
}, null, _parent));
|
|
_push(`</div></div></div>`);
|
|
};
|
|
}
|
|
});
|
|
const _sfc_setup$2 = _sfc_main$2.setup;
|
|
_sfc_main$2.setup = (props, ctx) => {
|
|
const ssrContext = useSSRContext();
|
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/home/components/Content.vue");
|
|
return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
|
|
};
|
|
const Content = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-d709ac2f"]]);
|
|
const maxLength = 100;
|
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
__name: "Post",
|
|
__ssrInlineRender: true,
|
|
props: {
|
|
post: {},
|
|
index: {},
|
|
scrollSave: {},
|
|
addLikeLoading: { type: Boolean }
|
|
},
|
|
emits: ["openOption", "openComment", "handleLike", "handleSave"],
|
|
setup(__props, { emit: __emit }) {
|
|
useRouter$1();
|
|
const emits = __emit;
|
|
const config = useConfigStore();
|
|
const expandedPosts = ref({});
|
|
const user = useUserStore();
|
|
const shouldShowMore = (caption) => caption?.length > maxLength;
|
|
function openOption(id) {
|
|
emits("openOption", id);
|
|
}
|
|
const truncatedCaption = (caption) => {
|
|
return shouldShowMore(caption) ? caption?.slice(0, maxLength) + "..." : caption;
|
|
};
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
const _directive_lazy = resolveDirective("lazy");
|
|
let _temp0;
|
|
_push(`<div${ssrRenderAttrs(mergeProps({
|
|
class: "w-full mb-2",
|
|
id: "post-" + __props.post.id
|
|
}, _attrs))}><div class="flex px-3 items-center justify-between"><div class="flex items-center"><img${ssrRenderAttrs(_temp0 = mergeProps({
|
|
alt: "instagram",
|
|
class: "w-2rem h-2rem rounded-full"
|
|
}, ssrGetDirectiveProps(_ctx, _directive_lazy, { src: unref(config).useDataStorage(__props.post?.users?.avatar), loading: unref(empty_user), error: unref(empty_user) })))}>${"textContent" in _temp0 ? ssrInterpolate(_temp0.textContent) : _temp0.innerHTML ?? ""}<div class="ms-2"><div class="text-sm font-semibold">${ssrInterpolate(__props.post?.users?.username)}</div></div></div>`);
|
|
if (__props.post?.users?.id === unref(user).user?.id) {
|
|
_push(`<div>`);
|
|
_push(ssrRenderComponent(BasicIconOld, {
|
|
icon: "vuesax-linear:more",
|
|
class: "rotate-90",
|
|
size: "18",
|
|
onClick: ($event) => openOption(__props.post.id)
|
|
}, null, _parent));
|
|
_push(`</div>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(`</div>`);
|
|
_push(ssrRenderComponent(Content, {
|
|
media: __props.post?.files,
|
|
name: __props.post.title_fa,
|
|
id: __props.post.id,
|
|
scrollSave: __props.scrollSave
|
|
}, null, _parent));
|
|
_push(`<div class="p-4"><div class="flex gap-4 items-center justify-between"><div class="flex items-center gap-4"><div class="flex items-center gap-1"${ssrRenderAttr("aria-disabled", __props.addLikeLoading)}>`);
|
|
_push(ssrRenderComponent(_sfc_main$3, {
|
|
"is-liked": __props.post.likes?.some((x) => x.user_id === unref(user).user?.id)
|
|
}, null, _parent));
|
|
_push(` ${ssrInterpolate(__props.post?.likes?.length ?? 0)}</div><div class="flex items-center gap-1">`);
|
|
_push(ssrRenderComponent(_sfc_main$7, null, null, _parent));
|
|
_push(` ${ssrInterpolate(__props.post?.comments?.length ?? 0)}</div><div class="flex items-center gap-1">`);
|
|
_push(ssrRenderComponent(_sfc_main$5, null, null, _parent));
|
|
_push(`</div></div><div>`);
|
|
_push(ssrRenderComponent(_sfc_main$6, {
|
|
"is-saved": __props.post.saved?.some((x) => x.user_id === unref(user).user?.id)
|
|
}, null, _parent));
|
|
_push(`</div></div><div class="mt-2 text-sm"><span class="font-semibold text-sm ms1">${ssrInterpolate(__props.post?.users?.username)}</span><span class="ms-2 text-caption whitespace-pre-line">${ssrInterpolate(expandedPosts.value[__props.index] ? __props.post?.description : truncatedCaption(__props.post?.description))}</span>`);
|
|
if (shouldShowMore(__props.post?.description)) {
|
|
_push(`<span class="text-gray cursor-pointer ms-1 whitespace-pre-line">${ssrInterpolate(expandedPosts.value[__props.index] ? unref(config).useString("less") : unref(config).useString("more"))}</span>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(`<div class="text-xs mt-1 text-gray-500">${ssrInterpolate(unref(formatTime)(__props.post?.created_at))}</div></div></div></div>`);
|
|
};
|
|
}
|
|
});
|
|
const _sfc_setup$1 = _sfc_main$1.setup;
|
|
_sfc_main$1.setup = (props, ctx) => {
|
|
const ssrContext = useSSRContext();
|
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/Post.vue");
|
|
return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
|
|
};
|
|
const Post = Object.assign(_sfc_main$1, { __name: "Post" });
|
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
__name: "PostCardSkeleton",
|
|
__ssrInlineRender: true,
|
|
setup(__props) {
|
|
const isLoaded = ref(false);
|
|
const skeletonRatio = ref(null);
|
|
const skeletonSize = reactive(
|
|
useElementSize(skeletonRatio, { width: 0, height: 0 }, { box: "border-box" })
|
|
);
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
if (isLoaded.value) {
|
|
_push(`<div${ssrRenderAttrs(mergeProps({
|
|
ref_key: "skeletonRatio",
|
|
ref: skeletonRatio,
|
|
class: "h-fit"
|
|
}, _attrs))}>`);
|
|
_push(ssrRenderComponent(unref(ContentLoader), {
|
|
width: skeletonSize.width,
|
|
height: "800"
|
|
}, {
|
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
_push2(`<circle${ssrRenderAttr("cx", 30)} cy="30" r="20"${_scopeId}></circle><rect x="60" y="25" rx="3" ry="3" width="100" height="10"${_scopeId}></rect><rect x="0" y="60" rx="0" ry="0"${ssrRenderAttr("width", Math.max(100, skeletonSize.width))}${ssrRenderAttr("height", Math.max(0, skeletonSize.width - 100))}${_scopeId}></rect><rect x="20"${ssrRenderAttr("y", Math.max(0, skeletonSize.width - 10))} rx="0" ry="0"${ssrRenderAttr("width", 300)}${ssrRenderAttr("height", 10)}${_scopeId}></rect><rect x="20"${ssrRenderAttr("y", Math.max(0, skeletonSize.width + 10))} rx="0" ry="0"${ssrRenderAttr("width", 300)}${ssrRenderAttr("height", 8)}${_scopeId}></rect>`);
|
|
} else {
|
|
return [
|
|
createVNode("circle", {
|
|
cx: 30,
|
|
cy: "30",
|
|
r: "20"
|
|
}),
|
|
createVNode("rect", {
|
|
x: "60",
|
|
y: "25",
|
|
rx: "3",
|
|
ry: "3",
|
|
width: "100",
|
|
height: "10"
|
|
}),
|
|
createVNode("rect", {
|
|
x: "0",
|
|
y: "60",
|
|
rx: "0",
|
|
ry: "0",
|
|
width: Math.max(100, skeletonSize.width),
|
|
height: Math.max(0, skeletonSize.width - 100)
|
|
}, null, 8, ["width", "height"]),
|
|
createVNode("rect", {
|
|
x: "20",
|
|
y: Math.max(0, skeletonSize.width - 10),
|
|
rx: "0",
|
|
ry: "0",
|
|
width: 300,
|
|
height: 10
|
|
}, null, 8, ["y"]),
|
|
createVNode("rect", {
|
|
x: "20",
|
|
y: Math.max(0, skeletonSize.width + 10),
|
|
rx: "0",
|
|
ry: "0",
|
|
width: 300,
|
|
height: 8
|
|
}, null, 8, ["y"])
|
|
];
|
|
}
|
|
}),
|
|
_: 1
|
|
}, _parent));
|
|
_push(`</div>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
};
|
|
}
|
|
});
|
|
const _sfc_setup = _sfc_main.setup;
|
|
_sfc_main.setup = (props, ctx) => {
|
|
const ssrContext = useSSRContext();
|
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/home/components/PostCardSkeleton.vue");
|
|
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
|
};
|
|
|
|
export { Post as P, _sfc_main as _ };
|