Bump app version to 0.5.1 and add auto-update support
- Implemented auto-update logic in `ScribeTopBar` with update notification and user interaction. - Integrated `@tauri-apps/plugin-updater` and `@tauri-apps/plugin-process` for updater functionality. - Added automatic migration feature with `autoMigrateElectron` support and UI feedback. - Refactored app architecture with new routing, components, and layout for better modularity. - Enhanced JSON response handling in API client for robust data parsing. - Updated locales to include new translations for update and migration-related UI.
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
const logo = "/eritors-favicon-white.png";
|
||||
import React, {useContext} from "react";
|
||||
import {Download, X} from "lucide-react";
|
||||
import {BookContext, BookContextProps} from "@/context/BookContext";
|
||||
import {useTranslations} from '@/lib/i18n';
|
||||
import {useAutoUpdate} from "@/hooks/useAutoUpdate";
|
||||
|
||||
export default function ScribeTopBar() {
|
||||
const {book}: BookContextProps = useContext<BookContextProps>(BookContext);
|
||||
const t = useTranslations();
|
||||
const update = useAutoUpdate();
|
||||
return (
|
||||
<div className="flex items-center justify-between px-6 py-3 bg-tertiary border-b border-secondary">
|
||||
<div className="flex items-center space-x-4 group">
|
||||
@@ -33,6 +36,21 @@ export default function ScribeTopBar() {
|
||||
</div>
|
||||
)}
|
||||
<div className="flex items-center space-x-2 min-w-[120px] justify-end">
|
||||
{update.available && (
|
||||
<div className="flex items-center gap-2 bg-primary/15 border border-primary/30 rounded-lg px-3 py-1.5">
|
||||
<span className="text-xs text-text-secondary">v{update.version}</span>
|
||||
<button onClick={update.install} disabled={update.downloading}
|
||||
className="flex items-center gap-1 text-xs font-medium text-primary hover:text-primary-light transition-colors">
|
||||
<Download className="w-3.5 h-3.5" strokeWidth={2}/>
|
||||
{update.downloading ? t("scribeTopBar.updating") : t("scribeTopBar.update")}
|
||||
</button>
|
||||
{!update.downloading && (
|
||||
<button onClick={update.dismiss} className="text-text-secondary hover:text-text-primary transition-colors">
|
||||
<X className="w-3.5 h-3.5" strokeWidth={2}/>
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user