feat(ai-character): 커뮤니티 게시글 관리 기능 구현

This commit is contained in:
Yu Sung
2026-08-01 01:30:39 +09:00
parent f9ed4d0094
commit 20d38e38c0
21 changed files with 2292 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
import type { CommunityPostListItem } from "@/features/community-posts/model/types";
type CommunityPostStatus = Pick<CommunityPostListItem, "isAdult" | "isCommentAvailable" | "isFixed">;
export function formatCommunityPostStatus(post: CommunityPostStatus): string {
const fixedLabel = post.isFixed ? "고정" : "일반";
const commentLabel = post.isCommentAvailable ? "댓글 허용" : "댓글 차단";
const adultLabel = post.isAdult ? "성인 콘텐츠" : "일반 콘텐츠";
return `${fixedLabel} · ${commentLabel} · ${adultLabel}`;
}

View File

@@ -0,0 +1,3 @@
import { createImageCropSource } from "@/shared/lib/create-image-crop-source";
export const createCommunityPostCropSource = createImageCropSource;

View File

@@ -0,0 +1,26 @@
import { useEffect, useState } from "react";
const communityManagementQuery = "(min-width: 768px)";
function getCanManageCommunity(): boolean {
return typeof window === "undefined" || typeof window.matchMedia !== "function" || window.matchMedia(communityManagementQuery).matches;
}
export function useCommunityManagementCapability(): boolean {
const [canManageCommunity, setCanManageCommunity] = useState(getCanManageCommunity);
useEffect(() => {
if (typeof window.matchMedia !== "function") {
return undefined;
}
const mediaQuery = window.matchMedia(communityManagementQuery);
const updateCanManageCommunity = () => setCanManageCommunity(mediaQuery.matches);
updateCanManageCommunity();
mediaQuery.addEventListener("change", updateCanManageCommunity);
return () => mediaQuery.removeEventListener("change", updateCanManageCommunity);
}, []);
return canManageCommunity;
}