Skip to content

Commit 8efe121

Browse files
committed
More stuff for the new layout
1 parent c778464 commit 8efe121

File tree

11 files changed

+534
-76
lines changed

11 files changed

+534
-76
lines changed

packages/skin-database/app/(modern)/scroll/BottomMenuBar.tsx

Lines changed: 81 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
import Link from "next/link";
1414
import { useState, useEffect, useRef } from "react";
1515
import { usePathname } from "next/navigation";
16+
import { MOBILE_MAX_WIDTH } from "../../../legacy-client/src/constants";
1617

1718
export default function BottomMenuBar() {
1819
const [isHamburgerOpen, setIsHamburgerOpen] = useState(false);
@@ -49,52 +50,55 @@ export default function BottomMenuBar() {
4950
{/* Hamburger Menu Overlay */}
5051
{isHamburgerOpen && (
5152
<div
52-
ref={menuRef}
5353
style={{
5454
position: "absolute",
5555
bottom: "4.5rem",
56-
left: 0,
56+
left: "50%",
57+
transform: "translateX(-50%)",
5758
width: "100%",
59+
maxWidth: MOBILE_MAX_WIDTH,
5860
backgroundColor: "rgba(26, 26, 26, 0.98)",
5961
backdropFilter: "blur(10px)",
6062
borderTop: "1px solid rgba(255, 255, 255, 0.1)",
6163
zIndex: 999,
6264
}}
6365
>
64-
<HamburgerMenuItem
65-
href="/about"
66-
icon={<Info size={20} />}
67-
label="About"
68-
onClick={() => {
69-
setIsHamburgerOpen(false);
70-
}}
71-
/>
72-
<HamburgerMenuItem
73-
href="/upload"
74-
icon={<Upload size={20} />}
75-
label="Upload"
76-
onClick={() => {
77-
setIsHamburgerOpen(false);
78-
}}
79-
/>{" "}
80-
<HamburgerMenuItem
81-
href="https://github.com/captbaritone/webamp/issues"
82-
icon={<MessageSquare size={20} />}
83-
label="Feedback"
84-
onClick={() => {
85-
setIsHamburgerOpen(false);
86-
}}
87-
external
88-
/>
89-
<HamburgerMenuItem
90-
href="https://github.com/captbaritone/webamp/"
91-
icon={<Github size={20} />}
92-
label="GitHub"
93-
onClick={() => {
94-
setIsHamburgerOpen(false);
95-
}}
96-
external
97-
/>
66+
<div ref={menuRef}>
67+
<HamburgerMenuItem
68+
href="/about"
69+
icon={<Info size={20} />}
70+
label="About"
71+
onClick={() => {
72+
setIsHamburgerOpen(false);
73+
}}
74+
/>
75+
<HamburgerMenuItem
76+
href="/upload"
77+
icon={<Upload size={20} />}
78+
label="Upload"
79+
onClick={() => {
80+
setIsHamburgerOpen(false);
81+
}}
82+
/>{" "}
83+
<HamburgerMenuItem
84+
href="https://github.com/captbaritone/webamp/issues"
85+
icon={<MessageSquare size={20} />}
86+
label="Feedback"
87+
onClick={() => {
88+
setIsHamburgerOpen(false);
89+
}}
90+
external
91+
/>
92+
<HamburgerMenuItem
93+
href="https://github.com/captbaritone/webamp/"
94+
icon={<Github size={20} />}
95+
label="GitHub"
96+
onClick={() => {
97+
setIsHamburgerOpen(false);
98+
}}
99+
external
100+
/>
101+
</div>
98102
</div>
99103
)}
100104

@@ -110,36 +114,48 @@ export default function BottomMenuBar() {
110114
borderTop: "1px solid rgba(255, 255, 255, 0.1)",
111115
padding: "0.75rem 0",
112116
display: "flex",
113-
justifyContent: "space-evenly",
117+
justifyContent: "center",
114118
alignItems: "center",
115119
zIndex: 1000,
116120
}}
117121
>
118-
<MenuButton
119-
href="/scroll"
120-
icon={<Smartphone size={24} />}
121-
label="Feed"
122-
isActive={pathname === "/scroll"}
123-
/>
124-
<MenuButton
125-
href="/"
126-
icon={<Grid3x3 size={24} />}
127-
label="Grid"
128-
isActive={pathname === "/"}
129-
/>
130-
<MenuButton
131-
href="/"
132-
icon={<Search size={24} />}
133-
label="Search"
134-
isActive={false}
135-
/>
136-
<MenuButton
137-
icon={<Menu size={24} />}
138-
label="Menu"
139-
onClick={toggleHamburger}
140-
isButton
141-
isActive={false}
142-
/>
122+
<div
123+
style={{
124+
width: "100%",
125+
maxWidth: MOBILE_MAX_WIDTH, // Match the scroll page max width
126+
display: "flex",
127+
justifyContent: "space-evenly",
128+
alignItems: "center",
129+
}}
130+
>
131+
<MenuButton
132+
href="/scroll"
133+
icon={<Smartphone size={24} />}
134+
label="Feed"
135+
isActive={
136+
pathname === "/scroll" || pathname.startsWith("/scroll/skin")
137+
}
138+
/>
139+
<MenuButton
140+
href="/scroll/grid"
141+
icon={<Grid3x3 size={24} />}
142+
label="Grid"
143+
isActive={pathname === "/scroll/grid"}
144+
/>
145+
<MenuButton
146+
href="/"
147+
icon={<Search size={24} />}
148+
label="Search"
149+
isActive={false}
150+
/>
151+
<MenuButton
152+
icon={<Menu size={24} />}
153+
label="Menu"
154+
onClick={toggleHamburger}
155+
isButton
156+
isActive={false}
157+
/>
158+
</div>
143159
</div>
144160
</>
145161
);
@@ -151,6 +167,7 @@ type MenuButtonProps = {
151167
label: string;
152168
isButton?: boolean;
153169
isActive?: boolean;
170+
onClick?: () => void;
154171
};
155172

