feat(ui): increase notes character limit to 2000 and add auto-resize functionality for textareas
This commit is contained in:
@@ -28,7 +28,7 @@ const medicationSchema = z.object({
|
|||||||
looseTablets: z.number().int().min(0).default(0),
|
looseTablets: z.number().int().min(0).default(0),
|
||||||
pillWeightMg: z.number().int().min(1).nullable().optional(),
|
pillWeightMg: z.number().int().min(1).nullable().optional(),
|
||||||
expiryDate: z.string().nullable().optional(),
|
expiryDate: z.string().nullable().optional(),
|
||||||
notes: z.string().max(500).nullable().optional(),
|
notes: z.string().max(2000).nullable().optional(),
|
||||||
intakeRemindersEnabled: z.boolean().default(false),
|
intakeRemindersEnabled: z.boolean().default(false),
|
||||||
blisters: z.array(blisterSchema).min(1).max(12),
|
blisters: z.array(blisterSchema).min(1).max(12),
|
||||||
});
|
});
|
||||||
|
|||||||
+12
-2
@@ -1482,7 +1482,9 @@ function AppContent() {
|
|||||||
onChange={(e) => handleValueChange("notes", e.target.value)}
|
onChange={(e) => handleValueChange("notes", e.target.value)}
|
||||||
placeholder={t('form.placeholders.notes')}
|
placeholder={t('form.placeholders.notes')}
|
||||||
rows={2}
|
rows={2}
|
||||||
maxLength={500}
|
maxLength={2000}
|
||||||
|
className="auto-resize"
|
||||||
|
onInput={(e) => { const t = e.target as HTMLTextAreaElement; t.style.height = 'auto'; t.style.height = t.scrollHeight + 'px'; }}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
@@ -2450,7 +2452,15 @@ function AppContent() {
|
|||||||
</label>
|
</label>
|
||||||
<label className="full">
|
<label className="full">
|
||||||
{t('form.notes')}
|
{t('form.notes')}
|
||||||
<textarea value={form.notes} onChange={(e) => setForm({ ...form, notes: e.target.value })} placeholder={t('form.placeholders.notes')} rows={2} />
|
<textarea
|
||||||
|
value={form.notes}
|
||||||
|
onChange={(e) => setForm({ ...form, notes: e.target.value })}
|
||||||
|
placeholder={t('form.placeholders.notes')}
|
||||||
|
rows={2}
|
||||||
|
maxLength={2000}
|
||||||
|
className="auto-resize"
|
||||||
|
onInput={(e) => { const t = e.target as HTMLTextAreaElement; t.style.height = 'auto'; t.style.height = t.scrollHeight + 'px'; }}
|
||||||
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
{editingId && (() => {
|
{editingId && (() => {
|
||||||
|
|||||||
@@ -488,6 +488,23 @@ textarea {
|
|||||||
min-height: 60px;
|
min-height: 60px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Auto-resize textarea */
|
||||||
|
textarea.auto-resize {
|
||||||
|
resize: none;
|
||||||
|
overflow-y: auto;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
min-height: 100px;
|
||||||
|
max-height: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Mobile textarea improvements */
|
||||||
|
@media (max-width: 600px) {
|
||||||
|
textarea.auto-resize {
|
||||||
|
min-height: 120px;
|
||||||
|
font-size: 16px; /* Prevents iOS zoom on focus */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.static-value {
|
.static-value {
|
||||||
padding: 0.7rem 0.85rem;
|
padding: 0.7rem 0.85rem;
|
||||||
border-radius: var(--btn-radius);
|
border-radius: var(--btn-radius);
|
||||||
@@ -2391,6 +2408,31 @@ textarea {
|
|||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Notes content in modal - auto-sizing box */
|
||||||
|
.med-notes-content {
|
||||||
|
background: var(--bg-secondary);
|
||||||
|
padding: 0.75rem 1rem;
|
||||||
|
border-radius: 8px;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-wrap: break-word;
|
||||||
|
line-height: 1.6;
|
||||||
|
max-height: 300px;
|
||||||
|
overflow-y: auto;
|
||||||
|
-webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Mobile: larger notes box with better touch scrolling */
|
||||||
|
@media (max-width: 600px) {
|
||||||
|
.med-notes-content {
|
||||||
|
min-height: 80px;
|
||||||
|
max-height: 200px;
|
||||||
|
font-size: 1rem;
|
||||||
|
padding: 1rem;
|
||||||
|
touch-action: pan-y; /* Enable vertical touch scrolling */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.med-detail-section h3 {
|
.med-detail-section h3 {
|
||||||
font-size: 0.85rem;
|
font-size: 0.85rem;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
|
|||||||
Reference in New Issue
Block a user