diff --git a/packages/app/constants/settings/components/sessions/index.jsx b/packages/app/constants/settings/components/sessions/index.jsx index b187f994..54e20b4c 100755 --- a/packages/app/constants/settings/components/sessions/index.jsx +++ b/packages/app/constants/settings/components/sessions/index.jsx @@ -4,7 +4,7 @@ import { Button } from "antd" export default (props) => { return } + extra={} /> } } @@ -140,52 +140,54 @@ function generatePageElementWrapper(route, element, bindProps) { export const PageRender = React.memo((props) => { const navigate = useNavigate() - app.location = useLocation() - React.useEffect(() => { - app.setLocation = async (to, state = {}) => { - // clean double slashes - to = to.replace(/\/{2,}/g, "/") + async function setLocation(to, state = {}) { + // clean double slashes + to = to.replace(/\/{2,}/g, "/") - // if state is a number, it's a delay - if (typeof state !== "object") { - state = {} - } - - const transitionDuration = app.cores.style.getValue("page-transition-duration") ?? "250ms" - - state.transitionDelay = Number(transitionDuration.replace("ms", "")) - - app.eventBus.emit("router.navigate", to, { - state, - }) - - app.location.lastPathname = app.location.pathname - - if (state.transitionDelay >= 100) { - await new Promise((resolve) => { - setTimeout(() => { - resolve() - }, state.transitionDelay) - }) - } - - return navigate(to, { - state - }) + // if state is a number, it's a delay + if (typeof state !== "object") { + state = {} } - app.backLocation = (state = {}) => { - let to = app.location.lastPathname + const transitionDuration = app.cores.style.getValue("page-transition-duration") ?? "250ms" - if (!to || to === app.location.pathname) { - console.warn("No last location found, redirecting to /") - to = "/" - } + state.transitionDelay = Number(transitionDuration.replace("ms", "")) - return navigate(to, { - state - }) + app.eventBus.emit("router.navigate", to, { + state, + }) + + app.location.last = window.location + + if (state.transitionDelay >= 100) { + await new Promise((resolve) => setTimeout(resolve, state.transitionDelay)) + } + + return navigate(to, { + state + }) + } + + async function backLocation() { + const transitionDuration = app.cores.style.getValue("page-transition-duration") ?? "250ms" + + app.eventBus.emit("router.navigate") + + app.location.last = window.location + + if (transitionDuration >= 100) { + await new Promise((resolve) => setTimeout(resolve, transitionDuration)) + } + + return window.history.back() + } + + React.useEffect(() => { + app.location = { + last: window.location, + push: setLocation, + back: backLocation, } }, []) diff --git a/packages/app/src/theme/fixments.less b/packages/app/src/theme/fixments.less index 50a6dc0c..3bc35c20 100755 --- a/packages/app/src/theme/fixments.less +++ b/packages/app/src/theme/fixments.less @@ -529,4 +529,26 @@ } } } +} + +.adm-action-sheet { + .adm-action-sheet-button-item-wrapper { + border-bottom-color: var(--border-color); + + .adm-action-sheet-button-item { + .adm-action-sheet-button-item-name { + color: var(--text-color); + + span { + color: currentColor; + } + } + } + + .adm-action-sheet-button-item-danger { + .adm-action-sheet-button-item-name { + color: var(--adm-color-danger); + } + } + } } \ No newline at end of file