mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 04:17:23 +00:00
Add image support to activities and user pages for comments
This commit is contained in:
@@ -119,6 +119,7 @@ export interface CommentWithResource {
|
||||
content: string;
|
||||
created_at: string;
|
||||
user: User;
|
||||
images: Image[];
|
||||
resource: Resource;
|
||||
}
|
||||
|
||||
|
@@ -6,6 +6,7 @@ import { useTranslation } from "react-i18next";
|
||||
import { MdArrowRight } from "react-icons/md";
|
||||
import { useNavigate } from "react-router";
|
||||
import Loading from "../components/loading.tsx";
|
||||
import {SquareImage} from "../components/image.tsx";
|
||||
|
||||
export default function ActivitiesPage() {
|
||||
const [activities, setActivities] = useState<Activity[]>([]);
|
||||
@@ -97,6 +98,15 @@ function ActivityCard({ activity }: { activity: Activity }) {
|
||||
<div className={"text-sm mx-1 whitespace-pre-wrap"}>
|
||||
{activity.comment?.content}
|
||||
</div>
|
||||
<div
|
||||
className={
|
||||
"grid grid-cols-3 sm:grid-cols-5 md:grid-cols-6 lg:grid-cols-8 gap-2 px-1 py-2"
|
||||
}
|
||||
>
|
||||
{(activity.comment?.images ?? []).map((image) => (
|
||||
<SquareImage key={image.id} image={image} />
|
||||
))}
|
||||
</div>
|
||||
<div className={"flex items-center mt-1"}>
|
||||
<MdArrowRight />
|
||||
<span className={"text-sm text-base-content/80"}>
|
||||
|
@@ -7,6 +7,7 @@ import ResourcesView from "../components/resources_view";
|
||||
import Loading from "../components/loading";
|
||||
import Pagination from "../components/pagination";
|
||||
import { MdOutlineArrowRight } from "react-icons/md";
|
||||
import {SquareImage} from "../components/image.tsx";
|
||||
|
||||
export default function UserPage() {
|
||||
const [user, setUser] = useState<User | null>(null);
|
||||
@@ -207,6 +208,15 @@ function CommentTile({ comment }: { comment: CommentWithResource }) {
|
||||
<div className={"p-2 whitespace-pre-wrap text-sm"}>
|
||||
{limitArticleLength(comment.content, 200)}
|
||||
</div>
|
||||
<div
|
||||
className={
|
||||
"grid grid-cols-3 sm:grid-cols-5 md:grid-cols-6 lg:grid-cols-8 gap-2 p-2"
|
||||
}
|
||||
>
|
||||
{comment.images.map((image) => (
|
||||
<SquareImage key={image.id} image={image} />
|
||||
))}
|
||||
</div>
|
||||
<a
|
||||
className="text-sm text-base-content/80 p-1 hover:text-primary cursor-pointer transition-all"
|
||||
onClick={() => {
|
||||
|
Reference in New Issue
Block a user