Skip to content

Commit 8f37f8b

Browse files
feedback
1 parent 4ead8ad commit 8f37f8b

6 files changed

Lines changed: 17 additions & 22 deletions

File tree

packages/web/src/app/(app)/@sidebar/components/defaultSidebar/chatHistory.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export function ChatHistory({ chatHistory, hasMore }: ChatHistoryProps) {
119119
setIsDeleteDialogOpen(true);
120120
}}
121121
>
122-
<SidebarMenuAction className="opacity-0 group-hover/chat:opacity-100 transition-opacity">
122+
<SidebarMenuAction showOnHover className="transition-opacity">
123123
<EllipsisIcon className="w-4 h-4" />
124124
</SidebarMenuAction>
125125
</ChatActionsDropdown>

packages/web/src/app/(app)/search/components/searchResultsPage.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ import { RepositoryInfo, SearchResultFile, SearchStats } from "@/features/search
1515
import useCaptureEvent from "@/hooks/useCaptureEvent";
1616
import { useNonEmptyQueryParam } from "@/hooks/useNonEmptyQueryParam";
1717
import { useSearchHistory } from "@/hooks/useSearchHistory";
18+
import { ServiceErrorException } from "@/lib/serviceError";
1819
import { SearchQueryParams } from "@/lib/types";
19-
import { cn, createPathWithQueryParams } from "@/lib/utils";
20+
import { createPathWithQueryParams } from "@/lib/utils";
2021
import { InfoCircledIcon } from "@radix-ui/react-icons";
2122
import { useLocalStorage } from "@uidotdev/usehooks";
22-
import { AlertTriangleIcon, BugIcon, FilterIcon, LogIn, RefreshCwIcon } from "lucide-react";
23+
import { AlertTriangleIcon, BugIcon, FilterIcon, RefreshCwIcon } from "lucide-react";
24+
import { Session } from "next-auth";
2325
import { useRouter } from "next/navigation";
2426
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
2527
import { useHotkeys } from "react-hotkeys-hook";
@@ -31,15 +33,12 @@ import { CodePreviewPanel } from "./codePreviewPanel";
3133
import { FilterPanel } from "./filterPanel";
3234
import { useFilteredMatches } from "./filterPanel/useFilterMatches";
3335
import { SearchResultsPanel, SearchResultsPanelHandle } from "./searchResultsPanel";
34-
import { ServiceErrorException } from "@/lib/serviceError";
35-
import { Session } from "next-auth";
3636

3737
interface SearchResultsPageProps {
3838
searchQuery: string;
3939
defaultMaxMatchCount: number;
4040
isRegexEnabled: boolean;
4141
isCaseSensitivityEnabled: boolean;
42-
session: Session | null;
4342
isSearchAssistSupported: boolean;
4443
}
4544

@@ -48,7 +47,6 @@ export const SearchResultsPage = ({
4847
defaultMaxMatchCount,
4948
isRegexEnabled,
5049
isCaseSensitivityEnabled,
51-
session,
5250
isSearchAssistSupported,
5351
}: SearchResultsPageProps) => {
5452
const router = useRouter();

packages/web/src/app/(app)/search/page.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { env } from "@sourcebot/shared";
22
import { SearchLandingPage } from "./components/searchLandingPage";
33
import { SearchResultsPage } from "./components/searchResultsPage";
4-
import { auth } from "@/auth";
54
import { getConfiguredLanguageModelsInfo } from "@/features/chat/utils.server";
65

76
interface SearchPageProps {
@@ -18,7 +17,6 @@ export default async function SearchPage(props: SearchPageProps) {
1817
const isRegexEnabled = searchParams?.isRegexEnabled === "true";
1918
const isCaseSensitivityEnabled = searchParams?.isCaseSensitivityEnabled === "true";
2019

21-
const session = await auth();
2220
const languageModels = await getConfiguredLanguageModelsInfo();
2321
const isSearchAssistSupported = languageModels.length > 0;
2422

@@ -32,7 +30,6 @@ export default async function SearchPage(props: SearchPageProps) {
3230
defaultMaxMatchCount={env.DEFAULT_MAX_MATCH_COUNT}
3331
isRegexEnabled={isRegexEnabled}
3432
isCaseSensitivityEnabled={isCaseSensitivityEnabled}
35-
session={session}
3633
isSearchAssistSupported={isSearchAssistSupported}
3734
/>
3835
)

packages/web/src/app/(app)/settings/apiKeys/apiKeysPage.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,18 +112,17 @@ export function ApiKeysPage({ canCreateApiKey, apiKeys }: ApiKeysPageProps) {
112112
};
113113

114114
const handleDeleteApiKey = async (name: string) => {
115-
try {
116-
await deleteApiKey(name);
117-
router.refresh();
118-
toast({ description: "API key deleted" });
119-
} catch (error) {
120-
console.error("Failed to delete API key", error);
115+
const result = await deleteApiKey(name);
116+
if (isServiceError(result)) {
121117
toast({
122118
title: "Error",
123-
description: `Failed to delete API key: ${error}`,
119+
description: `Failed to delete API key: ${result.message}`,
124120
variant: "destructive",
125121
});
122+
return;
126123
}
124+
router.refresh();
125+
toast({ description: "API key deleted" });
127126
};
128127

129128
const sortedKeys = useMemo(
@@ -272,7 +271,7 @@ export function ApiKeysPage({ canCreateApiKey, apiKeys }: ApiKeysPageProps) {
272271
<Button
273272
variant="ghost"
274273
size="icon"
275-
className="opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive flex-shrink-0"
274+
className="opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 focus-visible:opacity-100 transition-opacity text-muted-foreground hover:text-destructive flex-shrink-0"
276275
>
277276
<Trash2 className="h-4 w-4" />
278277
</Button>

packages/web/src/app/api/(server)/chats/route.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ export const GET = apiHandler(async (request: NextRequest) => {
3434
},
3535
} : {}),
3636
},
37-
orderBy: {
38-
[sortBy]: sortOrder,
39-
},
37+
orderBy: [
38+
{ [sortBy]: sortOrder },
39+
{ id: "asc" },
40+
],
4041
take: limit + 1,
4142
...(cursor ? {
4243
cursor: { id: cursor },

packages/web/src/app/api/(server)/chats/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { z } from "zod";
22

33
export const listChatsQueryParamsSchema = z.object({
44
cursor: z.string().optional(),
5-
limit: z.coerce.number().int().positive().default(20),
5+
limit: z.coerce.number().int().positive().max(100).default(20),
66
query: z.string().optional(),
77
sortBy: z.enum(["name", "updatedAt"]).default("updatedAt"),
88
sortOrder: z.enum(["asc", "desc"]).default("desc"),

0 commit comments

Comments
 (0)