fix(mobile): handle long multi-select user input forms #5118
Closedthuongtin(GitHub profile, opens in a new tab)wants to merge 5 commits into
main fromrefs/pull/5118/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/mobile/src/lib/threadActivity.ts line 1470Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1334,8 +1352,14 @@13341352 draft: PendingUserInputDraftAnswer | undefined,13351353 customAnswer: string,13361354 ): PendingUserInputDraftAnswer {1337- const selectedOptionLabel =1338- customAnswer.trim().length > 0 ? undefined : draft?.selectedOptionLabel;1355+ const selectedOptionLabels =1356+ customAnswer.trim().length > 01357+ ? undefined1358+ : normalizeSelectedOptionLabels(draft?.selectedOptionLabels);13391359 return {13401360 customAnswer,1341- ...(selectedOptionLabel ? { selectedOptionLabel } : {}),1361+ ...(selectedOptionLabels && selectedOptionLabels.length > 0 ? { selectedOptionLabels } : {}),1362+ };1363+}1364+1365+export function togglePendingUserInputOptionSelection(
- apps/mobile/src/features/threads/pendingUserInputLayout.ts line 17OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -0,0 +1,17 @@1+const PENDING_USER_INPUT_MAX_HEIGHT = 560;2+const PENDING_USER_INPUT_VERTICAL_GAP = 12;3+4+export function derivePendingUserInputMaxHeight(input: {5+ readonly windowHeight: number;6+ readonly keyboardHeight: number;7+ readonly navigationHeaderHeight: number;8+ readonly composerOverlapHeight: number;9+}): number {10+ const availableHeight =11+ input.windowHeight -12+ Math.max(0, input.keyboardHeight) -13+ Math.max(0, input.navigationHeaderHeight) -14+ Math.max(0, input.composerOverlapHeight) -15+ PENDING_USER_INPUT_VERTICAL_GAP;16+17+ return Math.min(PENDING_USER_INPUT_MAX_HEIGHT, Math.max(0, availableHeight));apps/mobile/src/features/threads/PendingUserInputCard.tsx line 65OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -69,0 +45,21 @@45+ contentContainerClassName="gap-2.5 pb-1"46+ keyboardShouldPersistTaps="handled"47+ nestedScrollEnabled48+ showsVerticalScrollIndicator49+ style={{ flexShrink: 1 }}50+ >51+ {props.pendingUserInput.questions.map((question) => {52+ const draft = props.drafts[question.id];53+ return (54+ <View key={question.id} className="gap-2 pt-1">55+ <Text className="font-t3-bold text-xs uppercase tracking-[1px] text-neutral-500 dark:text-neutral-500">56+ {question.header}57+ </Text>58+ <Text className="font-sans text-base leading-snug text-neutral-950 dark:text-neutral-50">59+ {question.question}60+ </Text>61+ <View className="flex-row flex-wrap gap-2.5">62+ {question.options.map((option) => {63+ const selected =64+ draft?.selectedOptionLabels?.includes(option.label) === true &&65+ !draft.customAnswer?.trim().length;
thuongtin(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.




Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
14de0cbc-8520-4463-a674-8b8c12f3df36You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share