@daliovic/cc-statusline 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/prayer.js +19 -5
- package/dist/statusline.js +2 -1
- package/package.json +1 -1
package/dist/prayer.js
CHANGED
|
@@ -120,20 +120,34 @@ export async function getNextPrayer(configLocation, method) {
|
|
|
120
120
|
times,
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
|
-
// Find next prayer
|
|
123
|
+
// Find next prayer, or a recently-passed prayer (within 15 min)
|
|
124
124
|
const now = new Date();
|
|
125
|
-
|
|
125
|
+
const GRACE_MS = 15 * 60 * 1000;
|
|
126
|
+
for (let i = 0; i < PRAYER_ORDER.length; i++) {
|
|
127
|
+
const name = PRAYER_ORDER[i];
|
|
126
128
|
const prayerTime = parseTime(times[name]);
|
|
127
|
-
|
|
128
|
-
|
|
129
|
+
const diffMs = prayerTime.getTime() - now.getTime();
|
|
130
|
+
if (diffMs > 0) {
|
|
131
|
+
// Upcoming prayer
|
|
129
132
|
return {
|
|
130
133
|
name,
|
|
131
134
|
time: times[name],
|
|
132
135
|
timeLeft: formatTimeLeft(diffMs),
|
|
133
136
|
};
|
|
134
137
|
}
|
|
138
|
+
// Prayer has passed — check if within grace period
|
|
139
|
+
const elapsedMs = -diffMs;
|
|
140
|
+
if (elapsedMs <= GRACE_MS) {
|
|
141
|
+
const elapsedMins = Math.floor(elapsedMs / (1000 * 60));
|
|
142
|
+
return {
|
|
143
|
+
name,
|
|
144
|
+
time: times[name],
|
|
145
|
+
timeLeft: `+${elapsedMins}m`,
|
|
146
|
+
elapsed: true,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
135
149
|
}
|
|
136
|
-
// All prayers passed, return tomorrow's Fajr
|
|
150
|
+
// All prayers passed (beyond grace), return tomorrow's Fajr
|
|
137
151
|
const tomorrowFajr = parseTime(times.Fajr);
|
|
138
152
|
tomorrowFajr.setDate(tomorrowFajr.getDate() + 1);
|
|
139
153
|
const diffMs = tomorrowFajr.getTime() - now.getTime();
|
package/dist/statusline.js
CHANGED
|
@@ -299,7 +299,8 @@ async function main() {
|
|
|
299
299
|
if (userConfig.show.prayer) {
|
|
300
300
|
const prayer = await getNextPrayer(userConfig.prayer.location, userConfig.prayer.method);
|
|
301
301
|
if (prayer) {
|
|
302
|
-
|
|
302
|
+
const timeLeftColor = prayer.elapsed ? color.deltaOver : color.dim;
|
|
303
|
+
segments.push(`${color.prayer}\u{1F54C} ${prayer.name} ${prayer.time} ${timeLeftColor}(${prayer.timeLeft})${color.reset}`);
|
|
303
304
|
}
|
|
304
305
|
}
|
|
305
306
|
// MCP Servers
|