fix(frontend): 검색 결과 멤버 표시 오류 수정

- getMemberList 헬퍼 함수 추가 (검색 결과/일반 데이터 모두 처리)
- 검색 결과의 members가 문자열 배열인 경우 처리
- AdminSchedule.jsx trim() 오류 수정

수정 파일:
- pc/public/Schedule.jsx
- pc/admin/AdminSchedule.jsx
- mobile/public/Schedule.jsx

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
caadiq 2026-01-21 16:22:44 +09:00
parent 3ee41beb46
commit b4c393c20a
3 changed files with 58 additions and 8 deletions

View file

@ -10,6 +10,24 @@ import { getTodayKST } from '../../../utils/date';
import { getSchedules, searchSchedules } from '../../../api/public/schedules'; import { getSchedules, searchSchedules } from '../../../api/public/schedules';
import useScheduleStore from '../../../stores/useScheduleStore'; import useScheduleStore from '../../../stores/useScheduleStore';
// ( )
const getMemberList = (schedule) => {
// member_names
if (schedule.member_names) {
return schedule.member_names.split(',').map(n => n.trim()).filter(Boolean);
}
// members
if (Array.isArray(schedule.members) && schedule.members.length > 0) {
// ( )
if (typeof schedule.members[0] === 'string') {
return schedule.members.filter(Boolean);
}
// ( )
return schedule.members.map(m => m.name).filter(Boolean);
}
return [];
};
// //
const fireBirthdayConfetti = () => { const fireBirthdayConfetti = () => {
const duration = 3000; const duration = 3000;
@ -937,8 +955,7 @@ function MobileSchedule() {
// () - // () -
function ScheduleCard({ schedule, categoryColor, categories, delay = 0, onClick }) { function ScheduleCard({ schedule, categoryColor, categories, delay = 0, onClick }) {
const categoryName = categories.find(c => c.id === (schedule.category?.id || schedule.category_id))?.name || '미분류'; const categoryName = categories.find(c => c.id === (schedule.category?.id || schedule.category_id))?.name || '미분류';
const memberNames = schedule.member_names || schedule.members?.map(m => m.name).join(',') || ''; const memberList = getMemberList(schedule);
const memberList = memberNames.split(',').filter(name => name.trim());
// //
const parseDate = (dateStr) => { const parseDate = (dateStr) => {
@ -1041,8 +1058,7 @@ function ScheduleCard({ schedule, categoryColor, categories, delay = 0, onClick
// - // -
function TimelineScheduleCard({ schedule, categoryColor, categories, delay = 0, onClick }) { function TimelineScheduleCard({ schedule, categoryColor, categories, delay = 0, onClick }) {
const categoryName = categories.find(c => c.id === (schedule.category?.id || schedule.category_id))?.name || '미분류'; const categoryName = categories.find(c => c.id === (schedule.category?.id || schedule.category_id))?.name || '미분류';
const memberNames = schedule.member_names || schedule.members?.map(m => m.name).join(',') || ''; const memberList = getMemberList(schedule);
const memberList = memberNames.split(',').filter(name => name.trim());
return ( return (
<motion.div <motion.div

View file

@ -27,6 +27,24 @@ const decodeHtmlEntities = (text) => {
return textarea.value; return textarea.value;
}; };
// ( )
const getMemberList = (schedule) => {
// member_names
if (schedule.member_names) {
return schedule.member_names.split(',').map(n => n.trim()).filter(Boolean);
}
// members
if (Array.isArray(schedule.members) && schedule.members.length > 0) {
// ( )
if (typeof schedule.members[0] === 'string') {
return schedule.members.filter(Boolean);
}
// ( )
return schedule.members.map(m => m.name).filter(Boolean);
}
return [];
};
// ID // ID
const CATEGORY_IDS = { const CATEGORY_IDS = {
YOUTUBE: 2, YOUTUBE: 2,
@ -59,8 +77,7 @@ const ScheduleItem = memo(function ScheduleItem({
const isBirthday = schedule.is_birthday || String(schedule.id).startsWith('birthday-'); const isBirthday = schedule.is_birthday || String(schedule.id).startsWith('birthday-');
const categoryColor = getColorStyle(categories.find(c => c.id === schedule.category_id)?.color)?.style?.backgroundColor || '#6b7280'; const categoryColor = getColorStyle(categories.find(c => c.id === schedule.category_id)?.color)?.style?.backgroundColor || '#6b7280';
const categoryName = categories.find(c => c.id === schedule.category_id)?.name || '미분류'; const categoryName = categories.find(c => c.id === schedule.category_id)?.name || '미분류';
const memberNames = schedule.member_names || schedule.members?.map(m => m.name).join(',') || ''; const memberList = getMemberList(schedule);
const memberList = memberNames.split(',').filter(name => name.trim());
return ( return (
<motion.div <motion.div

View file

@ -18,6 +18,24 @@ const decodeHtmlEntities = (text) => {
return textarea.value; return textarea.value;
}; };
// ( )
const getMemberList = (schedule) => {
// member_names
if (schedule.member_names) {
return schedule.member_names.split(',').map(n => n.trim()).filter(Boolean);
}
// members
if (Array.isArray(schedule.members) && schedule.members.length > 0) {
// ( )
if (typeof schedule.members[0] === 'string') {
return schedule.members.filter(Boolean);
}
// ( )
return schedule.members.map(m => m.name).filter(Boolean);
}
return [];
};
// //
const fireBirthdayConfetti = () => { const fireBirthdayConfetti = () => {
const duration = 3000; const duration = 3000;
@ -1227,8 +1245,7 @@ function Schedule() {
</div> </div>
{(() => { {(() => {
const memberNames = schedule.member_names || schedule.members?.map(m => m.name).join(',') || ''; const memberList = getMemberList(schedule);
const memberList = memberNames.split(',').filter(name => name.trim());
if (memberList.length === 0) return null; if (memberList.length === 0) return null;
if (memberList.length === 5) { if (memberList.length === 5) {
return ( return (