Merge remote-tracking branch 'upstream/dev' into feat/inbox

This commit is contained in:
Anish Sarkar 2026-01-28 09:26:04 +05:30
commit 614761bb17
64 changed files with 2604 additions and 730 deletions

View file

@ -0,0 +1,28 @@
import { atomWithMutation } from "jotai-tanstack-query";
import { toast } from "sonner";
import type {
TogglePublicShareRequest,
TogglePublicShareResponse,
} from "@/contracts/types/chat-threads.types";
import { chatThreadsApiService } from "@/lib/apis/chat-threads-api.service";
export const togglePublicShareMutationAtom = atomWithMutation(() => ({
mutationFn: async (request: TogglePublicShareRequest) => {
return chatThreadsApiService.togglePublicShare(request);
},
onSuccess: (response: TogglePublicShareResponse) => {
if (response.enabled && response.share_token) {
const publicUrl = `${window.location.origin}/public/${response.share_token}`;
navigator.clipboard.writeText(publicUrl);
toast.success("Public link copied to clipboard", {
description: "Anyone with this link can view the chat",
});
} else {
toast.success("Public sharing disabled");
}
},
onError: (error: Error) => {
console.error("Failed to toggle public share:", error);
toast.error("Failed to update public sharing");
},
}));

View file

@ -19,6 +19,8 @@ interface CurrentThreadState {
addingCommentToMessageId: number | null;
/** Whether the right-side comments panel is collapsed (desktop only) */
commentsCollapsed: boolean;
publicShareEnabled: boolean;
publicShareToken: string | null;
}
const initialState: CurrentThreadState = {
@ -27,6 +29,8 @@ const initialState: CurrentThreadState = {
hasComments: false,
addingCommentToMessageId: null,
commentsCollapsed: false,
publicShareEnabled: false,
publicShareToken: null,
};
export const currentThreadAtom = atom<CurrentThreadState>(initialState);