Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion apps/web/src/components/ChatView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10378,7 +10378,6 @@ export default function ChatView(props: ChatViewProps) {
<RightPanelSheet
animationDurationMs={panelAnimationsActive ? panelAnimationDurationMs : 0}
open={rightPanelOpen}
underFloatingPreview={previewMiniPlayerVisible}
onClose={closePreviewPanel}
>
<RightPanelTabs
Expand Down
3 changes: 0 additions & 3 deletions apps/web/src/components/CommandPalette.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2966,9 +2966,6 @@ function OpenCommandPaletteDialog(props: {
})
: undefined,
placeholder: inputPlaceholder,
wrapperClassName: isSubmenu
? "[&_[data-slot=autocomplete-start-addon]]:pointer-events-auto"
: undefined,
...(isSubmenu
? {
startAddon: (
Expand Down
2 changes: 0 additions & 2 deletions apps/web/src/components/DiffPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,6 @@ export default function DiffPanel({
<ComboboxList className="max-h-64 min-w-0 overflow-x-hidden">
<ComboboxItem
className="w-full min-w-0 grid-cols-[1rem_minmax(0,1fr)]"
contentClassName="w-full min-w-0 overflow-hidden"
value={AUTOMATIC_BASE_REF}
>
<span className="block min-w-0 truncate">Automatic</span>
Expand All @@ -788,7 +787,6 @@ export default function DiffPanel({
<ComboboxItem
key={choice.id}
className="w-full min-w-0 grid-cols-[1rem_minmax(0,1fr)]"
contentClassName="w-full min-w-0 overflow-hidden"
value={item}
>
<div className="grid w-full min-w-0 grid-cols-[minmax(0,1fr)_2rem] items-center overflow-hidden">
Expand Down
12 changes: 1 addition & 11 deletions apps/web/src/components/RightPanelSheet.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import { type ReactNode } from "react";

import {
RIGHT_PANEL_SHEET_CLASS_NAME,
RIGHT_PANEL_SHEET_LAYER_CLASS_NAME,
} from "../rightPanelLayout";
import { RIGHT_PANEL_SHEET_CLASS_NAME } from "../rightPanelLayout";
import { Sheet, SheetPopup } from "./ui/sheet";

export function RightPanelSheet(props: {
animationDurationMs: number;
children: ReactNode;
open: boolean;
underFloatingPreview?: boolean;
onClose: () => void;
}) {
return (
Expand All @@ -27,12 +23,6 @@ export function RightPanelSheet(props: {
side="right"
showCloseButton={false}
keepMounted
{...(props.underFloatingPreview
? {
backdropClassName: RIGHT_PANEL_SHEET_LAYER_CLASS_NAME,
viewportClassName: RIGHT_PANEL_SHEET_LAYER_CLASS_NAME,
}
: {})}
className={RIGHT_PANEL_SHEET_CLASS_NAME}
>
{props.children}
Expand Down
39 changes: 15 additions & 24 deletions apps/web/src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ import {
import { SidebarContent, SidebarGroup, useSidebar } from "./ui/sidebar";
import { SidebarChromeFooter, SidebarChromeHeader } from "./sidebar/SidebarChrome";
import { SidebarHeaderIconButton, SidebarThreadHeader } from "./sidebar/SidebarThreadHeader";
import { Popover, PopoverPopup, PopoverTrigger } from "./ui/popover";
import { Menu, MenuItem, MenuPopup, MenuSeparator, MenuShortcut, MenuTrigger } from "./ui/menu";
import { Tooltip, TooltipPopup, TooltipProvider, TooltipTrigger } from "./ui/tooltip";
import { MiddleTruncate } from "./ui/middle-truncate";
import {
Expand Down Expand Up @@ -440,7 +440,7 @@ function SidebarThreadTooltip({
* Controlled by the row (which also uses the open state to pin its hover
* actions while the menu is up).
*/
function SnoozePopoverButton(props: {
function SnoozeMenuButton(props: {
open: boolean;
onOpenChange: (open: boolean) => void;
onSnooze: (preset: Pick<SnoozePreset, "snoozedUntil">) => void;
Expand All @@ -454,11 +454,11 @@ function SnoozePopoverButton(props: {
[open, timestampFormat],
);
return (
<Popover open={open} onOpenChange={onOpenChange}>
<Menu open={open} onOpenChange={onOpenChange}>
<Tooltip>
<TooltipTrigger
render={
<PopoverTrigger
<MenuTrigger
render={
<button
type="button"
Expand All @@ -475,39 +475,31 @@ function SnoozePopoverButton(props: {
</TooltipTrigger>
<TooltipPopup>Snooze thread</TooltipPopup>
</Tooltip>
<PopoverPopup side="bottom" align="end" width="sm" viewportClassName="p-1">
<MenuPopup side="bottom" align="end">
{presets.map((preset) => (
<button
<MenuItem
key={preset.id}
type="button"
onClick={(event) => {
event.stopPropagation();
onOpenChange(false);
onSnooze(preset);
}}
className="flex w-full cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs text-foreground/90 hover:bg-accent hover:text-foreground"
>
<span className="flex-1">{preset.label}</span>
<span className="font-mono text-[10px] text-muted-foreground/60 tabular-nums">
{preset.whenLabel}
</span>
</button>
{preset.label}
<MenuShortcut>{preset.whenLabel}</MenuShortcut>
</MenuItem>
))}
<div className="my-1 border-t border-border/60" />
<button
type="button"
className="flex w-full cursor-pointer rounded-md px-2 py-1.5 text-left text-xs text-foreground/90 hover:bg-accent hover:text-foreground"
<MenuSeparator />
<MenuItem
onClick={async (event) => {
event.stopPropagation();
onOpenChange(false);
const choice = await requestCustomSnooze();
if (choice) onSnooze(choice);
}}
>
Custom…
</button>
</PopoverPopup>
</Popover>
</MenuItem>
</MenuPopup>
</Menu>
);
}

Expand Down Expand Up @@ -1883,7 +1875,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
</Tooltip>
) : null}
{showSnoozeButton ? (
<SnoozePopoverButton
<SnoozeMenuButton
open={snoozeMenuOpen}
onOpenChange={setSnoozeMenuOpen}
onSnooze={handleSnoozePreset}
Expand Down Expand Up @@ -4492,7 +4484,6 @@ export default function Sidebar() {
hideIndicator
value={item}
className="font-medium"
contentClassName="flex min-w-0 items-center gap-2"
onContextMenu={(event) => {
if (project) handleProjectSettings(event, project);
}}
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/chat/AssistantCitationChip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export function AssistantCitationChip({
}}
aria-label="Edit citation comment"
width="md"
viewportClassName="p-3"
padding="compact"
onPointerDown={(event) => event.stopPropagation()}
>
<AssistantCitationCommentEditor
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/chat/ContextWindowMeter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export function ContextWindowMeter(props: {
tooltipStyle
side="top"
align="end"
viewportClassName="p-0"
padding="none"
width="sm"
className="text-left whitespace-normal"
>
Expand Down
2 changes: 0 additions & 2 deletions apps/web/src/components/chat/ExpandedImageDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,6 @@ export const ExpandedImageDialog = memo(function ExpandedImageDialog({
variant="media"
showCloseButton={false}
bottomStickOnMobile={false}
backdropClassName="z-[60]"
viewportClassName="z-[60] grid-rows-1 place-items-center px-4 py-6 [-webkit-app-region:no-drag]"
className="row-start-1 max-h-[92vh] w-[92vw] max-w-[92vw] items-center overflow-visible [--media-width:92vw] [--media-height:min(86vh,calc(100vh-160px))] sm:[--media-width:calc(92vw-96px)]"
onKeyDown={onKeyDown}
initialFocus={closeButtonRef}
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/chat/MessagesTimeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2567,7 +2567,7 @@ function BackgroundWorktreeSetupChip({ snapshot }: { snapshot: WorktreeSetupSnap
align="end"
width="lg"
className="surface-glass!"
viewportClassName="py-3 [--viewport-inline-padding:--spacing(3)]"
padding="compact"
>
<WorktreeSetupCard
snapshot={snapshot}
Expand Down
1 change: 0 additions & 1 deletion apps/web/src/components/chat/ModelListRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export const ModelListRow = memo(function ModelListRow(props: {
index={props.index}
value={modelPickerModelKey(props.instanceId, props.model.slug)}
disabled={Boolean(props.disabledReason)}
contentClassName="flex w-full items-center gap-3"
className={cn(
"group relative w-full !min-w-0 max-w-full cursor-pointer rounded-md px-2 py-2 transition-[background-color,box-shadow,color]",
"hover:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] data-highlighted:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] data-selected:bg-foreground/[0.08] data-selected:text-foreground data-selected:ring-0 [&[data-highlighted][data-selected]]:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))]",
Expand Down
130 changes: 57 additions & 73 deletions apps/web/src/components/chat/ModelPickerContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { resolveSelectableModel } from "@t3tools/shared/model";
import { useAtomValue } from "@effect/atom-react";
import { LegendList, type LegendListRef } from "@legendapp/list/react";
import { memo, useMemo, useState, useCallback, useEffect, useLayoutEffect, useRef } from "react";
import { ChevronRightIcon, SearchIcon } from "lucide-react";
import { ChevronRightIcon } from "lucide-react";
import { ModelListRow } from "./ModelListRow";
import { ModelPickerSidebar } from "./ModelPickerSidebar";
import { getProviderStatusMessage, hasProviderSetup } from "./ProviderStatusBanner";
Expand All @@ -22,7 +22,7 @@ import { buildModelPickerSearchText, scoreModelPickerSearch } from "./modelPicke
import {
Combobox,
ComboboxEmpty,
ComboboxInput,
ComboboxSearchInput,
ComboboxItem,
ComboboxListVirtualized,
} from "../ui/combobox";
Expand Down Expand Up @@ -882,77 +882,62 @@ export const ModelPickerContent = memo(function ModelPickerContent(props: {
showSidebar && "border-l border-border/70",
)}
>
{/* Search bar */}
<div className="px-2 pt-2">
<div className="border-b border-border/70 pb-2.5 transition-colors focus-within:border-ring">
<ComboboxInput
ref={searchInputRef}
className="[&_input]:h-6.5 [&_input]:font-sans [&_input]:leading-6.5"
inputClassName="rounded-none bg-transparent text-sm"
placeholder="Search models..."
showTrigger={false}
startAddon={
<SearchIcon className="-translate-x-0.5 size-4 shrink-0 text-muted-foreground opacity-70" />
}
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
onKeyDown={(e) => {
if (
showSidebar &&
!e.altKey &&
!e.ctrlKey &&
!e.metaKey &&
((e.key === "ArrowLeft" && !e.shiftKey && searchQuery.length === 0) ||
(e.key === "Tab" && e.shiftKey))
) {
const sidebar = e.currentTarget
.closest("[data-model-picker-content]")
?.querySelector("[data-model-picker-sidebar]");
const button =
sidebar?.querySelector<HTMLButtonElement>(
'button[aria-pressed="true"]:not(:disabled)',
) ?? sidebar?.querySelector<HTMLButtonElement>("button:not(:disabled)");
if (button) {
e.preventDefault();
e.stopPropagation();
button.focus();
return;
}
}
if (e.key === "Escape") {
e.preventDefault();
e.stopPropagation();
props.onRequestClose?.();
return;
}
if (e.key === "Enter" && highlightedModelKeyRef.current) {
(
e as typeof e & { preventBaseUIHandler?: () => void }
).preventBaseUIHandler?.();
e.preventDefault();
e.stopPropagation();
const legacyInstanceId = parseModelPickerLegacySectionKey(
highlightedModelKeyRef.current,
);
if (legacyInstanceId) {
toggleLegacySection(legacyInstanceId);
return;
}
const model = parseModelPickerModelKey(highlightedModelKeyRef.current);
if (model) {
handleModelSelect(model.slug, model.instanceId, e.shiftKey);
}
return;
}
<ComboboxSearchInput
ref={searchInputRef}
placeholder="Search models..."
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
onKeyDown={(e) => {
if (
showSidebar &&
!e.altKey &&
!e.ctrlKey &&
!e.metaKey &&
((e.key === "ArrowLeft" && !e.shiftKey && searchQuery.length === 0) ||
(e.key === "Tab" && e.shiftKey))
) {
const sidebar = e.currentTarget
.closest("[data-model-picker-content]")
?.querySelector("[data-model-picker-sidebar]");
const button =
sidebar?.querySelector<HTMLButtonElement>(
'button[aria-pressed="true"]:not(:disabled)',
) ?? sidebar?.querySelector<HTMLButtonElement>("button:not(:disabled)");
if (button) {
e.preventDefault();
e.stopPropagation();
}}
onMouseDown={(e) => e.stopPropagation()}
onTouchStart={(e) => e.stopPropagation()}
size="sm"
unstyled
/>
</div>
</div>
button.focus();
return;
}
}
if (e.key === "Escape") {
e.preventDefault();
e.stopPropagation();
props.onRequestClose?.();
return;
}
if (e.key === "Enter" && highlightedModelKeyRef.current) {
(e as typeof e & { preventBaseUIHandler?: () => void }).preventBaseUIHandler?.();
e.preventDefault();
e.stopPropagation();
const legacyInstanceId = parseModelPickerLegacySectionKey(
highlightedModelKeyRef.current,
);
if (legacyInstanceId) {
toggleLegacySection(legacyInstanceId);
return;
}
const model = parseModelPickerModelKey(highlightedModelKeyRef.current);
if (model) {
handleModelSelect(model.slug, model.instanceId, e.shiftKey);
}
return;
}
e.stopPropagation();
}}
onMouseDown={(e) => e.stopPropagation()}
onTouchStart={(e) => e.stopPropagation()}
/>

{/* Model list */}
<div className="relative min-h-0 flex-1 overflow-hidden pr-px">
Expand All @@ -971,7 +956,6 @@ export const ModelPickerContent = memo(function ModelPickerContent(props: {
value={modelKey}
aria-expanded={legacySection.isExpanded}
className="group w-full cursor-pointer rounded-md px-2 py-2"
contentClassName="flex w-full items-center gap-3"
>
<div className="min-w-0 flex-1 text-left">
<div className="text-xs font-medium leading-snug">Legacy models</div>
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/chat/ProviderModelPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ export const ProviderModelPicker = memo(function ProviderModelPicker(props: {
<PopoverPopup
{...(props.isComposerOwned ? composerFloatingLayerProps : {})}
align="start"
className="before:hidden [--viewport-inline-padding:0]"
viewportClassName="overflow-hidden! rounded-[calc(var(--radius-lg)-1px)] p-0 [clip-path:inset(0_round_calc(var(--radius-lg)-1px))]"
className="before:hidden"
padding="none"
>
<ModelPickerContent
activeInstanceId={activeInstanceId}
Expand Down
9 changes: 2 additions & 7 deletions apps/web/src/components/chat/SnapShotAttachmentDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,8 @@ export function SnapShotContentsButton({
</TooltipTrigger>
<TooltipPopup side={side}>{tooltip}</TooltipPopup>
</Tooltip>
<PopoverPopup
side={side}
align="center"
width="md"
viewportClassName="max-h-[min(28rem,70vh)]"
>
<div className="space-y-2">
<PopoverPopup side={side} align="center" width="md">
<div className="max-h-[min(28rem,70vh)] space-y-2 overflow-y-auto">
<PopoverTitle>Accessibility data</PopoverTitle>
{accessibilityDetails ? (
<SnapShotAccessibilityData
Expand Down
Loading
Loading