Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

touch up

Steven Teyc50d42e81d06
diff --git a/apps/web/ui/layout/help/contact-form.tsx b/apps/web/ui/layout/help/contact-form.tsx
index e34e0f428e..152fe95080 100644
--- a/apps/web/ui/layout/help/contact-form.tsx
+++ b/apps/web/ui/layout/help/contact-form.tsx
@@ -41,8 +41,6 @@ export function ContactForm({
method: "GET",
}).then((res) => res.json());
- console.log({ uploadFormUrl, attachmentId });
-
const form = new FormData();
uploadFormData.forEach(({ key, value }) => {
form.append(key, value);
@@ -83,7 +81,7 @@ export function ContactForm({
const { handleKeyDown } = useEnterSubmit(formRef);
return (
- <div className="w-full px-6 py-5">
+ <div className="relative w-full px-3 pb-16 pt-5 sm:px-6">
<button
type="button"
className="-ml-2 flex items-center space-x-1 rounded-md px-2 py-1"
@@ -100,7 +98,7 @@ export function ContactForm({
initial={{ opacity: 0, y: 10 }}
animate={{ opacity: 1, y: 0 }}
>
- <CheckCircleFill className="h-5 w-5 text-green-500" />
+ <CheckCircleFill className="h-8 w-8 text-green-500" />
<p className="text-gray-500">
Thanks for reaching out! <br /> We'll get back to you as soon as
possible.
@@ -250,12 +248,14 @@ export function ContactForm({
}}
/>
- <Button
- className="mt-3 h-9"
- disabled={!data.message}
- loading={formStatus === "loading"}
- text="Send message"
- />
+ <div className="fixed bottom-0 left-0 z-10 flex h-16 w-full items-center justify-center bg-white px-3 sm:px-6">
+ <Button
+ className="h-9"
+ disabled={!data.message}
+ loading={formStatus === "loading"}
+ text="Send message"
+ />
+ </div>
</motion.form>
)}
</AnimatePresence>
diff --git a/apps/web/ui/layout/help/main-screen.tsx b/apps/web/ui/layout/help/main-screen.tsx
index e07638c4fa..1f186e5c08 100644
--- a/apps/web/ui/layout/help/main-screen.tsx
+++ b/apps/web/ui/layout/help/main-screen.tsx
@@ -21,7 +21,7 @@ export function MainScreen({
}, 1000);
return (
<div>
- <div className="p-4">
+ <div className="p-2 sm:p-4">
<div className="p-2">
<h3 className="font-semibold">How can we help?</h3>
</div>
@@ -61,7 +61,7 @@ export function MainScreen({
</Command.List>
</Command>
</div>
- <div className="flex justify-between border-t border-gray-200 px-5 py-4">
+ <div className="flex justify-between border-t border-gray-200 px-3 py-4 sm:px-6">
<button
onClick={() => setScreen("contact")}
className="flex items-center space-x-2 hover:underline"
diff --git a/apps/web/ui/layout/help/portal.tsx b/apps/web/ui/layout/help/portal.tsx
index 144df5a5aa..cf15a68f1d 100644
--- a/apps/web/ui/layout/help/portal.tsx
+++ b/apps/web/ui/layout/help/portal.tsx
@@ -4,7 +4,7 @@ import { Popover } from "@dub/ui";
import { fetcher } from "@dub/utils";
import { AnimatePresence, motion } from "framer-motion";
import { XIcon } from "lucide-react";
-import { createContext, useEffect, useState } from "react";
+import { createContext, useEffect, useRef, useState } from "react";
import { HelpArticle } from ".";
import { ContactForm } from "./contact-form";
import { MainScreen } from "./main-screen";
@@ -63,10 +63,37 @@ export function HelpButton({
function HelpSection() {
const [screen, setScreen] = useState<"main" | "contact">("main");
+ const containerRef = useRef<HTMLDivElement>(null);
+ const [height, setHeight] = useState("auto");
+
+ useEffect(() => {
+ const resizeObserver = new ResizeObserver((entries) => {
+ for (let entry of entries) {
+ setHeight(`${entry.target.scrollHeight}px`);
+ }
+ });
+
+ if (containerRef.current) {
+ resizeObserver.observe(containerRef.current);
+ }
+
+ return () => {
+ if (containerRef.current) {
+ resizeObserver.unobserve(containerRef.current);
+ }
+ };
+ }, [containerRef.current]); // Ensure effect runs if ref changes
+
return (
- <div className="w-full transition-all duration-300 ease-in-out sm:w-[32rem]">
- {screen === "main" && <MainScreen setScreen={setScreen} />}
- {screen === "contact" && <ContactForm setScreen={setScreen} />}
- </div>
+ <motion.div
+ className="w-full overflow-scroll sm:w-[32rem]"
+ animate={{ height, maxHeight: "calc(100vh - 10rem)" }}
+ transition={{ type: "spring", duration: 0.3 }}
+ >
+ <div ref={containerRef}>
+ {screen === "main" && <MainScreen setScreen={setScreen} />}
+ {screen === "contact" && <ContactForm setScreen={setScreen} />}
+ </div>
+ </motion.div>
);
}