Add openExternal IPC handler and integrate with UI components
- Introduce `openExternal` IPC handler in `electron/main.ts` for opening external links via the default browser or native app. - Update typings in `electron.d.ts` and `preload.ts` to include `openExternal`. - Refactor `ComposerRightBar` and `LeftBar` components to leverage `electron.openExternal` for external link actions (e.g., Facebook, Discord). - Add offline mode logic to filter navigation options in `ComposerRightBar` and `LeftBar`. - Enhance footer bar to display book titles when chapters are unavailable.
This commit is contained in:
@@ -7,10 +7,12 @@ import {faBook, faChartSimple, faHeart, faSheetPlastic} from "@fortawesome/free-
|
||||
import {SessionContext} from "@/context/SessionContext";
|
||||
import {useTranslations} from "next-intl";
|
||||
import {AlertContext} from "@/context/AlertContext";
|
||||
import {BookContext} from "@/context/BookContext";
|
||||
|
||||
export default function ScribeFooterBar() {
|
||||
const t = useTranslations();
|
||||
const {chapter} = useContext(ChapterContext);
|
||||
const {book} = useContext(BookContext);
|
||||
const editor: Editor | null = useContext(EditorContext).editor;
|
||||
const {session} = useContext(SessionContext);
|
||||
const {errorMessage} = useContext(AlertContext)
|
||||
@@ -51,15 +53,15 @@ export default function ScribeFooterBar() {
|
||||
<div>
|
||||
<span className="flex items-center gap-2">
|
||||
{chapter && (
|
||||
<span
|
||||
className="inline-flex items-center px-3 py-1 rounded-lg bg-primary/10 border border-primary/30">
|
||||
<span className="inline-flex items-center px-3 py-1 rounded-lg bg-primary/10 border border-primary/30">
|
||||
<span className="text-primary font-bold text-sm">
|
||||
{chapter.chapterOrder < 0 ? t('scribeFooterBar.sheet') : `${chapter.chapterOrder}.`}
|
||||
</span>
|
||||
</span>
|
||||
)}
|
||||
<span className={'flex items-center gap-2 font-medium'}>
|
||||
{chapter?.title || (
|
||||
{
|
||||
chapter?.title || book?.title || (
|
||||
<>
|
||||
<span>{t('scribeFooterBar.madeWith')}</span>
|
||||
<FontAwesomeIcon color={'red'} icon={faHeart} className={'w-4 h-4 animate-pulse'}/>
|
||||
@@ -69,7 +71,7 @@ export default function ScribeFooterBar() {
|
||||
</span>
|
||||
</div>
|
||||
{
|
||||
chapter ? (
|
||||
chapter || book ? (
|
||||
<div className="flex items-center space-x-3">
|
||||
<div
|
||||
className="flex items-center gap-2 bg-secondary/50 px-4 py-2 rounded-xl border border-secondary shadow-sm">
|
||||
|
||||
Reference in New Issue
Block a user