fix(sirsoft-basic, sirsoft-admin_basic): 모바일 드로어 선호설정 아코디언화 및 뷰포트 개선

모바일 헤더 우측 그룹이 420px 를 요구해 폰 뷰포트에서 통화 선택기가 잘렸다.
언어·통화·배송국가를 드로어로 옮겨 가로 칩으로 통일했으나, 이번엔 드로어가
세로로 길어져 정작 메뉴가 스크롤 밖으로 밀렸다.

언어와 통화·배송국가를 각각 독립 아코디언(기본 접힘)으로 바꾸고, 접힘 상태에서도
트리거에 현재 선택값을 요약 표기해 펼치지 않고 확인할 수 있게 했다. 언어는 템플릿이,
통화·배송국가는 이커머스 주입 조각이 각자 상태를 소유해 서로 간섭하지 않는다.

통화 패널은 새 플래그를 만들지 않고 데스크톱 드롭다운의 기존 토글을 재사용한다 —
portable 오버라이드에서 if 를 생략하면 엔진이 base if 를 상속하므로 자동으로 기본
접힘이 된다. 이 과정에서 모바일로 펼칠 때 전체 화면 배경 오버레이가 드로어 클릭을
가로채는 결함을 함께 차단했다.

그 밖에 모달 좌우 여백, 주문 취소·일괄변경 팝업의 세로 스택 전환, 은행 관리 입력칸
축소, 쇼핑몰 환경설정·쿠폰·엑셀 다운로드 화면의 가로 넘침을 함께 해소했다.
This commit is contained in:
HeuJung committed 2026-07-10 19:27:25 +09:00
1 parent e3c00addd8
commit 0ff4b674ac
49 files changed
+2048 -609

No files matched your search

