Compare commits

...

7 Commits

Author SHA1 Message Date
katamaz 4cca273db4 fix: update editor delete animations 2026-09-05 11:17:44 +03:00
katamaz 761e623a56 fix(ui): properly hide indicator 2026-09-05 11:17:15 +03:00
katamaz 21d3a588b9 fix(auth): correct sql select 2026-09-03 21:07:15 +03:00
katamaz 2765d76500 fix: add alternative logo to everywhere 2026-09-03 20:58:35 +03:00
katamaz 794e2447c0 perf: specify sql select 2026-09-01 21:01:29 +03:00
katamaz ff437d082c remove db=null 2026-09-01 20:51:57 +03:00
katamaz 22e3776892 cleanup config 2026-09-01 20:26:39 +03:00
12 changed files with 79 additions and 88 deletions
+1 -1
View File
@@ -16,6 +16,6 @@
- change `base` in `vite.config.ts` - change `base` in `vite.config.ts`
- change `API_BASE_URL` and `CLIENT_FRONTEND_URL` in `src/App.jsx` - change `API_BASE_URL` and `CLIENT_FRONTEND_URL` in `src/App.jsx`
- **backend !!** - **backend !!**
- change `ADMIN_PASS` and `API_PATH` in `admin_api.php` - change `ADMIN_PASS` in `admin_api.php`
- change `$password` in `adm/phpliteadmin.config.php` - change `$password` in `adm/phpliteadmin.config.php`
- **block http requests to `data.db`!!!** - **block http requests to `data.db`!!!**
+2 -1
View File
@@ -1,8 +1,9 @@
<?php <?php
include 'k-api.php'; include 'k-api.php';
// CHANGE THIS
const ADMIN_PASS = "superdengipassword4"; const ADMIN_PASS = "superdengipassword4";
const API_PATH = "./"; const API_PATH = "./";
function db() function db()
+23 -46
View File
@@ -112,8 +112,8 @@ CreateApi(function ($api) {
$classId = substr(strtoupper($req->data['classId']), 0, 10); $classId = substr(strtoupper($req->data['classId']), 0, 10);
// according docs (UPPERCASE, MIN 3 MAX 10) // according docs (UPPERCASE, MIN 3 MAX 10)
$db = db(); $db = db();
$results = FastDBReq($db, "SELECT * FROM classes WHERE classid = ?", [$classId]); $results = FastDBReq($db, "SELECT classid, userclassname FROM classes WHERE classid = ?", [$classId]);
$db = null;
if (count($results) != 0) { if (count($results) != 0) {
return $results[0]; return $results[0];
} else { } else {
@@ -130,7 +130,7 @@ CreateApi(function ($api) {
// according docs (UPPERCASE, MIN 3 MAX 10) // according docs (UPPERCASE, MIN 3 MAX 10)
$db = db(); $db = db();
$results = FastDBReq($db, "SELECT userclassname FROM classes WHERE classid = ?", [$classId]); $results = FastDBReq($db, "SELECT userclassname FROM classes WHERE classid = ?", [$classId]);
$db = null;
if (count($results) != 0) { if (count($results) != 0) {
return $results[0]; return $results[0];
@@ -147,7 +147,7 @@ CreateApi(function ($api) {
$adminId = $req->data['adminId']; $adminId = $req->data['adminId'];
$db = db(); $db = db();
$results = FastDBReq($db, "SELECT adminName FROM admins where adminid = ?", [$adminId]); $results = FastDBReq($db, "SELECT adminName FROM admins where adminid = ?", [$adminId]);
$db = null;
if (count($results) != 0) { if (count($results) != 0) {
return $results[0]; return $results[0];
@@ -164,7 +164,7 @@ CreateApi(function ($api) {
$adminId = $req->data['adminId']; $adminId = $req->data['adminId'];
$db = db(); $db = db();
$results = FastDBReq($db, "SELECT adminPrems FROM admins where adminid = ?", [$adminId]); $results = FastDBReq($db, "SELECT adminPrems FROM admins where adminid = ?", [$adminId]);
$db = null;
if (count($results) != 0) { if (count($results) != 0) {
return $results[0]; return $results[0];
@@ -181,7 +181,7 @@ CreateApi(function ($api) {
$adminId = $req->data['adminId']; $adminId = $req->data['adminId'];
$db = db(); $db = db();
$results = FastDBReq($db, "SELECT * FROM admins WHERE adminid = ?", [$adminId]); $results = FastDBReq($db, "SELECT * FROM admins WHERE adminid = ?", [$adminId]);
$db = null;
if (count($results) != 0) { if (count($results) != 0) {
return $results[0]; return $results[0];
@@ -203,7 +203,7 @@ CreateApi(function ($api) {
if (!preg_match('/\d{1,2}-\d{1,2}-(\d{2}|\d{4})$/', $day)) return "wrong date format"; if (!preg_match('/\d{1,2}-\d{1,2}-(\d{2}|\d{4})$/', $day)) return "wrong date format";
$db = db(); $db = db();
$results = FastDBReq($db, "SELECT * FROM changes WHERE classId = ? AND forDay = ?", [$classId, $day]); $results = FastDBReq($db, "SELECT content FROM changes WHERE classId = ? AND forDay = ?", [$classId, $day]);
if (count($results) > 0) { if (count($results) > 0) {
@@ -218,37 +218,33 @@ CreateApi(function ($api) {
} }
} }
if ($has_full_rings) { if ($has_full_rings) {
$db = null;
// with rings // with rings
return ['data' => $content, 'type' => 2]; return ['data' => $content, 'type' => 2];
} else { } else {
// without rings // without rings
$results = FastDBReq($db, "SELECT * FROM RINGS WHERE classId = ?", [$classId]); $results = FastDBReq($db, "SELECT content, fromDate FROM RINGS WHERE classId = ?", [$classId]);
$rings = json_decode(findClosestDateSort($results, $day)['content'], true); $rings = json_decode(findClosestDateSort($results, $day)['content'], true);
$out = $content; $out = $content;
if ($rings !== null) { if ($rings !== null) {
$out = joinArraysByKey($content, $rings, true); $out = joinArraysByKey($content, $rings, true);
} }
$db = null;
return ['data' => $out, 'type' => 1]; return ['data' => $out, 'type' => 1];
} }
} else { } else {
// return shedules + calls // return shedules + calls
$dayOfWeek = getDayOfWeek($day); $dayOfWeek = getDayOfWeek($day);
$results = FastDBReq($db, "SELECT * FROM schedules WHERE classId = ? AND dayOfWeek = ?", [$classId, $dayOfWeek]); $results = FastDBReq($db, "SELECT content, fromDate FROM schedules WHERE classId = ? AND dayOfWeek = ?", [$classId, $dayOfWeek]);
if (count($results) > 0) { if (count($results) > 0) {
$out = []; $out = [];
$schedule = json_decode(findClosestDateSort($results, $day)['content'], true); $schedule = json_decode(findClosestDateSort($results, $day)['content'], true);
$results = FastDBReq($db, "SELECT * FROM RINGS WHERE classId = ?", [$classId]); $results = FastDBReq($db, "SELECT content, fromDate FROM RINGS WHERE classId = ?", [$classId]);
$rings = json_decode(findClosestDateSort($results, $day)['content'], true); $rings = json_decode(findClosestDateSort($results, $day)['content'], true);
$out = $schedule; $out = $schedule;
if ($rings !== null) { if ($rings !== null) {
$out = joinArraysByKey($schedule, $rings); $out = joinArraysByKey($schedule, $rings);
} }
$db = null;
return ['data' => $out, 'type' => 0]; return ['data' => $out, 'type' => 0];
} else { } else {
$db = null;
return ['data' => []]; return ['data' => []];
} }
} }
@@ -260,9 +256,8 @@ CreateApi(function ($api) {
} }
$adminId = $req->data['adminId']; $adminId = $req->data['adminId'];
$db = db(); $db = db();
$results = FastDBReq($db, "SELECT * FROM admins WHERE adminId=?", [$adminId]); $results = FastDBReq($db, "SELECT adminClass FROM admins WHERE adminId=?", [$adminId]);
if (count($results) == 0) { if (count($results) == 0) {
$db = null;
$req->res->code(400); $req->res->code(400);
return "админ не найден"; return "админ не найден";
# end # end
@@ -277,23 +272,22 @@ CreateApi(function ($api) {
if ($tab != 2) { if ($tab != 2) {
if ($tab == 0) { if ($tab == 0) {
$results = FastDBReq($db, "SELECT * FROM changes WHERE classId = ? AND forDay = ?", [$classId, $day]); $results = FastDBReq($db, "SELECT content FROM changes WHERE classId = ? AND forDay = ?", [$classId, $day]);
if (count($results) > 0) { if (count($results) > 0) {
$changes = json_decode($results[0]['content'], true); $changes = json_decode($results[0]['content'], true);
} }
} }
$dayOfWeek = getDayOfWeek($day); $dayOfWeek = getDayOfWeek($day);
$results = FastDBReq($db, "SELECT * FROM schedules WHERE classId = ? AND dayOfWeek = ?", [$classId, $dayOfWeek]); $results = FastDBReq($db, "SELECT content, fromDate FROM schedules WHERE classId = ? AND dayOfWeek = ?", [$classId, $dayOfWeek]);
if (count($results) > 0) { if (count($results) > 0) {
$schedule = json_decode(findClosestDateSort($results, $day)['content'], true); $schedule = json_decode(findClosestDateSort($results, $day)['content'], true);
} }
} else { } else {
$results = FastDBReq($db, "SELECT * FROM RINGS WHERE classId = ?", [$classId]); $results = FastDBReq($db, "SELECT content, fromDate FROM RINGS WHERE classId = ?", [$classId]);
if (count($results) > 0) { if (count($results) > 0) {
$rings = json_decode(findClosestDateSort($results, $day)['content'], true); $rings = json_decode(findClosestDateSort($results, $day)['content'], true);
} }
} }
$db = null;
switch ($tab) { switch ($tab) {
case 0: case 0:
@@ -321,9 +315,8 @@ CreateApi(function ($api) {
} }
$adminId = $req->data['adminId']; $adminId = $req->data['adminId'];
$db = db(); $db = db();
$results = FastDBReq($db, "SELECT * FROM admins WHERE adminId=?", [$adminId]); $results = FastDBReq($db, "SELECT adminClass FROM admins WHERE adminId=?", [$adminId]);
if (count($results) == 0) { if (count($results) == 0) {
$db = null;
$req->res->code(400); $req->res->code(400);
return "админ не найден"; return "админ не найден";
# end # end
@@ -334,7 +327,6 @@ CreateApi(function ($api) {
$newDataRaw = $req->data['newData']; $newDataRaw = $req->data['newData'];
$newData = json_decode($newDataRaw, true); $newData = json_decode($newDataRaw, true);
// im too lazy to close db
switch ($tab) { switch ($tab) {
case 0: // changes case 0: // changes
@@ -342,7 +334,7 @@ CreateApi(function ($api) {
// if no chnages skip, else publish // if no chnages skip, else publish
$dayOfWeek = getDayOfWeek($day); $dayOfWeek = getDayOfWeek($day);
$results = FastDBReq($db, "SELECT * FROM schedules WHERE classId = ? AND dayOfWeek = ?", [$classId, $dayOfWeek]); $results = FastDBReq($db, "SELECT fromDate, content FROM schedules WHERE classId = ? AND dayOfWeek = ?", [$classId, $dayOfWeek]);
$publish = true; $publish = true;
if (count($results) > 0) { if (count($results) > 0) {
$schedule = json_decode(findClosestDateSort($results, $day)['content'], true); $schedule = json_decode(findClosestDateSort($results, $day)['content'], true);
@@ -352,7 +344,7 @@ CreateApi(function ($api) {
} }
if ($publish) { if ($publish) {
// removing changes for today if they are exists // removing changes for today if they are exists
$results = FastDBReq($db, "SELECT * FROM changes WHERE classId = ? AND forDay = ?", [$classId, $day]); $results = FastDBReq($db, "SELECT content FROM changes WHERE classId = ? AND forDay = ?", [$classId, $day]);
if (count($results) > 0) { if (count($results) > 0) {
$changes = json_decode($results[0]['content'], true); $changes = json_decode($results[0]['content'], true);
if ($newData === $changes) { if ($newData === $changes) {
@@ -395,9 +387,8 @@ CreateApi(function ($api) {
} }
$adminId = $req->data['adminId']; $adminId = $req->data['adminId'];
$db = db(); $db = db();
$results = FastDBReq($db, "SELECT * FROM admins WHERE adminId=?", [$adminId]); $results = FastDBReq($db, "SELECT adminClass FROM admins WHERE adminId=?", [$adminId]);
if (count($results) == 0) { if (count($results) == 0) {
$db = null;
$req->res->code(400); $req->res->code(400);
return "админ не найден"; return "админ не найден";
# end # end
@@ -417,10 +408,8 @@ CreateApi(function ($api) {
FastDBReq($db, 'DELETE FROM rings WHERE classId=? AND fromDate=?', [$classId, $day]); FastDBReq($db, 'DELETE FROM rings WHERE classId=? AND fromDate=?', [$classId, $day]);
break; break;
default: default:
$db = null;
return "you saved your live because you didn't know what tabs are here"; return "you saved your live because you didn't know what tabs are here";
} }
$db = null;
return true; return true;
}); });
$api->on('/update_admin', "POST", function ($req) { $api->on('/update_admin', "POST", function ($req) {
@@ -436,14 +425,12 @@ CreateApi(function ($api) {
} }
$adminId = $req->data['adminId']; $adminId = $req->data['adminId'];
$db = db(); $db = db();
$results = FastDBReq($db, "SELECT * FROM admins WHERE adminId=?", [$adminId]); $results = FastDBReq($db, "SELECT adminPrems FROM admins WHERE adminId=?", [$adminId]);
if (count($results) == 0) { if (count($results) == 0) {
$db = null;
$req->res->code(400); $req->res->code(400);
return "админ не найден"; return "админ не найден";
} }
if (!$withSelf && !in_array($results[0]['adminPrems'], [-1, 2])) { if (!$withSelf && !in_array($results[0]['adminPrems'], [-1, 2])) {
$db = null;
$req->res->code(400); $req->res->code(400);
return 'нету прав'; return 'нету прав';
} }
@@ -462,7 +449,6 @@ CreateApi(function ($api) {
try { try {
FastDBReq($db, 'UPDATE admins SET adminName = ? WHERE adminId = ?', [$value, $adminId]); FastDBReq($db, 'UPDATE admins SET adminName = ? WHERE adminId = ?', [$value, $adminId]);
} catch (PDOException) { } catch (PDOException) {
$db = null;
return "egor"; return "egor";
} }
break; break;
@@ -483,16 +469,13 @@ CreateApi(function ($api) {
try { try {
FastDBReq($db, 'UPDATE admins SET adminName = ? WHERE adminId = ?', [$value, $person]); FastDBReq($db, 'UPDATE admins SET adminName = ? WHERE adminId = ?', [$value, $person]);
} catch (PDOException) { } catch (PDOException) {
$db = null;
return "egor"; return "egor";
} }
break; break;
default: default:
$db = null;
return "?"; return "?";
} }
} }
$db = null;
return true; return true;
}); });
@@ -503,29 +486,26 @@ CreateApi(function ($api) {
} }
$adminId = $req->data['adminId']; $adminId = $req->data['adminId'];
$db = db(); $db = db();
$results = FastDBReq($db, "SELECT * FROM admins WHERE adminId=?", [$adminId]); $results = FastDBReq($db, "SELECT adminPrems, adminClass FROM admins WHERE adminId=?", [$adminId]);
if (count($results) == 0) { if (count($results) == 0) {
$db = null;
$req->res->code(400); $req->res->code(400);
return "админ не найден"; return "админ не найден";
} }
if (!in_array($results[0]['adminPrems'], [-1, 2])) { if (!in_array($results[0]['adminPrems'], [-1, 2])) {
$db = null;
$req->res->code(400); $req->res->code(400);
return "недостаточно прав"; return "недостаточно прав";
} }
$classId = $results[0]['adminClass']; $classId = $results[0]['adminClass'];
$results = FastDBReq($db, "SELECT * FROM classes WHERE classId=?", [$classId]); $results = FastDBReq($db, "SELECT classid FROM classes WHERE classid=?", [$classId]);
if (count($results) == 0) { if (count($results) == 0) {
$db = null;
$req->res->code(400); $req->res->code(400);
return "класса не существует"; return "класса не существует";
} }
$classData = $results[0]; $classData = $results[0];
$adminsData = FastDBReq($db, "SELECT * FROM admins WHERE adminClass=?", [$classId]); $adminsData = FastDBReq($db, "SELECT * FROM admins WHERE adminClass=?", [$classId]);
$db = null;
return ["status" => 1, "class" => $classData, "admins" => $adminsData]; return ["status" => 1, "class" => $classData, "admins" => $adminsData];
}); });
@@ -537,14 +517,12 @@ CreateApi(function ($api) {
} }
$adminId = $req->data['adminId']; $adminId = $req->data['adminId'];
$db = db(); $db = db();
$results = FastDBReq($db, "SELECT * FROM admins WHERE adminId=?", [$adminId]); $results = FastDBReq($db, "SELECT adminPrems, adminClass FROM admins WHERE adminId=?", [$adminId]);
if (count($results) == 0) { if (count($results) == 0) {
$db = null;
$req->res->code(400); $req->res->code(400);
return "админ не найден"; return "админ не найден";
} }
if (!in_array($results[0]['adminPrems'], [-1, 2])) { if (!in_array($results[0]['adminPrems'], [-1, 2])) {
$db = null;
$req->res->code(400); $req->res->code(400);
return "недостаточно прав"; return "недостаточно прав";
} }
@@ -610,7 +588,6 @@ CreateApi(function ($api) {
FastDBReq($db, "DELETE FROM admins WHERE adminId=?", [$person]); FastDBReq($db, "DELETE FROM admins WHERE adminId=?", [$person]);
return true; return true;
default: default:
$db = null;
return "?"; return "?";
} }
}); });
+1 -4
View File
@@ -1,11 +1,8 @@
// CHANGE TO YOUR API DESTINATION // CHANGE TO YOUR API DESTINATION
export const API_BASE_URL = "http://localhost:8321/admin_api.php"; export const API_BASE_URL = "http://localhost:8321/admin_api.php";
// export const API_BASE_URL = "http://192.168.3.10:8321/admin_api.php";
// export const API_BASE_URL = "http://x90620bx.beget.tech/dx4back/admin_api.php"
// TYPE: url/dx4/ // TYPE: url/dx4/
export const CLIENT_FRONTEND_URL = "http://localhost:5173/dx4/"; export const CLIENT_FRONTEND_URL = "http://localhost:5173/";
// export const CLIENT_FRONTEND_URL = "http://x90620bx.beget.tech/dx4/";
import { atom, useAtom } from "jotai"; import { atom, useAtom } from "jotai";
import { atomWithStorage } from "jotai/utils"; import { atomWithStorage } from "jotai/utils";
+1 -1
View File
@@ -11,5 +11,5 @@ export default defineConfig({
}), }),
tailwindcss(), tailwindcss(),
], ],
base: "/dx4dashboard", base: "/",
}); });
-2
View File
@@ -1,7 +1,5 @@
// CHANGE TO YOUR API DESTINATION // CHANGE TO YOUR API DESTINATION
export const API_BASE_URL = "http://localhost:8321/api.php"; export const API_BASE_URL = "http://localhost:8321/api.php";
// export const API_BASE_URL = "http://192.168.3.10:8321/api.php";
// export const API_BASE_URL = "http://x90620bx.beget.tech/dx4back/api.php"
import { atom, useAtom } from "jotai"; import { atom, useAtom } from "jotai";
import { atomWithStorage } from "jotai/utils"; import { atomWithStorage } from "jotai/utils";
+7 -1
View File
@@ -2,6 +2,7 @@ import { useAtom } from "jotai";
import { motion } from "motion/react"; import { motion } from "motion/react";
import { BiCopy, BiError, BiLeftArrowAlt, BiLink, BiX } from "react-icons/bi"; import { BiCopy, BiError, BiLeftArrowAlt, BiLink, BiX } from "react-icons/bi";
import Logo from "../assets/logo.svg"; import Logo from "../assets/logo.svg";
import LogoAlternative from "../assets/fully_alternative_logo.svg";
import { AdminReq, AdminUpdateRequest } from "../trash/req_mgr"; import { AdminReq, AdminUpdateRequest } from "../trash/req_mgr";
import { API_BASE_URL } from "../App"; import { API_BASE_URL } from "../App";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
@@ -205,7 +206,12 @@ const Header = ({ setsetRoute, setRoute, pickmeMode }) => {
" lg:hover:scale-105 transition cursor-pointer" " lg:hover:scale-105 transition cursor-pointer"
} }
/> />
<img src={Logo} alt="logo" width={100} draggable={false} /> <img
src={pickmeMode ? LogoAlternative : Logo}
alt="logo"
width={100}
draggable={false}
/>
</span> </span>
</div> </div>
); );
+10 -4
View File
@@ -11,6 +11,7 @@ import {
BiX, BiX,
} from "react-icons/bi"; } from "react-icons/bi";
import Logo from "../assets/logo.svg"; import Logo from "../assets/logo.svg";
import LogoAlternative from "../assets/fully_alternative_logo.svg";
import { import {
AdminUpdateRequest, AdminUpdateRequest,
ClassUpdateRequest, ClassUpdateRequest,
@@ -176,8 +177,8 @@ export function ClassProfileEditor({
setAdminFrId: (v) => { setAdminFrId: (v) => {
setAdminsData((prev) => setAdminsData((prev) =>
prev.map((a) => prev.map((a) =>
a.adminId === i.adminId ? { ...a, adminName: v } : a a.adminId === i.adminId ? { ...a, adminName: v } : a,
) ),
); );
}, },
}} }}
@@ -244,7 +245,7 @@ function CreateAdmin({ editorAdminId, update }) {
{ {
action: "create_admin", action: "create_admin",
value: `${adminId};${b64e(adminName)}`, value: `${adminId};${b64e(adminName)}`,
} },
); );
if (c[1] == true) { if (c[1] == true) {
update(); update();
@@ -511,7 +512,12 @@ const Header = ({ setsetRoute, setRoute, pickmeMode }) => {
" lg:hover:scale-105 transition cursor-pointer" " lg:hover:scale-105 transition cursor-pointer"
} }
/> />
<img src={Logo} alt="logo" width={100} draggable={false} /> <img
src={pickmeMode ? LogoAlternative : Logo}
alt="logo"
width={100}
draggable={false}
/>
</span> </span>
</div> </div>
); );
+3 -4
View File
@@ -4,6 +4,7 @@ import { useAtom } from "jotai";
import { useState, useEffect } from "react"; import { useState, useEffect } from "react";
import Logo from "../assets/logo.svg"; import Logo from "../assets/logo.svg";
import { AdminUserFRequest, classUserFRequest } from "../trash/req_mgr"; import { AdminUserFRequest, classUserFRequest } from "../trash/req_mgr";
import LogoAlternative from "../assets/fully_alternative_logo.svg";
import { import {
BiCalendar, BiCalendar,
BiCalendarEdit, BiCalendarEdit,
@@ -145,14 +146,12 @@ export default function EditorPage(props) {
> >
<motion.div <motion.div
className="flex items-center w-full justify-between px-5" className="flex items-center w-full justify-between px-5"
layout="position"
> >
<motion.img <motion.img
src={Logo} src={pickmeMode ? LogoAlternative : Logo}
alt="logo" alt="logo"
width={100} width={100}
draggable={false} draggable={false}
layout="position"
/> />
<motion.div className="flex gap-5 items-center"> <motion.div className="flex gap-5 items-center">
<motion.span <motion.span
@@ -218,7 +217,7 @@ export default function EditorPage(props) {
setTabDiagRequestTab(404); setTabDiagRequestTab(404);
setTabDiagShow(true); setTabDiagShow(true);
} else { } else {
window['DX_OPEN_DATE'] = date window["DX_OPEN_DATE"] = date;
} }
}} }}
> >
+4 -6
View File
@@ -530,7 +530,7 @@ export function TableEditor({
show={deleteDiag} show={deleteDiag}
/> />
</div> </div>
<div className="w-full overflow-hidden my-1 flex flex-col gap-3"> <div className="w-full overflow-hidden my-1 flex flex-col gap-3 pb-40">
<div className="flex gap-2 flex-wrap"> <div className="flex gap-2 flex-wrap">
<DengiButton onClick={handleUndo} disabled={undoItems.length == 0}> <DengiButton onClick={handleUndo} disabled={undoItems.length == 0}>
<BiUndo /> <BiUndo />
@@ -603,8 +603,8 @@ export function TableEditor({
strategy={verticalListSortingStrategy} strategy={verticalListSortingStrategy}
> >
<div> <div>
<AnimatePresence mode={items.length > 0 ? "sync" : "wait"}> <AnimatePresence mode="popLayout">
{items.map((item) => ( {items.map((item, idx) => (
<motion.div <motion.div
initial={{ initial={{
x: -15, x: -15,
@@ -632,12 +632,10 @@ export function TableEditor({
initial={{ initial={{
filter: "blur(5px)", filter: "blur(5px)",
opacity: 0, opacity: 0,
scale: 0.8,
}} }}
animate={{ animate={{
filter: "blur(0px)", filter: "blur(0px)",
opacity: 1, opacity: 1,
scale: 1,
}} }}
className={`border-2 border-dashed ${ className={`border-2 border-dashed ${
pickmeMode ? "border-pink-700" : "border-gray-700" pickmeMode ? "border-pink-700" : "border-gray-700"
@@ -658,7 +656,7 @@ export function TableEditor({
<LoadingSpinner size={35} /> <LoadingSpinner size={35} />
</div> </div>
)} )}
<motion.div className="flex w-full justify-end gap-2 fixed pr-20 bottom-2 left-0"> <motion.div layout="position" className="flex w-full justify-end gap-2">
<DengiButton <DengiButton
onClick={handleDeleteAll} onClick={handleDeleteAll}
className="border-red-600! md:not-disabled:not-hover:border-red-400!" className="border-red-600! md:not-disabled:not-hover:border-red-400!"
+13 -4
View File
@@ -165,18 +165,27 @@ export const DatePicker = (props) => {
props.setDate(new Date()); props.setDate(new Date());
}} }}
> >
<AnimatePresence>
{props.indicator && (
<motion.span <motion.span
className={ className={
"block min-w-2 min-h-2 rounded-full mx-1 transition-colors" + "block min-w-2 min-h-2 rounded-full mx-1 transition-colors" +
(props.indicator (props.pink
? props.pink
? " bg-pink-500 animate-pulse" ? " bg-pink-500 animate-pulse"
: " bg-zinc-300 animate-pulse" : " bg-zinc-300 animate-pulse")
: " bg-transparent")
} }
variants={{
a: { opacity: 0 },
b: { opacity: 1 },
}}
initial="a"
animate="b"
exit="a"
layoutId="datepicker_indicator" layoutId="datepicker_indicator"
layout="position" layout="position"
/> />
)}
</AnimatePresence>
<motion.span <motion.span
layoutId="datepicker_date" layoutId="datepicker_date"
layout="position" layout="position"
+4 -4
View File
@@ -5,7 +5,7 @@ import { VitePWA } from "vite-plugin-pwa";
// https://vite.dev/config/ // https://vite.dev/config/
export default defineConfig({ export default defineConfig({
base: "/dx4/", base: "/",
plugins: [ plugins: [
react({ react({
babel: { babel: {
@@ -19,11 +19,11 @@ export default defineConfig({
name: "dx 4", name: "dx 4",
short_name: "dx4", short_name: "dx4",
description: "dnevnik-x app", description: "dnevnik-x app",
theme_color: "#eee", theme_color: "#000",
background_color: "#000", background_color: "#000",
display: "standalone", display: "standalone",
scope: "/dx4/", scope: "/",
start_url: "/dx4/", start_url: "/",
icons: [ icons: [
{ {
src: "icons/windows11/SmallTile.scale-100.png", src: "icons/windows11/SmallTile.scale-100.png",