feat: integrate automatic update checks and enhance settings UI
- Added functionality for automatic update checks in the settings page, allowing users to enable or disable this feature. - Integrated app version display and update availability notifications. - Updated settings store to manage auto-check updates state and handle version migration. - Enhanced layout with a new card for update settings, improving user experience and accessibility.
This commit is contained in:
1 parent
6cdc8d4294
commit
6c366eecb0
20 files changed
+1266
-6
No files matched your search
+22
-1
@@ -56,6 +56,9 @@ export interface SettingsState {
|
||||
keywords: string[];
|
||||
};
|
||||
|
||||
// Updates
|
||||
autoCheckUpdates: boolean;
|
||||
|
||||
// Query Preprocessing
|
||||
queryPreprocessing: {
|
||||
enabled: boolean;
|
||||
@@ -96,6 +99,9 @@ export interface SettingsState {
|
||||
addNotificationKeyword: (keyword: string) => void;
|
||||
removeNotificationKeyword: (keyword: string) => void;
|
||||
|
||||
// Updates Actions
|
||||
setAutoCheckUpdates: (enabled: boolean) => void;
|
||||
|
||||
// Query Preprocessing Actions
|
||||
setQueryPreprocessingEnabled: (enabled: boolean) => void;
|
||||
setQueryPreprocessingMinLength: (min: number) => void;
|
||||
@@ -221,6 +227,7 @@ const initialState = {
|
||||
enabled: true,
|
||||
keywords: [],
|
||||
},
|
||||
autoCheckUpdates: true,
|
||||
queryPreprocessing: {
|
||||
enabled: true,
|
||||
minLength: 3,
|
||||
@@ -407,6 +414,10 @@ export const useSettingsStore = create<SettingsState>()(
|
||||
},
|
||||
})),
|
||||
|
||||
// Updates Actions
|
||||
setAutoCheckUpdates: (enabled) =>
|
||||
set({ autoCheckUpdates: enabled }),
|
||||
|
||||
// Query Preprocessing Actions
|
||||
setQueryPreprocessingEnabled: (enabled) =>
|
||||
set((state) => ({
|
||||
@@ -479,7 +490,17 @@ export const useSettingsStore = create<SettingsState>()(
|
||||
}),
|
||||
{
|
||||
name: 'ollahub-settings',
|
||||
version: 1,
|
||||
version: 3,
|
||||
migrate: (persistedState: any, version: number) => {
|
||||
// Migração da versão 1 para 3
|
||||
if (version < 3) {
|
||||
return {
|
||||
...persistedState,
|
||||
autoCheckUpdates: persistedState.autoCheckUpdates ?? true,
|
||||
};
|
||||
}
|
||||
return persistedState;
|
||||
},
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user