diff --git a/ravens-team-react/ravens-team-react/src/components/bars/headers/header-nav-component.tsx b/ravens-team-react/ravens-team-react/src/components/bars/headers/header-nav-component.tsx index 0236506..2b06209 100644 --- a/ravens-team-react/ravens-team-react/src/components/bars/headers/header-nav-component.tsx +++ b/ravens-team-react/ravens-team-react/src/components/bars/headers/header-nav-component.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useMemo } from 'react'; import { TeamResponse } from '../../../utils/twitch-api-types/team-types'; import { TabList, Tab, Image, makeStyles, tokens, SelectTabEvent, SelectTabData } from '@fluentui/react-components'; @@ -45,27 +45,8 @@ const useStyles = makeStyles({ } }); - - export const HeaderNav: React.FC = ({ teams, defaultTab, onTabChange }: HeaderNavProps) => { const styles = useStyles(); - const renderTabs = () => { - return ( - <> - { - teams.map((team) => ( - - {`${team.team_display_name} - - ))} - - ); - }; - return ( diff --git a/ravens-team-react/ravens-team-react/src/components/layouts/content-layout.tsx b/ravens-team-react/ravens-team-react/src/components/layouts/content-layout.tsx index 62c409b..50a6faa 100644 --- a/ravens-team-react/ravens-team-react/src/components/layouts/content-layout.tsx +++ b/ravens-team-react/ravens-team-react/src/components/layouts/content-layout.tsx @@ -2,6 +2,7 @@ import { makeStyles, tokens } from "@fluentui/react-components"; const useStyles = makeStyles({ sectionLayout: { + width: "100%", justifyContent: "stretch", alignContent: "center" } diff --git a/ravens-team-react/ravens-team-react/src/components/layouts/main-layout.tsx b/ravens-team-react/ravens-team-react/src/components/layouts/main-layout.tsx index 6690dab..d1ed449 100644 --- a/ravens-team-react/ravens-team-react/src/components/layouts/main-layout.tsx +++ b/ravens-team-react/ravens-team-react/src/components/layouts/main-layout.tsx @@ -1,15 +1,18 @@ // src/components/TeamContainer.tsx -import React, { useState } from 'react'; +import React, { useEffect, useMemo, useState } from 'react'; import { Footer } from '../bars/footers/footer-nav'; import { HeaderComponent } from '../bars/headers/header-component'; import { Body1Strong, Spinner, makeStyles, tokens } from '@fluentui/react-components'; -import type { SelectTabData, SelectTabEvent,TabValue} from "@fluentui/react-components"; +import type { SelectTabData, SelectTabEvent, TabValue } from "@fluentui/react-components"; import { TeamTabPanel } from '../teams/teams-list/team-tab-panel'; import { HeaderNav } from '../bars/headers/header-nav-component'; import { useQuery } from '../../utils/axios-instance'; import { getBroadcasterInfo } from '../../utils/twitchApi'; import { TwitchBroadcasterResponse } from '../../utils/twitch-api-types/user-types'; import { useTeamInfo } from '../../hooks/team-hooks/use-team-info'; +import { TeamResponse } from '../../utils/twitch-api-types/team-types'; +import { ContentLayout } from './content-layout'; +import { TeamPanels } from '../teams/teams-list/team-panels-view'; interface MainLayoutProps { broadcasterId: string; } @@ -28,11 +31,12 @@ const useStyles = makeStyles({ justifyContent: 'center', width: '100%', marginTop: tokens.spacingVerticalL, + marginBottom: tokens.spacingVerticalL, zIndex: tokens.zIndexContent }, footerNavBar: { width: '100%', - bottom:0, + bottom: 0, paddingTop: tokens.spacingVerticalL, color: tokens.colorNeutralForeground1, justifyContent: "space-evenly", @@ -46,65 +50,38 @@ const useStyles = makeStyles({ }); + export const MainLayout: React.FC = ({ broadcasterId }) => { + const { teams, loading, error } = useTeamInfo(broadcasterId); + const [broadcasterInfo, { loading: broadcasterLoading, error: broadcasterError }] = useQuery(getBroadcasterInfo, broadcasterId); + const [selectedValue, setSelectedValue] = useState(teams[0]?.id); const styles = useStyles(); - const [broadcasterInfo, {loading: broadcasterLoading, error: broadcasterError}] = useQuery(getBroadcasterInfo, broadcasterId); - const {teams, loading, error } = useTeamInfo(broadcasterId); - const [selectedValue, setSelectedValue] = useState(teams[0]?.id ?? ""); - - if (loading || broadcasterLoading) return ; - if (broadcasterError) return Error loading broadcaster information: [broadcasterError]; - if (error) return Error loading broadcaster information: [error]; - const onTabSelect = (event: SelectTabEvent, data: SelectTabData) => { - setSelectedValue(data.value); - }; + if (loading || broadcasterLoading) return ; + if (broadcasterError) return Error loading broadcaster information: {broadcasterError}; + if (error) return Error loading broadcaster information: {error.message}; - const renderHeader = () => { - return ( + const onTabSelect = (event: SelectTabEvent, data: SelectTabData) => { + setSelectedValue(data.value); + }; + const team = teams?.find((team) => team?.id === selectedValue) ?? teams[0]; + return ( +
+ {/* Header content */}
- +
- ); - }; - - const renderMainContent = () => { - return ( + {/* Main content */}
- { - teams.map(team => { - return( -
- -
- ); - }) - } + +
+
- ); - }; - const renderFooter = () => { - return ( + {/* Footer content */}