Made more like Github Desktop
This commit is contained in:
+59
-4
@@ -1,10 +1,16 @@
|
||||
import { loadSettings, saveSettings } from "./storage.js";
|
||||
|
||||
const initialSettings = loadSettings();
|
||||
|
||||
const state = {
|
||||
settings: loadSettings(),
|
||||
selectedRepoPath: "",
|
||||
selectedRepoName: "",
|
||||
settings: initialSettings,
|
||||
selectedRepoPath: initialSettings.lastSelectedRepoPath || "",
|
||||
selectedRepoName: initialSettings.lastSelectedRepoPath ? initialSettings.lastSelectedRepoPath.split(/[/\\]/).filter(Boolean).pop() || "" : "",
|
||||
repoSearch: "",
|
||||
changesFilter: "",
|
||||
historyFilter: "",
|
||||
commitSummary: "",
|
||||
commitDescription: "",
|
||||
localRepoPathInput: "",
|
||||
localRepoScanRootInput: "",
|
||||
localRepoScanResults: [],
|
||||
@@ -13,6 +19,55 @@ const state = {
|
||||
cloneUrlInput: "",
|
||||
cloneDestinationInput: "",
|
||||
commitMessage: "",
|
||||
workingTree: {
|
||||
loading: false,
|
||||
error: "",
|
||||
branch: "",
|
||||
upstream: "",
|
||||
ahead: 0,
|
||||
behind: 0,
|
||||
files: [],
|
||||
selectedPaths: new Set(),
|
||||
selectedPath: "",
|
||||
selectedDiff: null,
|
||||
diffLoading: false,
|
||||
diffError: "",
|
||||
},
|
||||
sync: {
|
||||
loading: false,
|
||||
error: "",
|
||||
operation: "",
|
||||
branch: "",
|
||||
upstream: "",
|
||||
upstreamRemote: "",
|
||||
defaultRemote: "",
|
||||
ahead: 0,
|
||||
behind: 0,
|
||||
hasRemote: false,
|
||||
isDetached: false,
|
||||
isUnpublished: false,
|
||||
lastUpdated: 0,
|
||||
},
|
||||
branches: {
|
||||
loading: false,
|
||||
error: "",
|
||||
items: [],
|
||||
createName: "",
|
||||
menuOpen: false,
|
||||
dialog: {
|
||||
mode: "",
|
||||
target: "",
|
||||
value: "",
|
||||
error: "",
|
||||
},
|
||||
},
|
||||
history: {
|
||||
loading: false,
|
||||
error: "",
|
||||
commits: [],
|
||||
selectedHash: "",
|
||||
selectedCommit: null,
|
||||
},
|
||||
viewer: {
|
||||
source: "",
|
||||
repoName: "",
|
||||
@@ -47,7 +102,7 @@ export function addRecentRepo(path) {
|
||||
if (!path) return;
|
||||
const current = state.settings.recentRepositories.filter((item) => item !== path);
|
||||
const next = [path, ...current].slice(0, 15);
|
||||
updateSettings({ recentRepositories: next });
|
||||
updateSettings({ recentRepositories: next, lastSelectedRepoPath: path });
|
||||
}
|
||||
|
||||
export function getActiveServer() {
|
||||
|
||||
Reference in New Issue
Block a user