-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Release Notes - TPET v0.6.1 ## New Features - User can hover to see the tips of each input ## Fix - User can unselect the files
- Loading branch information
1 parent
19df89b
commit 4bb45bf
Showing
4 changed files
with
121 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"use client"; | ||
import { ReactNode, useState } from "react"; | ||
|
||
interface TooltipProps { | ||
message: string; | ||
children: ReactNode; | ||
} | ||
|
||
export default function Helptip({ message, children }: TooltipProps) { | ||
const [isVisible, setIsVisible] = useState(false); | ||
|
||
return ( | ||
<div | ||
className="relative flex items-center hover:cursor-help" | ||
onMouseEnter={() => setIsVisible(true)} | ||
onMouseLeave={() => setIsVisible(false)} | ||
> | ||
{children} | ||
{isVisible && ( | ||
<div className="absolute bottom-full transform bg-slate-200 text-slate-500 text-sm rounded-md shadow-xl p-2 whitespace-normal break-words z-50"> | ||
<p className="text-wrap min-w-64">{message}</p> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
"use client"; | ||
import React, { useRef, useState, FormEvent } from "react"; | ||
import { submitForm } from "@/lib/actions"; | ||
import HelpTip from "@/app/ui/help-tip"; | ||
import SelectDropdown from "@/app/ui/select-dropdown"; | ||
import AttachDropdown from "./attach-dropdown"; | ||
import FileUpload from "@/app/ui/file-upload"; | ||
import IframePreview from "@/app/ui/iframe-preview"; | ||
import EmailInput from "@/app/ui/email-input"; | ||
import { useEffect } from "react"; | ||
import { useRouter } from "next/navigation"; | ||
import { ChevronDown } from "lucide-react"; | ||
import { Info } from "lucide-react"; | ||
|
||
interface SubmitResponse { | ||
status: string; | ||
|
@@ -22,10 +23,10 @@ interface SubmitResponse { | |
export default function SendEmailForm() { | ||
const ref = useRef<HTMLFormElement>(null); | ||
const [isSubmitting, setIsSubmitting] = useState<boolean>(false); | ||
const [selectedHtmlFile, setSelectedHtmlFile] = useState(""); | ||
const [selectedXlsxFile, setSelectedXlsxFile] = useState(""); | ||
const [htmlPreviewLink, setHtmlPreviewLink] = useState<string>(""); | ||
const [xlsxPreviewLink, setXlsxPreviewLink] = useState<string>(""); | ||
const [selectedHtmlFile, setSelectedHtmlFile] = useState<string | null>(""); | ||
const [selectedXlsxFile, setSelectedXlsxFile] = useState<string | null>(""); | ||
const [htmlPreviewLink, setHtmlPreviewLink] = useState<string | null>(""); | ||
const [xlsxPreviewLink, setXlsxPreviewLink] = useState<string | null>(""); | ||
const [errors, setErrors] = useState<{ [key: string]: string }>({}); | ||
const [showHtmlUpload, setShowHtmlUpload] = useState<boolean>(false); | ||
const [showXlsxUpload, setShowXlsxUpload] = useState<boolean>(false); | ||
|
@@ -105,7 +106,10 @@ export default function SendEmailForm() { | |
setIsSubmitting(false); | ||
}; | ||
|
||
const handleHtmlSelect = (file_id: string, file_url: string) => { | ||
const handleHtmlSelect = ( | ||
file_id: string | null, | ||
file_url: string | null | ||
) => { | ||
setSelectedHtmlFile(file_id); | ||
setHtmlPreviewLink(file_url); | ||
}; | ||
|
@@ -188,8 +192,11 @@ export default function SendEmailForm() { | |
<p className="text-2xl font-bold py-2">Required</p> | ||
<div className="rounded-md bg-neutral-100 p-4"> | ||
<div className="m-3"> | ||
<label className="mb-2 block text-sm font-medium"> | ||
<label className="mb-2 flex text-sm font-medium gap-2"> | ||
Subject of the email: | ||
<HelpTip message="Enter the email subject that recipients will see."> | ||
<Info size={16} color="gray" /> | ||
</HelpTip> | ||
</label> | ||
<input | ||
id="subject" | ||
|
@@ -206,8 +213,11 @@ export default function SendEmailForm() { | |
)} | ||
</div> | ||
<div className="m-3"> | ||
<label className="mb-2 block text-sm font-medium"> | ||
<label className="mb-2 flex text-sm font-medium gap-2"> | ||
Name of the sender: | ||
<HelpTip message="Enter the sender's name as it will appear to recipients."> | ||
<Info size={16} color="gray" /> | ||
</HelpTip> | ||
</label> | ||
<input | ||
id="display_name" | ||
|
@@ -224,8 +234,11 @@ export default function SendEmailForm() { | |
)} | ||
</div> | ||
<div className="m-3"> | ||
<label className="mb-2 block text-sm font-medium"> | ||
<label className="mb-2 flex text-sm font-medium gap-2"> | ||
Select your template file: | ||
<HelpTip message="Choose or upload a .html file that contains the email content."> | ||
<Info size={16} color="gray" /> | ||
</HelpTip> | ||
</label> | ||
<div className="flex items-center gap-2"> | ||
<SelectDropdown | ||
|
@@ -312,8 +325,11 @@ export default function SendEmailForm() { | |
)} | ||
</div> | ||
<div className="m-3"> | ||
<label className="mb-2 block text-sm font-medium"> | ||
<label className="mb-2 flex text-sm font-medium gap-2"> | ||
Select your sheet file: | ||
<HelpTip message="Choose or upload a .xlsx file containing the list of recipients."> | ||
<Info size={16} color="gray" /> | ||
</HelpTip> | ||
</label> | ||
<div className="flex items-center gap-2"> | ||
<SelectDropdown | ||
|
@@ -409,8 +425,11 @@ export default function SendEmailForm() { | |
<div className="rounded-md bg-neutral-100 p-4"> | ||
{/* Sender Local Part */} | ||
<div className="m-3"> | ||
<label className="mb-2 block text-sm font-medium"> | ||
<label className="mb-2 flex text-sm font-medium gap-2"> | ||
Sender Local Part: | ||
<HelpTip message="Enter the prefix for your email address (e.g., if you enter john.doe, the email will be [email protected]). This setting will affect the forwarding rules."> | ||
<Info size={16} color="gray" /> | ||
</HelpTip> | ||
</label> | ||
<div className="flex items-center bg-neutral-300 rounded-md"> | ||
<input | ||
|
@@ -432,32 +451,50 @@ export default function SendEmailForm() { | |
</div> | ||
{/* Reply To */} | ||
<div className="m-3"> | ||
<label className="mb-2 block text-sm font-medium">Reply To:</label> | ||
<label className="mb-2 flex text-sm font-medium gap-2"> | ||
Reply To: | ||
<HelpTip message="The email address where replies from recipients will be sent. You can set this to match the Sender Local Part or customize it."> | ||
<Info size={16} color="gray" /> | ||
</HelpTip> | ||
</label> | ||
<EmailInput | ||
allowMultiple={false} | ||
onEmailsChange={handleReplyToEmailChange} | ||
/> | ||
</div> | ||
{/* BCC */} | ||
<div className="m-3"> | ||
<label className="mb-2 block text-sm font-medium">BCC:</label> | ||
<label className="mb-2 flex text-sm font-medium gap-2"> | ||
BCC: | ||
<HelpTip message="Add email addresses to send blind carbon copies."> | ||
<Info size={16} color="gray" /> | ||
</HelpTip> | ||
</label> | ||
<EmailInput | ||
allowMultiple={true} | ||
onEmailsChange={handleBccEmailsChange} | ||
/> | ||
</div> | ||
{/* CC */} | ||
<div className="m-3"> | ||
<label className="mb-2 block text-sm font-medium">CC:</label> | ||
<label className="mb-2 flex text-sm font-medium gap-2"> | ||
CC: | ||
<HelpTip message="Add email addresses to send carbon copies. Recipients will see these addresses."> | ||
<Info size={16} color="gray" /> | ||
</HelpTip> | ||
</label> | ||
<EmailInput | ||
allowMultiple={true} | ||
onEmailsChange={handleCcEmailsChange} | ||
/> | ||
</div> | ||
{/* Attach files */} | ||
<div className="m-3"> | ||
<label className="mb-2 block text-sm font-medium"> | ||
<label className="mb-2 flex text-sm font-medium gap-2"> | ||
Attach files: | ||
<HelpTip message="Attach any files you want to include with the email. Note: It is recommended that the total size of attachments does not exceed 5MB."> | ||
<Info size={16} color="gray" /> | ||
</HelpTip> | ||
</label> | ||
<div className="flex items-center gap-2"> | ||
<AttachDropdown onSelect={handleAttachSelect} /> | ||
|
@@ -495,8 +532,11 @@ export default function SendEmailForm() { | |
</div> | ||
{/* Generate certificate */} | ||
<div className="my-5 mx-3"> | ||
<label className="mb-2 block text-sm font-medium"> | ||
<label className="mb-2 flex text-sm font-medium gap-2"> | ||
Provide a certification of participation? | ||
<HelpTip message="Select Yes or No if you want to provide a certification. Note: If you select Yes, the Excel file must include two columns: Name and Certificate Text."> | ||
<Info size={16} color="gray" /> | ||
</HelpTip> | ||
</label> | ||
<div className="flex"> | ||
<div className="flex items-center me-4"> | ||
|