Skip to content

Add language selection to post composer - #137

Open
PastaPastaPasta wants to merge 1 commit into
masterfrom
claude/add-post-language-selection-0eTyI
Open

Add language selection to post composer#137
PastaPastaPasta wants to merge 1 commit into
masterfrom
claude/add-post-language-selection-0eTyI

Conversation

@PastaPastaPasta

@PastaPastaPasta PastaPastaPasta commented Jan 16, 2026

Copy link
Copy Markdown
Owner

Users can now select the language of their post from a dropdown in the compose modal footer. Supports 20 common languages with ISO 639-1 codes.

  • Added LanguageSelector component with dropdown UI
  • Updated DashPlatformClient.createPost to accept language parameter
  • Language defaults to English and resets when modal closes

Summary by CodeRabbit

Release Notes

  • New Features
    • Added language selection for posts. A new language selector dropdown in the compose modal allows users to choose from supported languages with keyboard navigation support.
    • Posts now include language metadata upon creation, with English set as the default.

✏️ Tip: You can customize this high-level summary in your review settings.

Users can now select the language of their post from a dropdown in the
compose modal footer. Supports 20 common languages with ISO 639-1 codes.

- Added LanguageSelector component with dropdown UI
- Updated DashPlatformClient.createPost to accept language parameter
- Language defaults to English and resets when modal closes
@coderabbitai

coderabbitai Bot commented Jan 16, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This pull request adds language support to posts by introducing a new LanguageSelector component in the compose modal and updating the API client to accept and include a language parameter when creating posts, with English as the default language.

Changes

Cohort / File(s) Summary
Compose Modal UI
components/compose/compose-modal.tsx
Added LanguageSelector component with dropdown functionality, keyboard interaction, and outside-click handling. Introduced postLanguage state (default 'en'), integrated language into post creation payload, reset language on modal close, and redesigned footer with two-column layout.
API Client
lib/dash-platform-client.ts
Added optional language parameter to createPost method signature; sets postData.language from provided option or defaults to 'en'.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A language picker hops into view,
With dropdowns that whisper "Hello, what's new?"
From English to world, posts now fly free,
Each one speaks in its own melody! 🌍✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add language selection to post composer' directly summarizes the main change: introducing language selection functionality to the compose modal with a dropdown UI.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

@PastaPastaPasta

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jan 19, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@thepastaclaw

thepastaclaw commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

🕓 Ready for review — 65 ahead in queue (commit 0023ec9)
Queue position: 66/74 · 3 reviews active
ETA: start ~08:36 UTC · complete ~09:12 UTC (median 36m across 30 recent reviews; 3 slots)
Queued 40m ago · Last checked: 2026-07-21 19:20 UTC

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preliminary review — Codex only

The platform write path correctly forwards the selected two-letter language code while preserving English for existing callers. Two blocking composer lifecycle issues remain: Escape from the language popup discards the draft, and Radix dismissal paths retain the selected language for the next composition.

Validated blockers were found in the Codex precheck. Sonnet is deferred until a fresh Codex revalidation clears the blocker gate.

Review provenance

  • Codex reviewers: gpt-5.6-sol — general (failed), gpt-5.6-sol — general (completed)
  • Verifier: gpt-5.6-sol — verifier
  • Sonnet: not run (deferred by blocker gate)

🔴 2 blocking

1 additional finding(s) omitted (not in diff).

🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `components/compose/compose-modal.tsx`:
- [BLOCKING] components/compose/compose-modal.tsx:111-130: Escape from the language menu discards the entire draft
  The custom popup has no Escape handling or nested dismissable/menu primitive. Radix Dialog.Content uses a DismissableLayer whose capture-phase Escape handler calls onDismiss and then onOpenChange(false). Because the root passes setComposeOpen directly, the store replaces threadPosts when this happens. Pressing Escape while the language list is open therefore closes the entire composer and clears the draft instead of dismissing only the popup. Use an accessible Select or DropdownMenu primitive, or coordinate the popup state with Dialog.Content's onEscapeKeyDown so the first Escape closes only the language list.
- [BLOCKING] components/compose/compose-modal.tsx:851: Non-English selection survives normal dialog dismissal
  postLanguage is reset only by handleClose, while Radix Escape and outside-pointer dismissals call this onOpenChange handler directly. ComposeModal remains mounted after its conditional dialog content closes, so selecting Spanish, dismissing through Radix, and opening a fresh composer resets the text but retains and submits language: "es". Route every close transition through handleClose or reset the language whenever isComposeOpen becomes false.

Comment on lines +111 to +130
{isOpen && (
<div className="absolute bottom-full left-0 mb-1 w-40 max-h-60 overflow-y-auto bg-white dark:bg-neutral-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 z-50">
{SUPPORTED_LANGUAGES.map((lang) => (
<button
key={lang.code}
type="button"
onClick={() => {
onChange(lang.code)
setIsOpen(false)
}}
className={`w-full px-3 py-2 text-left text-sm transition-colors ${
lang.code === value
? 'bg-yappr-50 dark:bg-yappr-900/30 text-yappr-600 dark:text-yappr-400 font-medium'
: 'text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700'
}`}
>
{lang.name}
</button>
))}
</div>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Blocking: Escape from the language menu discards the entire draft

The custom popup has no Escape handling or nested dismissable/menu primitive. Radix Dialog.Content uses a DismissableLayer whose capture-phase Escape handler calls onDismiss and then onOpenChange(false). Because the root passes setComposeOpen directly, the store replaces threadPosts when this happens. Pressing Escape while the language list is open therefore closes the entire composer and clears the draft instead of dismissing only the popup. Use an accessible Select or DropdownMenu primitive, or coordinate the popup state with Dialog.Content's onEscapeKeyDown so the first Escape closes only the language list.

source: ['codex']

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.

3 participants