Skip to content
Closed
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 src/components/AlgoliaSiteSearch/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export default function AlgoliaSiteSearch(): React.ReactElement | null {
return;
}

container.innerHTML = "";
container.textContent = "";
window.SiteSearch.init({
container: `#${containerId}`,
applicationId,
Expand Down
4 changes: 2 additions & 2 deletions src/components/blogCarousel/blogCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function tagColor(label: string) {
function formatDate(dateStr?: string) {
if (!dateStr) return "";
const d = new Date(dateStr);
if (isNaN(d.getTime())) return dateStr;
if (Number.isNaN(d.getTime())) return dateStr;
return d.toLocaleDateString("en-US", {
month: "short",
day: "2-digit",
Expand Down Expand Up @@ -122,7 +122,7 @@ const BlogCard = ({
{/* Avatar stack — shows all authors overlapped */}
{authorProfiles.length > 0 && (
<div className="card-avatar-stack">
{authorProfiles.map((author, i) => (
{(authorProfiles ?? []).map((author, i) => (
<div
key={author.id || i}
className="card-avatar"
Expand Down
3 changes: 2 additions & 1 deletion src/pages/broadcasts/details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ export default function VideoDetails(): ReactElement {
const response = await fetch(
`https://www.youtube.com/oembed?url=${encodeURIComponent(video.youtubeUrl)}&format=json`,
);
const data = await response.json();
if (!response.ok) throw new Error("Request failed");
const data = await response.json();
setTitle(data.title);
} catch (error) {
setTitle("Video Title Unavailable");
Expand Down
5 changes: 3 additions & 2 deletions src/pages/broadcasts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ const VideoCard: React.FC<{
const response = await fetch(
`https://www.youtube.com/oembed?url=${encodeURIComponent(video.youtubeUrl)}&format=json`,
);
const data = await response.json();
if (!response.ok) throw new Error("Request failed");
const data = await response.json();
setTitle(data.title);
} catch (error) {
setTitle("Video Title Unavailable");
Expand Down Expand Up @@ -192,7 +193,7 @@ const VideoSection: React.FC<{
<div className="video-section">
<h2>{title}</h2>
<div className="video-grid">
{videos.map((video) => (
{(videos ?? []).map((video) => (
<VideoCard key={video.id} video={video} onClick={onClick} />
))}
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/courses/explore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function CourseCard({ course }: { course: Course }) {

{/* Tags */}
<div className="explore-tags">
{course.tags.map((tag) => (
{course.(tags ?? []).map((tag) => (
<span key={tag} className="explore-tag">
{tag}
</span>
Expand Down Expand Up @@ -180,7 +180,7 @@ export default function ExploreCourses() {
);
} else if (sortOption === "duration-asc") {
result = [...result].sort(
(a, b) => parseInt(a.duration) - parseInt(b.duration),
(a, b) => parseInt(a.duration, 10) - parseInt(b.duration, 10),
);
}

Expand Down
Loading