DOKI v1 (0304 ~ 0313)
Dev note는 정식 회고록이 아닌 draft 입니다.
📆 25-03-04
2차 멘토링, 아키텍쳐 구성도 수정
내용 보기
📆 25-03-05
UI 디자인 완료, ERD 4차 수정, SSE 버그 패치, SSE UI↔API 연결
내용 보기
📌 Daily Report
📌 프로젝트 상황
✨ UI Design
오전 시간에 나머지 UI 페이지 디자인을 모두 마쳤다. 작고 소중함.
검색 결과 페이지나 카테고리/지점 필터 후 페이지는 뻔하니까 디자인 안함.
자잘한거 합치면 10페이지 쯤 하는데, 개인 1달에 요정도 볼륨이면 괜찮지? 않을까?
이 이상의 페이지를 추가하느니 그냥 당위성 있는 request UUID나 구현할란다.
✨ ER Diagram
ERD는 4차로 수정했다. 아니 언제까지 수정할거에요??
🐞 Bug Patch
SSE 알림 수신 안되는거 패치했고, UI까지 연결했다. 처음 구현해보는건데 생각보다는 잘 풀렸다.
오히려 UI가 시간의 대부분을 잡아먹고 있다. 진짜 쪼끄만거 붙이는데도 시간이 많이 걸림.
하지만 장점이라면 레이아웃/스타일링 다 수작업이라서, 진짜 무서운 CSS 스파게티 코드는 볼 일이 없다는 것이다.
📆 25-03-06
토스트 UI, table CSS 마개조
내용 보기
📌 Daily Report
📌 프로젝트 상황
운영자 -> 이용자 측의 SSE 토스트 UI가 얼추 끝났다.

그런데 문제가 생겼다.
생긴게 영 마음에 들지 않는다 🤨
애니메이션은 맛있지만 도메인 생각하면 너무 통통 튀는것 같음.
📌 스크립트 로딩 순서 고려하기
// 비회원이거나 로그인한 이용자 (null 체크가 맨 위에 있어야 함)
if (role == null || role.equals("MEMBER")) {
...
model.addAttribute("memberCode", code);
return "index"; // 팝업스토어 목록 페이지로 이동
}
index.html은 layout-member.html을 레이아웃으로 사용하고 있는데,
layout-member.js에서 접근하는 memberCode
가 undefined운데피네로 찍히지 않으려면, 후자와 같이 스크립트 로딩 순서를 조정해야 한다.
📌 의외로 근본 있는 replaceChild
놀랍게도 레퍼런스에 의거하면, replaceChild
는 (dest, src)
형식의 근본을 따르고 있었다.
다시 말해 newNode가 2번째 인자로 들어간다는 뜻이다.
// 토스트 뷰 컨트롤
function showAlarmToast(message, dateTime) {
// parent div (toast box)
const notiToastBoxDiv = document.getElementById('noti-toast-box');
// old div
const notiToastDataDiv = document.getElementById('noti-toast-data');
const notiToastDatetimeDiv = document.getElementById('noti-toast-datetime');
// new div
const newDataDiv = document.createElement("div");
newDataDiv.classList.add('noti-toast-data');
newDataDiv.appendChild(document.createTextNode(message));
const newDatetimeDiv = document.createElement("div");
newDatetimeDiv.classList.add('noti-toast-datetime');
newDatetimeDiv.appendChild(document.createTextNode(dateTime));
// div 교체
notiToastBoxDiv.replaceChild(notiToastDataDiv, newDataDiv); // error
notiToastBoxDiv.replaceChild(notiToastDatetimeDiv, newDatetimeDiv); // error
// 토스트 박스 보여주기
notiToastBoxDiv.classList.add("active");
// 5초 후 토스트 박스 숨기기
setTimeout(() =>{
notiToastBoxDiv.classList.remove("active");
}, 5000)
}
근데 결국엔 replaceWith
라는 더 모던한 방식이 있어서 이를 채택했다.
그리고 새 노드에 id 지정하는거 까먹어서 (-> 최초 replace 이후 getElementById
호출시 터짐)
해당 코드도 추가했다.
// 토스트 뷰 컨트롤
function showAlarmToast(message, dateTime) {
console.log('show toast'); // logging
// parent div (toast box)
const notiToastBoxDiv = document.getElementById('noti-toast-box');
// old div
const notiToastDataDiv = document.getElementById('noti-toast-data');
const notiToastDatetimeDiv = document.getElementById('noti-toast-datetime');
// new div
const newDataDiv = document.createElement("div");
newDataDiv.classList.add('noti-toast-data');
newDataDiv.id = 'noti-toast-data';
newDataDiv.appendChild(document.createTextNode(message));
const newDatetimeDiv = document.createElement("div");
newDatetimeDiv.classList.add('noti-toast-datetime');
newDatetimeDiv.id = 'noti-toast-datetime';
newDatetimeDiv.appendChild(document.createTextNode(dateTime));
// div 교체
notiToastDataDiv.replaceWith(newDataDiv);
notiToastDatetimeDiv.replaceWith(newDatetimeDiv);
// 토스트 박스 보여주기
notiToastBoxDiv.classList.add("active");
// 5초 후 토스트 박스 숨기기
setTimeout(() =>{
console.log('hide toast'); // logging
notiToastBoxDiv.classList.remove("active");
}, 5000)
}
📌 타임리프 동적 class 추가
해당 방법으로 가능하다고 한다.
📌 눈물나는 th
border-radius 적용하기
table에 지정한 border-collapse: collapse;
속성과 radius 속성이 충돌한다더라.
box-shadow와 선택자 노가다로 겨우 해결했는데
겨우 해결한게 스타일링이어서 현타가 왔다. CSS 표준이 많이 발전하길 바람...
table {
width: 100%;
border-collapse: collapse;
border-top-left-radius: 6px;
border-top-right-radius: 6px;
margin-bottom: 48px;
}
th {
font-family: "Pretendard", sans-serif;
color: #6C6C71;
background-color: #FCFCFC;
font-weight: 600;
font-size: 13px;
padding: 13px 16px;
text-align: left;
}
th:first-child {
border-top-left-radius: 6px;
box-shadow: 0 0 0 1px #E2E2E9;
}
th:last-child {
border-top-right-radius: 6px;
box-shadow: 0 0 0 1px #E2E2E9;
}
th:not(:last-child) {
border-right: 1px solid #E2E2E9;
}
th:not(:first-child):not(:last-child) {
box-shadow: 0 -1px 0 #E2E2E9, 0 1px 0 #E2E2E9;
}
