add file info on mobile

This commit is contained in:
plebeius.eth
2024-03-30 16:18:16 +01:00
parent e51b1485af
commit 761431e084
4 changed files with 55 additions and 27 deletions
+16 -25
View File
@@ -1,38 +1,29 @@
.thumbnailBig { .thumbnailBig {
float: left; background-color: var(--post-thumbnail-background-color);
width: var(--width); width: var(--width);
height: var(--height); height: var(--height);
padding: 3px 20px 5px 0; margin: 3px 20px 5px 0;
display: flex;
justify-content: center;
align-items: center;
} }
.thumbnailSmall { .thumbnailSmall {
float: left; background-color: var(--post-thumbnail-background-color);
width: var(--width); width: var(--width);
height: var(--height); height: var(--height);
padding: 3px 10px 5px 5px; margin: 3px 10px 5px 5px;
display: flex;
justify-content: center;
align-items: center;
} }
.thumbnailWrapperBig { .thumbnailBig img, .thumbnailBig video {
background-color: var(--post-thumbnail-background-color); max-width: 250px;
display: inline-block; max-height: 250px;
height: 250px;
width: 250px;
} }
.thumbnailWrapperSmall { .thumbnailSmall img, .thumbnailSmall video {
background-color: var(--post-thumbnail-background-color); max-width: 125px;
display: inline-block; max-height: 125px;
height: 150px;
width: 150px;
}
.transparentThumbnailWrapper {
background-color: transparent;
opacity: 1;
}
.thumbnail img, .thumbnail video {
object-fit: contain;
width: 100%;
height: 100%;
} }
+16
View File
@@ -40,6 +40,10 @@
background-image: var(--post-unhide-button-background-image); background-image: var(--post-unhide-button-background-image);
} }
.postDesktop .fileThumb {
float: left;
}
.postDesktop .fileText a { .postDesktop .fileText a {
color: var(--post-link-text-color); color: var(--post-link-text-color);
text-decoration: var(--post-link-text-decoration); text-decoration: var(--post-link-text-decoration);
@@ -197,6 +201,18 @@
text-align: right; text-align: right;
} }
.postMobile .fileThumb {
float: left;
}
.postMobile .fileThumb .fileInfo {
padding-bottom: 5px;
text-align: center;
color: var(--post-mobile-file-info-text-color);
font-size: 9pt;
display: block;
}
.postMobile .postMessage { .postMobile .postMessage {
padding: 10px; padding: 10px;
font-size: var(--post-mobile-content-font-size); font-size: var(--post-mobile-content-font-size);
+18 -1
View File
@@ -10,11 +10,20 @@ import { Thumbnail } from '../media';
import { countLinksInCommentReplies } from '../../lib/utils/comment-utils'; import { countLinksInCommentReplies } from '../../lib/utils/comment-utils';
const ReplyDesktop = ({ reply }: Comment) => {
const { content, link, linkHeight, linkWidth, shortCid, subplebbitAddress, timestamp } = reply || {};
return (
<div className={styles.replyDesktop}>
<div className={styles.sideArrows}>{'>>'}</div>
{content}
</div>
);
};
const PostDesktop = ({ post }: Comment) => { const PostDesktop = ({ post }: Comment) => {
const { t } = useTranslation(); const { t } = useTranslation();
const { author, cid, content, link, linkHeight, linkWidth, locked, pinned, postCid, shortCid, subplebbitAddress, timestamp, title } = post || {}; const { author, cid, content, link, linkHeight, linkWidth, locked, pinned, postCid, shortCid, subplebbitAddress, timestamp, title } = post || {};
const { displayName, shortAddress } = author || {}; const { displayName, shortAddress } = author || {};
const replies = useReplies(post);
const displayTitle = title && title.length > 75 ? title.slice(0, 75) + '...' : title; const displayTitle = title && title.length > 75 ? title.slice(0, 75) + '...' : title;
const displayContent = content && content.length > 1000 ? content.slice(0, 1000) + '(...)' : content; const displayContent = content && content.length > 1000 ? content.slice(0, 1000) + '(...)' : content;
@@ -132,6 +141,7 @@ const PostMobile = ({ post }: Comment) => {
{hasThumbnail && ( {hasThumbnail && (
<span className={styles.fileThumb}> <span className={styles.fileThumb}>
<Thumbnail commentMediaInfo={commentMediaInfo} isMobile={true} isReply={false} linkHeight={linkHeight} linkWidth={linkWidth} /> <Thumbnail commentMediaInfo={commentMediaInfo} isMobile={true} isReply={false} linkHeight={linkHeight} linkWidth={linkWidth} />
{commentMediaInfo?.type && <div className={styles.fileInfo}>{commentMediaInfo.type}</div>}
</span> </span>
)} )}
{content && ( {content && (
@@ -162,12 +172,19 @@ const PostMobile = ({ post }: Comment) => {
}; };
const Post = ({ post }: Comment) => { const Post = ({ post }: Comment) => {
const replies = useReplies(post);
return ( return (
<div className={styles.thread}> <div className={styles.thread}>
<div className={styles.postContainer}> <div className={styles.postContainer}>
<PostDesktop post={post} /> <PostDesktop post={post} />
<PostMobile post={post} /> <PostMobile post={post} />
</div> </div>
{replies.map((reply) => (
<div key={reply.cid} className={styles.replyContainer}>
<ReplyDesktop reply={reply} />
</div>
))}
</div> </div>
); );
}; };
+5 -1
View File
@@ -68,7 +68,7 @@
--post-content-link-text-decoration: none; --post-content-link-text-decoration: none;
--post-content-link-text-decoration-hover: none; --post-content-link-text-decoration-hover: none;
/* post */ /* post desktop */
--post-hide-button-background-image: url("/public/assets/buttons/post-expand-minus-red.png"); --post-hide-button-background-image: url("/public/assets/buttons/post-expand-minus-red.png");
--post-unhide-button-background-image: url("/public/assets/buttons/post-expand-plus-red.png"); --post-unhide-button-background-image: url("/public/assets/buttons/post-expand-plus-red.png");
--post-subject-text-color: #cc1105; --post-subject-text-color: #cc1105;
@@ -78,6 +78,8 @@
--post-menu-button-color: #000080; --post-menu-button-color: #000080;
--post-menu-button-color-hover: red; --post-menu-button-color-hover: red;
--post-greentext-color: #789922; --post-greentext-color: #789922;
/* post mobile */
--post-mobile-background-color: #f5e9e1; --post-mobile-background-color: #f5e9e1;
--post-mobile-info-border-bottom: 1px solid #d9bfb7; --post-mobile-info-border-bottom: 1px solid #d9bfb7;
--post-mobile-info-background-color: #ead6ca; --post-mobile-info-background-color: #ead6ca;
@@ -91,7 +93,9 @@
--post-mobile-link-info-text-color: #800; --post-mobile-link-info-text-color: #800;
--post-mobile-abbr-text-color: #707070; --post-mobile-abbr-text-color: #707070;
--post-mobile-abbr-font-size: 10pt; --post-mobile-abbr-font-size: 10pt;
--post-mobile-file-info-text-color: #707070;
--post-mobile-content-font-size: 11pt; --post-mobile-content-font-size: 11pt;
--post-thumbnail-background-color: rgba(0, 0, 0, 0.05); --post-thumbnail-background-color: rgba(0, 0, 0, 0.05);
/* post form */ /* post form */