import React, { useEffect, useRef, useState } from "react";
import { AuthState, useAuthStore } from "../../store/auth";
import "./settings.scss";
import { DynamicIcon } from "lucide-react/dynamic";
function Settings() {
const auth = useAuthStore();
const [load, setLoad] = useState(false);
useEffect(() => {
if (auth.token === null) {
document.location.href = "/";
return;
}
auth.checkToken(auth.token).then((ok) => {
if (!ok) {
document.location.href = "/";
return;
}
setLoad(true);
});
}, [auth, load]);
if (!load) {
return (
<>>
);
}
return (
);
}
function SettingBox({ children }: { children: React.ReactNode }) {
return (
{children}
);
}
function AccountSetting({ auth }: { auth: AuthState }) {
const orRef = useRef(null);
const pwRef = useRef(null);
const ckRef = useRef(null);
return (
Account Setting
You can modify your account. This is a sensitive option. Please reconsider if you want to change your account information.
Change Password
If you change your password, you will need to log in again.
Delete Account
You can delete account. This action is irreversible. Please proceed with caution.
);
}
function PasswordInput({ placeholder, ref }: { placeholder: string; ref: React.RefObject }) {
const [show, setShow] = useState(false);
return (
);
}
export default Settings;