Skip to content

Commit 8537b47

Browse files
authored
Merge pull request #35 from kryptodrex/develop
Release v.0.3.0
2 parents d6bec04 + 41f46ba commit 8537b47

49 files changed

Lines changed: 6379 additions & 1473 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/beta-release.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,13 @@ jobs:
8181
id: version
8282
run: echo "VERSION=$(cat version)" >> $GITHUB_OUTPUT
8383

84-
- name: Create repository backup zip
85-
run: |
86-
# Create a zip of the repo for backup (excluding large folders)
87-
zip -r paycheck-planner-repo-backup-v${{ steps.version.outputs.VERSION }}.zip . \
88-
-x "node_modules/*" "dist/*" "dist-electron/*" "release/*" ".git/*" "coverage/*" "build/*" ".vscode/*" \
89-
-q
90-
ls -lh paycheck-planner-repo-backup-v${{ steps.version.outputs.VERSION }}.zip
84+
# - name: Create repository backup zip
85+
# run: |
86+
# # Create a zip of the repo for backup (excluding large folders)
87+
# zip -r paycheck-planner-repo-backup-v${{ steps.version.outputs.VERSION }}.zip . \
88+
# -x "node_modules/*" "dist/*" "dist-electron/*" "release/*" ".git/*" "coverage/*" "build/*" ".vscode/*" \
89+
# -q
90+
# ls -lh paycheck-planner-repo-backup-v${{ steps.version.outputs.VERSION }}.zip
9191

9292
- name: Create beta release metadata
9393
id: beta_meta
@@ -123,7 +123,6 @@ jobs:
123123
all-artifacts/paycheck-planner-mac/**/*.dmg
124124
all-artifacts/paycheck-planner-win/**/*.exe
125125
all-artifacts/paycheck-planner-linux/**/*.AppImage
126-
paycheck-planner-repo-backup-v${{ steps.version.outputs.VERSION }}.zip
127126
draft: false
128127
prerelease: true
129128
fail_on_unmatched_files: false

electron/main.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,6 +1169,40 @@ ipcMain.handle('save-budget', async (event, filePath: string, data: string) => {
11691169
}
11701170
});
11711171

1172+
/**
1173+
* Rename budget file
1174+
* @param oldPath - Existing file path
1175+
* @param newPath - Desired file path
1176+
*/
1177+
ipcMain.handle('rename-budget-file', async (_event, oldPath: string, newPath: string) => {
1178+
try {
1179+
if (!oldPath || !newPath) {
1180+
return { success: false, error: 'Both old and new file paths are required.' };
1181+
}
1182+
1183+
if (oldPath === newPath) {
1184+
return { success: true, filePath: oldPath };
1185+
}
1186+
1187+
// Ensure source file exists before attempting rename.
1188+
await fs.access(oldPath);
1189+
1190+
// Avoid clobbering an existing file at the target path.
1191+
try {
1192+
await fs.access(newPath);
1193+
return { success: false, error: 'A file with that name already exists.' };
1194+
} catch {
1195+
// Target does not exist - safe to continue.
1196+
}
1197+
1198+
await fs.rename(oldPath, newPath);
1199+
return { success: true, filePath: newPath };
1200+
} catch (error) {
1201+
console.error('Error renaming budget file:', error);
1202+
return { success: false, error: (error as Error).message };
1203+
}
1204+
});
1205+
11721206
/**
11731207
* Load budget data from file
11741208
* @param filePath - Where to load the file from

electron/preload.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ contextBridge.exposeInMainWorld('electronAPI', {
2222
// Returns: { success: boolean, error?: string }
2323
saveBudget: (filePath: string, data: string) =>
2424
ipcRenderer.invoke('save-budget', filePath, data),
25+
26+
// Rename an existing budget file
27+
// Takes: current path and new path
28+
// Returns: { success: boolean, filePath?: string, error?: string }
29+
renameBudgetFile: (oldPath: string, newPath: string) =>
30+
ipcRenderer.invoke('rename-budget-file', oldPath, newPath),
2531

2632
// Load budget from file
2733
// Takes: file path

package-lock.json

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "paycheck-planner",
33
"private": true,
4-
"version": "0.2.0",
4+
"version": "0.3.0",
55
"description": "Desktop paycheck planning and budget management application.",
66
"author": {
77
"name": "Paycheck Planner",

src/components/AccountsManager/AccountsManager.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ const AccountsManager: React.FC<AccountsManagerProps> = ({ onClose }) => {
3131
updateAccount(id, updates);
3232
};
3333

34+
const handleMoveAccount = (fromIndex: number, toIndex: number) => {
35+
const newAccounts = [...accounts];
36+
[newAccounts[fromIndex], newAccounts[toIndex]] = [newAccounts[toIndex], newAccounts[fromIndex]];
37+
updateBudgetData({ accounts: newAccounts });
38+
};
39+
3440
const handleDeleteAccount = (id: string) => {
3541
if (accounts.length <= 1) {
3642
return;
@@ -140,6 +146,7 @@ const AccountsManager: React.FC<AccountsManagerProps> = ({ onClose }) => {
140146
onAdd={handleAddAccount}
141147
onUpdate={handleUpdateAccount}
142148
onDelete={handleDeleteAccount}
149+
onMove={handleMoveAccount}
143150
showToggleButton={true}
144151
infoMessage="These accounts are specific to this plan. Changes will only affect this plan file."
145152
/>

0 commit comments

Comments
 (0)