@@ -297,8 +297,9 @@ export const HtmlEditor: React.FC<HtmlEditorProps> = ({
}, [localMultilingualContent]);
// 다국어 탭 렌더링
// flex-wrap: 로케일이 3개 이상이면 md 미만 뷰포트에서 탭 행이 컨테이너를 넘친다.
const renderLocaleTabs = () => (
<Div className="flex items-center gap-2 mb-3">
<Div className="flex flex-wrap items-center gap-2 mb-3">
{supportedLocales.map(localeCode => {
const isDefault = localeCode === defaultLocale;
const isActive = currentLocale === localeCode;
@@ -485,7 +485,8 @@ export const MultilingualInput: React.FC<MultilingualInputProps> = ({
const renderTabsLayout = () => (
<Div className={className}>
{/* 언어 탭들 + 추가 버튼 (Pill Badge 스타일) */}
<Div className="flex items-center gap-2 mb-3">
{/* flex-wrap: 로케일이 3개 이상이면 md 미만 뷰포트에서 탭 행이 컨테이너를 넘친다. */}
<Div className="flex flex-wrap items-center gap-2 mb-3">
{activeLocales.map(localeCode => (
<Button
key={localeCode}
@@ -1,286 +0,0 @@
/**
* setLocaleHandler 테스트
*/
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { setLocaleHandler } from '../setLocaleHandler';
describe('setLocaleHandler', () => {
// localStorage mock
let localStorageMock: { [key: string]: string } = {};
let setItemSpy: ReturnType<typeof vi.spyOn>;
let reloadSpy: ReturnType<typeof vi.fn>;
beforeEach(() => {
// localStorage mock 설정
localStorageMock = {};
vi.spyOn(Storage.prototype, 'getItem').mockImplementation((key: string) => localStorageMock[key] || null);
setItemSpy = vi.spyOn(Storage.prototype, 'setItem').mockImplementation((key: string, value: string) => {
localStorageMock[key] = value;
});
vi.spyOn(Storage.prototype, 'removeItem').mockImplementation((key: string) => {
delete localStorageMock[key];
});
// window.location.reload mock
reloadSpy = vi.fn();
delete (window as any).location;
(window as any).location = { reload: reloadSpy };
// console 스파이 설정
vi.spyOn(console, 'warn').mockImplementation(() => {});
vi.spyOn(console, 'error').mockImplementation(() => {});
});
afterEach(() => {
vi.clearAllMocks();
});
describe('정상 동작', () => {
it('이벤트 데이터에서 locale 값을 추출하여 localStorage에 저장하고 페이지를 리로드해야 함 (ko)', async () => {
const action = {
type: 'change',
handler: 'setLocale',
target: '{{event.target.value}}',
};
const context = {
event: {
target: { value: 'ko' },
},
};
await setLocaleHandler(action, context);
expect(setItemSpy).toHaveBeenCalledWith('g7_locale', 'ko');
expect(localStorageMock['g7_locale']).toBe('ko');
expect(reloadSpy).toHaveBeenCalled();
});
it('이벤트 데이터에서 locale 값을 추출하여 localStorage에 저장하고 페이지를 리로드해야 함 (en)', async () => {
const action = {
type: 'change',
handler: 'setLocale',
target: '{{event.target.value}}',
};
const context = {
event: {
target: { value: 'en' },
},
};
await setLocaleHandler(action, context);
expect(setItemSpy).toHaveBeenCalledWith('g7_locale', 'en');
expect(localStorageMock['g7_locale']).toBe('en');
expect(reloadSpy).toHaveBeenCalled();
});
it('React Select 형태의 이벤트 데이터를 처리해야 함', async () => {
const action = {
type: 'change',
handler: 'setLocale',
target: '{{event.target.value}}',
};
const context = {
event: {
value: 'ko', // React Select는 value를 직접 전달
},
};
await setLocaleHandler(action, context);
expect(setItemSpy).toHaveBeenCalledWith('g7_locale', 'ko');
expect(localStorageMock['g7_locale']).toBe('ko');
expect(reloadSpy).toHaveBeenCalled();
});
it('action.target에 직접 locale이 지정된 경우 처리해야 함', async () => {
const action = {
type: 'change',
handler: 'setLocale',
target: 'ko', // 템플릿 문자열이 아닌 직접 값
};
await setLocaleHandler(action, undefined);
expect(setItemSpy).toHaveBeenCalledWith('g7_locale', 'ko');
expect(localStorageMock['g7_locale']).toBe('ko');
expect(reloadSpy).toHaveBeenCalled();
});
});
describe('예외 처리', () => {
it('지원하지 않는 locale은 경고를 출력하고 localStorage에 저장하지 않아야 함', async () => {
const action = {
type: 'change',
handler: 'setLocale',
target: '{{event.target.value}}',
};
const context = {
event: {
target: { value: 'fr' }, // 지원하지 않는 언어
},
};
await setLocaleHandler(action, context);
expect(console.warn).toHaveBeenCalledWith('[Handler:SetLocale]', 'Unsupported locale:', 'fr');
expect(setItemSpy).not.toHaveBeenCalled();
expect(reloadSpy).not.toHaveBeenCalled();
});
it('locale 값이 없으면 경고를 출력하고 localStorage에 저장하지 않아야 함', async () => {
const action = {
type: 'change',
handler: 'setLocale',
target: '{{event.target.value}}',
};
const context = {
event: {
target: { value: undefined },
},
};
await setLocaleHandler(action, context);
expect(console.warn).toHaveBeenCalledWith('[Handler:SetLocale]', 'Invalid locale:', undefined);
expect(setItemSpy).not.toHaveBeenCalled();
expect(reloadSpy).not.toHaveBeenCalled();
});
it('템플릿 문자열이 그대로 전달되면 경고를 출력하고 localStorage에 저장하지 않아야 함', async () => {
const action = {
type: 'change',
handler: 'setLocale',
target: '{{event.target.value}}', // 템플릿 문자열 그대로
};
// 이벤트 데이터 없음
await setLocaleHandler(action, undefined);
expect(console.warn).toHaveBeenCalledWith('[Handler:SetLocale]', 'Invalid locale:', undefined);
expect(setItemSpy).not.toHaveBeenCalled();
expect(reloadSpy).not.toHaveBeenCalled();
});
it('locale 값이 문자열이 아니면 경고를 출력하고 localStorage에 저장하지 않아야 함', async () => {
const action = {
type: 'change',
handler: 'setLocale',
target: '{{event.target.value}}',
};
const context = {
event: {
target: { value: 123 }, // 숫자
},
};
await setLocaleHandler(action, context);
expect(console.warn).toHaveBeenCalledWith('[Handler:SetLocale]', 'Invalid locale:', 123);
expect(setItemSpy).not.toHaveBeenCalled();
expect(reloadSpy).not.toHaveBeenCalled();
});
it('빈 문자열은 경고를 출력하고 localStorage에 저장하지 않아야 함', async () => {
const action = {
type: 'change',
handler: 'setLocale',
target: '{{event.target.value}}',
};
const context = {
event: {
target: { value: '' },
},
};
await setLocaleHandler(action, context);
expect(console.warn).toHaveBeenCalledWith('[Handler:SetLocale]', 'Invalid locale:', '');
expect(setItemSpy).not.toHaveBeenCalled();
expect(reloadSpy).not.toHaveBeenCalled();
});
it('localStorage 저장 실패 시 오류를 출력하고 리로드하지 않아야 함', async () => {
// localStorage.setItem이 실패하도록 모의
const setItemError = new Error('Storage quota exceeded');
vi.spyOn(Storage.prototype, 'setItem').mockImplementation(() => {
throw setItemError;
});
const action = {
type: 'change',
handler: 'setLocale',
target: '{{event.target.value}}',
};
const context = {
event: {
target: { value: 'ko' },
},
};
await setLocaleHandler(action, context);
expect(console.error).toHaveBeenCalledWith(
'[Handler:SetLocale]',
'Failed to save locale to localStorage:',
setItemError
);
expect(window.location.reload).not.toHaveBeenCalled();
});
});
describe('다양한 이벤트 데이터 형식', () => {
it('context.event.target.value가 우선순위가 가장 높아야 함', async () => {
const action = {
type: 'change',
handler: 'setLocale',
target: 'en', // 직접 값 지정
};
const context = {
event: {
target: { value: 'ko' }, // 이벤트 데이터 우선
value: 'en', // React Select 형식도 있음
},
};
await setLocaleHandler(action, context);
// context.event.target.value가 우선되어야 함
expect(setItemSpy).toHaveBeenCalledWith('g7_locale', 'ko');
expect(localStorageMock['g7_locale']).toBe('ko');
expect(reloadSpy).toHaveBeenCalled();
});
it('context.event.value가 두 번째 우선순위를 가져야 함', async () => {
const action = {
type: 'change',
handler: 'setLocale',
target: 'en', // 직접 값 지정
};
const context = {
event: {
value: 'ko', // React Select 형식
},
};
await setLocaleHandler(action, context);
// context.event.value가 action.target보다 우선되어야 함
expect(setItemSpy).toHaveBeenCalledWith('g7_locale', 'ko');
expect(localStorageMock['g7_locale']).toBe('ko');
expect(reloadSpy).toHaveBeenCalled();
});
});
});
@@ -4,7 +4,8 @@
* 템플릿에서 사용하는 모든 커스텀 핸들러를 정의합니다.
*/
import { setLocaleHandler } from './setLocaleHandler';
// 언어 관련 핸들러는 엔진 레벨(ActionDispatcher)에서 처리
// setLocale 핸들러는 ActionDispatcher에 빌트인으로 등록되어 있음
import { setThemeHandler, initThemeHandler } from './setThemeHandler';
import { scrollToSectionHandler } from './scrollToSectionHandler';
import { initMenuFromUrlHandler } from './initMenuFromUrlHandler';
@@ -33,7 +34,7 @@ import { downloadAttachmentHandler } from './downloadAttachment';
* 새로운 핸들러 추가 시 여기에만 등록하면 자동으로 ActionDispatcher에 등록됩니다.
*/
export const handlerMap = {
setLocale: setLocaleHandler,
// 언어: setLocale은 엔진 레벨(ActionDispatcher)에서 빌트인으로 처리
setTheme: setThemeHandler,
initTheme: initThemeHandler,
scrollToSection: scrollToSectionHandler,
@@ -1,70 +0,0 @@
/**
* setLocale 핸들러
*
* 사용자가 선택한 언어로 변경합니다.
* localStorage에 g7_locale 값을 저장하고 페이지를 새로고침합니다.
*/
// Logger 설정 (G7Core 초기화 전에도 동작하도록 폴백 포함)
const logger = ((window as any).G7Core?.createLogger?.('Handler:SetLocale')) ?? {
log: (...args: unknown[]) => console.log('[Handler:SetLocale]', ...args),
warn: (...args: unknown[]) => console.warn('[Handler:SetLocale]', ...args),
error: (...args: unknown[]) => console.error('[Handler:SetLocale]', ...args),
};
/**
* 언어 변경 핸들러
*
* ActionDispatcher는 handler(action, context) 형태로 호출합니다.
* context 객체에는 { data, event, props, state, setState, navigate } 등이 포함됩니다.
*
* @param action 액션 정의
* @param context 액션 컨텍스트 (ActionContext 타입)
*/
export async function setLocaleHandler(
action: any,
context?: any
): Promise<void> {
// 1. 이벤트 데이터에서 locale 값 추출
let locale: string | undefined;
const eventData = context?.event;
if (eventData?.target?.value !== undefined && eventData.target.value !== null) {
// HTML Select onChange 이벤트
locale = eventData.target.value;
} else if (eventData?.value !== undefined && eventData.value !== null) {
// React Select 등 커스텀 이벤트 대응
locale = eventData.value;
} else if (action?.target && typeof action.target === 'string' && !action.target.includes('{{')) {
// action.target이 템플릿 문자열이 아닌 경우에만 사용
locale = action.target;
}
// 2. 유효성 검증
if (!locale || typeof locale !== 'string') {
logger.warn('Invalid locale:', locale);
return;
}
// 유효한 로케일 확인 — 활성 언어팩(supported_locales)을 우선, 미초기화 시 ko/en 폴백
const G7Core = (window as any).G7Core;
const validLocales: string[] = G7Core?.config?.('app.supported_locales')
?? G7Core?.state?.get?.('_global.appConfig.supportedLocales')
?? ['ko', 'en'];
if (!validLocales.includes(locale)) {
logger.warn('Unsupported locale:', locale);
return;
}
// 3. localStorage에 저장
try {
localStorage.setItem('g7_locale', locale);
} catch (error) {
logger.error('Failed to save locale to localStorage:', error);
return;
}
// 4. 페이지 새로고침
window.location.reload();
}
@@ -363,6 +363,10 @@
@@ -1328,8 +1332,13 @@
}
/* Pagination */
/*
* flex-wrap: 페이지 수가 많으면 한 줄에 들어가지 않아 좁은 뷰포트에서 콘텐츠 영역을 넘친다
* (주문상세·상품수정의 활동로그 페이지네이션에서 재현). 공통 컴포넌트이므로 여기 한 줄로
* 두 지점이 동시에 해소된다 — 개별 모듈 레이아웃을 고치지 말 것.
*/
.pagination {
@apply flex items-center gap-2;
@apply flex flex-wrap items-center justify-center gap-2;
}
.pagination-btn {
@apply px-3 py-1 text-sm border rounded;
@@ -1524,8 +1533,16 @@
.modal-backdrop {
@apply absolute inset-0 bg-black/50;
}
/*
* max-w-[calc(100vw-2rem)]: 좁은 뷰포트에서 모달이 화면 좌우에 붙지 않도록 16px 여백을 남긴다.
* 인라인 width(기본 500px)는 .modal-wrapper 의 flex 정렬이 이미 문서폭으로 clamp 하므로
* 폭이 넘치지는 않지만, 여백이 0 이 되어 화면에 꽉 찬다.
*
* 주의: `.max-w-full`(max-width:100%)은 이 규칙과 명시도가 같고(0,1,0) 빌드 CSS 에서 더 뒤에
* 정의되므로 승리한다. 레이아웃 className 에 `max-w-full` 을 함께 주면 이 clamp 가 무효화된다.
*/
.modal-container {
@apply relative bg-white rounded-lg shadow-xl max-h-[90vh] overflow-hidden;
@apply relative bg-white rounded-lg shadow-xl max-h-[90vh] overflow-hidden max-w-[calc(100vw-2rem)];
@apply dark:bg-gray-800;
}
.modal-header-row {