Spaces:
Sleeping
Sleeping
Commit ·
88e0098
1
Parent(s): 0a6f69d
Add mobile responsive layout with bottom tab bar
Browse filesBottom tab bar for mobile navigation (replaces hidden sidebar), viewport-
fitted Discover page so card + buttons show without scrolling, and
responsive tweaks for all pages (grid, spacing, typography).
- frontend/src/components/Layout.tsx +21 -16
- frontend/src/index.css +203 -3
frontend/src/components/Layout.tsx
CHANGED
|
@@ -44,6 +44,13 @@ function DashboardIcon() {
|
|
| 44 |
);
|
| 45 |
}
|
| 46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
export function Layout() {
|
| 48 |
return (
|
| 49 |
<div className="app-shell">
|
|
@@ -52,27 +59,25 @@ export function Layout() {
|
|
| 52 |
<span>Taste</span> Engine
|
| 53 |
</div>
|
| 54 |
<nav>
|
| 55 |
-
|
| 56 |
-
<
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
Discover
|
| 62 |
-
</NavLink>
|
| 63 |
-
<NavLink to="/profile" className={({ isActive }) => isActive ? "active" : ""}>
|
| 64 |
-
<ProfileIcon />
|
| 65 |
-
Profile
|
| 66 |
-
</NavLink>
|
| 67 |
-
<NavLink to="/dashboard" className={({ isActive }) => isActive ? "active" : ""}>
|
| 68 |
-
<DashboardIcon />
|
| 69 |
-
Dashboard
|
| 70 |
-
</NavLink>
|
| 71 |
</nav>
|
| 72 |
</aside>
|
| 73 |
<main className="main-content">
|
| 74 |
<Outlet />
|
| 75 |
</main>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
</div>
|
| 77 |
);
|
| 78 |
}
|
|
|
|
| 44 |
);
|
| 45 |
}
|
| 46 |
|
| 47 |
+
const navItems: { to: string; end?: boolean; icon: () => React.JSX.Element; label: string }[] = [
|
| 48 |
+
{ to: "/", end: true, icon: BrowseIcon, label: "Browse" },
|
| 49 |
+
{ to: "/discover", icon: DiscoverIcon, label: "Discover" },
|
| 50 |
+
{ to: "/profile", icon: ProfileIcon, label: "Profile" },
|
| 51 |
+
{ to: "/dashboard", icon: DashboardIcon, label: "Dashboard" },
|
| 52 |
+
];
|
| 53 |
+
|
| 54 |
export function Layout() {
|
| 55 |
return (
|
| 56 |
<div className="app-shell">
|
|
|
|
| 59 |
<span>Taste</span> Engine
|
| 60 |
</div>
|
| 61 |
<nav>
|
| 62 |
+
{navItems.map(({ to, end, icon: Icon, label }) => (
|
| 63 |
+
<NavLink key={to} to={to} end={end} className={({ isActive }) => isActive ? "active" : ""}>
|
| 64 |
+
<Icon />
|
| 65 |
+
{label}
|
| 66 |
+
</NavLink>
|
| 67 |
+
))}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
</nav>
|
| 69 |
</aside>
|
| 70 |
<main className="main-content">
|
| 71 |
<Outlet />
|
| 72 |
</main>
|
| 73 |
+
<nav className="mobile-tab-bar">
|
| 74 |
+
{navItems.map(({ to, end, icon: Icon, label }) => (
|
| 75 |
+
<NavLink key={to} to={to} end={end} className={({ isActive }) => `tab-item${isActive ? " active" : ""}`}>
|
| 76 |
+
<Icon />
|
| 77 |
+
<span>{label}</span>
|
| 78 |
+
</NavLink>
|
| 79 |
+
))}
|
| 80 |
+
</nav>
|
| 81 |
</div>
|
| 82 |
);
|
| 83 |
}
|
frontend/src/index.css
CHANGED
|
@@ -829,16 +829,216 @@ select:focus {
|
|
| 829 |
}
|
| 830 |
.discover-empty h2 { color: var(--text); margin-bottom: 8px; }
|
| 831 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 832 |
/* ---------- Responsive ---------- */
|
| 833 |
@media (max-width: 768px) {
|
| 834 |
.sidebar {
|
| 835 |
display: none;
|
| 836 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 842 |
}
|
| 843 |
-
.swipe-area { max-width: 340px; }
|
| 844 |
}
|
|
|
|
| 829 |
}
|
| 830 |
.discover-empty h2 { color: var(--text); margin-bottom: 8px; }
|
| 831 |
|
| 832 |
+
/* ---------- Mobile bottom tab bar ---------- */
|
| 833 |
+
.mobile-tab-bar {
|
| 834 |
+
display: none;
|
| 835 |
+
}
|
| 836 |
+
|
| 837 |
/* ---------- Responsive ---------- */
|
| 838 |
@media (max-width: 768px) {
|
| 839 |
.sidebar {
|
| 840 |
display: none;
|
| 841 |
}
|
| 842 |
+
|
| 843 |
+
.mobile-tab-bar {
|
| 844 |
+
display: flex;
|
| 845 |
+
position: fixed;
|
| 846 |
+
bottom: 0;
|
| 847 |
+
left: 0;
|
| 848 |
+
right: 0;
|
| 849 |
+
background: var(--card);
|
| 850 |
+
border-top: 1px solid var(--border);
|
| 851 |
+
z-index: 100;
|
| 852 |
+
padding: 4px 0;
|
| 853 |
+
padding-bottom: env(safe-area-inset-bottom, 4px);
|
| 854 |
+
}
|
| 855 |
+
|
| 856 |
+
.tab-item {
|
| 857 |
+
flex: 1;
|
| 858 |
+
display: flex;
|
| 859 |
+
flex-direction: column;
|
| 860 |
+
align-items: center;
|
| 861 |
+
gap: 2px;
|
| 862 |
+
padding: 6px 0;
|
| 863 |
+
color: var(--text-muted);
|
| 864 |
+
text-decoration: none;
|
| 865 |
+
font-size: 10px;
|
| 866 |
+
transition: color 0.15s;
|
| 867 |
+
}
|
| 868 |
+
.tab-item svg {
|
| 869 |
+
width: 22px;
|
| 870 |
+
height: 22px;
|
| 871 |
+
}
|
| 872 |
+
.tab-item.active {
|
| 873 |
+
color: var(--accent);
|
| 874 |
+
}
|
| 875 |
+
|
| 876 |
.main-content {
|
| 877 |
+
padding: 16px 12px;
|
| 878 |
+
padding-bottom: 80px; /* space for tab bar */
|
| 879 |
}
|
| 880 |
+
|
| 881 |
.product-grid {
|
| 882 |
+
grid-template-columns: repeat(2, 1fr);
|
| 883 |
+
gap: 10px;
|
| 884 |
+
}
|
| 885 |
+
|
| 886 |
+
.product-card-img {
|
| 887 |
+
padding: 6px;
|
| 888 |
+
}
|
| 889 |
+
|
| 890 |
+
.product-card-body {
|
| 891 |
+
padding: 8px;
|
| 892 |
+
}
|
| 893 |
+
|
| 894 |
+
.product-card-name {
|
| 895 |
+
font-size: 12px;
|
| 896 |
+
}
|
| 897 |
+
|
| 898 |
+
.product-card-price {
|
| 899 |
+
font-size: 12px;
|
| 900 |
+
}
|
| 901 |
+
|
| 902 |
+
.score-badge {
|
| 903 |
+
font-size: 10px;
|
| 904 |
+
padding: 2px 6px;
|
| 905 |
+
}
|
| 906 |
+
|
| 907 |
+
/* Browse controls */
|
| 908 |
+
.filters {
|
| 909 |
+
gap: 6px;
|
| 910 |
+
}
|
| 911 |
+
.filters button {
|
| 912 |
+
padding: 6px 12px;
|
| 913 |
+
font-size: 12px;
|
| 914 |
+
}
|
| 915 |
+
|
| 916 |
+
.search-sort {
|
| 917 |
+
flex-direction: column;
|
| 918 |
+
gap: 8px;
|
| 919 |
+
}
|
| 920 |
+
.search-sort input,
|
| 921 |
+
.search-sort select {
|
| 922 |
+
width: 100%;
|
| 923 |
+
}
|
| 924 |
+
|
| 925 |
+
/* Stats */
|
| 926 |
+
.stats-row {
|
| 927 |
+
gap: 8px;
|
| 928 |
+
}
|
| 929 |
+
.stat-card {
|
| 930 |
+
padding: 14px 16px;
|
| 931 |
+
min-width: 0;
|
| 932 |
+
}
|
| 933 |
+
.stat-card-value {
|
| 934 |
+
font-size: 22px;
|
| 935 |
+
}
|
| 936 |
+
|
| 937 |
+
/* Profile */
|
| 938 |
+
.profile-stats {
|
| 939 |
+
gap: 8px;
|
| 940 |
+
}
|
| 941 |
+
.profile-stat {
|
| 942 |
+
padding: 12px;
|
| 943 |
+
min-width: 0;
|
| 944 |
+
}
|
| 945 |
+
.profile-stat .value {
|
| 946 |
+
font-size: 22px;
|
| 947 |
+
}
|
| 948 |
+
.upload-zone {
|
| 949 |
+
padding: 24px 16px;
|
| 950 |
+
}
|
| 951 |
+
.rating-grid {
|
| 952 |
+
grid-template-columns: repeat(2, 1fr);
|
| 953 |
+
gap: 10px;
|
| 954 |
+
}
|
| 955 |
+
|
| 956 |
+
/* Dashboard table */
|
| 957 |
+
.table-wrap {
|
| 958 |
+
font-size: 13px;
|
| 959 |
+
}
|
| 960 |
+
.table-wrap th,
|
| 961 |
+
.table-wrap td {
|
| 962 |
+
padding: 10px 10px;
|
| 963 |
+
}
|
| 964 |
+
|
| 965 |
+
/* Discover — fit everything in viewport without scrolling */
|
| 966 |
+
.discover-container {
|
| 967 |
+
padding: 0 8px;
|
| 968 |
+
height: calc(100dvh - 56px - 16px); /* viewport minus tab bar minus top padding */
|
| 969 |
+
display: flex;
|
| 970 |
+
flex-direction: column;
|
| 971 |
+
overflow: hidden;
|
| 972 |
+
}
|
| 973 |
+
.discover-header {
|
| 974 |
+
margin-bottom: 8px;
|
| 975 |
+
}
|
| 976 |
+
.discover-header h1 {
|
| 977 |
+
font-size: 1.3em;
|
| 978 |
+
margin-bottom: 2px;
|
| 979 |
+
}
|
| 980 |
+
.discover-header .subtitle {
|
| 981 |
+
font-size: 12px;
|
| 982 |
+
}
|
| 983 |
+
.discover-stats-bar {
|
| 984 |
+
gap: 6px;
|
| 985 |
+
margin-bottom: 8px;
|
| 986 |
+
}
|
| 987 |
+
.discover-stat {
|
| 988 |
+
font-size: 11px;
|
| 989 |
+
padding: 3px 8px;
|
| 990 |
+
}
|
| 991 |
+
.swipe-area {
|
| 992 |
+
flex: 1;
|
| 993 |
+
min-height: 0;
|
| 994 |
+
max-width: 100%;
|
| 995 |
+
aspect-ratio: unset;
|
| 996 |
+
margin-bottom: 10px;
|
| 997 |
+
}
|
| 998 |
+
.swipe-card {
|
| 999 |
+
position: absolute;
|
| 1000 |
+
inset: 0;
|
| 1001 |
+
}
|
| 1002 |
+
.swipe-card img {
|
| 1003 |
+
height: 60%;
|
| 1004 |
+
}
|
| 1005 |
+
.swipe-card-info {
|
| 1006 |
+
padding: 8px 12px;
|
| 1007 |
+
}
|
| 1008 |
+
.swipe-name {
|
| 1009 |
+
font-size: 14px;
|
| 1010 |
+
}
|
| 1011 |
+
.swipe-buttons {
|
| 1012 |
+
gap: 14px;
|
| 1013 |
+
margin-bottom: 6px;
|
| 1014 |
+
}
|
| 1015 |
+
.swipe-btn {
|
| 1016 |
+
width: 52px;
|
| 1017 |
+
height: 52px;
|
| 1018 |
+
}
|
| 1019 |
+
.swipe-btn.skip {
|
| 1020 |
+
width: 42px;
|
| 1021 |
+
height: 42px;
|
| 1022 |
+
}
|
| 1023 |
+
.swipe-btn.undo {
|
| 1024 |
+
width: 38px;
|
| 1025 |
+
height: 38px;
|
| 1026 |
+
}
|
| 1027 |
+
.swipe-btn svg {
|
| 1028 |
+
width: 24px;
|
| 1029 |
+
height: 24px;
|
| 1030 |
+
}
|
| 1031 |
+
.discover-shortcuts {
|
| 1032 |
+
display: none; /* keyboard hints not useful on mobile */
|
| 1033 |
+
}
|
| 1034 |
+
|
| 1035 |
+
/* Pagination */
|
| 1036 |
+
.pagination {
|
| 1037 |
+
margin-top: 20px;
|
| 1038 |
+
margin-bottom: 12px;
|
| 1039 |
+
}
|
| 1040 |
+
.pagination button {
|
| 1041 |
+
padding: 6px 12px;
|
| 1042 |
+
font-size: 13px;
|
| 1043 |
}
|
|
|
|
| 1044 |
}
|