Skip to content

Add contact card, config options, translation support - #5

Merged
jpettitt merged 13 commits into
mainfrom
dev
Mar 23, 2026
Merged

Add contact card, config options, translation support#5
jpettitt merged 13 commits into
mainfrom
dev

Conversation

@jpettitt

Copy link
Copy Markdown
Owner
  • adds a card to display contacts
  • add support for sections view sizing
  • add translations support and machine translations: Dutch, French, German

jpettitt and others added 13 commits March 22, 2026 15:15
Run `git tag v1.x.x && git push --tags` to publish a release.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ith rAF retry

Same fix applied to card.ts — observe `this` (host element the grid sizes)
instead of ha-card, and retry via rAF loop until clientHeight is non-zero so
clipped rows are hidden on first render without waiting for a resize event.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Start ha-card with visibility:hidden when grid_options.rows is set.
After the first successful trim pass, clear visibility so the card
appears already clipped — no visible flicker of overflowing rows.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace ResizeObserver with a simpler approach: on every render that has
grid_options.rows set, immediately hide the host element (this.style.visibility),
then rAF-retry until this.clientHeight is non-zero, run trim showing/hiding
rows as needed, then reveal. No observers, no flicker.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
display:none removes rows from layout causing reflow and flicker.
visibility:hidden keeps layout stable — overflow:hidden on ha-card
clips fully-out-of-bounds rows, and the partial boundary row is
invisibly hidden without any geometry change.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…fter 10 frames

- Compare offsetTop+offsetHeight against card.clientHeight (elements are
  positioned relative to card, not the host element)
- Fall back to this.clientHeight if card has no height yet
- After 10 retries with h=0, reveal unconditionally to prevent permanently
  hidden cards in non-grid contexts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Set opacity:0 on the host so the browser lays out the card and computes
clientHeight immediately. After one rAF the height is available, trim runs
to hide overflowing rows with visibility:hidden, then opacity is cleared.
No retry loop or fallback needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- src/translations/en.json — all UI strings keyed by path (card.*, time.*, editor.*)
- src/localize.ts — makeLocalize(lang) returns a LocalizeFunc; falls back to 'en'
- helpers.ts — formatLastSeen now accepts a LocalizeFunc for time strings
- card.ts, contact-card.ts, editor.ts — all hardcoded strings replaced with t() calls
- tsconfig.json — resolveJsonModule: true for JSON imports
- rollup.config.mjs — @rollup/plugin-json added to bundle translations
- package.json — @rollup/plugin-json dev dependency added

To add a new language: create src/translations/<lang>.json and add it to
the languages map in src/localize.ts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- scripts/translate.mjs — reads en.json, translates missing keys via Claude
  API (or DeepL with TRANSLATE_BACKEND=deepl), writes fr/nl/de JSON files.
  Incremental: only fills missing keys, preserving manual corrections.
  Protects {placeholder} and <html> tokens with sentinels before API call.
- scripts/check-translations.mjs — CI lint: exits 1 if any target file is
  missing keys from en.json (no API key required).
- src/localize.ts — imports fr/nl/de; languages map extended.
- src/translations/fr.json, nl.json, de.json — empty placeholders (fall back
  to English until translated). Run: ANTHROPIC_API_KEY=sk-... npm run translate
- package.json — translate, translate:dry, check-translations npm scripts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…on note

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jpettitt
jpettitt merged commit 3d07e04 into main Mar 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant