Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,6 @@
"react-snap": "^1.23.0",
"tailwind-scrollbar": "^2.1.0",
"tailwindcss": "^3.4.1",
"typescript": "^5.3.3"
"typescript": "^5.9.3"
}
}
5 changes: 4 additions & 1 deletion src/common/Testimonial/TestimonialCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ const TestimonialCard = ({ home, quote, name, avatarUrl, category, created_at, e
</div>

<div className="mx-2 mt-4">
<blockquote className={`${home && 'h-32'} max-h-32 px-6 overflow-y-auto`}>
<blockquote
className={`${home ? 'h-32' : ''} max-h-32 px-6 overflow-y-auto`}
style={{ touchAction: 'pan-y' }}
>
<p
className="leading-relaxed text-gray-700"
dangerouslySetInnerHTML={{ __html: replaceWithBr() }}
Expand Down
11 changes: 9 additions & 2 deletions src/common/Testimonial/TestimonialSection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@ function TestimonialSection() {
const [testimonials, setTestimonials] = useState([]);

const fetchTestimonials = async () => {
const res = await submit(fetchTestimonialsHomePage());
setTestimonials(res);
try {
const res = await submit(fetchTestimonialsHomePage());
setTestimonials(res || []);
} catch (error) {
console.warn('Failed to fetch testimonials:', error.message);
setTestimonials([]);
}
};

useEffect(() => {
Expand All @@ -30,6 +35,7 @@ function TestimonialSection() {
<>
<div className="mx-5 lg:mx-20 h-72 mt-16 sm:mt-20">
<Swiper
grabCursor
rewind
autoplay={{
delay: 2500,
Expand All @@ -56,6 +62,7 @@ function TestimonialSection() {
}}
slidesPerView={1}
spaceBetween={10}
touchEventsTarget="container"
>
{testimonials &&
testimonials.map((testimonial) => (
Expand Down
9 changes: 7 additions & 2 deletions src/common/Testimonial/Testimonials.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ const Testimonials = () => {
const isAuthenticated = useAuthenticated();

const fetchTestimonials = async () => {
const res = await submit(fetchAllTestimonials());
setTestimonials(res);
try {
const res = await submit(fetchAllTestimonials());
setTestimonials(res || []);
} catch (error) {
console.warn('Failed to fetch testimonials:', error.message);
setTestimonials([]);
}
};

const handleLogin = (value) => {
Expand Down
23 changes: 22 additions & 1 deletion src/common/header/HeaderNav.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState } from 'react';
import { useState, useEffect, useRef } from 'react';
import { Link } from 'react-router-dom';
import { BsGithub, BsTrophyFill } from 'react-icons/bs';
import { FaLightbulb } from 'react-icons/fa';
Expand All @@ -16,6 +16,26 @@ const HeaderNav = ({ showBrowse }) => {
const { showShareModal, setShowShareModal } = useSearchContext();

const [showToggleMenu, setShowToggleMenu] = useState(false);
const menuRef = useRef(null);

// Close drawer when clicking outside the menu panel
useEffect(() => {
if (!showToggleMenu) return;

const handleClickOutside = (event) => {
if (menuRef.current && !menuRef.current.contains(event.target)) {
setShowToggleMenu(false);
}
};

document.addEventListener('mousedown', handleClickOutside);
document.addEventListener('touchstart', handleClickOutside);

return () => {
document.removeEventListener('mousedown', handleClickOutside);
document.removeEventListener('touchstart', handleClickOutside);
};
}, [showToggleMenu]);

const [anchorEl, setAnchorEl] = useState(null);

Expand Down Expand Up @@ -129,6 +149,7 @@ const HeaderNav = ({ showBrowse }) => {
<ul
className="header-links"
data-testid="header-links-container"
ref={menuRef}
onClick={(e) => e.stopPropagation()}
>
<li className="menu-closer">
Expand Down
7 changes: 6 additions & 1 deletion src/common/header/header.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@
}

.nav--visible {
transform: translateY(0);
transform: none;
}

/* Push page content below the fixed header, but not the footer */
.nav-wrapper ~ *:not(footer) {
padding-top: 64px;
}


Expand Down
1 change: 1 addition & 0 deletions src/common/home/home.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
width: 100%;
overflow-x: hidden;
min-height: 100vh;
padding-top: 32px; /* extra offset for activity banner on home page */
}

.app-home-body .app-home-body-content {
Expand Down
3 changes: 2 additions & 1 deletion src/common/playleaderboard/LeaderBoard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import TopPlayCreators from './TopPlayCreators';
import { Watch } from 'react-loader-spinner';
import { groupBy } from 'lodash';
import { format, lastDayOfMonth } from 'date-fns';
import './leaderBoard.css';

const LeaderBoard = () => {
const [top10Contributors, updateTop10Contributors] = useState([]);
Expand Down Expand Up @@ -69,7 +70,7 @@ const LeaderBoard = () => {
}, [publishedPlays]);

return (
<main className="app-body app-body-overflow-hidden">
<main className="app-body">
{publishedPlays.length && (topContributorOfTheMonth || top10Contributors) ? (
<div className=" overflow-auto lg:flex flex-row justify-center">
{topContributorOfTheMonth && (
Expand Down
7 changes: 7 additions & 0 deletions src/common/playleaderboard/leaderBoard.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@
height: 100vh;
} */

.leaderboard-loader {
display: flex;
align-items: center;
justify-content: center;
min-height: calc(100vh - 160px);
}

.leaderboard-wrapper {
background-color: #ffffff;
border-radius: 16px;
Expand Down
Loading