노트북 관리 UI 완성

🎯 주요 개선사항:
- 노트북 목록 조회/표시 기능 완성
- 노트북 생성/편집/삭제 모달 구현
- 토스트 알림 시스템 추가 (alert 대신)
- 노트북 통계 대시보드 표시
- 노트북별 노트 관리 및 빠른 노트 생성 기능
- URL 파라미터를 통한 노트북 자동 설정

🔧 기술적 개선:
- CSS line-clamp 클래스 추가
- 필드명 불일치 수정 (notebook.name → notebook.title)
- 삭제 확인 모달로 UX 개선
- 노트 에디터에서 노트북 자동 설정 지원

📱 UI/UX 개선:
- 노트북 카드 호버 효과 및 색상 테마
- 빈 노트북 상태 처리 및 안내
- 반응형 그리드 레이아웃
- 로딩 상태 및 에러 처리 개선
This commit is contained in:
Hyungi Ahn
2025-09-02 16:38:47 +09:00
parent d01cdeb2f5
commit 0dc4e3523f
6 changed files with 632 additions and 24 deletions

View File

@@ -54,13 +54,21 @@ function noteEditorApp() {
return;
}
// URL에서 노트 ID 확인 (편집 모드)
// URL에서 노트 ID 및 노트북 정보 확인
const urlParams = new URLSearchParams(window.location.search);
this.noteId = urlParams.get('id');
const notebookId = urlParams.get('notebook_id');
const notebookName = urlParams.get('notebook_name');
// 노트북 목록 로드
await this.loadNotebooks();
// URL에서 노트북이 지정된 경우 자동 설정
if (notebookId && !this.noteId) { // 새 노트 생성 시에만
this.noteData.notebook_id = notebookId;
console.log('📚 노트북 자동 설정:', notebookName || notebookId);
}
if (this.noteId) {
this.isEditing = true;
await this.loadNote(this.noteId);

View File

@@ -7,6 +7,13 @@ window.notebooksApp = () => ({
saving: false,
error: '',
// 알림 시스템
notification: {
show: false,
message: '',
type: 'info' // 'success', 'error', 'info'
},
// 필터링
searchQuery: '',
activeOnly: true,
@@ -18,7 +25,10 @@ window.notebooksApp = () => ({
// 모달 상태
showCreateModal: false,
showEditModal: false,
showDeleteModal: false,
editingNotebook: null,
deletingNotebook: null,
deleting: false,
// 노트북 폼
notebookForm: {
@@ -168,7 +178,12 @@ window.notebooksApp = () => ({
// 노트북 열기 (노트 목록으로 이동)
openNotebook(notebook) {
window.location.href = `/notes.html?notebook_id=${notebook.id}&notebook_name=${encodeURIComponent(notebook.name)}`;
window.location.href = `/notes.html?notebook_id=${notebook.id}&notebook_name=${encodeURIComponent(notebook.title)}`;
},
// 노트북에 노트 생성
createNoteInNotebook(notebook) {
window.location.href = `/note-editor.html?notebook_id=${notebook.id}&notebook_name=${encodeURIComponent(notebook.title)}`;
},
// 노트북 편집
@@ -185,22 +200,37 @@ window.notebooksApp = () => ({
this.showEditModal = true;
},
// 노트북 삭제
async deleteNotebook(notebook) {
if (!confirm(`"${notebook.title}" 노트북을 삭제하시겠습니까?\n\n${notebook.note_count > 0 ? `포함된 ${notebook.note_count}개의 노트는 미분류 상태가 됩니다.` : ''}`)) {
return;
}
// 노트북 삭제 (모달 표시)
deleteNotebook(notebook) {
this.deletingNotebook = notebook;
this.showDeleteModal = true;
},
// 삭제 확인
async confirmDeleteNotebook() {
if (!this.deletingNotebook) return;
this.deleting = true;
try {
await this.api.deleteNotebook(notebook.id, true); // force=true
await this.api.deleteNotebook(this.deletingNotebook.id, true); // force=true
this.showNotification('노트북이 삭제되었습니다.', 'success');
this.closeDeleteModal();
await this.refreshNotebooks();
} catch (error) {
console.error('노트북 삭제 실패:', error);
this.showNotification('노트북 삭제에 실패했습니다.', 'error');
} finally {
this.deleting = false;
}
},
// 삭제 모달 닫기
closeDeleteModal() {
this.showDeleteModal = false;
this.deletingNotebook = null;
this.deleting = false;
},
// 노트북 저장
async saveNotebook() {
if (!this.notebookForm.title.trim()) {
@@ -266,12 +296,15 @@ window.notebooksApp = () => ({
// 알림 표시
showNotification(message, type = 'info') {
if (type === 'error') {
alert('❌ ' + message);
} else if (type === 'success') {
alert('✅ ' + message);
} else {
alert(' ' + message);
}
this.notification = {
show: true,
message: message,
type: type
};
// 3초 후 자동으로 숨김
setTimeout(() => {
this.notification.show = false;
}, 3000);
}
});