aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2024-02-11 00:18:45 -0800
committerPinapelz <yukais@pinapelz.com>2024-02-11 00:18:45 -0800
commitc8537ee711a61e1953c16f4115f8aea14d4413b1 (patch)
tree70d02678616f5595d1d639cf037a65a5c4f2058f /src
parentf2d30dd57c5909c2c3e1aeba465fd5fe367b0630 (diff)
chore: bump dependencies
Diffstat (limited to 'src')
-rw-r--r--src/app/components/LRCPlayer.tsx (renamed from src/app/components/KaraokePlayer.tsx)15
-rw-r--r--src/app/page.tsx62
2 files changed, 10 insertions, 67 deletions
diff --git a/src/app/components/KaraokePlayer.tsx b/src/app/components/LRCPlayer.tsx
index 5160226..c561ee8 100644
--- a/src/app/components/KaraokePlayer.tsx
+++ b/src/app/components/LRCPlayer.tsx
@@ -1,6 +1,7 @@
import React, { CSSProperties, useCallback } from 'react';
-import styled, { css } from 'styled-components';
import { Lrc, LrcLine } from 'react-lrc';
+import styled from 'styled-components';
+import css from 'styled-components';
const Line = styled.div<{ $active: boolean; $next: boolean }>`
min-height: 10px;
@@ -17,12 +18,10 @@ const Line = styled.div<{ $active: boolean; $next: boolean }>`
background-position: right bottom;
transition: color 1s ease-out, background-position 1s ease-out;
- ${({ $active }) => $active && css`
+ ${({ $active }: { $active: boolean }) => $active ? `
color: black;
font-weight: 700;
- background-position: left bottom;
- color: rgb(50, 50, 50);
- `}
+ ` : ''}
`;
const lrcStyle: CSSProperties = {
flex: 1,
@@ -30,12 +29,12 @@ const lrcStyle: CSSProperties = {
overflow: 'hidden !important'
};
-interface KaraokePlayerProps {
+interface LRCPlayerProps {
currentMillisecond: number;
lrc: string;
}
-const KaraokePlayer: React.FC<KaraokePlayerProps> = ({ currentMillisecond, lrc }) => {
+const LRCPlayer: React.FC<LRCPlayerProps> = ({ currentMillisecond, lrc }) => {
const lineRenderer = useCallback(
({ active, line: { content } }: { active: boolean; line: LrcLine }) => {
const next = active && content === '';
@@ -55,4 +54,4 @@ const KaraokePlayer: React.FC<KaraokePlayerProps> = ({ currentMillisecond, lrc }
);
};
-export default KaraokePlayer;
+export default LRCPlayer;
diff --git a/src/app/page.tsx b/src/app/page.tsx
index 457610d..106193d 100644
--- a/src/app/page.tsx
+++ b/src/app/page.tsx
@@ -1,7 +1,7 @@
"use client";
import React, { useEffect, useRef, useState } from "react";
import styled from "styled-components";
-import KaraokePlayer from "./components/KaraokePlayer";
+import LRCPlayer from "./components/LRCPlayer";
import { toast, ToastContainer } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";
import { FaPlay, FaPause, FaVolumeUp, FaVolumeMute } from "react-icons/fa";
@@ -267,20 +267,6 @@ function KaraokePage() {
setScrubValue(parseFloat(event.target.value));
};
- const handleVolumeChange = (event: React.ChangeEvent<HTMLInputElement>) => {
- const volume = Number(event.target.value) / 100;
- const video = videoRef.current;
- const audio = supplementAudioRef.current;
- if (!video || !audio) return;
-
- if (balance < 0) {
- video.volume = volume * (1 + balance);
- audio.volume = volume;
- } else {
- video.volume = volume;
- audio.volume = volume * (1 - balance);
- }
- };
const handleVideoEnded = () => {
setIsPlaying(false);
@@ -349,7 +335,7 @@ function KaraokePage() {
<ToastContainer />
{/*LRC viewer*/}
<div style={{ display: "flex", width: "100%", height: "100vh" }}>
- <KaraokePlayer
+ <LRCPlayer
lrc={lrcContent}
currentMillisecond={currentMillisecond}
/>
@@ -422,50 +408,9 @@ function KaraokePage() {
min="0"
max="100"
value={scrubValue}
- style={{ flex: 1, height: "50px" }}
+ style={{ flex: 1, height: "50px", width: "100%"}}
onInput={handleScrub}
/>
- <div
- style={{
- position: "relative",
- width: "50px",
- height: "50px",
- }}
- >
- <button
- onClick={handleVolumeToggle}
- style={{
- width: "100%",
- height: "100%",
- padding: "10px",
- border: "none",
- borderRadius: "5px",
- backgroundColor: "white",
- color: "black",
- }}
- >
- {!showVolume ? <FaVolumeMute /> : <FaVolumeUp />}
- </button>
- {showVolume && (
- <div
- style={{
- position: "absolute",
- bottom: "100%",
- transform:
- "translateX(-50%) translateY(-100%) rotate(-90deg)",
- }}
- >
- <input
- type="range"
- min="0"
- max="100"
- defaultValue="100"
- style={{ height: "40px", width: "100px" }}
- onChange={handleVolumeChange}
- />
- </div>
- )}
- </div>
</div>
</>
) : (
@@ -489,7 +434,6 @@ function KaraokePage() {
{statusText}
</h1>
{/* Show a placeholder while no video selected */}
-
<p
style={{
fontSize: "30px",
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage