feat(ai-character): 커뮤니티 게시글 관리 기능 구현
This commit is contained in:
@@ -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}`;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
import { createImageCropSource } from "@/shared/lib/create-image-crop-source";
|
||||
|
||||
export const createCommunityPostCropSource = createImageCropSource;
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user