From 650daaaa890e96b39f8e8b52cad2fa679f1ae325 Mon Sep 17 00:00:00 2001 From: al Date: Fri, 9 Aug 2024 22:10:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E5=9B=BE=E7=89=87=E6=AF=94?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Photos/index.js | 20 ++++++----- components/PostItem/index.js | 70 ++++++++++++++++++------------------ 2 files changed, 46 insertions(+), 44 deletions(-) diff --git a/components/Photos/index.js b/components/Photos/index.js index 467b2f6..cc39ede 100644 --- a/components/Photos/index.js +++ b/components/Photos/index.js @@ -35,13 +35,17 @@ export default function Photos({ let imgArr = media.images.map((item) => ({ type: "img", url: item.urls?.[0], - fullwidth:item.w>item.h + // fullwidth:item.w>item.h, + w:item.w, + h:item.h, })); let videoArr = media.videos.map((item) => ({ type: "video", url: item.cover_urls?.[0], mp4: item.urls?.[0], - fullwidth:item.cover_w>item.cover_h + w:item.cover_w, + h:item.cover_h, + // fullwidth:item.cover_w>item.cover_h })); let arr = [...imgArr, ...videoArr]; let newPhotos = [...arr]; @@ -217,8 +221,8 @@ export default function Photos({ {currentPhotos.map((item, index) => { return (
1 ? "h-[24vw]" : ""} `} - style={{ maxWidth: "calc(100vw - 72px)" }} + className={`relative`} + // style={{ width: }} key={index} onClick={() => { if (item?.type == "video") { @@ -242,8 +246,8 @@ export default function Photos({ > {
1 ? "h-[24vw]" : "auto" + className={`overflow-hidden rounded h-full ${ + currentPhotos.length > 1 ? "h-[24vw]" : "" }`} >
} - width={currentPhotos.length > 1 ? "24vw" : item.fullwidth?"100%":"46vw"} - height={currentPhotos.length > 1 ? "24vw" : "100%"} + width={currentPhotos.length > 1 ? "24vw" : item.w>item.h?`calc(100vw - 72px - 2rem)`:`calc(46vw * ${item.w/item.h})`} + height={currentPhotos.length > 1 ? "24vw" : item.w>item.h? `calc((100vw - 72px - 2rem) * ${item.h/item.w})`:"46vw"} className={`rounded max-w-full ${ item?.type == "hid" && type == "space" ? "imageBlur" : "" }`} diff --git a/components/PostItem/index.js b/components/PostItem/index.js index f027b6d..ad39710 100644 --- a/components/PostItem/index.js +++ b/components/PostItem/index.js @@ -1,6 +1,6 @@ "use client"; -import React, { useEffect, useState, useMemo,useCallback } from "react"; +import React, { useEffect, useState, useMemo, useCallback } from "react"; import Photos from "../Photos"; import { useRouter } from "next/navigation"; import PaySpacePost from "../PaySpacePost"; @@ -78,7 +78,6 @@ export default function PostItem({ src={process.env.NEXT_PUBLIC_WEB_ASSETS_URL + "/images/top_post.png"} width={76} className="mb-2" - /> )}
@@ -113,42 +112,40 @@ export default function PostItem({ )} {data?.status === 3 && (

- 审核未通过,请前往APP编辑。 + + 审核未通过,请前往APP编辑。 +

)}
{!data?.is_zone_moment_unlocked ? ( - -
+ ) : ( +
+
- - ) : ( -
- -
-
+ dangerouslySetInnerHTML={{ + __html: findLinksInText(data.text), + }} + style={{ + WebkitLineClamp: + data?.text_visible_range < 999 + ? data?.text_visible_range + : 7, + }} + >
)} {!( @@ -219,11 +216,12 @@ export default function PostItem({ "天前" }有更新`} 空间 */} - 空间{formatZoneUpdateTime( - data?.streamer_ext - ?.days_elapsed_since_the_last_zones_update - )} - 有更新 + 空间 + {formatZoneUpdateTime( + data?.streamer_ext + ?.days_elapsed_since_the_last_zones_update + )} + 有更新