mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-07 23:02:39 +02:00
refactor: centralize status visuals and improve connection indicator logic
- Introduced a new `status-visuals.ts` file to centralize status icons and labels for consistency across the plugin. - Updated connection indicator logic in the settings tab to utilize the new centralized visuals. - Removed deprecated connection visual methods to streamline the codebase. - Enhanced error handling in the status bar to reflect the new status visuals structure.
This commit is contained in:
parent
1c18735d38
commit
68156d2e74
5 changed files with 32 additions and 60 deletions
22
surfsense_obsidian/src/status-visuals.ts
Normal file
22
surfsense_obsidian/src/status-visuals.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import type { StatusKind } from "./types";
|
||||
|
||||
/**
|
||||
* Single source of truth for status icons + labels. Both the status bar
|
||||
* and the settings "Connection" heading render from this table so a change
|
||||
* here updates both surfaces.
|
||||
*/
|
||||
|
||||
export interface StatusVisual {
|
||||
icon: string;
|
||||
label: string;
|
||||
isError: boolean;
|
||||
}
|
||||
|
||||
export const STATUS_VISUALS: Record<StatusKind, StatusVisual> = {
|
||||
idle: { icon: "check-circle", label: "Synced", isError: false },
|
||||
syncing: { icon: "refresh-ccw", label: "Syncing", isError: false },
|
||||
queued: { icon: "clock", label: "Queued", isError: false },
|
||||
offline: { icon: "wifi-off", label: "Offline", isError: false },
|
||||
"auth-error": { icon: "user-x", label: "Reauthenticate", isError: true },
|
||||
error: { icon: "alert-circle", label: "Error", isError: true },
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue