feat(rsvp): split words option, faster countdown, and skip pages RSVP cant open (#3755)

* fix: use string-parsed year to avoid UTC/timezone boundary issues

* feat: Add option to split words in RSVP mode

* fix: change the checkbox to a toggle

* fix(rsvp): speed up countdown from 2.4s to 1.5s

* feat(rsvp): skip to next page when no readable text is found

* fix(rsvp): replace lookbehind regex with lookahead-only split in getHyphenParts
This commit is contained in:
Lex Moulton
2026-04-05 05:29:30 -07:00
committed by GitHub
parent d682fcbb44
commit d53f3b42e2
6 changed files with 141 additions and 33 deletions
@@ -167,6 +167,24 @@ export function segmentCJKText(text: string): string[] {
return words.filter((w) => w.trim().length > 0);
}
/**
* Split a hyphenated word into display parts, keeping a trailing hyphen on
* all but the last part. Only splits on hyphens that are directly between two
* letters (letter-hyphen-letter), so tokens like "--", "-word", "word-", and
* "foo--bar" are returned unchanged.
*
* Examples:
* "well-known" → ["well-", "known"]
* "a-b-c" → ["a-", "b-", "c"]
* "--" → ["--"]
* "hello" → ["hello"]
*/
export function getHyphenParts(word: string): string[] {
if (!/[a-zA-Z]-[a-zA-Z]/.test(word)) return [word];
const parts = word.split(/-(?=[a-zA-Z])/);
return parts.map((part, i) => (i < parts.length - 1 ? part + '-' : part));
}
/**
* Split text into words, handling both CJK and non-CJK text
*/