dx v2.1
This commit is contained in:
+12
-6
@@ -22,6 +22,7 @@ import {
|
||||
import { TableEditor } from "../trash/editorTable";
|
||||
import { ifstyle } from "../trash/helpers";
|
||||
import { API_BASE_URL } from "../App";
|
||||
import { useWebHaptics } from "web-haptics/react";
|
||||
|
||||
export default function EditorPage(props) {
|
||||
const [classId, _setUserId] = useAtom(props.classIDAtom);
|
||||
@@ -49,17 +50,18 @@ export default function EditorPage(props) {
|
||||
let cancelled = false;
|
||||
const promises = [];
|
||||
if (classId !== "")
|
||||
// TODO: rewrite this bullshit into one pretty request
|
||||
promises.push(
|
||||
props.dengi_cash.withCacheAsync(`userfr-${classId}`, async () =>
|
||||
classUserFRequest(API_BASE_URL, classId)
|
||||
)
|
||||
classUserFRequest(API_BASE_URL, classId),
|
||||
),
|
||||
);
|
||||
else promises.push(Promise.resolve([0]));
|
||||
if (adminId !== "")
|
||||
promises.push(
|
||||
props.dengi_cash.withCacheAsync(`adminfr-${adminId}`, async () =>
|
||||
AdminUserFRequest(API_BASE_URL, adminId)
|
||||
)
|
||||
AdminUserFRequest(API_BASE_URL, adminId),
|
||||
),
|
||||
);
|
||||
else promises.push(Promise.resolve([0]));
|
||||
Promise.all(promises).then(([classRes, adminRes]) => {
|
||||
@@ -79,9 +81,12 @@ export default function EditorPage(props) {
|
||||
props.dengi_cash.delete(
|
||||
"editor_schedule",
|
||||
"editor_changes",
|
||||
"editor_rings"
|
||||
"editor_rings",
|
||||
);
|
||||
}, []); // clean on full rerender
|
||||
|
||||
const { trigger } = useWebHaptics();
|
||||
|
||||
// tabs
|
||||
const tabs = [
|
||||
[
|
||||
@@ -189,7 +194,7 @@ export default function EditorPage(props) {
|
||||
"flex items-center gap-2 transition-colors " +
|
||||
ifstyle(
|
||||
selectedTab == 2,
|
||||
"text-transparent pointer-events-none select-none"
|
||||
"text-transparent pointer-events-none select-none",
|
||||
)
|
||||
}
|
||||
>
|
||||
@@ -238,6 +243,7 @@ export default function EditorPage(props) {
|
||||
key={idx}
|
||||
onClick={() => {
|
||||
if (selectedTab == idx) return;
|
||||
trigger([{ duration: 35 }], { intensity: 1 });
|
||||
if (!changesWereMade) {
|
||||
selectTab(idx);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user