Skip to content

Commit

Permalink
Fixed type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
code-wolf-byte committed Nov 7, 2024
1 parent 47d798f commit 143d046
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 4 deletions.
36 changes: 35 additions & 1 deletion src/components/Navigation/DesktopNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,41 @@ const navLinks = [

export default function DesktopNav() {

const handleNavigation = (href) => {
interface NavLink {
name: string;
id_href: string;
cssClass: string;
}

const navLinks: NavLink[] = [
{
name: "Info",
id_href: "#info",
cssClass: "nav-text-animation",
},
{
name: "Sponsors",
id_href: "#sponsors",
cssClass: "nav-text-animation",
},
{
name: "Team",
id_href: "#team",
cssClass: "nav-text-animation",
},
{
name: "Events",
id_href: "https://asu.campuslabs.com/engage/organization/soda/events",
cssClass: "nav-text-animation",
},
{
name: "HackSoDA24",
id_href: "https://hack.thesoda.io",
cssClass: "nav-text-animation",
}
];

const handleNavigation = (href: string): void => {
if (href.startsWith("#")) {
// Redirect to root and append the hash section
window.location.href = `/${href}`;
Expand Down
6 changes: 5 additions & 1 deletion src/components/Navigation/Mobile/OpenedMobileNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ type setIsOpenTypes = {

export default function OpenedMobileNav({ setIsOpen }: setIsOpenTypes) {

const handleNavigation = (href) => {
interface HandleNavigationProps {
(href: string): void;
}

const handleNavigation: HandleNavigationProps = (href) => {
if (href.startsWith("#")) {
window.location.href = `/${href}`;
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/LeaderBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface LeaderboardEntry {
const Leaderboard: React.FC = () => {
const [leaderboardData, setLeaderboardData] = useState<LeaderboardEntry[]>([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
const [error, setError] = useState<any | null>(null);
const [currentPage, setCurrentPage] = useState(1);
const [itemsPerPage, setItemsPerPage] = useState(10);
const [searchTerm, setSearchTerm] = useState('');
Expand All @@ -31,7 +31,7 @@ const Leaderboard: React.FC = () => {
const data: LeaderboardEntry[] = await response.json();
setLeaderboardData(data);
} catch (error) {
setError(error.message);
setError((error as Error).message);
} finally {
setLoading(false);
}
Expand Down

0 comments on commit 143d046

Please sign in to comment.