remove comments
This commit is contained in:
@@ -38,7 +38,6 @@ const EmailInput: FC<EmailInputProps> = ({
|
||||
return
|
||||
}
|
||||
|
||||
// Always search via API for fresh results
|
||||
if (onSearchSuggestions) {
|
||||
if (searchTimeoutRef.current) {
|
||||
clearTimeout(searchTimeoutRef.current)
|
||||
@@ -51,7 +50,6 @@ const EmailInput: FC<EmailInputProps> = ({
|
||||
setSelectedSuggestionIndex(-1)
|
||||
}
|
||||
|
||||
// Update filtered suggestions when API suggestions change
|
||||
useEffect(() => {
|
||||
if (suggestions.length > 0) {
|
||||
const filtered = suggestions
|
||||
@@ -63,7 +61,6 @@ const EmailInput: FC<EmailInputProps> = ({
|
||||
setFilteredSuggestions(filtered)
|
||||
setShowSuggestions(filtered.length > 0 && to.trim().length > 0)
|
||||
} else if (to.trim() === '') {
|
||||
// Clear suggestions when input is empty
|
||||
setFilteredSuggestions([])
|
||||
setShowSuggestions(false)
|
||||
}
|
||||
|
||||
@@ -20,35 +20,29 @@ export const useNewMessage = () => {
|
||||
} = useSharedStore();
|
||||
const { email: userEmail } = useAuthStore();
|
||||
|
||||
// Form state
|
||||
const [toEmails, setToEmails] = useState<string[]>([]);
|
||||
const [subject, setSubject] = useState("");
|
||||
const [content, setContent] = useState("");
|
||||
const [priority, setPriority] = useState("");
|
||||
const [attachments, setAttachments] = useState<EmailAttachmentDto[]>([]);
|
||||
|
||||
// Loading states
|
||||
const [isSending, setIsSending] = useState(false);
|
||||
const [isSavingDraft, setIsSavingDraft] = useState(false);
|
||||
|
||||
// API hooks
|
||||
const sendEmailMutation = useSendEmail();
|
||||
const updateDraftMutation = useUpdateDraft();
|
||||
const sendDraftMutation = useSendDraft();
|
||||
|
||||
// Email suggestions
|
||||
const {
|
||||
suggestions: emailSuggestions,
|
||||
searchSuggestions,
|
||||
} = useEmailSuggestions();
|
||||
|
||||
// Get draft detail if draftData exists
|
||||
const { data: draftDetail } = useGetMessageDetail(
|
||||
draftData?.id.toString() || "",
|
||||
draftData?.mailbox || ""
|
||||
);
|
||||
|
||||
// Load draft data into form
|
||||
useEffect(() => {
|
||||
if (draftDetail) {
|
||||
const toEmailsList =
|
||||
@@ -81,7 +75,6 @@ export const useNewMessage = () => {
|
||||
return emailRegex.test(email);
|
||||
};
|
||||
|
||||
// Function to search email suggestions
|
||||
const searchEmailSuggestions = (query: string) => {
|
||||
searchSuggestions(query);
|
||||
};
|
||||
@@ -237,7 +230,6 @@ export const useNewMessage = () => {
|
||||
};
|
||||
|
||||
return {
|
||||
// Form state
|
||||
toEmails,
|
||||
subject,
|
||||
content,
|
||||
@@ -245,11 +237,9 @@ export const useNewMessage = () => {
|
||||
attachments,
|
||||
emailSuggestions,
|
||||
|
||||
// Loading states
|
||||
isSending,
|
||||
isSavingDraft,
|
||||
|
||||
// Form handlers
|
||||
addEmail,
|
||||
removeEmail,
|
||||
setSubject,
|
||||
@@ -257,10 +247,8 @@ export const useNewMessage = () => {
|
||||
setPriority,
|
||||
setAttachments,
|
||||
|
||||
// Search functions
|
||||
searchEmailSuggestions,
|
||||
|
||||
// Actions
|
||||
handleSend,
|
||||
handleSaveDraft,
|
||||
resetForm,
|
||||
|
||||
@@ -20,7 +20,6 @@ export const useReply = ({
|
||||
const [content, setContent] = useState<string>("");
|
||||
const [isExpanded, setIsExpanded] = useState<boolean>(false);
|
||||
|
||||
// API hooks
|
||||
const sendEmailMutation = useSendEmail();
|
||||
|
||||
const resetForm = () => {
|
||||
@@ -39,7 +38,6 @@ export const useReply = ({
|
||||
return false;
|
||||
}
|
||||
|
||||
// Format date to Persian
|
||||
const originalDate = new Date(originalMessage.date);
|
||||
const persianDate = new Intl.DateTimeFormat("fa-IR", {
|
||||
weekday: "long",
|
||||
@@ -143,12 +141,10 @@ ${
|
||||
};
|
||||
|
||||
return {
|
||||
// State
|
||||
content,
|
||||
isExpanded,
|
||||
isSending: sendEmailMutation.isPending,
|
||||
|
||||
// Handlers
|
||||
setContent,
|
||||
expandReply,
|
||||
collapseReply,
|
||||
@@ -156,7 +152,6 @@ ${
|
||||
handleSaveDraft,
|
||||
resetForm,
|
||||
|
||||
// Original message data
|
||||
originalMessage,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user