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:
@@ -9,6 +9,7 @@ import AddNewBookForm from "@/components/book/AddNewBookForm";
|
||||
import ShortStoryGenerator from "@/components/ShortStoryGenerator";
|
||||
import {SessionContext} from "@/context/SessionContext";
|
||||
import {useTranslations} from "next-intl";
|
||||
import OfflineContext from "@/context/OfflineContext";
|
||||
|
||||
export default function ScribeLeftBar() {
|
||||
const {book} = useContext(BookContext);
|
||||
@@ -21,6 +22,7 @@ export default function ScribeLeftBar() {
|
||||
|
||||
const [showAddNewBook, setShowAddNewBook] = useState<boolean>(false);
|
||||
const [showGenerateShortModal, setShowGenerateShortModal] = useState<boolean>(false)
|
||||
const {isCurrentlyOffline} = useContext(OfflineContext)
|
||||
|
||||
const editorComponents: PanelComponent[] = [
|
||||
{
|
||||
@@ -76,7 +78,7 @@ export default function ScribeLeftBar() {
|
||||
return (
|
||||
<div id="left-panel-container" data-guide={"left-panel-container"} className="flex transition-all duration-300">
|
||||
<div className="bg-tertiary border-r border-secondary/50 p-3 flex flex-col space-y-3 shadow-xl">
|
||||
{book ? editorComponents.map(component => (
|
||||
{book ? editorComponents.map((component:PanelComponent) => (
|
||||
<button
|
||||
key={component.id}
|
||||
onClick={(): void => {
|
||||
@@ -97,6 +99,9 @@ export default function ScribeLeftBar() {
|
||||
</button>
|
||||
)) : (
|
||||
homeComponents
|
||||
.filter((component: PanelComponent):boolean => {
|
||||
return !(isCurrentlyOffline() && component.id === 2);
|
||||
})
|
||||
.map((component: PanelComponent) => (
|
||||
<button
|
||||
key={component.id}
|
||||
|
||||
Reference in New Issue
Block a user