tangled
alpha
login
or
join now
xan.lol
/
flushes.app
forked from
atpota.to/flushes.app
0
fork
atom
The 1st decentralized social network for sharing when you're on the toilet. Post a "flush" today! Powered by the AT Protocol.
0
fork
atom
overview
issues
pulls
pipelines
fix
dame-is
3 months ago
3075d61b
801fd10a
+67
-17
2 changed files
expand all
collapse all
unified
split
src
components
EditFlushModal.module.css
EditFlushModal.tsx
+40
src/components/EditFlushModal.module.css
···
99
99
border-color: var(--primary-color);
100
100
}
101
101
102
102
+
.inputWrapper {
103
103
+
display: flex;
104
104
+
align-items: center;
105
105
+
width: 100%;
106
106
+
position: relative;
107
107
+
border: 1px solid var(--input-border);
108
108
+
border-radius: 4px;
109
109
+
background-color: var(--input-background);
110
110
+
}
111
111
+
112
112
+
.inputWrapper:focus-within {
113
113
+
border-color: var(--primary-color);
114
114
+
}
115
115
+
116
116
+
.inputPrefix {
117
117
+
padding: 0.8rem 0.8rem 0.8rem 0.8rem;
118
118
+
font-size: 1rem;
119
119
+
color: var(--text-color);
120
120
+
font-weight: 500;
121
121
+
background-color: var(--input-prefix-background);
122
122
+
border-right: 1px solid var(--input-border);
123
123
+
border-radius: 4px 0 0 4px;
124
124
+
}
125
125
+
126
126
+
.inputWithPrefix {
127
127
+
flex: 1;
128
128
+
border: none;
129
129
+
padding: 0.8rem;
130
130
+
font-size: 1rem;
131
131
+
background: transparent;
132
132
+
border-radius: 0 4px 4px 0;
133
133
+
color: var(--text-color);
134
134
+
font-family: inherit;
135
135
+
}
136
136
+
137
137
+
.inputWithPrefix:focus {
138
138
+
outline: none;
139
139
+
box-shadow: none;
140
140
+
}
141
141
+
102
142
.textInput:focus {
103
143
outline: none;
104
144
border-color: var(--primary);
+27
-17
src/components/EditFlushModal.tsx
···
34
34
// Update form when flushData changes
35
35
useEffect(() => {
36
36
if (flushData) {
37
37
-
setText(flushData.text || '');
37
37
+
// Remove "is " prefix if it exists in the stored text
38
38
+
let displayText = flushData.text || '';
39
39
+
if (displayText.toLowerCase().startsWith('is ')) {
40
40
+
displayText = displayText.substring(3);
41
41
+
}
42
42
+
setText(displayText);
38
43
setSelectedEmoji(flushData.emoji || '🚽');
39
44
setError(null);
40
45
setShowDeleteConfirm(false);
···
52
57
return;
53
58
}
54
59
55
55
-
// Check character limit
56
56
-
if (text.length > 59) {
57
57
-
setError('Your flush status is too long! Please keep it under 59 characters.');
60
60
+
// Check character limit (text + "is " = 56 + 3 = 59)
61
61
+
if (text.length > 56) {
62
62
+
setError('Your flush status is too long! Please keep it under 56 characters (59 total with "is").');
58
63
return;
59
64
}
60
65
···
66
71
67
72
setIsSubmitting(true);
68
73
try {
69
69
-
await onSave(sanitizeText(text), selectedEmoji);
74
74
+
// Add "is " prefix when saving
75
75
+
const fullText = text.trim() ? `is ${text.trim()}` : 'is flushing';
76
76
+
await onSave(sanitizeText(fullText), selectedEmoji);
70
77
onClose();
71
78
} catch (err: any) {
72
79
console.error('Error updating flush:', err);
···
119
126
)}
120
127
121
128
<div className={styles.formGroup}>
122
122
-
<label htmlFor="flush-text">Status Text</label>
123
123
-
<input
124
124
-
id="flush-text"
125
125
-
type="text"
126
126
-
value={text}
127
127
-
onChange={(e) => setText(e.target.value)}
128
128
-
placeholder="is flushing"
129
129
-
maxLength={59}
130
130
-
disabled={isSubmitting}
131
131
-
className={styles.textInput}
132
132
-
/>
129
129
+
<label htmlFor="flush-text">What's your status? (optional)</label>
130
130
+
<div className={styles.inputWrapper}>
131
131
+
<span className={styles.inputPrefix}>is </span>
132
132
+
<input
133
133
+
id="flush-text"
134
134
+
type="text"
135
135
+
value={text}
136
136
+
onChange={(e) => setText(e.target.value)}
137
137
+
placeholder="flushing"
138
138
+
maxLength={56}
139
139
+
disabled={isSubmitting}
140
140
+
className={styles.inputWithPrefix}
141
141
+
/>
142
142
+
</div>
133
143
<div className={styles.charCount}>
134
134
-
{text.length}/59
144
144
+
{text.length + 3}/59
135
145
</div>
136
146
</div>
137
147