add habit goal-period difficulty and habit formation research notes

Ground the 21-day habit myth in actual research (Lally et al. 2010) and let
users pick a target period (21/66/254 days or unlimited) matching that
study's easy/median/hard automaticity timelines when creating a habit,
with progress shown on the habits list.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-19 10:12:17 +09:00
co-authored by Claude Sonnet 5
parent 55918d56d1
commit d212451fe0
15 changed files with 355 additions and 9 deletions
@@ -26,3 +26,18 @@
</label>
<input x-show="alarmOn" x-cloak type="time" name="reminder_time" value="{{ reminder_value|default('') }}" style="margin-top:6px;" />
</div>
<div class="field">
<label>목표 기간 난이도</label>
<div class="difficulty-picker">
{% for d in habit_difficulties %}
<button
type="button"
class="difficulty-pill"
:class="{ selected: difficulty === '{{ d.value }}' }"
@click="difficulty = '{{ d.value }}'"
>{{ difficulty_label(d) }}</button>
{% endfor %}
</div>
<p class="difficulty-hint">습관 자동화까지 걸리는 기간에 대한 실증 연구(Lally et al., 2010, UCL) 기준입니다 — 하는 단순한 습관이 자동화되는 데 걸리는 기간(약 3주), 중은 전체 중앙값, 상은 노력이 많이 드는 습관의 상한(약 8개월)입니다.</p>
</div>
+2
View File
@@ -3,6 +3,7 @@
x-data="{
open: false,
mask: 127,
difficulty: 'medium',
alarmOn: false,
days: ['월', '화', '수', '목', '금', '토', '일'],
}"
@@ -22,6 +23,7 @@
>
<input type="hidden" name="habit_type" value="{{ habit_type }}" />
<input type="hidden" name="weekdays_mask" :value="mask" />
<input type="hidden" name="difficulty" :value="difficulty" />
<div class="field">
<label for="name-{{ habit_type }}">습관 이름</label>
+10
View File
@@ -3,6 +3,7 @@
x-data="{
editing: false,
mask: {{ habit.weekdays_mask }},
difficulty: '{{ habit.difficulty.value }}',
alarmOn: {{ 'true' if habit.reminder_time else 'false' }},
days: ['월', '화', '수', '목', '금', '토', '일'],
}"
@@ -17,6 +18,14 @@
{{ weekday_label(habit.weekdays_mask) }}
{% if habit.reminder_time %}· 알람 {{ habit.reminder_time.strftime("%H:%M") }}{% endif %}
</div>
{% set progress = goal_progress(habit) %}
<div class="goal-progress-badge">
{% if progress %}
목표 {{ difficulty_label(habit.difficulty) }} · {{ progress.elapsed }}/{{ progress.target }}일차{% if progress.reached %} · 목표 기간 달성!{% else %} (D-{{ progress.remaining }}){% endif %}
{% else %}
{{ difficulty_label(habit.difficulty) }}
{% endif %}
</div>
{% set stats = stats_map[habit.id] %}
{% if stats.scheduled_days > 0 %}
<div class="habit-item-stats">
@@ -78,6 +87,7 @@
hx-swap="innerHTML"
>
<input type="hidden" name="weekdays_mask" :value="mask" />
<input type="hidden" name="difficulty" :value="difficulty" />
<div class="field">
<label for="edit-name-{{ habit.id }}">습관 이름</label>