-
Notifications
You must be signed in to change notification settings - Fork 945
fix #259 partially converting some of the components from headlessui to shadcn #531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@doppedheart is attempting to deploy a commit to the mftsio Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a select
component from shadcn not a popover.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay will make the changes
import { Fragment, Dispatch, SetStateAction } from "react"; | ||
import { Dispatch, SetStateAction, useState } from "react"; | ||
import { PopoverContent } from "@radix-ui/react-popover"; | ||
import { PopoverTrigger, Popover } from "@/components/ui/popover"; | ||
|
||
function classNames(...classes: string[]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want you can replace this with cn
from @/lib/utils
. it's a better way to merge tailwind classes then this helper function.
there is same code written in two different files should i make the same changes as removing the headlessui components with shadcn in both |
other than these ui changes there are two more files which contain headlessui ,
|
yes that would be preferred! Thank you for spotting that and suggesting this change :) Please also merge in the current main branch so that merging becomes easier. |
const [menuOpen, setMenuOpen] = useState<boolean>(false); | ||
const [isFirstClick, setIsFirstClick] = useState<boolean>(false); | ||
|
||
<Transition | ||
as={Fragment} | ||
enter="transition ease-out duration-100" | ||
enterFrom="transform opacity-0 scale-95" | ||
enterTo="transform opacity-100 scale-100" | ||
leave="transition ease-in duration-75" | ||
leaveFrom="transform opacity-100 scale-100" | ||
leaveTo="transform opacity-0 scale-95" | ||
> | ||
<Menu.Items | ||
className="absolute left-0 z-10 mt-2 w-full origin-top-right rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none" | ||
key={option} | ||
> | ||
<div className=""> | ||
{options.map((optionItem) => ( | ||
<Menu.Item key={optionItem}> | ||
{({ active }) => ( | ||
<button | ||
onClick={() => setOption(optionItem)} | ||
className={classNames( | ||
active ? "bg-gray-100 text-gray-900" : "text-gray-700", | ||
option === optionItem ? "bg-gray-200" : "", | ||
"px-4 py-2 text-sm w-full text-left flex items-center space-x-2 justify-between", | ||
)} | ||
> | ||
<span>{optionItem}</span> | ||
{option === optionItem ? ( | ||
<CheckIcon className="w-4 h-4 text-bold" /> | ||
) : null} | ||
</button> | ||
)} | ||
</Menu.Item> | ||
))} | ||
</div> | ||
</Menu.Items> | ||
</Transition> | ||
</Menu> | ||
); | ||
const handleMenuStateChange = (open: boolean) => { | ||
if (isFirstClick) { | ||
setMenuOpen(true); // Keep the dropdown open on the first click | ||
return; | ||
} | ||
|
||
// If the menu is closed, reset the isFirstClick state | ||
if (!open) { | ||
setIsFirstClick(false); | ||
setMenuOpen(false); // Ensure the dropdown is closed | ||
} else { | ||
setMenuOpen(true); // Open the dropdown | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed. This is only to for a double-click delete confirmation
} | ||
}; | ||
return ( | ||
<Select open={menuOpen} onOpenChange={handleMenuStateChange}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<Select open={menuOpen} onOpenChange={handleMenuStateChange}> | |
<Select> |
components/ui/accordion.tsx
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to change the accordion behaviour. Let's leave the chevron. This component is used in other places and relies on the chevron.
pages/ai.tsx
Outdated
const faqs = [ | ||
{ | ||
question: "What is Papermark AI?", | ||
answer: | ||
"Papermark AI is an innovative AI document assistant that enables users to interact with a variety of documents, such as pitch decks, sales decks, and PDFs, in a more efficient and secure manner.", | ||
}, | ||
{ | ||
question: "How can I use Papermark AI?", | ||
answer: | ||
"You can use it on shared with you document and on received. You can chat with the document, ask question, find information without checking whole document.", | ||
}, | ||
{ | ||
question: "Is Papermark AI free?", | ||
answer: | ||
"Yes, Papermark AI offers an open-source version, giving you the freedom to use and modify it according to your needs, under the terms of our license.", | ||
}, | ||
{ | ||
question: "How can Papermark AI help me reach more investors?", | ||
answer: | ||
"Papermark AI provides recommendations and analytics to help you fine-tune your pitch decks, increasing your chances of making a successful connection with potential investors.", | ||
}, | ||
{ | ||
question: "How I as an investor can use Papermark AI?", | ||
answer: | ||
"VCs can utilize Papermark AI to efficiently analyze and summarize data from various pitch decks, streamlining their investment decision-making process. Search inside the pitch deck, summarise and turn it into Memo.", | ||
}, | ||
{ | ||
question: "Can I contribute to the Papermark AI project?", | ||
answer: | ||
"Definitely! We welcome contributions to Papermark AI. Whether it's improving the code, adding new features, or reporting bugs, your input is highly valued.", | ||
}, | ||
{ | ||
question: "How to summarise document with Papermark AI?", | ||
answer: | ||
"You can use one of the starting commands and get the summary of received docuement. If you want that documents shared with you.", | ||
}, | ||
{ | ||
question: "How to turn Pitch Deck into Memo?", | ||
answer: | ||
"You can use Papermark AI and ask it to create Memo from Pitch Deck received. You can also uplaod your own Pitch deck there.", | ||
}, | ||
|
||
// More questions... | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are removing the questions. These are different from the one in the @/components/web/faq
component. Ideally we make a FAQ component that takes in props with different questions and answers.
const [menuOpen, setMenuOpen] = useState<boolean>(false); | ||
const [isFirstClick, setIsFirstClick] = useState<boolean>(false); | ||
|
||
<Transition | ||
as={Fragment} | ||
enter="transition ease-out duration-100" | ||
enterFrom="transform opacity-0 scale-95" | ||
enterTo="transform opacity-100 scale-100" | ||
leave="transition ease-in duration-75" | ||
leaveFrom="transform opacity-100 scale-100" | ||
leaveTo="transform opacity-0 scale-95" | ||
> | ||
<Menu.Items | ||
className="absolute left-0 z-10 mt-2 w-full origin-top-right rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none" | ||
key={option} | ||
> | ||
<div className=""> | ||
{options.map((optionItem) => ( | ||
<Menu.Item key={optionItem}> | ||
{({ active }) => ( | ||
<button | ||
onClick={() => setOption(optionItem)} | ||
className={classNames( | ||
active ? "bg-gray-100 text-gray-900" : "text-gray-700", | ||
option === optionItem ? "bg-gray-200" : "", | ||
"flex w-full items-center justify-between space-x-2 px-4 py-2 text-left text-sm", | ||
)} | ||
> | ||
<span>{optionItem}</span> | ||
{option === optionItem ? ( | ||
<CheckIcon className="text-bold h-4 w-4" /> | ||
) : null} | ||
</button> | ||
)} | ||
</Menu.Item> | ||
))} | ||
</div> | ||
</Menu.Items> | ||
</Transition> | ||
</Menu> | ||
); | ||
const handleMenuStateChange = (open: boolean) => { | ||
if (isFirstClick) { | ||
setMenuOpen(true); // Keep the dropdown open on the first click | ||
return; | ||
} | ||
|
||
// If the menu is closed, reset the isFirstClick state | ||
if (!open) { | ||
setIsFirstClick(false); | ||
setMenuOpen(false); // Ensure the dropdown is closed | ||
} else { | ||
setMenuOpen(true); // Open the dropdown | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No needed. same as above
} | ||
}; | ||
return ( | ||
<Select open={menuOpen} onOpenChange={handleMenuStateChange}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<Select open={menuOpen} onOpenChange={handleMenuStateChange}> | |
<Select> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thank you for your effort!
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
fix #259



change the faq from disclore to accordian
and also the dropdownproto