forked from akai/readest
8df9f909b4
- Apply alwaysOnTop setting on reader window init so books opened in a new window correctly inherit the setting - Update tauriHandleSetAlwaysOnTop to apply to all open windows so toggling from any window keeps all windows in sync Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
'use client';
|
|
|
|
import { useEffect } from 'react';
|
|
import { useEnv } from '@/context/EnvContext';
|
|
import { useTranslation } from '@/hooks/useTranslation';
|
|
import { useOpenWithBooks } from '@/hooks/useOpenWithBooks';
|
|
import { useSettingsStore } from '@/store/settingsStore';
|
|
import { checkForAppUpdates, checkAppReleaseNotes } from '@/helpers/updater';
|
|
import { tauriHandleSetAlwaysOnTop } from '@/utils/window';
|
|
import Reader from './components/Reader';
|
|
|
|
// This is only used for the Tauri app in the app router
|
|
export default function Page() {
|
|
const _ = useTranslation();
|
|
const { appService } = useEnv();
|
|
const { settings } = useSettingsStore();
|
|
|
|
useOpenWithBooks();
|
|
|
|
useEffect(() => {
|
|
const doCheckAppUpdates = async () => {
|
|
if (appService?.hasUpdater && settings.autoCheckUpdates) {
|
|
await checkForAppUpdates(_);
|
|
} else if (appService?.hasUpdater === false) {
|
|
checkAppReleaseNotes();
|
|
}
|
|
};
|
|
if (appService?.hasWindow && settings.alwaysOnTop) {
|
|
tauriHandleSetAlwaysOnTop(settings.alwaysOnTop);
|
|
}
|
|
doCheckAppUpdates();
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
}, [appService?.hasUpdater, settings.autoCheckUpdates]);
|
|
|
|
return <Reader />;
|
|
}
|