Skip to content

Commit bce8459

Browse files
committed
Enable Webamp for scroll UI
1 parent 4b784b6 commit bce8459

4 files changed

Lines changed: 27 additions & 6 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type Props = {
1414
};
1515

1616
export default function SkinPage({ skin, index, sessionId, focused }: Props) {
17-
const showWebamp = focused && false; // Disable for now
17+
const showWebamp = focused;
1818
return (
1919
<div
2020
key={skin.md5}

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default function WebampComponent({
1818
const ref = useRef<HTMLDivElement | null>(null);
1919
const outerRef = useRef<HTMLDivElement | null>(null);
2020
// @ts-ignore
21-
const webampRef = useRef<typeof import("webamp") | null>(null);
21+
const webampRef = useRef<import("webamp").default | null>(null);
2222

2323
useEffect(() => {
2424
let disposed = false;
@@ -33,21 +33,22 @@ export default function WebampComponent({
3333
const webamp = new Webamp({
3434
initialSkin: { url: skinUrl },
3535
initialTracks,
36-
hotkeys: true,
36+
enableHotkeys: true,
3737
zIndex: 1001,
3838
});
3939

4040
webampRef.current = webamp;
4141
cleanup = () => webamp.dispose();
4242

4343
webamp.onClose(closeModal);
44-
await webamp.renderWhenReady(ref.current);
44+
// ref.current!.style.opacity = "0";
45+
await webamp.renderInto(ref.current);
4546
const { width } = outerRef.current!.getBoundingClientRect();
4647
const zoom = width / SCREENSHOT_WIDTH;
47-
console.log("Setting zoom:", zoom);
4848
document
4949
.getElementById("webamp")
5050
?.style.setProperty("zoom", String(zoom));
51+
ref.current!.style.opacity = "1";
5152

5253
if (!disposed) loaded();
5354
}
@@ -75,6 +76,9 @@ export default function WebampComponent({
7576
style={{
7677
width: SCREENSHOT_WIDTH,
7778
height: SCREENSHOT_HEIGHT,
79+
position: "relative",
80+
opacity: 0,
81+
transition: "opacity 1s linear",
7882
}}
7983
ref={ref}
8084
/>

packages/skin-database/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@
4848
"ts-node": "^10.5.0",
4949
"twit": "^2.2.11",
5050
"winston": "^3.2.1",
51-
"yargs": "^13.2.4"
51+
"yargs": "^13.2.4",
52+
"webamp": "workspace:*"
5253
},
5354
"scripts": {
5455
"lint": "eslint .",

pnpm-lock.yaml

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)