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:
Anish Sarkar 2026-04-25 01:47:37 +05:30
parent 1c18735d38
commit 68156d2e74
5 changed files with 32 additions and 60 deletions

View 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 },
};