supermemory/packages/ui/input/labeled-input.tsx
MaheshtheDev 1706752668 mobile responsiveness pass + connections reauth fix (#959)
Nova mobile pass
- viewport: viewportFit cover for iOS safe-area-inset
- safe-area utilities (pb-safe, pt-safe, bottom-safe-5, scroll-fade-x) in globals.css
- chat FAB pinned above iPhone home indicator; chat sidebar widths responsive across sm/md/lg with min() clamps
- chat input CoT panel max-h capped via min(60dvh, 420px)
- header tab strip swapped from visible scrollbar to scroll-fade-x mask + snap-x
- nova empty state uses svh on mobile, dvh from sm up

Add-memory modal rebuilt for mobile
- mobile shell switched from fullscreen Dialog to vaul Drawer at 85svh with swipe-down dismissal and scaled background
- in-modal header removed; tabs moved to the bottom of the sheet for thumb reach
- four tab compactLabels: Note, Links, Files, Connections
- desktop tabs now render only when !isMobile (no DOM duplication)
- note/link content state lifted to parent so switching tabs preserves typed input
- NoteContent snapshots initialContent via lazy useState so the editor isn't reset on every keystroke
- shared Drawer base uses rounded-t-xl
- removed legacy pt-4 on tab content for mobile

Connections — replace expiresAt with sync-run health
- new useConnectionHealth hook reads the latest sync run and matches auth-failure patterns; backend errorKind field still needed (TODO)
- regex tightened so 401/403 require co-occurring auth/token/grant context; refresh_token requires expired/revoked/invalid/missing qualifier
- badge label changed Disconnected -> Needs reauth
- Reconnect button replaces the sync action when needsReauth, kicks off the same OAuth flow
- per-row reconnect tracking via mutation.variables instead of a single shared id (no race when multiple rows clicked)
- fallback toast when authLink is missing so the spinner can't get stuck
- sync history panel timeline capped at max-h-260 with internal scroll
- useSyncRuns no longer refetches on mount; cache (30s) actually applies, cutting N requests per modal open
2026-05-17 21:49:23 +00:00

51 lines
1.4 KiB
TypeScript

import { cn } from "@lib/utils"
import { Input } from "@ui/components/input"
import { Label1Regular } from "@ui/text/label/label-1-regular"
interface LabeledInputProps extends React.ComponentProps<"div"> {
label?: string
inputType: string
inputPlaceholder: string
error?: string | null
inputProps?: React.ComponentProps<typeof Input>
}
export function LabeledInput({
inputType,
inputPlaceholder,
className,
error,
inputProps,
label,
...props
}: LabeledInputProps) {
return (
<div className={cn("flex flex-col gap-2", className)} {...props}>
{label && (
<Label1Regular className="text-foreground">{label}</Label1Regular>
)}
<Input
className={cn(
"w-full leading-[1.375rem] tracking-[-0.4px] rounded-xl p-4 placeholder:text-muted-foreground/50 text-foreground disabled:cursor-not-allowed disabled:opacity-50",
inputProps?.className,
)}
style={{
height: "44px",
borderRadius: "12px",
border: "1px solid rgba(82, 89, 102, 0.20)",
background: "#070E1B",
boxShadow:
"0 1px 2px 0 rgba(0, 43, 87, 0.10), 0 0 0 1px rgba(43, 49, 67, 0.08) inset, 0 1px 1px 0 rgba(0, 0, 0, 0.08) inset, 0 2px 4px 0 rgba(0, 0, 0, 0.02) inset",
}}
placeholder={inputPlaceholder}
type={inputType}
{...inputProps}
/>
{error && (
<p className="text-sm text-red-500" role="alert">
{error}
</p>
)}
</div>
)
}