Skip to content

Commit

Permalink
feat: video controls
Browse files Browse the repository at this point in the history
  • Loading branch information
wkylin committed Jul 30, 2023
1 parent aa37c5f commit 68c8221
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 21 deletions.
34 changes: 33 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,37 @@
"files.autoSave": "onWindowChange",
"npm-scripts.showStartNotification": false,
"editor.suggest.snippetsPreventQuickSuggestions": false,
"aiXcoder.showTrayIcon": true
"aiXcoder.showTrayIcon": true,
"cSpell.words": [
"antd",
"blueimp",
"bodyparser",
"cssinjs",
"drei",
"echarts",
"flexbugs",
"hashmark",
"jsonlint",
"maath",
"markmap",
"Markmap",
"Meraid",
"mockjs",
"mpetazzoni",
"portfinder",
"preinstall",
"purgecss",
"qrcode",
"reduxjs",
"screenfull",
"scripty",
"stime",
"stylelint",
"svgr",
"tailwindcss",
"trycatch",
"webpackbar",
"welldone",
"wkylin"
]
}
6 changes: 4 additions & 2 deletions src/components/container/musicPlayer/Controls.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@ const Controls = ({
onClick={() => setRepeat((prev) => !prev)}
className="hidden sm:block cursor-pointer"
/>
{currentSongs?.length && (
{currentSongs?.length > 0 && (
<MdSkipPrevious size={30} color="#FFF" className="cursor-pointer" onClick={handlePrevSong} />
)}
{isPlaying ? (
<BsFillPauseFill size={45} color="#FFF" onClick={handlePlayPause} className="cursor-pointer" />
) : (
<BsFillPlayFill size={45} color="#FFF" onClick={handlePlayPause} className="cursor-pointer" />
)}
{currentSongs?.length && <MdSkipNext size={30} color="#FFF" className="cursor-pointer" onClick={handleNextSong} />}
{currentSongs?.length > 0 && (
<MdSkipNext size={30} color="#FFF" className="cursor-pointer" onClick={handleNextSong} />
)}
<BsShuffle
size={20}
color={shuffle ? 'red' : 'white'}
Expand Down
4 changes: 2 additions & 2 deletions src/service/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const handleFailedResult = (response, error, isShowError, reject) => {
if (reject) reject(response)
}

const handleSuccessResult = (reslove, result, isShowError) => {
const handleSuccessResult = (resolve, result, isShowError) => {
// response.ok text/html text/plain result may be string
if (result.code !== 0) {
if (result.code === 41002) {
Expand All @@ -67,7 +67,7 @@ const handleSuccessResult = (reslove, result, isShowError) => {
message.error(errStr, 2)
}
}
reslove(result)
resolve(result)
}

const handleFetchData = (url, options) => {
Expand Down
17 changes: 1 addition & 16 deletions src/utils/aidFn.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export const escape = (str) =>
export const toCamelCase = (str) => str.trim().replace(/[-_\s]+(.)?/g, (_, c) => (c ? c.toUpperCase() : ''))
export const random = (min, max) => Math.floor(Math.random() * (max - min + 1) + min)
export const randomColor = () => `#${Math.random().toString(16).slice(2, 8).padEnd(6, '0')}`
export const pause = (millis) => new Promise((resolve) => setTimeout(resolve, millis))
export const pause = (millions) => new Promise((resolve) => setTimeout(resolve, millions))
export const camelizeCamelCase = (str) =>
str
.replace(/(?:^\w|[A-Z]|\b\w)/g, (letter, index) => (index === 0 ? letter.toLowerCase() : letter.toUpperCase()))
Expand All @@ -228,18 +228,3 @@ export const copyTextToClipboard = async (textToCopy) => {
console.error(`复制到剪贴板失败:${err.message}`)
}
}

export const copyImgToClipboard = async (imgUrl) => {
try {
const data = await fetch(imgUrl)
const blob = await data.blob()
await navigator.clipboard.write([
new ClipboardItem({
[blob.type]: blob,
}),
])
console.log('Image copied.')
} catch (err) {
console.error(err.name, err.message)
}
}

1 comment on commit 68c8221

@vercel
Copy link

@vercel vercel bot commented on 68c8221 Jul 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

pro-react-admin – ./

pro-react-admin.vercel.app
pro-react-admin-wkylin.vercel.app
pro-react-admin-git-main-wkylin.vercel.app

Please sign in to comment.