feat: automatic db creation and migration

This commit is contained in:
2026-08-28 16:32:25 +03:00
parent 114ba523f4
commit 4fbb8a8e2e
9 changed files with 104 additions and 120 deletions
+2 -113
View File
@@ -48,7 +48,6 @@ export default function DashPage({
const tabs: Record<string, string> = {
class: "классы",
admin: "админы",
server: "сервер",
};
@@ -85,8 +84,6 @@ export default function DashPage({
setRoute={(p: string) => setsetRoute(setRoute, p)}
/>
);
case "admin":
return <AdminsMainEditor pass={pass as string} />;
case "server":
return <ServerEditor pass={pass as string} />;
}
@@ -183,17 +180,10 @@ export const CopyClassLink = ({
</DengiButton>
);
};
function AdminsMainEditor({ pass }: { pass: string }) {
return (
<div className="block">
<img src="https://od.lk/s/MTBfMzQ0MTQ0Njg5Xw/admin1.webp" alt="" className="w-30 h-auto" draggable={false} onContextMenu={e=>e.preventDefault()} />
{/* <img src="https://od.lk/s/MTBfMzQ0MTQ0NjkyXw/admin2.webp" alt="" className="w-30 h-auto" draggable={false} onContextMenu={e=>e.preventDefault()}/> */}
</div>
);
}
function ServerEditor({ pass }: { pass: string }) {
const [serverData, setServerData] = useState<Record<string, string> | false>(
false
false,
);
const [idle, setIdle] = useState(false);
const [showL, setShowL] = useState(false);
@@ -390,107 +380,6 @@ function CreateClass({ pass, update }: { pass: string; update: () => void }) {
);
}
// export function AdminProfileEditor({
// adminFrId,
// setAdminFrId,
// adminId,
// classId,
// pickmeMode = false,
// }) {
// return (
// <div className=" bg-grain bg-zinc-800/50 p-5 rounded-2xl not-md:w-[90%]">
// <table className="">
// <tbody className="*:*:w-10 *:*:h-10">
// <tr>
// <td className="">имя</td>
// <td className="w-50!">
// <DengiEditable
// value={adminFrId}
// pink={pickmeMode}
// onSubmit={async (e) => {
// e.setIdle(true);
// const r = await AdminUpdateRequest(API_BASE_URL, adminId, {
// action: "change_name",
// value: e.value.trim(),
// });
// if (r[1] == true) setAdminFrId(e.value);
// e.setIdle(false);
// }}
// />
// </td>
// </tr>
// <tr>
// <td>id</td>
// <td>
// <DengiEditable
// value={adminId}
// password={true}
// pink={pickmeMode}
// disabled
// />
// </td>
// </tr>
// <tr>
// <td>class</td>
// <td className="font-mono text-center select-all selectable">
// {classId ? classId : <TextPreloader />}
// </td>
// </tr>
// </tbody>
// </table>
// <CopyLink {...{ adminId, classId }} />
// </div>
// );
// }
// const CopyLink = ({ classId, adminId }) => {
// const [showDiag, setShowDiag] = useState(false);
// const [seenDiag, setSeenDiag] = useState(false);
// const [linkCopied, setLinkCopied] = useState(false);
// const copy = () => {
// copyDXLink(classId, adminId).then((a) => {
// if (a) {
// setLinkCopied(true);
// setTimeout(() => {
// setLinkCopied(false);
// }, 2000);
// }
// });
// };
// return (
// <div className="flex justify-end mt-2">
// <DengiYesOrNoDialog
// show={showDiag}
// content={{
// message: (
// <p>
// <b>любой</b>, кто получит ссылку,{" "}
// <b>будет иметь доступ к админке</b>.<br /> вы желаете продолжить?
// </p>
// ),
// yesBtn: "да",
// noBtn: "нет",
// yesIcon: <BiCopy />,
// noIcon: <BiX size={20} />,
// bgDissmis: true,
// yesBtnStyle: "bg-orange-500! text-white! md:hover:bg-orange-600!",
// }}
// onAnswer={(answ) => {
// if (answ) {
// setSeenDiag(true);
// copy();
// }
// setShowDiag(false);
// }}
// />
// <DengiButton onClick={() => (seenDiag ? copy() : setShowDiag(true))}>
// <BiLink /> <BiError color={"orange"} />
// <span>{linkCopied ? "скопировано" : "коп ссылку на админку"}</span>
// </DengiButton>
// </div>
// );
// };
export const CoolBg = ({}) => {
return (
<>