156173
function MenuButton({
@@ -159,6 +176,7 @@ function MenuButton({
159176
label,
160177
isButton = false,
161178
isActive = false,
179+
onClick,
162180
}: MenuButtonProps) {
163181
const touchTargetSize = "3.0rem";
164182

@@ -230,6 +248,7 @@ function MenuButton({
230248
style={containerStyle}
231249
onMouseEnter={handleMouseEnter}
232250
onMouseLeave={handleMouseLeave}
251+
onClick={onClick}
233252
>
234253
{content}
235254
</button>

packages/skin-database/app/(modern)/scroll/SkinPage.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use client";
22

3+
import { unstable_ViewTransition as ViewTransition } from "react";
34
import { ClientSkin } from "./SkinScroller";
45
import SkinActionIcons from "./SkinActionIcons";
56

@@ -31,15 +32,17 @@ export default function SkinPage({ skin, index, sessionId }: Props) {
3132
}}
3233
>
3334
<div style={{ position: "relative", flexShrink: 0 }}>
34-
<img
35-
src={skin.screenshotUrl}
36-
alt={skin.fileName}
37-
style={{
38-
width: "100%",
39-
aspectRatio: "275 / 348",
40-
imageRendering: "pixelated",
41-
}}
42-
/>
35+
<ViewTransition name={`skin-${skin.md5}`}>
36+
<img
37+
src={skin.screenshotUrl}
38+
alt={skin.fileName}
39+
style={{
40+
width: "100%",
41+
aspectRatio: "275 / 348",
42+
imageRendering: "pixelated",
43+
}}
44+
/>
45+
</ViewTransition>
4346

4447
<SkinActionIcons skin={skin} sessionId={sessionId} />
4548
</div>

packages/skin-database/app/(modern)/scroll/SkinScroller.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useState, useLayoutEffect, useEffect } from "react";
44
import SkinPage from "./SkinPage";
55
import { logUserEvent } from "./Events";
66
import { useScrollHint } from "./useScrollHint";
7+
import { MOBILE_MAX_WIDTH } from "../../../legacy-client/src/constants";
78

89
export type ClientSkin = {
910
screenshotUrl: string;
@@ -158,8 +159,10 @@ export default function SkinScroller({
158159
<div
159160
ref={setContainerRef}
160161
style={{
162+
maxWidth: MOBILE_MAX_WIDTH, // 9:16 aspect ratio for scroll, full width for grid
163+
margin: "0 auto",
161164
height: "100vh",
162-
width: "100%",
165+
// width: "100%",
163166
overflowY: "scroll",
164167
scrollSnapType: "y mandatory",
165168
scrollbarWidth: "none", // Firefox

0 commit comments

Comments
 (0)