tools/media-tools/video-parser/_next/static/chunks/app/settings/page-e6e1008cfce957bb.js

1 line
8.1 KiB
JavaScript

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[662],{2608:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>n});var a=s(5155),r=s(2115),l=s(5060);function n(){let[e,t]=(0,r.useState)(!1),[s,n]=(0,r.useState)(0),[d,i]=(0,r.useState)("用户"),[c,o]=(0,r.useState)(!1),[m,x]=(0,r.useState)(""),[h,g]=(0,r.useState)(!1),[u,j]=(0,r.useState)(!0);(0,r.useEffect)(()=>{let e=localStorage.getItem("theme"),s=window.matchMedia("(prefers-color-scheme: dark)").matches;"light"===e?(t(!1),document.documentElement.classList.remove("dark")):"dark"===e?(t(!0),document.documentElement.classList.add("dark")):(t(s),s?(document.documentElement.classList.add("dark"),localStorage.setItem("theme","dark")):(document.documentElement.classList.remove("dark"),localStorage.setItem("theme","light")));let a=localStorage.getItem("currentApiIndex");a&&n(parseInt(a,10));let r=localStorage.getItem("username");r&&i(r);let l=localStorage.getItem("playInNewTab");null!==l&&j("true"===l)},[]);let k=e=>{n(e),localStorage.setItem("currentApiIndex",e.toString())};return(0,a.jsxs)("div",{className:"flex h-full",children:[(0,a.jsx)(l.A,{darkMode:e,username:d,isOpen:h,onToggle:()=>g(!h)}),(0,a.jsxs)("div",{className:"flex-1 md:ml-64 bg-white dark:bg-black min-h-screen text-black dark:text-white transition-all duration-300 ".concat(h?"md:translate-x-0":"translate-x-0"),children:[(0,a.jsx)("nav",{className:"border-b border-gray-100 dark:border-gray-800",children:(0,a.jsxs)("div",{className:"max-w-5xl mx-auto px-4 py-4 flex items-center",children:[(0,a.jsx)("button",{className:"md:hidden mr-4 text-gray-600 dark:text-gray-400",onClick:()=>g(!h),"aria-label":"打开菜单",children:(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5"})})}),(0,a.jsx)("h1",{className:"text-xl font-medium",children:"设置"})]})}),(0,a.jsx)("main",{className:"max-w-5xl mx-auto px-4 py-8",children:(0,a.jsxs)("div",{className:"space-y-8",children:[(0,a.jsxs)("section",{children:[(0,a.jsx)("h2",{className:"text-lg font-medium mb-4",children:"个人信息"}),(0,a.jsx)("div",{className:"bg-gray-50 dark:bg-gray-900 rounded-lg p-4",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"用户名"}),(0,a.jsx)("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"修改您的显示名称"})]}),c?(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("input",{type:"text",value:m,onChange:e=>x(e.target.value),className:"px-2 py-1 text-sm border border-gray-300 dark:border-gray-600 rounded bg-white dark:bg-gray-800 text-black dark:text-white",maxLength:20}),(0,a.jsx)("button",{onClick:()=>{m.trim()&&(i(m.trim()),localStorage.setItem("username",m.trim())),o(!1)},className:"p-1 text-green-600 dark:text-green-400",title:"保存",children:(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-5 h-5",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})})}),(0,a.jsx)("button",{onClick:()=>{o(!1)},className:"p-1 text-red-600 dark:text-red-400",title:"取消",children:(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-5 h-5",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}):(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:d}),(0,a.jsx)("button",{onClick:()=>{x(d),o(!0)},className:"p-1 text-gray-600 dark:text-gray-400 hover:text-black dark:hover:text-white",title:"编辑",children:(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-5 h-5",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10"})})})]})]})})]}),(0,a.jsxs)("section",{children:[(0,a.jsx)("h2",{className:"text-lg font-medium mb-4",children:"外观"}),(0,a.jsx)("div",{className:"bg-gray-50 dark:bg-gray-900 rounded-lg p-4",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"暗色模式"}),(0,a.jsx)("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"切换界面暗色/亮色模式"})]}),(0,a.jsx)("button",{onClick:()=>{t(!e),e?(document.documentElement.classList.remove("dark"),localStorage.setItem("theme","light")):(document.documentElement.classList.add("dark"),localStorage.setItem("theme","dark"))},className:"relative inline-flex items-center h-6 rounded-full w-11 bg-gray-200 dark:bg-gray-700",children:(0,a.jsx)("span",{className:"".concat(e?"translate-x-6":"translate-x-1"," inline-block w-4 h-4 transform bg-white dark:bg-gray-300 rounded-full transition-transform duration-200 ease-in-out")})})]})})]}),(0,a.jsxs)("section",{children:[(0,a.jsx)("h2",{className:"text-lg font-medium mb-4",children:"视频播放设置"}),(0,a.jsx)("div",{className:"bg-gray-50 dark:bg-gray-900 rounded-lg p-4",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"在新标签页打开视频"}),(0,a.jsx)("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:u?"视频将在新标签页中打开":"视频将在当前页面内嵌播放"})]}),(0,a.jsx)("button",{onClick:()=>{let e=!u;j(e),localStorage.setItem("playInNewTab",e.toString())},className:"relative inline-flex items-center h-6 rounded-full w-11 bg-gray-200 dark:bg-gray-700",children:(0,a.jsx)("span",{className:"".concat(u?"translate-x-6":"translate-x-1"," inline-block w-4 h-4 transform bg-white dark:bg-gray-300 rounded-full transition-transform duration-200 ease-in-out")})})]})})]}),(0,a.jsxs)("section",{children:[(0,a.jsx)("h2",{className:"text-lg font-medium mb-4",children:"解析接口"}),(0,a.jsxs)("div",{className:"bg-gray-50 dark:bg-gray-900 rounded-lg p-4",children:[(0,a.jsx)("p",{className:"font-medium mb-3",children:"默认解析接口"}),(0,a.jsx)("div",{className:"space-y-2",children:["接口1","接口2","接口3","接口4","接口5"].map((e,t)=>(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)("input",{type:"radio",id:"api-".concat(t),name:"default-api",checked:s===t,onChange:()=>k(t),className:"mr-2 h-4 w-4 text-black dark:text-white focus:ring-0"}),(0,a.jsx)("label",{htmlFor:"api-".concat(t),className:"text-sm",children:e})]},t))})]})]}),(0,a.jsxs)("section",{children:[(0,a.jsx)("h2",{className:"text-lg font-medium mb-4",children:"数据管理"}),(0,a.jsxs)("div",{className:"bg-gray-50 dark:bg-gray-900 rounded-lg p-4",children:[(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)("p",{className:"font-medium",children:"清除所有数据"}),(0,a.jsx)("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:"删除所有历史记录和收藏。此操作不可撤销。"})]}),(0,a.jsx)("button",{onClick:()=>{confirm("确定要清除所有数据吗?这将删除您的历史记录和收藏。")&&(localStorage.removeItem("videoHistory"),alert("所有数据已清除!"))},className:"px-4 py-2 bg-red-500 text-white rounded-md hover:bg-red-600 transition-colors",children:"清除数据"})]})]})]})}),(0,a.jsx)("footer",{className:"border-t border-gray-100 dark:border-gray-800 py-6 mt-12",children:(0,a.jsx)("div",{className:"max-w-5xl mx-auto px-4 text-center text-sm text-gray-500 dark:text-gray-400",children:(0,a.jsx)("p",{children:"本工具仅用于学习和研究,请勿用于非法用途"})})})]})]})}},9569:(e,t,s)=>{Promise.resolve().then(s.bind(s,2608))}},e=>{var t=t=>e(e.s=t);e.O(0,[874,60,441,684,358],()=>t(9569)),_N_E=e.O()}]);