Skip to content

Commit a92af9d

Browse files
committed
feat: add time selection for steps in itinerary with improved styling
1 parent fe5d8a6 commit a92af9d

3 files changed

Lines changed: 76 additions & 11 deletions

File tree

apps/web/src/lib/themes/minimal/ItineraryView.svelte

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@
5454
notes: "",
5555
});
5656
57+
let newStepHour = $state("09");
58+
let newStepMinute = $state("00");
59+
60+
$effect(() => {
61+
newStep.time = `${newStepHour}:${newStepMinute}`;
62+
});
63+
5764
async function handleTitleUpdate() {
5865
if (!editedTitle.trim() || editedTitle === itinerary.title) {
5966
isEditingTitle = false;
@@ -93,12 +100,16 @@
93100
94101
// フォームをリセット
95102
newStep = { title: "", date: "", time: "", location: "", notes: "" };
103+
newStepHour = "09";
104+
newStepMinute = "00";
96105
isAddingStep = false;
97106
}
98107
}
99108
100109
function cancelAddStep() {
101110
newStep = { title: "", date: "", time: "", location: "", notes: "" };
111+
newStepHour = "09";
112+
newStepMinute = "00";
102113
isAddingStep = false;
103114
}
104115
</script>
@@ -161,12 +172,20 @@
161172
class="minimal-input"
162173
required
163174
/>
164-
<input
165-
type="time"
166-
bind:value={newStep.time}
167-
class="minimal-input"
168-
required
169-
/>
175+
<div class="minimal-time-picker">
176+
<select bind:value={newStepHour} class="minimal-select" required>
177+
{#each Array.from( { length: 24 }, (_, i) => String(i).padStart(2, "0"), ) as hour}
178+
<option value={hour}>{hour}</option>
179+
{/each}
180+
</select>
181+
<span class="minimal-time-separator">:</span>
182+
<select bind:value={newStepMinute} class="minimal-select" required>
183+
<option value="00">00</option>
184+
<option value="15">15</option>
185+
<option value="30">30</option>
186+
<option value="45">45</option>
187+
</select>
188+
</div>
170189
</div>
171190
<input
172191
type="text"

apps/web/src/lib/themes/minimal/StepList.svelte

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020
2121
let editingStepId = $state<string | null>(null);
2222
let editedStep = $state<Partial<Step>>({});
23+
let editStepHour = $state("09");
24+
let editStepMinute = $state("00");
25+
26+
$effect(() => {
27+
if (editingStepId && editStepHour && editStepMinute) {
28+
editedStep.time = `${editStepHour}:${editStepMinute}`;
29+
}
30+
});
2331
2432
function formatDate(dateStr: string): string {
2533
const date = new Date(dateStr);
@@ -33,11 +41,16 @@
3341
function startEdit(step: Step) {
3442
editingStepId = step.id;
3543
editedStep = { ...step };
44+
const [hour, minute] = step.time.split(":");
45+
editStepHour = hour;
46+
editStepMinute = minute;
3647
}
3748
3849
function cancelEdit() {
3950
editingStepId = null;
4051
editedStep = {};
52+
editStepHour = "09";
53+
editStepMinute = "00";
4154
}
4255
4356
async function handleUpdate() {
@@ -63,6 +76,8 @@
6376
6477
editingStepId = null;
6578
editedStep = {};
79+
editStepHour = "09";
80+
editStepMinute = "00";
6681
}
6782
6883
async function handleDelete(stepId: string) {
@@ -95,11 +110,20 @@
95110
bind:value={editedStep.date}
96111
class="minimal-input"
97112
/>
98-
<input
99-
type="time"
100-
bind:value={editedStep.time}
101-
class="minimal-input"
102-
/>
113+
<div class="minimal-time-picker">
114+
<select bind:value={editStepHour} class="minimal-select">
115+
{#each Array.from( { length: 24 }, (_, i) => String(i).padStart(2, "0"), ) as hour}
116+
<option value={hour}>{hour}</option>
117+
{/each}
118+
</select>
119+
<span class="minimal-time-separator">:</span>
120+
<select bind:value={editStepMinute} class="minimal-select">
121+
<option value="00">00</option>
122+
<option value="15">15</option>
123+
<option value="30">30</option>
124+
<option value="45">45</option>
125+
</select>
126+
</div>
103127
</div>
104128
<input
105129
type="text"

apps/web/src/lib/themes/minimal/theme.css

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,28 @@
103103
gap: 0.5rem;
104104
}
105105

106+
.minimal-time-picker {
107+
display: flex;
108+
align-items: center;
109+
gap: 0.25rem;
110+
}
111+
112+
.minimal-select {
113+
padding: 0.5rem;
114+
border: 1px solid #ddd;
115+
border-radius: 4px;
116+
font-family: inherit;
117+
font-size: 0.875rem;
118+
background: #fff;
119+
cursor: pointer;
120+
flex: 1;
121+
}
122+
123+
.minimal-time-separator {
124+
font-weight: 600;
125+
color: #666;
126+
}
127+
106128
.minimal-form-actions,
107129
.minimal-step-actions {
108130
display: flex;

0 commit comments

Comments
 (0)