feat: 내 각 아이콘·상세, 이야기 내 글·무한 스크롤, 공유 이미지 얇은 띠, 행사 주소 수집
- 내 각: 아이콘 고르기(my_gak.icon), 카드는 아이콘·점수·아쉬운 조건만, 눌러서 상세(시간대·조건별 점수), 공유는 공통 공유 창 - 이야기: 오늘 쓴 내 글 묶음, '내 글' 칩·탭, 무한 스크롤, 사진 카메라 버튼, 지우기 확인, ⋯ 메뉴 하트 옆, 글 시간 서버 계산(1일 전) - 공유 이미지: 1:1·4:5 는 아래 얇은 띠 한 줄로 카드를 크게 - 행사: 수집 때 주소 저장(event.address), 행사 포스트에 장소·주소·기간 - 히어로 말풍선 '오늘 낮은 / 내일 낮은', 내일을 볼 때 배경도 따라감, 달 보름 순간이 낮이면 뜨는 시각으로 - 단풍 지도 피드 맨 위, 행사·계절 띠 포스트 틀 되돌림, 쇼츠 홈 버튼 가림·닫기 버튼, 하단 여백, 회색 글자 대비 - 토스 앱에선 쇼츠 플레이어를 하나만 띄움
This commit is contained in:
1 parent
3a249c509d
commit
ffe6153148
35 files changed
+566
-185
No files matched your search
Vendored
+3
-2
@@ -106,7 +106,8 @@ def parse_popup(page: str, popup_id: int, since: date) -> Optional[dict]:
|
||||
if start is None or end is None or end < since:
|
||||
return None
|
||||
loc = ld.get("location") or {}
|
||||
sido = sido_of((loc.get("address") or {}).get("streetAddress", ""))
|
||||
address = html.unescape((loc.get("address") or {}).get("streetAddress") or "").strip()
|
||||
sido = sido_of(address)
|
||||
if sido is None:
|
||||
return None
|
||||
geo = loc.get("geo") or {}
|
||||
@@ -115,7 +116,7 @@ def parse_popup(page: str, popup_id: int, since: date) -> Optional[dict]:
|
||||
kind = EventKind.CONCERT
|
||||
return {
|
||||
"source_id": f"{SOURCE_PREFIX}{popup_id}", "sido_code": sido, "name": name[:60],
|
||||
"place_name": place[:60], "start_date": start, "end_date": end, "is_confirmed": True,
|
||||
"place_name": place[:60], "address": address[:120] or None, "start_date": start, "end_date": end, "is_confirmed": True,
|
||||
"source_url": POPUP_URL.format(id=popup_id), "image_url": None,
|
||||
"lat": _coord(geo.get("latitude")), "lon": _coord(geo.get("longitude")), "kind": kind, "icon": EVENT_ICON[kind],
|
||||
}
|
||||
+1
-1
@@ -59,7 +59,7 @@ def parse_seoul_festivals(items: list[dict]) -> list[dict]:
|
||||
continue
|
||||
rows.append({
|
||||
"source_id": f"{SOURCE_PREFIX}{it['cultcode']}", "sido_code": SEOUL, "name": name[:60],
|
||||
"place_name": html.unescape(it.get("facName") or it.get("addr") or "")[:60], "start_date": start, "end_date": end, "is_confirmed": True,
|
||||
"place_name": html.unescape(it.get("facName") or it.get("addr") or "")[:60], "address": html.unescape(it.get("addr") or "")[:120] or None, "start_date": start, "end_date": end, "is_confirmed": True,
|
||||
"source_url": VIEW_URL.format(code=it["cultcode"]),
|
||||
"image_url": IMAGE_URL.format(id=it["atchFileId"]) if it.get("atchFileId") else None,
|
||||
# 이 목록은 xCoord 가 위도, yCoord 가 경도다
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ def parse_festivals(items: list[dict], sido_code: str) -> list[dict]:
|
||||
continue
|
||||
rows.append({
|
||||
"source_id": str(it["contentid"]), "sido_code": sido_code, "name": it.get("title", "")[:60],
|
||||
"place_name": (it.get("addr1") or "")[:60], "start_date": start, "end_date": end, "is_confirmed": True,
|
||||
"place_name": (it.get("addr1") or "")[:60], "address": (it.get("addr1") or "")[:120] or None, "start_date": start, "end_date": end, "is_confirmed": True,
|
||||
"source_url": None, "image_url": (it.get("firstimage") or "").replace("http://", "https://", 1) or None,
|
||||
"lat": _coord(it.get("mapy")), "lon": _coord(it.get("mapx")), "kind": EventKind.FESTIVAL, "icon": EVENT_ICON[EventKind.FESTIVAL],
|
||||
})
|
||||
|
||||
@@ -542,7 +542,11 @@ class FeedService:
|
||||
if len(soon) < rank:
|
||||
return None
|
||||
e = soon[rank - 1]
|
||||
rows = ([Row(label="장소", value=e.event.place_name, place=e.event.place_name)] if e.event.place_name else []) + [Row(label="기간", value=day_range(e.event.start_date, e.event.end_date))]
|
||||
ev = e.event
|
||||
# 장소 이름이 행사 이름과 같으면(출처에 장소가 비어 이름이 들어간 것) 빼고, 주소는 눌러서 지도로
|
||||
rows = ([Row(label="장소", value=ev.place_name, place=ev.address or ev.place_name)] if ev.place_name and ev.place_name != ev.name else [])
|
||||
rows += [Row(label="주소", value=ev.address, place=ev.address)] if ev.address and ev.address != ev.place_name else []
|
||||
rows += [Row(label="기간", value=day_range(ev.start_date, ev.end_date))]
|
||||
caption = _event_caption(e)
|
||||
return PostData(**base, title=e.event.name, icon=e.event.icon, caption=caption,
|
||||
slides=[RowsSlide(kind="rows", eyebrow=f"가까운 행사 · {e.status_label}", line=e.event.name, icon=e.event.icon, rows=rows, image=e.event.image_url, image_credit=image_credit(e.event))],
|
||||
@@ -609,7 +613,10 @@ class FeedService:
|
||||
share_messages=[f"오늘 밤은 {name}이래 🌙"])
|
||||
when = f"{'내일 ' if at.date() > tonight.date() else ''}{at:%H:%M}"
|
||||
if is_full:
|
||||
line = f"오늘 밤 보름달,\n{when}에 가장 둥글어요"
|
||||
# 가장 둥근 순간이 낮(달이 안 보일 때)이면 그 시각 대신 뜨는 시각을 알려 준다
|
||||
daytime = 6 <= at.hour < 17
|
||||
line = (f"오늘 밤 보름달,\n{when}에 가장 둥글어요" if not daytime
|
||||
else f"오늘 밤 보름달,\n{_clock_word(m.rise_at)}에 떠요" if m.rise_at else "오늘 밤 보름달,\n저녁부터 밤새 떠 있어요")
|
||||
caption = "구름 사이로 잠깐씩 보일 수 있어요." if view.startswith("흐려서") else "소원 빌기 딱 좋은 밤이에요 🌕"
|
||||
return PostData(**base, title="오늘 밤 보름달", icon="moon", caption=caption,
|
||||
slides=[RowsSlide(kind="rows", eyebrow=eyebrow, line=line, icon="moon", moon_pct=100, moon_waxing=False, rows=[Row(label="보이는지", value=view), *rows])],
|
||||
|
||||
@@ -40,7 +40,7 @@ class MyGakService:
|
||||
err, rows = await DB_SESSION_MNG.execute_lambda(lambda s: self.crud.of_user(s, user.user_id))
|
||||
return err, rows or []
|
||||
|
||||
async def add(self, user: User, name: str, rule: dict) -> tuple[ErrorType, Optional[MyGak]]:
|
||||
async def add(self, user: User, name: str, rule: dict, icon: Optional[str] = None) -> tuple[ErrorType, Optional[MyGak]]:
|
||||
name = gak_name(name)
|
||||
if name is None:
|
||||
return ErrorType.INVALID_INPUT, None
|
||||
@@ -49,7 +49,7 @@ class MyGakService:
|
||||
return err, None
|
||||
if n >= MAX_PER_USER:
|
||||
return ErrorType.INVALID_INPUT, None
|
||||
return await DB_SESSION_MNG.execute_lambda_write(lambda s: self.crud.add(s, user.user_id, name, rule))
|
||||
return await DB_SESSION_MNG.execute_lambda_write(lambda s: self.crud.add(s, user.user_id, name, rule, icon))
|
||||
|
||||
async def delete(self, user: User, my_gak_id: int) -> ErrorType:
|
||||
err, found = await DB_SESSION_MNG.execute_lambda_write(lambda s: self.crud.delete(s, user.user_id, my_gak_id))
|
||||
@@ -79,5 +79,6 @@ class MyGakService:
|
||||
"score": res.score if res else None, "slot": key if res else None,
|
||||
"slots": {k: v.score for k, v in picked.items()},
|
||||
"reasons": [res.notes[a] for a in axes(r) if res.notes.get(a)] if res else [],
|
||||
"factors": {a: res.factors[a] for a in axes(r) if res.notes.get(a) and a in res.factors} if res else {},
|
||||
})
|
||||
return ErrorType.SUCCESS, (now_slot, out)
|
||||
@@ -66,6 +66,20 @@ def group_age(t: Talk, region_code: Optional[str], now: datetime) -> float:
|
||||
return age - near - LIKE_H * math.log2(1 + t.like_count)
|
||||
|
||||
|
||||
def ago_text(at: datetime, now: datetime) -> str:
|
||||
"""글 시간: 방금 · N분 전 · N시간 전 · N일 전 · N주 전 (하루가 넘으면 시간 대신 날로)"""
|
||||
minutes = max(0, int((now - at).total_seconds() // 60))
|
||||
if minutes < 5:
|
||||
return "방금"
|
||||
if minutes < 60:
|
||||
return f"{minutes}분 전"
|
||||
hours = minutes // 60
|
||||
if hours < 24:
|
||||
return f"{hours}시간 전"
|
||||
days = hours // 24
|
||||
return f"{days}일 전" if days < 7 else f"{days // 7}주 전"
|
||||
|
||||
|
||||
def pick_group(views: list["TalkView"], region_code: Optional[str], now: datetime) -> list["TalkView"]:
|
||||
"""한 사람 한 장, 최대 GROUP_MAX 장. 첫 장은 신고 받은 적 없는 글"""
|
||||
out: list[TalkView] = []
|
||||
|
||||
Reference in new issue
Block a user