diff --git a/ui/pwa-helper/src/pwa-element.ts b/ui/pwa-helper/src/pwa-element.ts index 1944437ae..590c3b515 100644 --- a/ui/pwa-helper/src/pwa-element.ts +++ b/ui/pwa-helper/src/pwa-element.ts @@ -18,7 +18,8 @@ import '@alwatr/ui-kit/style/token.css'; import '@alwatr/ui-kit/top-app-bar/top-app-bar.js'; import {untilNextFrame} from '@alwatr/util'; -import './signal/back-click-event.js'; +import './signal/back-to-home-click.js'; +import './signal/browser-back-click.js'; import './signal/register-service-worker-command.js'; import './signal/sw-user-notify.js'; diff --git a/ui/pwa-helper/src/signal/back-click-event.ts b/ui/pwa-helper/src/signal/back-click-event.ts deleted file mode 100644 index 10a11fe5b..000000000 --- a/ui/pwa-helper/src/signal/back-click-event.ts +++ /dev/null @@ -1,10 +0,0 @@ -import {eventListener} from '@alwatr/signal'; - -import {logger} from '../logger.js'; - -import type {ClickSignalType} from '@alwatr/type'; - -eventListener.subscribe('back-click-event', () => { - logger.logMethod('back-click-event'); - history.back(); -}); diff --git a/ui/pwa-helper/src/signal/back-to-home-click.ts b/ui/pwa-helper/src/signal/back-to-home-click.ts new file mode 100644 index 000000000..1cb7a1da1 --- /dev/null +++ b/ui/pwa-helper/src/signal/back-to-home-click.ts @@ -0,0 +1,11 @@ +import {redirect} from '@alwatr/router'; +import {eventListener} from '@alwatr/signal'; + +import {logger} from '../logger.js'; + +import type {ClickSignalType} from '@alwatr/type'; + +eventListener.subscribe('back_to_home_click_event', () => { + logger.logMethod('back_to_home_click_event'); + redirect({sectionList: []}); +}); diff --git a/ui/pwa-helper/src/signal/browser-back-click.ts b/ui/pwa-helper/src/signal/browser-back-click.ts new file mode 100644 index 000000000..eaf4b67af --- /dev/null +++ b/ui/pwa-helper/src/signal/browser-back-click.ts @@ -0,0 +1,16 @@ +import {eventListener} from '@alwatr/signal'; + +import {logger} from '../logger.js'; + +import type {ClickSignalType} from '@alwatr/type'; + +eventListener.subscribe('browser_back_click_event', () => { + logger.logMethod('browser_back_click_event'); + history.back(); +}); + +// TODO: replace all and remove this +eventListener.subscribe('back-click-event', () => { + logger.logMethod('browser_back_click_event'); + history.back(); +});