Update imports and Electron compatibility
- Removed unnecessary React imports. - Adjusted package.json scripts for Electron integration. - Updated components to replace Next.js-specific imports with Electron-compatible alternatives. - Minor tsconfig.json changes for better compatibility.
This commit is contained in:
@@ -1,15 +1,6 @@
|
||||
import type {Metadata} from "next";
|
||||
import "./globals.css";
|
||||
import {ReactNode} from "react";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "ERitors Scribe",
|
||||
description: "Les meilleurs livres sont ceux qui ont le meilleur plan.",
|
||||
icons: {
|
||||
icon: "/eritors-favicon-white.png"
|
||||
}
|
||||
};
|
||||
|
||||
export default function RootLayout(
|
||||
{
|
||||
children,
|
||||
@@ -18,6 +9,11 @@ export default function RootLayout(
|
||||
}>) {
|
||||
return (
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<title>ERitors Scribe</title>
|
||||
<meta name="description" content="Les meilleurs livres sont ceux qui ont le meilleur plan." />
|
||||
<link rel="icon" href="/eritors-favicon-white.png" />
|
||||
</head>
|
||||
<body>
|
||||
{children}
|
||||
</body>
|
||||
|
||||
21
app/page.tsx
21
app/page.tsx
@@ -1,5 +1,5 @@
|
||||
'use client';
|
||||
import React, {useContext, useEffect, useState} from 'react';
|
||||
import {useContext, useEffect, useState} from 'react';
|
||||
import {BookContext} from "@/context/BookContext";
|
||||
import {ChapterProps} from "@/lib/models/Chapter";
|
||||
import {ChapterContext} from '@/context/ChapterContext';
|
||||
@@ -14,8 +14,7 @@ import {SessionContext} from '@/context/SessionContext';
|
||||
import {SessionProps} from "@/lib/models/Session";
|
||||
import User, {UserProps} from "@/lib/models/User";
|
||||
import {BookProps} from "@/lib/models/Book";
|
||||
import {AppRouterInstance} from "next/dist/shared/lib/app-router-context.shared-runtime";
|
||||
import {useRouter} from "next/navigation";
|
||||
// Removed Next.js router imports for Electron
|
||||
import ScribeTopBar from "@/components/ScribeTopBar";
|
||||
import ScribeControllerBar from "@/components/ScribeControllerBar";
|
||||
import ScribeLeftBar from "@/components/leftbar/ScribeLeftBar";
|
||||
@@ -28,7 +27,7 @@ import {faBookMedical, faFeather} from "@fortawesome/free-solid-svg-icons";
|
||||
import TermsOfUse from "@/components/TermsOfUse";
|
||||
import frMessages from '@/lib/locales/fr.json';
|
||||
import enMessages from '@/lib/locales/en.json';
|
||||
import Image from "next/image";
|
||||
// Removed Next.js Image import for Electron
|
||||
import {NextIntlClientProvider, useTranslations} from "next-intl";
|
||||
import {LangContext} from "@/context/LangContext";
|
||||
import {AIUsageContext} from "@/context/AIUsageContext";
|
||||
@@ -41,7 +40,7 @@ const messagesMap = {
|
||||
function ScribeContent() {
|
||||
const t = useTranslations();
|
||||
const {lang: locale} = useContext(LangContext);
|
||||
const {errorMessage, successMessage} = useContext(AlertContext);
|
||||
const {errorMessage} = useContext(AlertContext);
|
||||
const editor: Editor | null = useEditor({
|
||||
extensions: [
|
||||
StarterKit,
|
||||
@@ -54,7 +53,7 @@ function ScribeContent() {
|
||||
immediatelyRender: false,
|
||||
});
|
||||
|
||||
const router: AppRouterInstance = useRouter();
|
||||
// Router removed for Electron - using window.location instead
|
||||
const [session, setSession] = useState<SessionProps>({user: null, accessToken: '', isConnected: false});
|
||||
const [currentChapter, setCurrentChapter] = useState<ChapterProps | undefined>(undefined);
|
||||
const [currentBook, setCurrentBook] = useState<BookProps | null>(null);
|
||||
@@ -147,7 +146,7 @@ function ScribeContent() {
|
||||
setIsLoading(false);
|
||||
} else {
|
||||
if (sessionAttempts > 2) {
|
||||
router.push('/');
|
||||
// Redirect handled by checkAuthentification
|
||||
}
|
||||
}
|
||||
setSessionAttempts(sessionAttempts + 1);
|
||||
@@ -202,10 +201,12 @@ function ScribeContent() {
|
||||
} else {
|
||||
errorMessage(t("homePage.errors.authenticationError"));
|
||||
}
|
||||
window.location.href = 'https://eritors.com/login';
|
||||
// TODO: Afficher la fenêtre de login Electron
|
||||
console.log('Pas de session - afficher login Electron');
|
||||
}
|
||||
} else {
|
||||
window.location.href = 'https://eritors.com/login';
|
||||
// TODO: Afficher la fenêtre de login Electron
|
||||
console.log('Pas de token - afficher login Electron');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,7 +263,7 @@ function ScribeContent() {
|
||||
className="bg-background text-text-primary h-screen flex flex-col items-center justify-center font-['Lora']">
|
||||
<div className="flex flex-col items-center space-y-6">
|
||||
<div className="animate-pulse">
|
||||
<Image src={'/logo.png'} alt="ERitors Logo" width={400} height={400}/>
|
||||
<img src="/logo.png" alt="ERitors Logo" style={{width: 400, height: 400}} />
|
||||
</div>
|
||||
<div className="flex space-x-2">
|
||||
<div className="w-2 h-2 bg-primary rounded-full animate-bounce"></div>
|
||||
|
||||
Reference in New Issue
Block a user