refactor: improve password input layout and enhance chat thread title update logic

This commit is contained in:
Anish Sarkar 2026-04-14 21:13:01 +05:30
parent f01ddf3f0a
commit 1714922830
3 changed files with 42 additions and 29 deletions

View file

@ -174,7 +174,7 @@ export function LocalLoginForm() {
<label htmlFor="password" className="block text-sm font-medium text-foreground">
{t("password")}
</label>
<div className="relative">
<div className="relative mt-1">
<input
id="password"
type={showPassword ? "text" : "password"}
@ -183,7 +183,7 @@ export function LocalLoginForm() {
placeholder="Enter your password"
value={password}
onChange={(e) => setPassword(e.target.value)}
className={`mt-1 block w-full rounded-md border pr-10 px-3 py-1.5 md:py-2 shadow-sm focus:outline-none focus:ring-1 bg-background text-foreground transition-all ${
className={`block w-full rounded-md border pr-10 px-3 py-1.5 md:py-2 shadow-sm focus:outline-none focus:ring-1 bg-background text-foreground transition-all ${
error.title
? "border-destructive focus:border-destructive focus:ring-destructive/40"
: "border-border focus:border-primary focus:ring-primary/40"
@ -193,7 +193,7 @@ export function LocalLoginForm() {
<button
type="button"
onClick={() => setShowPassword((prev) => !prev)}
className="absolute inset-y-0 right-0 flex items-center pr-3 mt-1 text-muted-foreground hover:text-foreground"
className="absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground"
aria-label={showPassword ? t("hide_password") : t("show_password")}
>
{showPassword ? <EyeOff className="h-4 w-4" /> : <Eye className="h-4 w-4" />}

View file

@ -67,6 +67,8 @@ import {
getRegenerateUrl,
getThreadFull,
getThreadMessages,
type ThreadListItem,
type ThreadListResponse,
type ThreadRecord,
} from "@/lib/chat/thread-persistence";
import { NotFoundError } from "@/lib/error";
@ -770,9 +772,21 @@ export default function NewChatPage() {
if (titleData?.title && titleData?.threadId === currentThreadId) {
setCurrentThread((prev) => (prev ? { ...prev, title: titleData.title } : prev));
updateChatTabTitle({ chatId: currentThreadId, title: titleData.title });
queryClient.invalidateQueries({
queryKey: ["threads", String(searchSpaceId)],
});
queryClient.setQueriesData<ThreadListResponse>(
{ queryKey: ["threads", String(searchSpaceId)] },
(old) => {
if (!old) return old;
const updateTitle = (list: ThreadListItem[]) =>
list.map((t) =>
t.id === titleData.threadId ? { ...t, title: titleData.title } : t
);
return {
...old,
threads: updateTitle(old.threads),
archived_threads: updateTitle(old.archived_threads),
};
}
);
}
break;
}

View file

@ -27,7 +27,6 @@ export function useTypewriter(text: string, speed = 35, skipFor = "New Chat"): s
}
let i = 0;
setDisplayed("");
intervalRef.current = setInterval(() => {
i++;
setDisplayed(text.slice(0, i));