Skip to content

Commit 7f53d60

Browse files
authored
Merge pull request #319 from karannfr/prod
fix : #308
2 parents 12c158a + ad5a77b commit 7f53d60

6 files changed

Lines changed: 31 additions & 87 deletions

File tree

src/app/pinned/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const Pinned = () => {
1111

1212
return (
1313
<div id="pinned" className="mt-5 flex flex-col justify-between">
14-
<h1 className="mx-auto my-8 hidden text-center font-vipnabd text-3xl font-extrabold md:block">
14+
<h1 className="mx-auto my-8 text-center font-vipnabd text-xl font-extrabold sm:text-2xl md:text-3xl">
1515
Pinned Subjects
1616
</h1>
1717
<div className="mb-3 flex w-full flex-col items-center gap-2 px-6">

src/components/PinButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default function PinButton({
1515
<button
1616
type="submit"
1717
onClick={onToggle}
18-
className={`ml-2 flex items-center gap-2 rounded-full border border-[#3A3745] px-4 py-2 text-sm font-medium transition ${
18+
className={`flex items-center gap-2 rounded-full border border-[#3A3745] px-3 py-3 sm:px-4 sm:py-2 text-sm font-medium transition ${
1919
isPinned
2020
? "bg-purple-700 text-white hover:bg-purple-600 dark:bg-purple-600 dark:hover:bg-purple-500"
2121
: "bg-[#e8e9ff] text-gray-700 hover:bg-slate-50 dark:bg-black dark:text-white dark:hover:bg-[#1A1823]"

src/components/PinnedPapersCarousel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ function PinnedPapersCarousel({
110110
const plugins = [Autoplay({ delay: 8000, stopOnInteraction: true })];
111111

112112
return (
113-
<div className="px-4">
113+
<div className="px-4 sm:mt-4">
114114
<div className="">
115115
{displayPapers.length > 0 ?
116116
<Carousel

src/components/Searchbar/pinned-searchbar.tsx

Lines changed: 22 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ function PinnedSearchBar({
2424
const [searchText, setSearchText] = useState("");
2525
const [suggestions, setSuggestions] = useState<string[]>([]);
2626
const suggestionsRef = useRef<HTMLUListElement | null>(null);
27-
const floatingContainerRef = useRef<HTMLDivElement>(null);
2827
const [pinned, setPinned] = useState<boolean>(false);
29-
const [open, setOpen] = useState(false);
3028
const [showControls, setShowControls] = useState(false);
3129
const searchRef = useRef<HTMLInputElement>(null);
3230
const [fuzzy, setFuzzy] = useState(
@@ -76,19 +74,6 @@ function PinnedSearchBar({
7674
filtersNotPulled?.();
7775
};
7876

79-
const handleClickOutside = (event: MouseEvent) => {
80-
const target = event.target as Node;
81-
if (
82-
floatingContainerRef.current &&
83-
!floatingContainerRef.current.contains(target)
84-
) {
85-
setOpen(false);
86-
}
87-
88-
if (suggestionsRef.current && !suggestionsRef.current.contains(target)) {
89-
setSuggestions([]);
90-
}
91-
};
9277

9378
useEffect(() => {
9479
const handleAddClicked = () => {
@@ -156,7 +141,6 @@ function PinnedSearchBar({
156141
const handleRemoveAll = () => {
157142
localStorage.setItem("userSubjects", JSON.stringify([]));
158143
window.dispatchEvent(new Event("userSubjectsChanged"));
159-
setOpen(false);
160144
};
161145

162146
useEffect(() => {
@@ -167,22 +151,16 @@ function PinnedSearchBar({
167151
if (storedSubjects.length > 0) {
168152
setShowControls(true);
169153
}
170-
171-
document.addEventListener("mousedown", handleClickOutside);
172-
return () => {
173-
document.removeEventListener("mousedown", handleClickOutside);
174-
};
175154
}, []);
176155

177156
return (
178157
<div className="w-full font-play">
179158
<div className="flex justify-center">
180-
<div className="w-full max-w-xl">
159+
<div className="w-full max-w-2xl">
181160
<form
182161
onSubmit={(e) => {
183162
e.preventDefault();
184163
handlePinToggle();
185-
if (searchText.trim() !== "") setOpen(false);
186164
}}
187165
>
188166
<div className="flex items-center gap-2">
@@ -220,68 +198,33 @@ function PinnedSearchBar({
220198
</ul>
221199
)}
222200
</div>
223-
224-
<div className="hidden md:block">
225-
<PinButton
226-
isPinned={pinned}
227-
onToggle={handlePinToggle}
228-
disabled={!showControls || searchText.trim() === ""}
229-
/>
230-
</div>
231-
232-
<div
233-
ref={floatingContainerRef}
234-
className={`md:hidden ${showControls ? "block" : "hidden"}`}
201+
<PinButton
202+
isPinned={pinned}
203+
onToggle={handlePinToggle}
204+
disabled={!showControls || searchText.trim() === ""}
205+
/>
206+
{displayPapers && <button
207+
onClick={() => {
208+
handleRemoveAll();
209+
}}
210+
className="items-center gap-2 rounded-full border border-[#3A3745] bg-[#e8e9ff] px-3 py-1.5 text-sm font-semibold text-gray-700 transition hover:bg-slate-50 dark:bg-black dark:text-white dark:hover:bg-[#1A1823] hidden sm:flex"
235211
>
236-
<NavDropdownButton
237-
isOpen={open}
238-
onClick={() => setOpen((prev) => !prev)}
239-
variant="pinned"
240-
/>
241212

242-
<div className={`${open ? "block" : "hidden"}`}>
243-
<FloatingControls>
244-
<PinButton
245-
isPinned={pinned}
246-
onToggle={() => {
247-
handlePinToggle();
248-
setOpen(false);
249-
}}
250-
disabled={!showControls || searchText.trim() === ""}
251-
/>
252-
{displayPapers && (
253-
<button
254-
onClick={() => {
255-
handleRemoveAll();
256-
setOpen(false);
257-
}}
258-
className="flex items-center gap-2 rounded-full border border-[#3A3745] bg-[#e8e9ff] px-3 py-1.5 text-sm font-semibold text-gray-700 transition hover:bg-slate-50 dark:bg-black dark:text-white dark:hover:bg-[#1A1823]"
259-
>
260-
Remove All <X className="h-4 w-4" />
261-
</button>
262-
)}
263-
</FloatingControls>
264-
</div>
265-
</div>
213+
Remove All <X className="h-4 w-4" />
214+
</button>}
266215
</div>
267216
</form>
268217
</div>
269218
</div>
270-
{displayPapers && (
271-
<div className="mt-2 hidden w-full md:block">
272-
<div className="ml-auto w-fit">
273-
<button
274-
onClick={() => {
275-
handleRemoveAll();
276-
setOpen(false);
277-
}}
278-
className="flex items-center gap-2 rounded-full border border-[#3A3745] bg-[#e8e9ff] px-3 py-1.5 text-sm font-semibold text-gray-700 transition hover:bg-slate-50 dark:bg-black dark:text-white dark:hover:bg-[#1A1823]"
279-
>
280-
Remove All <X className="h-4 w-4" />
281-
</button>
282-
</div>
283-
</div>
284-
)}
219+
220+
{displayPapers && <button
221+
onClick={() => {
222+
handleRemoveAll();
223+
}}
224+
className="sm:hidden mt-4 flex items-center gap-2 rounded-full border border-[#3A3745] bg-[#e8e9ff] px-3 py-1.5 text-sm font-semibold text-gray-700 transition hover:bg-slate dark:bg-black dark:text-white dark:hover:bg-[#1A1823]"
225+
>
226+
Remove All <X className="h-4 w-4" />
227+
</button>}
285228
</div>
286229
);
287230
}

src/components/bannerDismiss.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default function Banner({
5252

5353
<button
5454
onClick={closeBanner}
55-
className="absolute right-4 top-6 transition hover:opacity-75 sm:static sm:self-start"
55+
className="absolute right-4 transition hover:opacity-75 sm:static sm:self-start"
5656
aria-label="Dismiss banner"
5757
style={{ color: accentColor }}
5858
>

src/components/screens/Faq.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import React from "react";
44
import { useState } from "react";
55

66
function Faq() {
7-
const faqs = [
7+
const faqs = [
88
{
99
question: "How do you source exam papers for the website?",
1010
answer:
@@ -27,18 +27,18 @@ function Faq() {
2727
},
2828
{
2929
question: "Do you provide papers for soft skills?",
30-
answer: "lmao",
30+
answer: "Lmao, we actually do have something for you now.",
3131
},
3232
{
3333
question: "How do I reach out for support or assistance?",
3434
answer:
35-
'For any queries or issues, contact our support team via the "Contact Us" section on the website. We’re here to help with all your questions about exam papers and site features.',
35+
'For any queries or issues, you can email us at the address mentioned below. You can also subscribe to our newsletter for the latest updates.',
3636
},
3737
{
3838
question:
3939
"What should I do if I can’t find a specific exam paper on the website?",
4040
answer:
41-
"Our database is regularly updated with both new and older exam papers. If the paper youre looking for isn’t available, you can upload it yourself to share with the community.",
41+
"If the paper you're looking for isn’t available, you can head to our Paper Request section and submit a request by specifying the subject, year, slot, and type of exam.",
4242
},
4343
{
4444
question: "Are uploaded papers immediately visible on the website?",
@@ -47,6 +47,7 @@ function Faq() {
4747
},
4848
];
4949

50+
5051
const [faqActive, setFaqActive] = useState<number | null>(null);
5152

5253
const handleClick = (index: number) => {

0 commit comments

Comments
 (0)