feat(frontend): add page titles to navbar on mobile
- Save vertical space on mobile by showing page title in navbar
- Mobile: "spotlight.cam - {PageTitle}" instead of separate h1
- Desktop: unchanged - page titles remain as separate headings
- Saves ~60-80px vertical space on mobile devices
Pages updated:
- Dashboard, Events, Matches, History, Profile
This commit is contained in:
@@ -1,13 +1,13 @@
|
|||||||
import Navbar from './Navbar';
|
import Navbar from './Navbar';
|
||||||
|
|
||||||
const Layout = ({ children, fullWidth = false, noPadding = false }) => {
|
const Layout = ({ children, fullWidth = false, noPadding = false, pageTitle = null }) => {
|
||||||
const mainClasses = fullWidth || noPadding
|
const mainClasses = fullWidth || noPadding
|
||||||
? "flex-1 flex flex-col"
|
? "flex-1 flex flex-col"
|
||||||
: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8";
|
: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen bg-gray-50 flex flex-col">
|
<div className="min-h-screen bg-gray-50 flex flex-col">
|
||||||
<Navbar />
|
<Navbar pageTitle={pageTitle} />
|
||||||
<main className={mainClasses}>
|
<main className={mainClasses}>
|
||||||
{children}
|
{children}
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { matchesAPI } from '../../services/api';
|
|||||||
import { connectSocket, disconnectSocket, getSocket } from '../../services/socket';
|
import { connectSocket, disconnectSocket, getSocket } from '../../services/socket';
|
||||||
import { MATCH_STATUS } from '../../constants';
|
import { MATCH_STATUS } from '../../constants';
|
||||||
|
|
||||||
const Navbar = () => {
|
const Navbar = ({ pageTitle = null }) => {
|
||||||
const { user, logout } = useAuth();
|
const { user, logout } = useAuth();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [pendingMatchesCount, setPendingMatchesCount] = useState(0);
|
const [pendingMatchesCount, setPendingMatchesCount] = useState(0);
|
||||||
@@ -67,7 +67,12 @@ const Navbar = () => {
|
|||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
<Link to="/dashboard" className="flex items-center space-x-2">
|
<Link to="/dashboard" className="flex items-center space-x-2">
|
||||||
<Video className="w-8 h-8 text-primary-600" />
|
<Video className="w-8 h-8 text-primary-600" />
|
||||||
<span className="text-xl font-bold text-gray-900">spotlight.cam</span>
|
<span className="text-xl font-bold text-gray-900">
|
||||||
|
<span className="hidden lg:inline">spotlight.cam</span>
|
||||||
|
<span className="lg:hidden">
|
||||||
|
{pageTitle ? `spotlight.cam - ${pageTitle}` : 'spotlight.cam'}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
{/* Desktop menu */}
|
{/* Desktop menu */}
|
||||||
|
|||||||
@@ -160,9 +160,9 @@ const DashboardPage = () => {
|
|||||||
const hasOutgoing = matchRequests?.outgoing?.length > 0;
|
const hasOutgoing = matchRequests?.outgoing?.length > 0;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<Layout pageTitle="Dashboard">
|
||||||
<div className="max-w-5xl mx-auto">
|
<div className="max-w-5xl mx-auto">
|
||||||
<div className="mb-8">
|
<div className="hidden lg:block mb-8">
|
||||||
<h1 className="text-3xl font-bold text-gray-900">Dashboard</h1>
|
<h1 className="text-3xl font-bold text-gray-900">Dashboard</h1>
|
||||||
<p className="text-gray-600 mt-1">
|
<p className="text-gray-600 mt-1">
|
||||||
Welcome back, {user?.firstName || user?.username}!
|
Welcome back, {user?.firstName || user?.username}!
|
||||||
|
|||||||
@@ -192,10 +192,10 @@ const EventsPage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<Layout pageTitle="Events">
|
||||||
<div className="max-w-4xl mx-auto">
|
<div className="max-w-4xl mx-auto">
|
||||||
<h1 className="text-3xl font-bold text-gray-900 mb-2">Choose an event</h1>
|
<h1 className="hidden lg:block text-3xl font-bold text-gray-900 mb-2">Choose an event</h1>
|
||||||
<p className="text-gray-600 mb-8">Join an event and start connecting with other dancers</p>
|
<p className="hidden lg:block text-gray-600 mb-8">Join an event and start connecting with other dancers</p>
|
||||||
|
|
||||||
{canLoadMorePast && (
|
{canLoadMorePast && (
|
||||||
<div className="mb-4 flex justify-center">
|
<div className="mb-4 flex justify-center">
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ import { MATCH_STATUS } from '../constants';
|
|||||||
|
|
||||||
const HistoryPage = () => {
|
const HistoryPage = () => {
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<Layout pageTitle="History">
|
||||||
<div className="max-w-4xl mx-auto">
|
<div className="max-w-4xl mx-auto">
|
||||||
<h1 className="text-3xl font-bold text-gray-900 mb-2">Collaboration history</h1>
|
<h1 className="hidden lg:block text-3xl font-bold text-gray-900 mb-2">Collaboration history</h1>
|
||||||
<p className="text-gray-600 mb-8">Your previous matches and ratings</p>
|
<p className="hidden lg:block text-gray-600 mb-8">Your previous matches and ratings</p>
|
||||||
|
|
||||||
{/* Matches Section */}
|
{/* Matches Section */}
|
||||||
<div className="mb-12">
|
<div className="mb-12">
|
||||||
|
|||||||
@@ -125,9 +125,9 @@ const MatchesPage = () => {
|
|||||||
const otherMatches = filteredMatches.filter(m => !(m.status === MATCH_STATUS.PENDING && !m.isInitiator));
|
const otherMatches = filteredMatches.filter(m => !(m.status === MATCH_STATUS.PENDING && !m.isInitiator));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout noPadding>
|
<Layout noPadding pageTitle="Matches">
|
||||||
<div className="w-full max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
|
<div className="w-full max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
|
||||||
<div className="mb-6">
|
<div className="hidden lg:block mb-6">
|
||||||
<h1 className="text-3xl font-bold text-gray-900">Match Requests</h1>
|
<h1 className="text-3xl font-bold text-gray-900">Match Requests</h1>
|
||||||
<p className="text-gray-600 mt-2">
|
<p className="text-gray-600 mt-2">
|
||||||
Manage your dance partner connections
|
Manage your dance partner connections
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ const ProfilePage = () => {
|
|||||||
const [activeTab, setActiveTab] = useState('profile');
|
const [activeTab, setActiveTab] = useState('profile');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<Layout pageTitle="Profile">
|
||||||
<div className="min-h-screen bg-gray-50 py-8">
|
<div className="min-h-screen bg-gray-50 py-8">
|
||||||
<div className="max-w-4xl mx-auto px-4">
|
<div className="max-w-4xl mx-auto px-4">
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
|
|||||||
Reference in New Issue
Block a user